Skip to content

Rename prettyPrintedTwoSpaces to indentationTwoSpaces#17

Merged
mattt merged 1 commit into
mainfrom
mattt/rename-options
Feb 6, 2026
Merged

Rename prettyPrintedTwoSpaces to indentationTwoSpaces#17
mattt merged 1 commit into
mainfrom
mattt/rename-options

Conversation

@mattt
Copy link
Copy Markdown
Owner

@mattt mattt commented Feb 6, 2026

Follow-up to #13

yyjson has an unfortunate API design where it has YYJSON_WRITE_PRETTY and YYJSON_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 .prettyPrinted and .prettyPrintedTwoSpaces in the public API.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 prettyPrintedTwoSpaces to indentationTwoSpaces in YYJSONSerialization.WritingOptions and YYJSONWriteOptions.
  • 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.

Comment thread Sources/YYJSON/Serialization.swift
Comment thread Sources/YYJSON/Configuration.swift
@mattt mattt merged commit b711073 into main Feb 6, 2026
15 checks passed
@mattt mattt deleted the mattt/rename-options branch February 6, 2026 11:47
tomritzow

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants