Repository navigation
feat(huma): the rules of valigo in the OpenAPI document - #71
Merged
Merged
Conversation
OpenAPI returns the OpenAPI document of the api with the constraints of the validator in the schemas of the request bodies and their nested structs: maxLength, format, enum, items, the required properties... A keyword with another value than the one of huma goes to allOf. The schemas of huma, which it validates the requests by, are not changed.
Contributor
Benchmark diff:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #71 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 36 37 +1
Lines 1189 1250 +61
=========================================
+ Hits 1189 1250 +61 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
vhuma.OpenAPI(api, v)returns the OpenAPI document of huma with the constraints of #70 in the schemas of the request bodies and their nested structs, so the clients and SDK generators seemaxLength,format,enum,items, the required properties of the rules of valigo.Resolve.maxLength, twopattern) goes toallOf; an equal one is kept once;Requiredaddsomitemptyfields torequiredwithout repeats.json:"-"and hidden fields are skipped; the parameters keep the schemas of huma (an operation doesn't know its input type).Docs: the page Integrations → JSON Schema (the table of the keywords, why the description is never stricter than the rule,
Schemaof own conversions) and the section of huma with a checked program. 100% coverage.