Expose public sort method for JSON schema generation by sydney-runkle · Pull Request #10595 · pydantic/pydantic (original) (raw)

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!