All Projects → ajv-validator → json-schema-migrate

ajv-validator / json-schema-migrate

Licence: MIT license
Migrate JSON-Schema draft-04 to draft-07, draft-2019-09 or draft-2020-12

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to json-schema-migrate

react-jsonschema-formbuilder
No description or website provided.
Stars: ✭ 45 (+150%)
Mutual labels:  json-schema
resource-x
Resource and domain modeling for quick APIs, CMSs, and applications.
Stars: ✭ 26 (+44.44%)
Mutual labels:  json-schema
schema
SpaceAPI JSON schema files.
Stars: ✭ 20 (+11.11%)
Mutual labels:  json-schema
scalable-form-platform
A solution for building dynamic web forms with visual editor
Stars: ✭ 109 (+505.56%)
Mutual labels:  json-schema
jgeXml
The Just-Good-Enough XML Toolkit
Stars: ✭ 20 (+11.11%)
Mutual labels:  json-schema
flowjv
Flow based approach to JSON validation.
Stars: ✭ 20 (+11.11%)
Mutual labels:  json-schema
check-jsonschema
A CLI and set of pre-commit hooks for jsonschema validation with built-in support for GitHub Workflows, Renovate, Azure Pipelines, and more!
Stars: ✭ 51 (+183.33%)
Mutual labels:  json-schema
jsons2xsd
Highly configurable converter from JSON-schema to XML-schema (XSD).
Stars: ✭ 65 (+261.11%)
Mutual labels:  json-schema
JsonSettings
This library simplifies creating configuration for your C# app/service by utilizing the serialization capabilities of Json.NET to serialize nested (custom) objects, dictionaries and lists as simply as by creating a POCO and inheriting JsonSettings class.
Stars: ✭ 59 (+227.78%)
Mutual labels:  json-schema
sf-java-ui
Json Schema Form java based library allow developers to define schema and form using field annotations
Stars: ✭ 23 (+27.78%)
Mutual labels:  json-schema
flow2schema
Generate json-schemas for flowtype definitions
Stars: ✭ 20 (+11.11%)
Mutual labels:  json-schema
JustJson
JSON helper library for Android
Stars: ✭ 15 (-16.67%)
Mutual labels:  json-schema
Minecraft-bedrock-json-schemas
The JSON validation schema files for Minecraft bedrock
Stars: ✭ 17 (-5.56%)
Mutual labels:  json-schema
jsoncodegen
Groovy based generation tasks from JSON schema
Stars: ✭ 28 (+55.56%)
Mutual labels:  json-schema
garden-schema
A simple data validation and cleaning library based on OpenAPI 3.0 Schema.
Stars: ✭ 21 (+16.67%)
Mutual labels:  json-schema
format-to-json
An algorithm that can format a string to json-like template. 字符串JSON格式化的算法。
Stars: ✭ 30 (+66.67%)
Mutual labels:  json-schema
hull
The incredible HULL - Helm Uniform Layer Library - is a Helm library chart to improve Helm chart based workflows
Stars: ✭ 66 (+266.67%)
Mutual labels:  json-schema
phpunit-json-assertions
JSON assertions for PHPUnit (including JSON Schema)
Stars: ✭ 30 (+66.67%)
Mutual labels:  json-schema
jsonschema-generator
Java JSON Schema Generator – creating JSON Schema (Draft 6, Draft 7, Draft 2019-09, or Draft 2020-12) from Java classes
Stars: ✭ 213 (+1083.33%)
Mutual labels:  json-schema
element-schema-form
A schema-based element-ui form component for Vue2.x.
Stars: ✭ 31 (+72.22%)
Mutual labels:  json-schema

json-schema-migrate

Migrate JSON-Schema from draft-04 to draft-07, draft-2019-09 or draft-2020-12

build npm coverage

Install

npm install json-schema-migrate

Usage

const migrate = require("json-schema-migrate")
const schema = {
  id: "my-schema",
  minimum: 1,
  exclusiveMinimum: true,
}
migrate.draft7(schema)
// or migrate.draft2019(schema)
// or migrate.draft2020(schema)

console.log(schema)
// {
//  $id: 'my-schema',
//  exclusiveMinimum: 1
// }

You can access Ajv instance that is used to migrate schema using migrate.getAjv function:

console.log(migrate.getAjv().errorsText(errors))

Changes in schemas after migration

  • id is replaced with $id
  • $schema value becomes draft-07, draft-2019-09 or draft-2020-12 meta-schema
  • draft-04 boolean form of exclusiveMaximum/Minimum is replaced with the current number form
  • enum with a single allowed value is replaced with const
  • Non-standard constant is replaced with const
  • empty schema is replaced with true
  • schema {"not":{}} is replaced with false
  • draft2019 function additionally replaces:
    • definitions with $defs
    • dependencies with dependentRequired and dependentSchemas
    • "id": "#foo" with "$anchor": "foo"
    • "id": "schema#foo" with "$id": "schema", "$anchor": "foo"
  • draft2020 function additionally replaces array form of items with prefixItems (and additionalItems with items)

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].