Comments (7)
@dailong If you add // +k8s:openapi-gen=true on your Type definition then you should be able to generate OpenAPI Spec for your Type. If there is any validation error then fix your Type definition and try again. The error that I have ran into typically is the name validation error. This means that in the type definition there is some problem with how names are defined in the type spec or the type status definition. The main issue for me has been when field name defined in the Go code and field name expected as json have been different. kube-openapi name validation rules expect the field name in Go code and field name in json to be exactly same with just the first letter in different case (Go code requires CamelCase, json requires camelCase). So keep an eye out for such an issue in your type definition.
Another issue that I have ran into is that kube-openapi doesn't seem to understand ObjectMeta and ListMeta types.
I have put together a small utility to make it easy to generate OpenAPI Spec for custom Types. You can find it here:
https://github.com/cloud-ark/kubeplus/tree/master/openapi-spec-generator
The driver script works on a copy of your types.go. It comments out lines containing ObjectMeta and ListMeta and then runs this modified types.go through kube-openapi.
README gives the steps that you can follow to generate OpenAPI Spec for your type. Hopefully it helps.
from kube-openapi.
I have this problem too. How did you solve it?
from kube-openapi.
I got it. thanks
from kube-openapi.
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale
.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close
.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale
from kube-openapi.
Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten
.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close
.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten
from kube-openapi.
Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen
.
Mark the issue as fresh with /remove-lifecycle rotten
.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close
from kube-openapi.
@fejta-bot: Closing this issue.
In response to this:
Rotten issues close after 30d of inactivity.
Reopen the issue with/reopen
.
Mark the issue as fresh with/remove-lifecycle rotten
.Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
from kube-openapi.
Related Issues (20)
- How to specify a default? HOT 6
- Build fails due to `undefined: atomic.Pointer` HOT 7
- Feature request: Tagged releases HOT 11
- Generated enum fails validation when used for CRD creation HOT 15
- Request to remove reference to deprecated module 'github.com/golang/protobuf HOT 8
- [Umbrella Issue] Caching library improvements HOT 8
- Change breaks client-go: gnostic -> gnostic-models HOT 7
- [Discussion] Compatibility Guarantees and Versioning HOT 10
- Validator for `byte` does not match mashalling behavior HOT 16
- Generating openAPIV3Schema YAML file HOT 1
- OpenAPI V3 specifications do not mark requestBody as "required" HOT 2
- [Bug] The latest main branch will conflict with k8s [email protected] HOT 2
- Bug: +enum type used in array is not reflected in Schema
- Bugs from recent changes - go.mod version invalid for go 1.20 and new interface is missing input -i HOT 11
- Add presubmit check to prevent accidental `go` directive bump HOT 1
- Please upgrade mergo HOT 1
- OpenAPI V3 references parsed as *proto.Arbitrary instead of *proto.Ref HOT 2
- Fix FilterSpecByPathsWithoutSideEffects to handle cases without slash HOT 2
- kube-openapi tests fail at newer versions of go HOT 7
- Recent changes break escapes in quoted strings HOT 4
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 kube-openapi.