{"_id":"@cameronhunter/jest-json-schema","_rev":"1-70a4ec17a7331102ff18df0694a6a4f4","name":"@cameronhunter/jest-json-schema","dist-tags":{"latest":"2.1.0"},"versions":{"2.1.0":{"name":"@cameronhunter/jest-json-schema","version":"2.1.0","description":"JSON schema matcher for jest","main":"index.js","scripts":{"lint":"eslint ./ --ignore-path .gitignore --ext .js","pretest":"npm run lint","test":"jest"},"repository":{"type":"git","url":"git+https://github.com/americanexpress/jest-json-schema.git"},"jest":{"preset":"amex-jest-preset"},"keywords":["jest","json","schema","matcher","test"],"author":{"name":"Jimmy King","email":"jimmy.king@aexp.com","url":"https://github.com/10xLaCroixDrinker"},"license":"Apache-2.0","dependencies":{"ajv":"^6.8.1","chalk":"^2.4.2","is-relative-url":"^2.0.0","jest-matcher-utils":"^24.0.0","node-fetch":"^2.3.0","url-relative":"^1.0.0"},"devDependencies":{"amex-jest-preset":"^5.0.0","eslint":"^5.13.0","eslint-config-amex":"^10.0.0","jest":"^24.1.0","jest-serializer-path":"^0.1.15"},"gitHead":"fcc759d9e0416f693f7867e63dd5674e96e89183","bugs":{"url":"https://github.com/americanexpress/jest-json-schema/issues"},"homepage":"https://github.com/americanexpress/jest-json-schema#readme","_id":"@cameronhunter/jest-json-schema@2.1.0","_npmVersion":"6.4.1","_nodeVersion":"10.13.0","_npmUser":{"name":"cameronhunter","email":"hello@cameronhunter.co.uk"},"dist":{"integrity":"sha512-hYNi8MpP28v9yMPXAaWUMGY/lBho4IBOdKyeqcIFxdt77IMUQcc6dUkYEpb4fzo25OGgIu4uw9Ovt5VCIlFs/w==","shasum":"2cd12577c4665b466cc50a831e4fc214aa2c21fe","tarball":"https://registry.npmjs.org/@cameronhunter/jest-json-schema/-/jest-json-schema-2.1.0.tgz","fileCount":24,"unpackedSize":47037,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcX0/8CRA9TVsSAnZWagAAcd8P/izSJaYq3jkbHHs7qEh2\nQbHzc3O0yMhQEkQrj/B2FLpIR75JsAKMIMmYHh0tnXwfZlsDYvVWL1dQ6YtY\nocK+T13VR3O3jSucJxjCtig6FF61EWjruPFHyUzX3CPreFA45XzHqxR0O0w0\nxo1cKZGd+4c0ShlNzoHVAR0xSJsn+BT5Dwo+7sdf0wrWu0eKScXNuPHYzA1P\nahCSUCjMXc53NxFZqBxPvXtcxOTWFTfirhKwH/W3Dj2Nt9nIRKkPLNlC3C2d\n9nZqXyEW+yGa7U6E38P+LAxakX8l1c2oE5XTzSne3ZEYjGG8P9P3tpXXiHxl\nk48rfZAjQiG2F7L4y4zVlqx8AnDq9f9lfSKHS8Et+/6Yp9TQ3b29YavtoIST\nhTf61h9hvp+soRbgtDhHtglLZWZIQd6/1rdnSf3zFm7wuas+078AwMbe3RSs\nfL+gYnrdWgM8rRw8yrITd/B8Y5dnNUmAqnW3N0zbyRZ5cScIDzFUyRtR3jzQ\nj14i22tsYNriFwkUc+vPQY1+gYEhfSbDyV1g+Qp28s6NgQXLKTlpku9aIVDK\n8X/3YQ9AdhSIqIruqkqCk/agudtSWJw2Ob3kec/5oN7jIK4VBENyqoGCSGSq\nl5y5wTNrHcvKa2qRQjlH8ecGGHkzq7TlpIZv9I20SwBYITxRIEGCfC+pg5w/\nWQnG\r\n=/x3O\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAHLuJA8j9i/b5D23EU4Ly+FnLHS9WUJaA/86sSMUw4KAiBggRNY+n3lHI6OadxjDS3tSmBQrO2g0OH5JoG9iJCVAw=="}]},"maintainers":[{"name":"cameronhunter","email":"hello@cameronhunter.co.uk"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/jest-json-schema_2.1.0_1549750267645_0.526563137971265"},"_hasShrinkwrap":false}},"time":{"created":"2019-02-09T22:11:07.461Z","2.1.0":"2019-02-09T22:11:07.786Z","modified":"2022-04-04T21:34:11.161Z"},"maintainers":[{"name":"cameronhunter","email":"hello@cameronhunter.co.uk"}],"description":"JSON schema matcher for jest","homepage":"https://github.com/americanexpress/jest-json-schema#readme","keywords":["jest","json","schema","matcher","test"],"repository":{"type":"git","url":"git+https://github.com/americanexpress/jest-json-schema.git"},"author":{"name":"Jimmy King","email":"jimmy.king@aexp.com","url":"https://github.com/10xLaCroixDrinker"},"bugs":{"url":"https://github.com/americanexpress/jest-json-schema/issues"},"license":"Apache-2.0","readme":"# jest-json-schema\n\n[![npm version](https://badge.fury.io/js/jest-json-schema.svg)](https://badge.fury.io/js/jest-json-schema)\n[![Build Status](https://travis-ci.org/americanexpress/jest-json-schema.svg?branch=master)](https://travis-ci.org/americanexpress/jest-json-schema)\n[![Mentioned in Awesome Jest](https://awesome.re/mentioned-badge.svg)](https://github.com/jest-community/awesome-jest)\n\n> JSON schema matcher for [jest](https://www.npmjs.com/package/jest)\n\n## Matchers included\n\n### `toMatchSchema(schema, [ajvOptions])`\n\nValidates that an object matches the given [JSON schema](http://json-schema.org/)\n\n```js\nit('validates my json', () => {\n  const schema = {\n    properties: {\n      hello: { type: 'string' },\n    },\n    required: ['hello'],\n  };\n  expect({ hello: 'world' }).toMatchSchema(schema);\n});\n```\n\nReferenced schemas will be automatically fetched if you use the `async` option.\n\n```js\nit('auto-fetches referenced schemas', async () => {\n  const schemaWithRefs = require('./schema-with-refs.json');\n  await expect({ hello: 'world' }).toMatchSchema(schemaWithRefs, {\n    async: true\n  });\n});\n```\n\nLocal schemas will be loaded via the filesystem by providing a `resolutions`\noption, removing the need for them to be hosted at their schema URI.\n\n```js\nit('auto-fetches referenced schemas', async () => {\n  const schemaWithRefs = require('./schema-with-refs.json');\n  await expect({ hello: 'world' }).toMatchSchema(schemaWithRefs, {\n    async: true,\n    resolutions: {\n      'http://my-domain.com/schema/': __dirname\n    }\n  });\n});\n```\n\n### `toBeValidSchema([ajvOptions])`\n\nValidates that a schema is valid\n\n```js\nit('validates my schema', () => {\n  const schema = {\n    properties: {\n      hello: { type: 'string' },\n    },\n    required: ['hello'],\n  };\n  expect(schema).toBeValidSchema();\n});\n```\n\n## Installation\n\n```bash\n$ npm install --save-dev jest-json-schema\n```\n\n## Usage\n\nIn any test file:\n\n```js\nimport matchers from 'jest-json-schema';\nexpect.extend(matchers);\n```\n\nOr if you want it available for all test files then set it up the same way in a\n[test framework script file](http://facebook.github.io/jest/docs/configuration.html#setuptestframeworkscriptfile-string)\n\nYou can pass [Ajv options](http://epoberezkin.github.io/ajv/#options) as a\nsecond parameter to any of the matchers. The only option passed by default is\n`allErrors: true`.\n\n```js\nconst ajvOptions = {\n  formats: {\n    bcp47: /^[a-z]{2}-[A-Z]{2}$/,\n  },\n};\n\nconst schema = {\n  type: 'object',\n  properties: {\n    lang: {\n      type: 'string',\n      format: 'bcp47',\n    },\n  },\n};\n\nexpect({ lang: 'en-US' }).toMatchSchema(schema, ajvOptions);\n```\n\n## Contributing\nWe welcome Your interest in the American Express Open Source Community on Github.\nAny Contributor to any Open Source Project managed by the American Express Open\nSource Community must accept and sign an Agreement indicating agreement to the\nterms below. Except for the rights granted in this Agreement to American Express\nand to recipients of software distributed by American Express, You reserve all\nright, title, and interest, if any, in and to Your Contributions. Please [fill\nout the Agreement](https://cla-assistant.io/americanexpress/).\n\n## License\nAny contributions made under this project will be governed by the [Apache License\n 2.0](https://github.com/americanexpress/jest-json-schema/blob/master/LICENSE.txt).\n\n## Code of Conduct\nThis project adheres to the [American Express Community Guidelines](https://github.com/americanexpress/jest-json-schema/wiki/Code-of-Conduct).\nBy participating, you are expected to honor these guidelines.\n","readmeFilename":"README.md"}