Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

openapi-json-schema

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openapi-json-schema

Minimalistic OpenAPI 3 ⬌ JSON Schema (draft 7) conversion

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
19K
increased by8.18%
Maintainers
1
Weekly downloads
 
Created
Source

npm version downloads build status coverage status

openapi-json-schema

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

  • This package aims at full conversion support except reference resolution, but isn't there yet. Currently supports:
    • null/nullable conversion
    • $ref's being converted #/definitions <-> #/components/schemas
    • constenum when converting to OpenAPI
    • $id/$commentinfo['x-id']/info['x-comment'] when converting to OpenAPI
    • PR's are welcome.
  • JSON $refs are not resolved.
  • This package has no dependencies, and will continue to have no dependencies - re: minimalistic.

Versions

  • Since v2 this is a pure ESM package, and requires Node.js >=14.13.1. It cannot be used from CommonJS.

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.

Keywords

FAQs

Package last updated on 02 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc