Skip to content

layer5io/kubeopenapi-jsonschema

KubeOpenAPI - JSON Schema

This is a very basic node based CLI for converting OpenAPI schema to JSON Schema Draft 4

Usage: kubeopenapi-jsonschema [options]

Options:
  -t, --type [type]           set type of input, can be either yaml or json (default: "yaml")
  -l, --location <location>   location of the schema
  -f, --filter [query]        give a query if a OpenAPISchema is nested
  --kubernetes                enable kubernetes specific filters (default: false)
  -o [output-format]          output format (default: "json")
  --o-filter [output-filter]  output filter query
  --silent                    skip output (default: false)
  --resolve [resolve-filter]  root of the OpenAPI spec to resolve the $ref. It is important to note that this jsonpath MUST evaluate to one object (default: "")
  -h, --help                  display help for command

Example

Download the binaries from the github releases. Only linux-x64, darwin-x64 and windows-x64 binaries are released

kubeopenapi-jsonschema --location ./k8s.json -f '$.definitions' -t json --o-filter '$[0][?(@["x-kubernetes-group-version-kind"][0].kind=="Deployment")].properties.spec' --resolve "$"

The above will consume kubernetes open API schema and will produce schema for Kubernetes Deployment

kubeopenapi-jsonschema --location ./istio.yaml -t yaml --filter '$[?(@.kind=="CustomResourceDefinition")]..schema.openAPIV3Schema.properties.spec' --o-filter '$' 

The above will consume istio CRD manifest and will produce schema for all of the CustomResourceDefinition objects

 

Join the Community!

Our projects are community-built and welcome collaboration. 👍 Be sure to see the Layer5 Community Welcome Guide for a tour of resources available to you and jump into our Slack!

MeshMates

Find your MeshMate

MeshMates are experienced Layer5 community members, who will help you learn your way around, discover live projects and expand your community network. Become a Meshtee today!

Find out more on the Layer5 community.




 
Shows an illustrated light mode meshery logo in light color mode and a dark mode meshery logo dark color mode.

Layer5 Cloud Native Community

✔️ Join any or all of the weekly meetings on community calendar.
✔️ Watch community meeting recordings.
✔️ Access the Community Drive by completing a community Member Form.

Not sure where to start? Grab an open issue with the help-wanted label.