Skip to content

Expose public sort method for JSON schema generation #10595

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 6 commits into from
Oct 10, 2024

Conversation

sydney-runkle
Copy link
Contributor

@sydney-runkle sydney-runkle commented Oct 10, 2024

Closes #7580

At first, thought we might have to add a flag to fix this. The way I feel about adding flags at this point is about how edna (from The Incredibles) feels about capes.

Luckily, was able to sidestep the need for a flag by exposing the sort method as a public one in the GenerateJsonSchema class.

Did a little bit of refactoring to make things more type checking friendly re the outer sort vs recursive sorts. I did the move -> public and refactoring in different commits, so should be easy to review. Also added a docs example to expose the customizability here. Yay for empowered users!

Copy link

cloudflare-workers-and-pages bot commented Oct 10, 2024

Deploying pydantic-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 12cc428
Status: ✅  Deploy successful!
Preview URL: https://756056c8.pydantic-docs.pages.dev
Branch Preview URL: https://sorting-for-good-hopefully.pydantic-docs.pages.dev

View logs

Copy link

codspeed-hq bot commented Oct 10, 2024

CodSpeed Performance Report

Merging #10595 will not alter performance

Comparing sorting-for-good-hopefully (12cc428) with main (09ade35)

Summary

✅ 38 untouched benchmarks

Copy link
Contributor

github-actions bot commented Oct 10, 2024

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  pydantic
  json_schema.py
Project Total  

This report was generated by python-coverage-comment-action

Copy link
Member

@Viicos Viicos left a comment

Choose a reason for hiding this comment

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

LGTM

Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>
@sydney-runkle sydney-runkle merged commit 07e2b72 into main Oct 10, 2024
63 checks passed
@sydney-runkle sydney-runkle deleted the sorting-for-good-hopefully branch October 10, 2024 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Order of keys differs in schema output
3 participants