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

openapi2jsonschema.py not working with missing property field. #199

Open
jmcgrath207 opened this issue May 9, 2023 · 2 comments
Open

openapi2jsonschema.py not working with missing property field. #199

jmcgrath207 opened this issue May 9, 2023 · 2 comments

Comments

@jmcgrath207
Copy link

When using the openapi2jsonschema.py with Json Schema output below, I keep getting a failed check from kubeconform. I believe it might be due to the property field missing. While YAML CRD is pretty empty, It is valid and I can deploy it against our cluster.

Json Schema Output for Kubeconform.

{
  "type": "object",
  "x-kubernetes-preserve-unknown-fields": true
}

What I expect

{
  "properties": {
    "apiVersion": {
      "type": "string"
    },
    "kind": {
      "type": "string"
    },
    "metadata": {
      "type": "object"
    },
    "spec": {
...

Kubeconform Command.

kubeconform -summary -kubernetes-version "${version}" -schema-location default -schema-location "${schemas_dir}/{{.ResourceKind}}-stable-{{.ResourceAPIVersion}}.json" -exit-on-error

Example CRD

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: flyteworkflows.flyte.lyft.com
spec:
  conversion:
    strategy: None
  group: flyte.lyft.com
  names:
    kind: FlyteWorkflow
    listKind: FlyteWorkflowList
    plural: flyteworkflows
    shortNames:
    - fly
    singular: flyteworkflow
  scope: Namespaced
  versions:
  - name: v1alpha1
    schema:
      openAPIV3Schema:
        type: object
        x-kubernetes-preserve-unknown-fields: true
    served: true
    storage: true
@eyarz
Copy link
Contributor

eyarz commented May 10, 2023

can you add the error that you're getting?

@jmcgrath207
Copy link
Author

Hey @eyarz sorry for the late reply, here is the error I am getting.

Kubeconform Error:
stdin - CustomResourceDefinition flyteworkflows.flyte.lyft.com failed validation: could not find schema for CustomResourceDefinition

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants