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

Export named validations to openApi properties #899

Merged
merged 2 commits into from
Apr 10, 2024

Conversation

peschmae
Copy link
Contributor

@peschmae peschmae commented Mar 25, 2024

This pull requests, exposes the attributes for the named #@schema/validations to the openApi schema, where a direct mapping is possible.

Type ytt validation openapi validation
string min_len minLength
string max_len maxLength
integer min minimum
integer max maximum
any one_of enum

The PR includes tests for all those validations.

Fixes #897

Signed-off-by: Mathias Petermann <mathias.petermann@gmail.com>
@prembhaskal prembhaskal self-assigned this Mar 26, 2024
@prembhaskal
Copy link
Member

will try to review this week.

@prembhaskal prembhaskal requested review from sethiyash and 100mik March 26, 2024 06:25
@peschmae
Copy link
Contributor Author

Just saw the linting errors, and will look into them.

Should I squash my commits and force push, or is it fine to have mutliple commits, and the will be squashed when merged?

@prembhaskal
Copy link
Member

you can have multiple commits and then squash them before merging.

@peschmae
Copy link
Contributor Author

peschmae commented Apr 8, 2024

Any change to get a review on this?
Compared to #901 this is a smaller change and would allow to integrate the conversion from openapi to json schema, in a separate tool if the other PR wouldn't be merged.

@prembhaskal prembhaskal requested a review from cppforlife April 8, 2024 17:53
Copy link
Member

@joaopapereira joaopapereira left a comment

Choose a reason for hiding this comment

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

Added some nitpick changes more stylistic than anything.
Generally, the PR looks good.

pkg/validations/validate.go Outdated Show resolved Hide resolved
pkg/validations/validate.go Outdated Show resolved Hide resolved
pkg/validations/validate.go Outdated Show resolved Hide resolved
pkg/validations/validate.go Outdated Show resolved Hide resolved
Signed-off-by: Mathias Petermann <mathias.petermann@gmail.com>
@peschmae peschmae force-pushed the feat/openapi-validations branch from 65e9b19 to 7348f37 Compare April 8, 2024 21:06
@peschmae
Copy link
Contributor Author

peschmae commented Apr 8, 2024

Ammended whitespace cleanup into latest commit, and force pushed

Copy link
Contributor

@sethiyash sethiyash left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@joaopapereira joaopapereira left a comment

Choose a reason for hiding this comment

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

LGTM

@joaopapereira joaopapereira merged commit d652316 into carvel-dev:develop Apr 10, 2024
5 checks passed
@peschmae peschmae deleted the feat/openapi-validations branch April 11, 2024 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Export validation annotations in openapi schema
5 participants