openapi-to-json-schema

command module
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

README

OpenAPI component to JSON Schema extraction

Minimal CLI to extract a single schema from the component section of a openAPI v3 schema, and convert it into a valid JSON schema.

The biggest change done to the schema, is that the type attribute is converted to a list, and the nullable: true flag, is removed and placed into the type list as a specific value.

Usage

openapi-to-json-schema openapi-petstore-schema.yaml -c Order

You can also pipe to the openapi-to-json-schema command, eg.

ytt --data-values-schema-inspect=true --output=openapi-v3 -f schema.yaml  | openapi-to-json-schema

The CLI will work with JSON or YAML as input, but only output JSON. By default, the generated schema will be written to stdout, unless the --output flag is set.

Documentation

Overview

Copyright © 2024 Mathias Petermann <mathias.petermann@gmail.com>

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL