From 2c99bd1ee3f29af38a09edaa388cca08589a5e9a Mon Sep 17 00:00:00 2001 From: Cristian Barlutiu Date: Wed, 10 Apr 2024 16:26:41 +0200 Subject: [PATCH 1/2] upgrade for fastify 5 (#700) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gürgün Dayıoğlu Co-authored-by: Gürgün Dayıoğlu --- .github/workflows/ci.yml | 2 +- .taprc | 15 +++------------ package.json | 22 +++++++++++----------- 3 files changed, 15 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7b002766..5395d92e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ on: jobs: test: - uses: fastify/workflows/.github/workflows/plugins-ci.yml@v3 + uses: fastify/workflows/.github/workflows/plugins-ci.yml@v4.1.0 with: license-check: true lint: true diff --git a/.taprc b/.taprc index 688ba704..1883a735 100644 --- a/.taprc +++ b/.taprc @@ -1,14 +1,5 @@ -ts: false -jsx: false - -branches: 65 -functions: 100 -lines: 89 -statements: 89 - -nyc-arg: - - "--exclude=.cache/*" - - "--exclude=lib/schema-validator.js" - +disable-coverage: true files: - test/**/*.test.js +plugin: + - "!@tapjs/typescript" \ No newline at end of file diff --git a/package.json b/package.json index 09c50f9c..12004576 100644 --- a/package.json +++ b/package.json @@ -37,27 +37,27 @@ }, "homepage": "https://github.com/fastify/fast-json-stringify#readme", "devDependencies": { - "@fastify/pre-commit": "^2.0.2", - "@sinclair/typebox": "^0.32.3", + "@fastify/pre-commit": "^2.1.0", + "@sinclair/typebox": "^0.32.15", "benchmark": "^2.1.4", "cli-select": "^1.1.2", "compile-json-stringify": "^0.1.2", - "is-my-json-valid": "^2.20.0", - "simple-git": "^3.7.1", - "standard": "^17.0.0", - "tap": "^16.0.1", + "is-my-json-valid": "^2.20.6", + "simple-git": "^3.23.0", + "standard": "^17.1.0", + "tap": "^18.7.1", "tsd": "^0.31.0", - "webpack": "^5.40.0", + "webpack": "^5.90.3", "fast-json-stringify": "." }, "dependencies": { - "ajv": "^8.10.0", + "ajv": "^8.12.0", "ajv-formats": "^3.0.1", "fast-deep-equal": "^3.1.3", - "fast-uri": "^2.1.0", - "rfdc": "^1.2.0", + "fast-uri": "^2.3.0", + "rfdc": "^1.3.1", "json-schema-ref-resolver": "^1.0.1", - "@fastify/merge-json-schemas": "^0.1.0" + "@fastify/merge-json-schemas": "^0.1.1" }, "standard": { "ignore": [ From 444ffa7afa13051bcceab0784a87a8aebf28f757 Mon Sep 17 00:00:00 2001 From: Ivan Tymoshenko Date: Thu, 11 Apr 2024 06:39:44 -0700 Subject: [PATCH 2/2] feat: drop array items type checking (#706) --- test/array.test.js | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/test/array.test.js b/test/array.test.js index fbffe02f..d10478f9 100644 --- a/test/array.test.js +++ b/test/array.test.js @@ -195,30 +195,6 @@ buildTest({ '@data': ['test'] }) -test('invalid items throw', (t) => { - t.plan(1) - const schema = { - type: 'object', - properties: { - args: { - type: 'array', - items: [ - { - type: 'object', - patternProperties: { - '.*': { - type: 'string' - } - } - } - ] - } - } - } - const stringify = build(schema) - t.throws(() => stringify({ args: ['invalid'] })) -}) - buildTest({ title: 'item types in array default to any', type: 'object', @@ -329,8 +305,8 @@ test('array items is a list of schema and additionalItems is false /2', (t) => { const stringify = build(schema) - t.throws(() => stringify({ foo: [1, 'bar'] }), new Error('Item at 0 does not match schema definition.')) - t.throws(() => stringify({ foo: ['foo', 1] }), new Error('Item at 1 does not match schema definition.')) + t.strictSame(stringify({ foo: [1, 'bar'] }), '{"foo":["1","bar"]}') + t.strictSame(stringify({ foo: ['foo', 1] }), '{"foo":["foo","1"]}') t.throws(() => stringify({ foo: ['foo', 'bar', 'baz'] }), new Error('Item at 2 does not match schema definition.')) })