The fastest JSON schema Validator. Supports JSON Schema draft-04/06/07/2019-09/2020-12 and JSON Type Definition (RFC8927)

Overview

Ajv logo

 

Ajv JSON schema validator

The fastest JSON validator for Node.js and browser.

Supports JSON Schema draft-06/07/2019-09/2020-12 (draft-04 is supported in version 6) and JSON Type Definition RFC8927.

build npm npm downloads Coverage Status Gitter GitHub Sponsors

Platinum sponsors

Ajv online event - May 20, 10am PT / 6pm UK

We will talk about:

  • new features of Ajv version 8.
  • the improvements sponsored by Mozilla's MOSS grant.
  • how Ajv is used in JavaScript applications.

Speakers:

  • Evgeny Poberezkin, the creator of Ajv.
  • Mehan Jayasuriya, Program Officer at Mozilla Foundation, leading the MOSS and other programs investing in the open source and community ecosystems.
  • Matteo Collina, Technical Director at NearForm and Node.js Technical Steering Committee member, creator of Fastify web framework.
  • Kin Lane, Chief Evangelist at Postman. Studying the tech, business & politics of APIs since 2010. Presidential Innovation Fellow during the Obama administration.
  • Ulysse Carion, the creator of JSON Type Definition specification.

Gajus Kuizinas will host the event.

Please register here.

Contributing

More than 100 people contributed to Ajv, and we would love to have you join the development. We welcome implementing new features that will benefit many users and ideas to improve our documentation.

Please review Contributing guidelines and Code components.

Documentation

All documentation is available on the Ajv website.

Some useful site links:

Please sponsor Ajv development

Since I asked to support Ajv development 40 people and 6 organizations contributed via GitHub and OpenCollective - this support helped receiving the MOSS grant!

Your continuing support is very important - the funds will be used to develop and maintain Ajv once the next major version is released.

Please sponsor Ajv via:

Thank you.

Open Collective sponsors

Performance

Ajv generates code to turn JSON Schemas into super-fast validation functions that are efficient for v8 optimization.

Currently Ajv is the fastest and the most standard compliant validator according to these benchmarks:

Performance of different validators by json-schema-benchmark:

performance

Features

Install

To install version 8:

npm install ajv

Getting started

Try it in the Node.js REPL: https://runkit.com/npm/ajv

In JavaScript:

// or ESM/TypeScript import
import Ajv from "ajv"
// Node.js require:
const Ajv = require("ajv")

const ajv = new Ajv() // options can be passed, e.g. {allErrors: true}

const schema = {
  type: "object",
  properties: {
    foo: {type: "integer"},
    bar: {type: "string"}
  },
  required: ["foo"],
  additionalProperties: false,
}

const validate = ajv.compile(schema)
const valid = validate(data)
if (!valid) console.log(validate.errors)

Learn how to use Ajv and see more examples in the Guide: getting started

Changes history

See https://github.com/ajv-validator/ajv/releases

Please note: Changes in version 8.0.0

Version 7.0.0

Version 6.0.0.

Code of conduct

Please review and follow the Code of conduct.

Please report any unacceptable behaviour to [email protected] - it will be reviewed by the project team.

Security contact

To report a security vulnerability, please use the Tidelift security contact. Tidelift will coordinate the fix and disclosure. Please do NOT report security vulnerabilities via GitHub issues.

Open-source software support

Ajv is a part of Tidelift subscription - it provides a centralised support to open-source software users, in addition to the support provided by software maintainers.

License

MIT

Comments
  • NPM: 6.9.0 AJV Commit causing failure to execute node_modules (multiple dependencies affected i.e. ESLint and WebPack Loaders)

    NPM: 6.9.0 AJV Commit causing failure to execute node_modules (multiple dependencies affected i.e. ESLint and WebPack Loaders)

    What version of Ajv are you using? Does the issue happen if you use the latest version?

    Latest version (6.9.0 release I believe)

    Ajv options object

    node_modules/ajv/lib/keyword.js:65
          throw new Error('custom keyword definition is invalid: '  + this.errorsText(validateDefinition.errors));
          ^
    
    Error: custom keyword definition is invalid: data.errors should be boolean
        at Ajv.addKeyword (/home/mmacheerpuppy/git/fsa/react-application/node_modules/ajv/lib/keyword.js:65:13)
        at module.exports (/home/mmacheerpuppy/git/fsa/react-application/node_modules/ajv-errors/index.js:10:7)
        at Object.<anonymous> (/home/mmacheerpuppy/git/fsa/react-application/node_modules/schema-utils/src/validateOptions.js:22:1)
        at Module._compile (module.js:652:30)
        at Object.Module._extensions..js (module.js:663:10)
        at Module.load (module.js:565:32)
        at tryModuleLoad (module.js:505:12)
        at Function.Module._load (module.js:497:3)
        at Module.require (module.js:596:17)
        at require (internal/module.js:11:18)
    

    What results did you expect?

    Expected to be able to build node_modules but experiencing above stacktrace.

    Are you going to resolve the issue? Current workaround is to remove ESLint dependencies for NPM users, or if using YARN to resolve dependencies to forced version. It's also possible (with the addition of another dependency) to use NPM resolutions (see conversation).

    Reproduction

    Try using the following packages declaration. npm post install will fail to start. ESLint relies on AJV.

    {
      "name": "food-standards",
      "version": "0.1.0",
      "private": true,
      "dependencies": {
        
        "axios": "^0.18.0",
        "bootstrap": "^4.2.1",
        "react": "^16.8.1",
        "react-dom": "^16.8.1",
        "react-scripts": "2.1.3",
        "reactstrap": "^7.1.0"
      },
      "scripts": {
        "start": "react-scripts start",
        "build": "react-scripts build",
        "test": "react-scripts test",
        "eject": "react-scripts eject"
      },
      "eslintConfig": {
        "extends": "react-app"
      },
      "browserslist": [
        ">0.2%",
        "not dead",
        "not ie <= 11",
        "not op_mini all"
      ],
      "devDependencies": {
        "axios-mock-adapter": "^1.16.0",
        "eslint": "5.6.0",
        "eslint-config-airbnb": "^17.1.0",
        "eslint-plugin-import": "^2.14.0",
        "eslint-plugin-jsx-a11y": "^6.1.1",
        "eslint-plugin-react": "^7.11.0",
        "react-testing-library": "^5.5.3"
      }
    }
    
    bug 
    opened by mmacheerpuppy 45
  • Option to allow type coercion/cast/type conversion.

    Option to allow type coercion/cast/type conversion.

    Hi there -

    Thanks so much for writing this fantastic validator!

    I'm using it for POSTed forms with checkboxes and other cases where basically I'd love to support conversion to a different type from a string and (as long as conversion from string works) changing the object in place, allowing validation to continue without errors.

    I realize this is a corruption of pure validation and there would be a performance hit but I suspect there are others out there that would like coercion to work as well. An option to 'allowTypeCoercion' or 'laxMode' could allow transformation of primitives like integers, floats and boolean when a 'string' is found.

    In the absence of support for this - I'm doing validation of the request.body with string types - and then if I need them manually converting each string to a primitive or other type. Beyond requiring additional code in which there's opportunity for inconsistencies with the schema - errors are found further downstream which we need to ripple upward. Support for this via an attribute would eliminate a bunch of redundant code...

    It looks like the best I can do currently is to specify a string 'format' to try to enforce a numeric value for example or perhaps an enum to enforce the string 'true', 'false' in the case of a boolean. I might be able to use keywords as described in your documentation to try to make this more consistent.

    Am I missing something that would allow conversion or support this in a more elegant way? Are there others interested in this sort of thing?

    Thanks in advance, -Darrin

    option 
    opened by darrin 41
  • Support JSON-Schema Draft 2019-09 (formerly known as draft-08)

    Support JSON-Schema Draft 2019-09 (formerly known as draft-08)

    I'm working on a project that will be heavily enhanced once the next JSON-Schema draft is released.

    Since the next JSON-Schema draft is in released now as Draft 2019-09. I'm wondering if there are any efforts done now to make avj compatible as soon as possible or any plan at all for that. I didn't find anything in issues/pull-requests.

    I've seen version 7.0.0 milestone but didn't find any official information about it

    Thanks in advance!

    More info https://json-schema.org/work-in-progress

    enhancement 
    opened by qcho 34
  • Building with Webpack causes spurious warnings

    Building with Webpack causes spurious warnings

    It is being caused by this line:

    https://github.com/epoberezkin/ajv/blob/3.5.0/lib/compile/index.js#L10

    Is there a cleaner way to manage this dependency? Is peerDependencies built for this?

    Error stack below:

    ./~/ajv/lib/compile/index.js
    Module not found: Error: Cannot resolve module 'js-beautify' in /app/myapp/node_modules/ajv/lib/compile
    resolve module js-beautify in /app/myapp/node_modules/ajv/lib/compile
      looking for modules in /app/myapp/node_modules
        /app/myapp/node_modules/js-beautify doesn't exist (module as directory)
        resolve 'file' js-beautify in /app/myapp/node_modules
          resolve file
            /app/myapp/node_modules/js-beautify doesn't exist
            /app/myapp/node_modules/js-beautify.webpack.js doesn't exist
            /app/myapp/node_modules/js-beautify.web.js doesn't exist
            /app/myapp/node_modules/js-beautify.js doesn't exist
            /app/myapp/node_modules/js-beautify.json doesn't exist
      looking for modules in /app/myapp/public/js
        /app/myapp/public/js/js-beautify doesn't exist (module as directory)
        resolve 'file' js-beautify in /app/myapp/public/js
          resolve file
            /app/myapp/public/js/js-beautify doesn't exist
            /app/myapp/public/js/js-beautify.webpack.js doesn't exist
            /app/myapp/public/js/js-beautify.web.js doesn't exist
            /app/myapp/public/js/js-beautify.js doesn't exist
            /app/myapp/public/js/js-beautify.json doesn't exist
      looking for modules in /app/myapp/public/css
        /app/myapp/public/css/js-beautify doesn't exist (module as directory)
        resolve 'file' js-beautify in /app/myapp/public/css
          resolve file
            /app/myapp/public/css/js-beautify doesn't exist
            /app/myapp/public/css/js-beautify.webpack.js doesn't exist
            /app/myapp/public/css/js-beautify.web.js doesn't exist
            /app/myapp/public/css/js-beautify.js doesn't exist
            /app/myapp/public/css/js-beautify.json doesn't exist
    [/app/myapp/node_modules/js-beautify]
    [/app/myapp/node_modules/js-beautify]
    [/app/myapp/node_modules/js-beautify.webpack.js]
    [/app/myapp/node_modules/js-beautify.web.js]
    [/app/myapp/node_modules/js-beautify.js]
    [/app/myapp/node_modules/js-beautify.json]
    [/app/myapp/public/js/js-beautify]
    [/app/myapp/public/js/js-beautify]
    [/app/myapp/public/js/js-beautify.webpack.js]
    [/app/myapp/public/js/js-beautify.web.js]
    [/app/myapp/public/js/js-beautify.js]
    [/app/myapp/public/js/js-beautify.json]
    [/app/myapp/public/css/js-beautify]
    [/app/myapp/public/css/js-beautify]
    [/app/myapp/public/css/js-beautify.webpack.js]
    [/app/myapp/public/css/js-beautify.web.js]
    [/app/myapp/public/css/js-beautify.js]
    [/app/myapp/public/css/js-beautify.json]
     @ ./~/ajv/lib/compile/index.js 8:42-69
    
    compatibility 
    opened by avindra 28
  • [docs] relation between JTDSchemaType and JTDDataType

    [docs] relation between JTDSchemaType and JTDDataType

    What version of Ajv are you using? 8.4.0 Does the issue happen if you use the latest version? Yes

    JTD Schema

    export interface REQ {
    	data: {
    		text: string,
    	}
    };
    export const Req: JTDSchemaType<REQ> = {
    	properties: {
    		data: {
    			properties: {
    				text: { type: 'string' },
    			},
    		},
    	},
    };
    

    Your code

    type ReqD = JTDDataType<typeof Req>
    /* {
        data: {
            text: unknown;
        } & {};
    } & {} */
    
    type ReqD2 = JTDDataType<typeof Req.properties.data>
    /*  {
        text: unknown;
    } & {}; */
    

    What results did you expect?

    JTDDataType<typeof Req.properties.data>
    // { text: string }
    

    Are you going to resolve the issue?

    If this is a bug, and I know where to start, sure.

    typescript 
    opened by josh-hemphill 26
  • Support creating ajv bundle in Windows

    Support creating ajv bundle in Windows

    Hi,

    While install ajv throug npm I'm getting error. Attached is the error log "npm-debug.txt" npm-debug.txt

    I was also not able to create separate UMD bundle for browser using npm run bundle script. Attached in the error log "npm-run-bundle-debug.txt" Is it required that I install ajv before creating the bundle? npm-run-bundle-debug.txt

    Let me know what could be the problem here.

    Thanks.

    enhancement help wanted 
    opened by sushant160185 26
  • npm ERR! peer dep missing: ajv@^6.0.0, required by ajv-keywords@3.1.0

    npm ERR! peer dep missing: ajv@^6.0.0, required by [email protected]

    What version of Ajv are you using? Does the issue happen if you use the latest version?

    Ajv options object

    
    
    

    JSON Schema

    
    
    

    Sample data

    
    
    

    Your code

    
    
    

    Validation result, data AFTER validation, error messages

    
    
    

    What results did you expect?

    Are you going to resolve the issue? a.txt

    dependency 
    opened by sbwfnyiiiu 24
  • Fix Webpack issues in v4?

    Fix Webpack issues in v4?

    Why are the require(name) pattern even used?

    If I change it to require('nodent') for example, webpack stops complaining.

    I feel a bit stuck in that we have no control over our ajv version in our product, as it's used by our dependencies. So it's not as simple as "use v5"

    Can we backport the removal of "webpack: bundle.js blah" to v4 and change the requires to require('regenerator') instead of require('name') ?

    compatibility 
    opened by aikar 24
  • missing file

    missing file

    In the last v6.6.0 release, there is a missing file:

    Error: Cannot find module 'ajv/lib/compile/equal'
        at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)
        at Function.Module._load (internal/modules/cjs/loader.js:529:25)
        at Module.require (internal/modules/cjs/loader.js:658:17)
        at require (internal/modules/cjs/helpers.js:22:18)
        at Object.<anonymous> (/home/travis/build/fastify/fastify/node_modules/table/dist/validateConfig.js:2:13)
        at Module._compile (internal/modules/cjs/loader.js:722:30)
        at Module.replacementCompile (/home/travis/build/fastify/fastify/node_modules/nyc/node_modules/append-transform/index.js:58:13)
        at Module._extensions..js (internal/modules/cjs/loader.js:733:10)
        at Object.<anonymous> (/home/travis/build/fastify/fastify/node_modules/nyc/node_modules/append-transform/index.js:62:4)
        at Module.load (internal/modules/cjs/loader.js:620:32)
        at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
        at Function.Module._load (internal/modules/cjs/loader.js:552:3)
        at Module.require (internal/modules/cjs/loader.js:658:17)
        at require (internal/modules/cjs/helpers.js:22:18)
        at Object.<anonymous> (/home/travis/build/fastify/fastify/node_modules/table/src/makeConfig.js:3:1)
        at Module._compile (internal/modules/cjs/loader.js:722:30)
    

    See https://travis-ci.org/fastify/fastify/jobs/461147572 and https://github.com/fastify/fastify/issues/1281.

    opened by mcollina 23
  • Module not found: Error: Can't resolve 'nodent' when used in Angular 2 project (browser)

    Module not found: Error: Can't resolve 'nodent' when used in Angular 2 project (browser)

    What version of Ajv are you using? Does the issue happen if you use the latest version? 4.8.0

    Your code (please use options, schema and data as variables):

    import * as Ajv from 'ajv';
    
    ... ...  ...
    
    @Injectable()
    export class ValidationService {
      ajv: Ajv.Ajv;
    
      constructor() {
          this.ajv = Ajv({ allErrors: true, verbose: false });
      }
    
      public validateSettings(settingsSchema: JsonSchema, settings: SettingsData): ValidationResult {
        let valid = this.ajv.validate(settingsSchema, settings);
        return {
            valid: valid,
            errors: this.ajv.errors
        };
      }
    }
    

    If I run this in chrome I get:

    Module not found: Error: Can't resolve 'nodent' in '/MyProject/projects/client/node_modules/ajv/lib' resolve 'nodent' in '/MyProject/projects/client/node_modules/ajv/lib' Parsed request is a module using description file: /MyProject/projects/client/node_modules/ajv/package.json (relative path: ./lib) Field 'browser' doesn't contain a valid alias configuration after using description file: /MyProject/projects/client/node_modules/ajv/package.json (relative path: ./lib) resolve as module /MyProject/projects/client/node_modules/ajv/lib/node_modules doesn't exist or is not a directory /MyProject/projects/client/node_modules/ajv/node_modules doesn't exist or is not a directory /MyProject/projects/client/node_modules/node_modules doesn't exist or is not a directory /MyProject/projects/node_modules doesn't exist or is not a directory /MyProject/node_modules doesn't exist or is not a directory /Users/mmc/repos/node_modules doesn't exist or is not a directory /Users/mmc/node_modules doesn't exist or is not a directory /Users/node_modules doesn't exist or is not a directory /node_modules doesn't exist or is not a directory looking for modules in /MyProject/projects/client/node_modules using description file: /MyProject/projects/client/package.json (relative path: ./node_modules) Field 'browser' doesn't contain a valid alias configuration after using description file: /MyProject/projects/client/package.json (relative path: ./node_modules) using description file: /MyProject/projects/client/package.json (relative path: ./node_modules/nodent) as directory /MyProject/projects/client/node_modules/nodent doesn't exist no extension Field 'browser' doesn't contain a valid alias configuration /MyProject/projects/client/node_modules/nodent doesn't exist Field 'browser' doesn't contain a valid alias configuration /MyProject/projects/client/node_modules/nodent doesn't exist .ts Field 'browser' doesn't contain a valid alias configuration /MyProject/projects/client/node_modules/nodent.ts doesn't exist .js Field 'browser' doesn't contain a valid alias configuration /MyProject/projects/client/node_modules/nodent.js doesn't exist [/MyProject/projects/client/node_modules/ajv/lib/node_modules] [/MyProject/projects/client/node_modules/ajv/node_modules] [/MyProject/projects/client/node_modules/node_modules] [/MyProject/projects/node_modules] [/MyProject/node_modules] [/node_modules] [/MyProject/projects/client/node_modules/nodent] [/MyProject/projects/client/node_modules/nodent] [/MyProject/projects/client/node_modules/nodent] [/MyProject/projects/client/node_modules/nodent.ts] [/MyProject/projects/client/node_modules/nodent.js] @ ./~/ajv/lib/async.js 116:26-48 @ ./~/ajv/lib/ajv.js @ ./src/app/shared/services/validation-service.ts @ ./src/app/app.module.ts @ ./src/app/index.ts @ ./src/main.ts @ multi main

    What results did you expect?

    Are you going to resolve the issue?

    compatibility 
    opened by mmc41 23
  • Option to merge defaults

    Option to merge defaults

    In JSON schema it's often useful for declare defaults, with the default value for an optional property. This is powerful for documentation, and many validators supports inserting the default into the validated object, this way you don't hardcode defaults into your code, but declare the defaults in your input schema.

    Example A)

    var Ajv = require('ajv');
    var ajv = Ajv({mergeDefaults: true}); // Specify that we want defaults merged
    
    var validate = ajv.compile({
      type: "object",
      properties: {
        myProp: { // optional property
          type: "string",
          default: "Hello World" // default value
        }
      }
    });
    
    var data = {
      someOtherProp: "another value"
    };
    
    validate(data); // true
    console.log(data)
    // {someOtherProp: "another value", myProp: "Hello World"}
    

    This would be extremely useful, and doing this outside of the schema validation is hard, as you want to do this on all sub-objects as well, some of which may exist under an anyOf, so you can't insert the defaults until you're sure which anyOf branch is satisfied.

    It's quite possible that this is a post processing step, as nested anyOf branches means you sometimes can't do this until after everything is validated. A possible work around might be to insert the defaults into a clone of the existing object, that way multiple anyOf branches shouldn't be a problem.

    Note, this only really relevant for objects, but could also be done for arrays which has items: [{default: ...}, {default: ...}] (though this is a corner case). It doesn't really make sense to do this when the top-level schema type is a value type like integer as the input is either valid (ie. an integer) or invalid (ie. another type or null).

    Remark, after inserting a default value, validator should validate the default value too. This should ideally be done a schema compile-time. It is important to do this, because the default value of a property which has type: 'object' may be {} and the schema for that object may specify properties for this that has additional default values. It would also be nice to get errors about inconsistencies at compile-time.

    feature 
    opened by jonasfj 21
  • Custom validation function (including multiple properties)

    Custom validation function (including multiple properties)

    Sorry if this is already answered. This isn't a bug or feature request rather a question.

    We have a schema with 2 date fields "date_fr" and "date_to". And need to validate that "date_fr" is always smaller than "date_to". I can't add any keyword. Is there any way i can add additional validation function along with what is defined in the schema. Or is there any other way to achieve this?

    Schema isn't formatting correctly when pasting here. You can check my question on here. Happy to provide any further details. Thanks

    opened by targhs 0
  • Fix readme chart

    Fix readme chart

    What issue does this pull request resolve?

    Performance chart from json-schema-benchmark in README.md is showing just an empty grid. Also, listed benchmark data is a bit outdated.

    What changes did you make?

    Copied chart code from json-schema-benchmark and updated performance metrics according to corresponding links.

    Is there anything that requires more attention while reviewing?

    Check if I didn't mess up metrics.

    opened by ixth 0
  • schemaPath is different between AWS Lambda and local execution

    schemaPath is different between AWS Lambda and local execution

    The version of Ajv you are using 8.11.0

    The environment you have the problem with AWS Lambda

    description

    when validating invalid data

    Results in node.js v8+ also occurs with sam local invoke

    ,"errors":[{
        "instancePath":"/join_ts",
        "schemaPath":"depot:com.<redacted>/analytics/user_ctx/2-0-0/properties/join_ts/format",
        "keyword":"format",
        "params":{"format":"date-time"},
        "message":"must match format \"date-time\""
    }]
    

    Results and error messages in your platform

      "errors": [
            {
              "instancePath": "/join_ts",
              "schemaPath": "#/properties/join_ts/format",
              "keyword": "format",
              "params": {
                "format": "date-time"
              },
              "message": "must match format \"date-time\""
            }
          ]
    
    compatibility missing info 
    opened by m-ronchi 2
  • build(deps-dev): bump @rollup/plugin-commonjs from 23.0.7 to 24.0.0

    build(deps-dev): bump @rollup/plugin-commonjs from 23.0.7 to 24.0.0

    Bumps @rollup/plugin-commonjs from 23.0.7 to 24.0.0.

    Changelog

    Sourced from @​rollup/plugin-commonjs's changelog.

    v24.0.0

    2022-12-18

    Breaking Changes

    • fix: check if defaultIsModuleExports is auto for getDefaultExportFromCjs #1358
    Commits
    • c4c26a5 chore(release): commonjs v24.0.0
    • 4766d93 fix(commonjs)!: check if defaultIsModuleExports is auto for getDefaultExportF...
    • 2c2fe9b chore(release): commonjs v23.0.7
    • See full diff in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependency 
    opened by dependabot[bot] 0
  • build(deps-dev): bump @rollup/plugin-json from 5.0.2 to 6.0.0

    build(deps-dev): bump @rollup/plugin-json from 5.0.2 to 6.0.0

    Bumps @rollup/plugin-json from 5.0.2 to 6.0.0.

    Changelog

    Sourced from @​rollup/plugin-json's changelog.

    v6.0.0

    2022-12-17

    Breaking Changes

    • fix: log more robustly when JSON parsing fails #1361
    Commits
    • 445f8ca fix(json): cannot be imported by rollup (#81)
    • 6c1cc76 chore: remove placeholder security script from each plugin (#77)
    • 03a2e57 chore: fix linting errors that snuck through
    • 4f0bff5 feat: export Rollup*Options interfaces (#53)
    • 3d6132a chore: align scripts to use pnpm run
    • e3e20e9 chore: migrate rollup-plugin-yaml (#36)
    • bb446bd chore: migrate rollup-plugin-json (#30)
    • See full diff in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependency 
    opened by dependabot[bot] 0
  • Check for first property in generated code

    Check for first property in generated code

    What issue does this pull request resolve? #2181 - compileSerializer fails with optional properties only

    What changes did you make? Added a failing test to demonstrate the bug.

    Is there anything that requires more attention while reviewing? No.

    fixes #2171 fixes #2181 fixes #2001

    opened by dangerginger 3
Releases(v8.11.2)
  • v8.11.2(Nov 13, 2022)

  • v8.11.1(Nov 13, 2022)

  • v8.11.0(Mar 22, 2022)

    Use root schemaEnv when resolving references in oneOf (#1901, @asprouse)

    Only use equal function in generated code when it is used (#1922, @bhvngt)

    Source code(tar.gz)
    Source code(zip)
  • v8.10.0(Feb 4, 2022)

  • v8.9.0(Jan 15, 2022)

    Option code.esm to generate ESM exports for standalone validation functions (@rehanvdm, #1861) Support discriminator keyword with $ref in oneOf subschemas (@dfeufel, #1815)

    Source code(tar.gz)
    Source code(zip)
  • v8.8.2(Nov 21, 2021)

  • v8.8.1(Nov 16, 2021)

  • v8.8.0(Nov 13, 2021)

  • v8.7.1(Nov 8, 2021)

  • v8.7.0(Nov 8, 2021)

  • v8.6.3(Sep 12, 2021)

    Fix $ref resolution for schemas without $id (@rbuckton, #1725) Support standalone module import from ESM modules without using .default property (@bhvngt, #1757) Update code for breaking TS change - error in catch has type unknown (#1760)

    Source code(tar.gz)
    Source code(zip)
  • v8.6.2(Jul 15, 2021)

  • v8.6.1(Jul 4, 2021)

  • v8.6.0(Jun 6, 2021)

  • v8.5.0(May 20, 2021)

  • v8.4.0(May 14, 2021)

    JSON Type Definition schema options:

    • parseDate: parse timestamp type as Date objects.
    • allowDate: non-standard - allow date without time with timestamp type.
    Source code(tar.gz)
    Source code(zip)
  • v8.3.0(May 9, 2021)

    Typescript improvements:

    • better error reporting for JSONSchemaType in case strictNullChecks option is disabled (@erikbrinkman, #1583)
    • support missed boolean type in JTDDataType (@m00s, #1587) JTD timestamp validation option (@jrr, #1584). Docs corrections.
    Source code(tar.gz)
    Source code(zip)
  • v8.2.0(Apr 27, 2021)

    Add JTDDataType to compile signature (@erikbrinkman, #1547) Improve JSONSchemaType for records (@erikbrinkman, #1564) Use rollup for browser bundles (@realityking, #1533) Docs corrections

    Source code(tar.gz)
    Source code(zip)
  • v8.1.0(Apr 11, 2021)

  • v8.0.5(Apr 2, 2021)

  • v8.0.4(Apr 2, 2021)

  • v8.0.3(Apr 1, 2021)

  • v8.0.2(Mar 31, 2021)

  • v8.0.1(Mar 27, 2021)

  • v8.0.0(Mar 27, 2021)

    This document describes changes from v7.2.4 to v8.0.0.

    If you are migrating from v6 you can use this document.

    New features

    Support JSON Schema draft-2020-12: prefixItems keyword and changed semantics of items keyword, dynamic recursive references. OpenAPI discriminator keyword. Improved JSON Type Definition support:

    • errors consistent with JTD specification.
    • error objects with additional properties to simplify error handling (see Error objects)
    • internationalized error messages with ajv-i18n TypeScript: support type unions in JSONSchemaType

    Other changes / improvements

    Node.js require works without .default property - see examples in Getting started Reduce runtime dependency for standalone validation code Fix resolution of $ref: "#" when $id is present (#815)

    Breaking changes

    Option strict controls all strict mode restrictions JSON Schema validation errors changes:

    • dataPath property replaced with instancePath
    • "should" replaced with "must" in the messages
    • property name is removed from "propertyName" keyword error message (it is still available in error.params.propertyName).
    Source code(tar.gz)
    Source code(zip)
  • v7.2.4(Mar 26, 2021)

  • v8.0.0-beta.4(Mar 23, 2021)

    Revert the change for strict mode options in v8.0.0-beta.1 to allow overrides to disable some options, not only to enable.

    These strict mode options are available: strictSchema - new, equivalent to strict: true in v7, default true strictNumbers - reinstated from v6, but with default true strictTypes - same as in v7, default "log" strictTuples - same as in v7, default "log" strictTuples - same as in v7, default false

    Option strict sets all options above to the same value.

    Source code(tar.gz)
    Source code(zip)
  • v8.0.0-beta.3(Mar 21, 2021)

    JSON Schema draft2012-12 support - prefixItems, new semantics of items, dynamicRef and dynamicAnchor

    Fixes:

    • #815 - incorrect resolution of $ref: "#" with $id in subschema
    • #1493 - incorrect error message for missing property with ownProperties: true option
    • #1501 - incorrect compilation of JTD schema with many properties in the schema
    Source code(tar.gz)
    Source code(zip)
  • v7.2.3(Mar 20, 2021)

  • v7.2.2(Mar 20, 2021)

    Docs correction Simplified JSONSchemaType (@erikbrinkman) Fix #1493 - incorrect reporting of missing required property with option ownProperties: true Fix #1501 - JTD not working correctly with many properties in the schema

    Source code(tar.gz)
    Source code(zip)
Owner
Ajv JSON schema validator
Ajv: the fastest JSON validator. Supports JSON Schema draft-04/06/07/2019-09/2020-12 and JSON Type Definition (RFC8927)
Ajv JSON schema validator
Tiny Validator for JSON Schema v4

Tiny Validator (for v4 JSON Schema) Use json-schema draft v4 to validate simple values and complex objects using a rich validation vocabulary (example

Geraint 1.2k Dec 21, 2022
Convert JSON examples into JSON schema (supports Swagger 2, OpenAPI 3 and 3.1)

json-to-json-schema Convert JSON examples into JSON schema. Supports JSON Schema draft-05 used in Swagger 2.0 and OpenAPI 3.0 and new draft draft-2020

Redocly 9 Sep 15, 2022
ForgJs is a javascript lightweight object validator. Go check the Quick start section and start coding with love

Hey every one im really happy that this repo reached this many stars ?? ,but this repo needs your contibution I started to better document the code th

Hamdaoui Oussama 1.7k Dec 21, 2022
A simple environment variables validator for Node.js and web browsers

A simple environment variables validator for Node.js and web browsers

Mathieu Acthernoene 25 Jul 20, 2022
Facile is an HTML form validator that is inspired by Laravel's validation style and is designed for simplicity of use.

Facile is an HTML form validator that is inspired by Laravel's validation style and is designed for simplicity of use.

upjs 314 Dec 26, 2022
A JSONSchema validator that uses code generation to be extremely fast

is-my-json-valid A JSONSchema validator that uses code generation to be extremely fast. It passes the entire JSONSchema v4 test suite except for remot

Mathias Buus 948 Dec 31, 2022
Super Fast Complex Object Validator for Javascript(& Typescript).

Super Fast Object Validator for Javascript(& Typescript). Safen supports the syntax similar to the type script interface. This makes it easy to create

Changwan Jun 31 Nov 25, 2022
Simple validator for Steuerliche Identifikationsnummer (German personal tax number) according to the official docs (see readme).

simple-de-taxid-validator Important Code of this validator is taken (with small changes like optimization or removing not needed elements) from THIS R

Wojciech 3 Feb 24, 2022
Easy HTML Form Validator

Easy HTML Form Validator

Ali Nazari 314 Dec 26, 2022
Fast, compiled, eval-free data validator/transformer

spectypes Fast, compiled, eval-free data validator/transformer Features really fast, can be even faster than ajv detailed errors, failure will result

null 65 Dec 29, 2022
Simple password validator made with Javascript 💛

Password Validator Simple password validator made with Javascript ?? Branch history base-code: a complex logic to password validator. In next branches

Lais Frigério 8 Jul 25, 2022
What does the Cosmos Hub validator set looks like without ICF delegations?

This is a Next.js project bootstrapped with create-next-app. Getting Started First, run the development server: npm run dev # or yarn dev Open http://

Made in Block 2 Sep 2, 2022
This is the code repository of the official mun testnet validator node source code.

How to join Munchain network Infrastructure **Recommended configuration:** - Number of CPUs: 4 - Memory: 16GB - OS: Ubuntu 22.04 LTS - Allow all incom

MUN Blockchain 16 Dec 15, 2022
Schema-Inspector is an JSON API sanitisation and validation module.

Schema-Inspector is a powerful tool to sanitize and validate JS objects. It's designed to work both client-side and server-side and to be scalable wit

null 494 Oct 3, 2022
FieldVal - multipurpose validation library. Supports both sync and async validation.

FieldVal-JS The FieldVal-JS library allows you to easily validate data and provide readable and structured error reports. Documentation and Examples D

null 137 Sep 24, 2022
Validate for XML schema and returns all the possible failures

detailed-xml-validator Validate for XML schema and returns all the possible failures Sample Rules file <?xml version = "1.0"?> <students nillable="fa

Natural Intelligence 11 Dec 20, 2022
TypeScript-first schema validation for h3 and Nuxt applications

h3-zod Validate h3 and Nuxt 3 requests using zod schema's. Install npm install h3-zod Usage import { createServer } from 'http' import { createApp } f

Robert Soriano 48 Dec 28, 2022
Dead simple Object schema validation

Yup Yup is a JavaScript schema builder for value parsing and validation. Define a schema, transform a value to match, validate the shape of an existin

Jason Quense 19.2k Jan 2, 2023
Validate graphql operations against a schema

@graphql-validate With the power of GraphQL-Tools and GraphQL-JS, we are able to provide a smooth experience for validation your GraphQL operations du

Saihajpreet Singh 13 Dec 23, 2022