@redocly/json-to-json-schema
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

json-to-json-schema

Convert JSON examples into JSON schema.

Supports JSON Schema Draft 5 used in Swagger 2.0 and OpenAPI 3.0 and new draft draft-2020-12 used in OpenAPI 3.1.

Usage

import { convert, format } from '@redocly/json-to-json-schema';

const example = { "firstname": "John", "surname": "Doe", "birthday": "1990-02-23" };

const schema = convert(example, {
  target: 'draft-05-oas', // or draft-2020-12
  includeExamples: false,
});

Similar tools

https://github.com/mohsen1/json-to-json-schema

Readme

Keywords

none

Package Sidebar

Install

npm i @redocly/json-to-json-schema

Weekly Downloads

636

Version

0.0.1

License

SEE LICENSE IN LICENSE

Unpacked Size

12.4 kB

Total Files

15

Last publish

Collaborators

  • aye-one
  • oleksandr.saveliev
  • bohdan.petryshyn
  • okachynskyy
  • viacheslavoprysk
  • romanhotsiy
  • alawar
  • adamaltman
  • marshevskyy