Skip to content
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

Fix Outputted Model JSON Schema for Sequence type #9303

Merged

Conversation

anesmemisevic
Copy link
Contributor

@anesmemisevic anesmemisevic commented Apr 23, 2024

Change Summary

Fixing an issue where the outputted JSON Schema, for the Sequence type, used minLength rather than minItems.
Fixed the same for maxLength - maxItems in advance.
Provided tests for the relevant changes.

Related issue number

fix #9256

Checklist

  • The pull request title is a good summary of the changes - it will be used in the changelog
  • Unit tests for the changes exist
  • Tests pass on CI
  • Documentation reflects the changes where applicable
  • My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers

Selected Reviewer: @davidhewitt

Copy link

codspeed-hq bot commented Apr 23, 2024

CodSpeed Performance Report

Merging #9303 will not alter performance

Comparing anesmemisevic:fix/model-json-schema-from-sequence (eb615cb) with main (2612947)

Summary

✅ 13 untouched benchmarks

@anesmemisevic
Copy link
Contributor Author

please review

Copy link
Contributor

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

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

Thanks for the fix! I have one thought, I wonder what you think of it?

pydantic/_internal/_known_annotated_metadata.py Outdated Show resolved Hide resolved
@sydney-runkle sydney-runkle added the relnotes-fix Used for bugfixes. label Apr 23, 2024
Copy link
Contributor

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

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

This looks good to me, thanks!

@sydney-runkle
Copy link
Member

Thanks! Merging now :).

@sydney-runkle sydney-runkle merged commit c4d2edc into pydantic:main Apr 28, 2024
53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When using min_length on Sequence field, outputted JSON schema is minLength instead of minItems for array type
3 participants