kubernetes / kube-openapi

Kubernetes OpenAPI spec generation & serving
Apache License 2.0
317 stars 205 forks source link

Feature: Added support for OpenAPI validations marker comments #435

Closed Schnides123 closed 9 months ago

Schnides123 commented 11 months ago

This PR adds the ability to annotate API fields with basic OpenAPI schema validations via marker comments, as part of the KEP-4153: Declarative Validation feature.

/assign @alexzielenski

linux-foundation-easycla[bot] commented 11 months ago

CLA Signed

The committers listed above are authorized under a signed CLA.

k8s-ci-robot commented 11 months ago

Welcome @Schnides123!

It looks like this is your first PR to kubernetes/kube-openapi 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/kube-openapi has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. :smiley:

alexzielenski commented 11 months ago

/ok-to-test

k8s-ci-robot commented 11 months ago

@alexzielenski: GitHub didn't allow me to request PR reviews from the following users: WDYT, is, preferable.

Note that only kubernetes members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to [this](https://github.com/kubernetes/kube-openapi/pull/435#discussion_r1361227273): >An alternative to using these helper functions is to do as you did in the test by abusing the array literal notation: > >``` >&[]float64{20.0}[0] >``` > >/cc @apelisse WDYT is preferable Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
apelisse commented 11 months ago

I would still add an intergration test. Create a new directory for value validation in https://github.com/kubernetes/kube-openapi/tree/master/test/integration/testdata, add some types in there with various validation markers, carefully follow the README including the notes at the bottom. Thanks!

Schnides123 commented 9 months ago

I have been told to add the prefix back in, so the prefix is now back in

alexzielenski commented 9 months ago

/label tide/merge-method-squash /lgtm

alexzielenski commented 9 months ago

/hold

can you squash (tide concats the descriptions which is not useful)

edit: i squashed for you

alexzielenski commented 9 months ago

/ok-to-test

alexzielenski commented 9 months ago

/hold cancel /lgtm

k8s-ci-robot commented 9 months ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alexzielenski, Schnides123

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/kubernetes/kube-openapi/blob/master/OWNERS)~~ [alexzielenski] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment