Giter Site home page Giter Site logo

Kubebuilder docs should more clearly state the interaction between `kubebuilder:validation:Required` and `omitempty` about kubebuilder HOT 6 OPEN

jmeyers35 avatar jmeyers35 commented on August 25, 2024 1
Kubebuilder docs should more clearly state the interaction between `kubebuilder:validation:Required` and `omitempty`

from kubebuilder.

Comments (6)

camilamacedo86 avatar camilamacedo86 commented on August 25, 2024

Hi @jmeyers35,

Thank you for raising this one.

However, note that all documentation in kubebuilder is generated automatically via what is the doc in the source code of controller-tools. Therefore:

  • a) Can you please transfer this issue to the controller-tools repo. Your request cannot be addressed via Kubebuilder repo/code source or project

  • b) WDYT about open a pull request for controller-tools with the changes that you suggest. Therefore, when a new controller-tool release is made with it, the Kubebuilder docs will be updated.

Thank you for attention.

@vincepri @joelanford (could you please move this issue to controller-tools if the owner be unable to do so?)

from kubebuilder.

jmeyers35 avatar jmeyers35 commented on August 25, 2024

I'm happy to open a PR for this at some point, but I wanted to flag this in case someone can get around to it before I can. I also could've been a bit more specific - when I said "documentation", I really meant the book, which I believe is indeed in this repo. But this is probably worth noting in the generated docs as well.

from kubebuilder.

camilamacedo86 avatar camilamacedo86 commented on August 25, 2024

Hi @jmeyers35,

That is great. I see, the info that you would like to add in the docs is:

Update:
The omitempty tag in Foo string json:"foo,omitempty" had more precedence than the kubebuilder marker +kubebuilder:validation:Required therefore making the resultant generated crd field to be optional.

The +kubebuilder:validation:Required marker does works as desired when omitempty is not used.

I am not able to recall if docs(https://book.kubebuilder.io/) mentions it, but I hope it does.

With that I mark this issue to be closed.

Following some examples that I hope that help you:

Please feel free to open a PR with your suggestion on where you see that it should fit, and then we can move forward from there. Thank you for your collaboration 🥇

from kubebuilder.

camilamacedo86 avatar camilamacedo86 commented on August 25, 2024

Hi @jmeyers35

After share above the info to you, do you think that it still requiring further explanation?
Would you like to contribute with this one?

from kubebuilder.

mateusoliveira43 avatar mateusoliveira43 commented on August 25, 2024

Just an update, kubernetes-sigs/controller-tools#944 got merged, so now it is possible to use omitempty with required (which was previously not).

Do we still need to add some documentation around this to close this issue, or just update controller-tools version used by kubebuilder to start using new behavior?

from kubebuilder.

jmeyers35 avatar jmeyers35 commented on August 25, 2024

the latter would work for me.

from kubebuilder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.