Feat/add better docs - #373
Merged
Merged
Conversation
Contributor
Reviewer's GuideImproves public-facing documentation and comments for the Rust JSON-to-XML accelerator and Python wrapper, clarifies serializer behavior and XML constraints, and updates security-sensitive dependency minimums (PyO3 and Requests). File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="json2xml/json2xml.py" line_range="47-49" />
<code_context>
# @lat: [[behavior#Conversion output]]
# @lat: [[behavior#Invalid XML payloads]]
def to_xml(self) -> Any | None:
- """
- Convert to xml using dicttoxml.dicttoxml and then pretty print it.
+ """Serialize the configured JSON value.
+
+ :return: Pretty-printed XML text when ``pretty`` is enabled, UTF-8 encoded XML bytes
+ otherwise, or ``None`` when the configured data is ``None``.
+ :raises InvalidDataError: If serialization rejects the data or pretty-print parsing finds
</code_context>
<issue_to_address>
**suggestion:** Tighten the return type annotation to reflect the documented bytes/str/None outputs.
Since the docstring defines the outputs as pretty-printed XML text, UTF-8 XML bytes, or ``None`` when the data is ``None``, the return annotation `Any | None` should be narrowed to `bytes | str | None` to match the actual API and improve static analysis and IDE support, without breaking callers.
```suggestion
# @lat: [[behavior#Conversion output]]
# @lat: [[behavior#Invalid XML payloads]]
def to_xml(self) -> bytes | str | None:
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #373 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 7 7
Lines 920 920
=========================================
Hits 920 920
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by Sourcery
Improve documentation and security-related dependency constraints for the JSON-to-XML converter and its Rust backend.
Enhancements:
Build:
Documentation:
Chores: