Rename prettyPrintedTwoSpaces to indentationTwoSpaces#17
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Renames the public 2-space pretty-printing option from prettyPrintedTwoSpaces to indentationTwoSpaces across the Swift API surface, aiming to better reflect the underlying yyjson flag behavior while aligning with Swift naming guidelines.
Changes:
- Renamed
prettyPrintedTwoSpacestoindentationTwoSpacesinYYJSONSerialization.WritingOptionsandYYJSONWriteOptions. - Updated write-flag mapping logic and all test references to use the new option name.
- Updated README examples and option lists to reflect the new name.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| Tests/YYJSONTests/SerializationTests.swift | Renames tests and option usage to .indentationTwoSpaces. |
| Tests/YYJSONTests/EncoderTests.swift | Updates encoder tests to use .indentationTwoSpaces. |
| Tests/YYJSONTests/ConfigurationTests.swift | Updates configuration tests to use .indentationTwoSpaces. |
| Sources/YYJSON/Serialization.swift | Renames WritingOptions case and updates flag mapping checks. |
| Sources/YYJSON/Configuration.swift | Renames YYJSONWriteOptions case and updates documentation string. |
| README.md | Updates docs/examples to the new option name. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Follow-up to #13
yyjson has an unfortunate API design where it has
YYJSON_WRITE_PRETTYandYYJSON_WRITE_PRETTY_TWO_SPACES. As peer C flags, they compose awkwardly — one implies the other, but there's an implicit hierarchy of refinement (petty > pretty w/2 spaces).This PR attempts to take the edge off of that tension with a heavy-handed application of Swift API naming guidelines. I'm not sure how successful we are in this regard (maybe we're worse off for creating unnecessary drift from underlying C API?) But some part of me just couldn't abide having both
.prettyPrintedand.prettyPrintedTwoSpacesin the public API.