-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Add option to output unsorted schema #7767
Add option to output unsorted schema #7767
Conversation
- add unit tests
@sydney-runkle have tried to create an option for unsorted output. Let me know if this is ok or totally off the mark :) Please review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vigneshmanick - looks great overall - just a few change requests.
Thanks so much for your contribution - I'm sure this feature will be highly appreciated 😄.
else: | ||
return json_schema |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else: | |
return json_schema | |
return json_schema |
def generate(self, schema, mode='validation', sort_schema=True): | ||
json_schema = super().generate(schema, mode=mode, sort_schema=sort_schema) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a section to this test that verifies the operation of the sort_schema=False
flag in the case of a custom generate json schema function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you mean parameterize the flag?
@adriangb, could you take a look at this PR? Others on the team mentioned that you've contributed significantly to the sorting logic, so would love to get your input 😄. |
Closing in favor of #7817 |
Change Summary
Add toggle so that the schema output
model_dump
can be sorted or unsorted. The sorting was added in #6043.Related issue number
#7580
Checklist
Selected Reviewer: @davidhewitt