carvel-dev / ytt

YAML templating tool that works on YAML structure instead of text
https://carvel.dev/ytt
Apache License 2.0
1.66k stars 135 forks source link

Export validation annotations in openapi schema #897

Closed peschmae closed 5 months ago

peschmae commented 6 months ago

Describe the problem/challenge you have Currently the openapi schema generated using ytt -f schema.yaml --data-values-schema-inspect --output openapi-v3 is missing any of the #@schema/validation rules.

Describe the solution you'd like Exporting the openapi-v3 schema, should include the named rules since they all seem to be relatively easy to map to openapi-v3.

Type ytt validation openapi validation
string min_len minLength
string max_len maxLength
integer min minimum
integer max. maximum
any not_null=(nullable) nullable=true
any one_of enum

Only one_not_null seems to be a bit more complicate to map, and could be left out.


Vote on this request

This is an invitation to the community to vote on issues, to help us prioritize our backlog. Use the "smiley face" up to the right of this comment to vote.

👍 "I would like to see this addressed as soon as possible" 👎 "There are other more important things to focus on right now"

We are also happy to receive and review Pull Requests if you want to help working on this issue.

peschmae commented 6 months ago

Just realized #@schema/nullable is converted to the corresponding attribute in openapi, but the not_null validation isn't.

Since the not_null validation, is documented mostly with additional lambda condition, this could also be left out.