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 service mesh community!
Our projects are community-built and welcome collaboration.
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.
Not sure where to start? Grab an open issue with the help-wanted label.