Comments (5)
@mattfarina Good question. This is all done through the openAPI v3 validation supported by CRDs. Do you know what the CRD validation supports? I may need to add an extra hook.
I am not totally clear from this document about what validation is supported by openAPI v3: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md. It mentions uuid and email as formats but says they are undefined by the spec.
If nothing else, you may be able to use "Pattern".
from kubebuilder.
@pwittrock Two things...
- How do I specify a custom data type such as email? What's the right annotation? https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types
- What's the right annotation to set the pattern?
from kubebuilder.
-
This may not be supported today, but should be possible to add with relatively little work if the CRD validation supports this use case.
-
Sorry about this. I'll update the godoc documentation to include Pattern and the other supported types. For now this should work. Remember to run kubebuilder generate afterward.
// +kubebuilder:validation:Pattern=^[a-z]+$
from kubebuilder.
@mattfarina Filed #67 to support annotating fields with the format generated for openapi.
from kubebuilder.
@pwittrock Thanks. You can consider my question answered. I'll leave this open in case you want to keep it open until you've updated the godocs. Or, you can close it if not.
from kubebuilder.
Related Issues (20)
- Document CRD design for the usecase of having mandatory fields within an optional struct field in the CRD spec. HOT 6
- Failed to create multi-version API HOT 3
- docs: Marker docs about required fields are not fully accurate HOT 1
- Doc: Getting Started fix code examples indentation HOT 1
- Custom webhook naming (for mutate or validator) HOT 10
- Failed to initialize project: unable to run post-scaffold HOT 3
- [Assessment and POC] - Integrate Server-Side-Apply Support in Kubebuilder via Controller-Tools and Code-Generator Enhancements
- Add support for configuring `boilerplatePath` during API scaffolding on plugin `base.go.kubebuilder.io/v4` HOT 10
- Watching Externally Managed Resources: source.Kind is a function but it's used as a type in example in kubebuilder book HOT 2
- More Development Makefile commands HOT 8
- Unexpected CR conversion behavior
- Feature request: `+kubebuilder:validation:UniqueItems` for uniqueness of field among structs HOT 7
- Analysis and Compliance Strategy for New Cyber Resilience Act HOT 3
- Standardize installation of golang tools with better version support HOT 1
- Avoid usage of newly deprecated webhook.Validator and webhook.Defaulter interfaces HOT 15
- Getting started guide various small typos/fixes HOT 2
- Development: automate squash commits HOT 3
- versionPattern should be more flexible to allow internal versions HOT 3
- Support for IBM Z (s390x architecture) HOT 1
- `exampleFile.txt` get expanded for every unit-test HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kubebuilder.