Home

Awesome

npm version downloads build status coverage status

openapi-json-schema

Minimalistic OpenAPI 3 ⬌ JSON Schema (draft 7) conversion.

Versions

Usage

import {
    jsonSchemaToOpenApiSchema,
    openApiSchemaToJsonSchema,
} from 'openapi-json-schema'

// JSON Schema to Open API
const openApi = jsonSchemaToOpenApiSchema( jsonSchema );

// Open API to JSON Schema
const jsonSchema = openApiSchemaToJsonSchema( openApi );

Utilities

The library exports utilities; encodeRefNameJsonSchema, decodeRefNameJsonSchema, encodeRefNameOpenApi and decodeRefNameOpenApi used to convert to/from references names, and their corresponding encoding in JSON Schema and Open API.