Skip to content

Simplify member indexing #510

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 6, 2025
Merged

Conversation

JordonPhillips
Copy link
Contributor

This updates schemas to use the natural ordering of a dict to set member index. Recursive shapes are accommodated by using a None value to reserve the member's spot in the dictionary until the value can be actually set.

This has two primary effects. Firstly, it allows the member index to be confidently used at runtime to actually retrieve a member. This isn't needed in most cases, but can come in handy occasionally.

This also cuts out a huge amount of boilerplate in the generated code.

In the PR I've also included a commit that uses this natural order when constructing http bindings as well as one to ignore magic trailing commas during formatting.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

This updates schemas to use the natural ordering of a dict to
set member index. Recursive shapes are accommodated by using a None
value to reserve the member's spot in the dictionary until the
value can be actually set.

This has two primary effects. Firstly, it allows the member index
to be confidently used at runtime to actually retrieve a member.
This isn't needed in most cases, but can come in handy occasionally.

This also cuts out a huge amount of boilerplate in the generated
code.
This makes generated code a bit more dense by informing ruff to not
use trailing commas as a signal skip condensing an expanded block.
@JordonPhillips JordonPhillips requested a review from a team as a code owner June 5, 2025 11:11
@JordonPhillips JordonPhillips merged commit f55ab14 into develop Jun 6, 2025
3 checks passed
@JordonPhillips JordonPhillips deleted the simplify-member-indexing branch June 6, 2025 14:15
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.

2 participants