diff --git a/README.md b/README.md index 4578853bd..4a7bff9bc 100644 --- a/README.md +++ b/README.md @@ -22,11 +22,12 @@ We'll be consolidating that soon. Just giving you the heads-up. You may see refe The OpenAPI Specification has undergone multiple revisions since initial creation in 2010. Compatibility between Swagger Client and the OpenAPI Specification is as follows: -Swagger Client Version | Release Date | OpenAPI Spec compatibility | Notes ------------------- |--------------|----------------------------------------| ----- -3.19.x | 2023-01-23 | 2.0, 3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.1.0 | [tag v3.19.0-alpha.3](https://github.com/swagger-api/swagger-js/releases/tag/v3.19.0-alpha.3) -3.10.x | 2020-01-17 | 2.0, 3.0.0, 3.0.1, 3.0.2, 3.0.3 | [tag v3.10.0](https://github.com/swagger-api/swagger-js/tree/v3.10.0) -2.1.32 | 2017-01-12 | 1.0, 1.1, 1.2 | [tag v2.1.32](https://github.com/swagger-api/swagger-js/tree/v2.1.32). This [release](https://github.com/swagger-api/swagger-js/releases/tag/v2.1.32) is only available on GitHub. +Swagger Client Version | Release Date | OpenAPI Spec compatibility | Notes +------------------ |--------------|-----------------------------------------------| ----- +3.33.x | 2024-12-30 | 2.0, 3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.1.0 | [tag v3.33.0](https://github.com/swagger-api/swagger-js/releases/tag/v3.33.0) +3.19.x | 2023-01-23 | 2.0, 3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.1.0 | [tag v3.19.0-alpha.3](https://github.com/swagger-api/swagger-js/releases/tag/v3.19.0-alpha.3) +3.10.x | 2020-01-17 | 2.0, 3.0.0, 3.0.1, 3.0.2, 3.0.3 | [tag v3.10.0](https://github.com/swagger-api/swagger-js/tree/v3.10.0) +2.1.32 | 2017-01-12 | 1.0, 1.1, 1.2 | [tag v2.1.32](https://github.com/swagger-api/swagger-js/tree/v2.1.32). This [release](https://github.com/swagger-api/swagger-js/releases/tag/v2.1.32) is only available on GitHub. ## Anonymized analytics diff --git a/docs/usage/http-client-for-oas-operations.md b/docs/usage/http-client-for-oas-operations.md index 2baac4699..e7bf056d9 100644 --- a/docs/usage/http-client-for-oas-operations.md +++ b/docs/usage/http-client-for-oas-operations.md @@ -32,11 +32,11 @@ Property | Description `contextUrl` | `String`. URL, e.g. `https://example.com`. Used in following situations:

If `server` option is not matched and there is no `Server Object` defined in the definition, this URL will be prepended to every requested path.

If matched `Server Object` is defined as relative URI Reference its `url` fixed field is resolved against `contenxtUrl`. Resolved URL will be prepended to every requested path. `baseURL` | `String`. URL (`https://example.com`) . Takes precedence over server and any defined servers in the Spec. It will be prepended to every requested path. -For all later references, we will always use following OpenAPI 3.0.0 definition when referring +For all later references, we will always use following OpenAPI 3.0.4 definition when referring to a `spec`. ```yaml -openapi: 3.0.0 +openapi: 3.0.4 info: title: Testing API version: 1.0.0 diff --git a/package-lock.json b/package-lock.json index bf50b0050..612dd53ab 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,11 +11,11 @@ "dependencies": { "@babel/runtime-corejs3": "^7.22.15", "@scarf/scarf": "=1.4.0", - "@swagger-api/apidom-core": ">=1.0.0-beta.3 <1.0.0-rc.0", - "@swagger-api/apidom-error": ">=1.0.0-beta.3 <1.0.0-rc.0", - "@swagger-api/apidom-json-pointer": ">=1.0.0-beta.3 <1.0.0-rc.0", - "@swagger-api/apidom-ns-openapi-3-1": ">=1.0.0-beta.3 <1.0.0-rc.0", - "@swagger-api/apidom-reference": ">=1.0.0-beta.3 <1.0.0-rc.0", + "@swagger-api/apidom-core": ">=1.0.0-beta.6 <1.0.0-rc.0", + "@swagger-api/apidom-error": ">=1.0.0-beta.6 <1.0.0-rc.0", + "@swagger-api/apidom-json-pointer": ">=1.0.0-beta.6 <1.0.0-rc.0", + "@swagger-api/apidom-ns-openapi-3-1": ">=1.0.0-beta.6 <1.0.0-rc.0", + "@swagger-api/apidom-reference": ">=1.0.0-beta.6 <1.0.0-rc.0", "cookie": "~0.7.2", "deepmerge": "~4.3.0", "fast-json-patch": "^3.0.0-1", @@ -3478,12 +3478,13 @@ } }, "node_modules/@swagger-api/apidom-ast": { - "version": "1.0.0-beta.5", - "resolved": "https://registry.npmjs.org/@swagger-api/apidom-ast/-/apidom-ast-1.0.0-beta.5.tgz", - "integrity": "sha512-Law51h4r1bOzOnvljFRRbyrdWA9FZX05+4cFJ2kCd4KGltci2cQsGKBMJ0xF79Ds1qcQhAwc5ztPUo2NdLidHw==", + "version": "1.0.0-beta.6", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-ast/-/apidom-ast-1.0.0-beta.6.tgz", + "integrity": "sha512-AAxEN/xTcH/ORpn/zEEuPPgtqX6/Q9EZC8RX2R7AlRdUeGZieE9OZ91mXYrg48FcHWi/xwWYqkPPHjyXTQkfww==", + "license": "Apache-2.0", "dependencies": { "@babel/runtime-corejs3": "^7.20.7", - "@swagger-api/apidom-error": "^1.0.0-beta.5", + "@swagger-api/apidom-error": "^1.0.0-beta.6", "@types/ramda": "~0.30.0", "ramda": "~0.30.0", "ramda-adjunct": "^5.0.0", @@ -3491,13 +3492,14 @@ } }, "node_modules/@swagger-api/apidom-core": { - "version": "1.0.0-beta.5", - "resolved": "https://registry.npmjs.org/@swagger-api/apidom-core/-/apidom-core-1.0.0-beta.5.tgz", - "integrity": "sha512-FNruouI/1Msy9JbrO5zLvsVDnsJ3652OYLKr5JLlO38LgO3XkKIwiLXaqy8la1DmwU4LNbpuMcn0zWptw73C0Q==", + "version": "1.0.0-beta.6", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-core/-/apidom-core-1.0.0-beta.6.tgz", + "integrity": "sha512-gmHpE5+wJgUmpkb0C3ZIM6VsMXj0heujwQeXqEcFRkp1d0u4crCNmQ5iPTewzvILcnMbxac0AUFFKuJbBpqzPg==", + "license": "Apache-2.0", "dependencies": { "@babel/runtime-corejs3": "^7.20.7", - "@swagger-api/apidom-ast": "^1.0.0-beta.5", - "@swagger-api/apidom-error": "^1.0.0-beta.5", + "@swagger-api/apidom-ast": "^1.0.0-beta.6", + "@swagger-api/apidom-error": "^1.0.0-beta.6", "@types/ramda": "~0.30.0", "minim": "~0.23.8", "ramda": "~0.30.0", @@ -3507,21 +3509,23 @@ } }, "node_modules/@swagger-api/apidom-error": { - "version": "1.0.0-beta.5", - "resolved": "https://registry.npmjs.org/@swagger-api/apidom-error/-/apidom-error-1.0.0-beta.5.tgz", - "integrity": "sha512-RRzVvOmgvmq5tR3kt1MXYFGw2xylfqQe7zVmratf74azO4AJetK/s4MGs0nt6EYlwkwZio88AzEvbh1hsOzazg==", + "version": "1.0.0-beta.6", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-error/-/apidom-error-1.0.0-beta.6.tgz", + "integrity": "sha512-bLttwjXj0u9pHIzc71L5rZWvhtcPFmGdvPDpXMoK4XOjmfpw9hqQKg1DGWKQHxNiMP/zlWAWO1RxjFQNYcO70g==", + "license": "Apache-2.0", "dependencies": { "@babel/runtime-corejs3": "^7.20.7" } }, "node_modules/@swagger-api/apidom-json-pointer": { - "version": "1.0.0-beta.5", - "resolved": "https://registry.npmjs.org/@swagger-api/apidom-json-pointer/-/apidom-json-pointer-1.0.0-beta.5.tgz", - "integrity": "sha512-wZJ7M3ShTkLgrydOlzXBK60IuqljroTgLypTojr35uEXJZMqe7AUTHQJFJZvOG0kUXMy1z1q3x8FinVc9kWSyw==", + "version": "1.0.0-beta.6", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-json-pointer/-/apidom-json-pointer-1.0.0-beta.6.tgz", + "integrity": "sha512-9XdWnouDGnn8UCr48TgtB16e4s37L7ibWFFgn4ercSkUMsJKMzHULabZ005IKVfP20UbhdIa5/r2W/i8iRk8Vg==", + "license": "Apache-2.0", "dependencies": { "@babel/runtime-corejs3": "^7.20.7", - "@swagger-api/apidom-core": "^1.0.0-beta.5", - "@swagger-api/apidom-error": "^1.0.0-beta.5", + "@swagger-api/apidom-core": "^1.0.0-beta.6", + "@swagger-api/apidom-error": "^1.0.0-beta.6", "@types/ramda": "~0.30.0", "ramda": "~0.30.0", "ramda-adjunct": "^5.0.0" @@ -3536,13 +3540,14 @@ "optional": true }, "node_modules/@swagger-api/apidom-ns-json-schema-draft-4": { - "version": "1.0.0-beta.5", - "resolved": "https://registry.npmjs.org/@swagger-api/apidom-ns-json-schema-draft-4/-/apidom-ns-json-schema-draft-4-1.0.0-beta.5.tgz", - "integrity": "sha512-/EPIBqbNZOIG+zrL5wE10fBDnhoV2whthJvMw+9siQmycQBpUNQs0zgwP9hRJGvFCGJ0nnwqhyt8+Win/7Wvhg==", + "version": "1.0.0-beta.6", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-ns-json-schema-draft-4/-/apidom-ns-json-schema-draft-4-1.0.0-beta.6.tgz", + "integrity": "sha512-Cn4+CH8ZqniejbmbD7nfUzw/N+S9lwGztOB5ZSoS23r1/mFzcya/bTOSuUW6BJ4Pa1L+AvUWhqmRlzG66Ta0gA==", + "license": "Apache-2.0", "dependencies": { "@babel/runtime-corejs3": "^7.20.7", - "@swagger-api/apidom-ast": "^1.0.0-beta.5", - "@swagger-api/apidom-core": "^1.0.0-beta.5", + "@swagger-api/apidom-ast": "^1.0.0-beta.6", + "@swagger-api/apidom-core": "^1.0.0-beta.6", "@types/ramda": "~0.30.0", "ramda": "~0.30.0", "ramda-adjunct": "^5.0.0", @@ -3558,14 +3563,15 @@ "optional": true }, "node_modules/@swagger-api/apidom-ns-openapi-3-0": { - "version": "1.0.0-beta.5", - "resolved": "https://registry.npmjs.org/@swagger-api/apidom-ns-openapi-3-0/-/apidom-ns-openapi-3-0-1.0.0-beta.5.tgz", - "integrity": "sha512-FzCmDC7i6tBJSmmruQ/uVBX3+wdXZ6era5bUygguzxIZiZl+j5oTlzWzC4h9tozALn21+5YRRQuHvShL5WKs7Q==", + "version": "1.0.0-beta.6", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-ns-openapi-3-0/-/apidom-ns-openapi-3-0-1.0.0-beta.6.tgz", + "integrity": "sha512-fqsF35X8O2yaENr74wbZtPqSgiuuomu9mT9KKj9P7z6in6SjBSTMMmGkbsjximdr+hVCrNm8ActDF1HRq3av7Q==", + "license": "Apache-2.0", "dependencies": { "@babel/runtime-corejs3": "^7.20.7", - "@swagger-api/apidom-core": "^1.0.0-beta.5", - "@swagger-api/apidom-error": "^1.0.0-beta.5", - "@swagger-api/apidom-ns-json-schema-draft-4": "^1.0.0-beta.5", + "@swagger-api/apidom-core": "^1.0.0-beta.6", + "@swagger-api/apidom-error": "^1.0.0-beta.6", + "@swagger-api/apidom-ns-json-schema-draft-4": "^1.0.0-beta.6", "@types/ramda": "~0.30.0", "ramda": "~0.30.0", "ramda-adjunct": "^5.0.0", @@ -3573,15 +3579,16 @@ } }, "node_modules/@swagger-api/apidom-ns-openapi-3-1": { - "version": "1.0.0-beta.5", - "resolved": "https://registry.npmjs.org/@swagger-api/apidom-ns-openapi-3-1/-/apidom-ns-openapi-3-1-1.0.0-beta.5.tgz", - "integrity": "sha512-X635P6DVSwjEA/ZHNld9wtoB5UVnl0qOKoatbYZ7iIlDUz+HZJERbYyZE797533abfm4ligLZIiqdkJAZo/oDA==", + "version": "1.0.0-beta.6", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-ns-openapi-3-1/-/apidom-ns-openapi-3-1-1.0.0-beta.6.tgz", + "integrity": "sha512-GOtloezNXZExvhmSp5OT2NO7XLMwUY12stXUWl0bWR3O/6I6U522JFgoO9SHKxuSed5ateJpE7eR39HCJ/pyOQ==", + "license": "Apache-2.0", "dependencies": { "@babel/runtime-corejs3": "^7.20.7", - "@swagger-api/apidom-ast": "^1.0.0-beta.5", - "@swagger-api/apidom-core": "^1.0.0-beta.5", - "@swagger-api/apidom-json-pointer": "^1.0.0-beta.5", - "@swagger-api/apidom-ns-openapi-3-0": "^1.0.0-beta.5", + "@swagger-api/apidom-ast": "^1.0.0-beta.6", + "@swagger-api/apidom-core": "^1.0.0-beta.6", + "@swagger-api/apidom-json-pointer": "^1.0.0-beta.6", + "@swagger-api/apidom-ns-openapi-3-0": "^1.0.0-beta.6", "@types/ramda": "~0.30.0", "ramda": "~0.30.0", "ramda-adjunct": "^5.0.0", @@ -3717,12 +3724,13 @@ "optional": true }, "node_modules/@swagger-api/apidom-reference": { - "version": "1.0.0-beta.5", - "resolved": "https://registry.npmjs.org/@swagger-api/apidom-reference/-/apidom-reference-1.0.0-beta.5.tgz", - "integrity": "sha512-dPxeYHrLnvIWUmhj4sJVZK8mpNkpLcorEQF0wILh2uEIoHa4vXqQJyMHk3EoPas8VtDgd1ewxNB7Ssp+vld8AQ==", + "version": "1.0.0-beta.6", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-reference/-/apidom-reference-1.0.0-beta.6.tgz", + "integrity": "sha512-GdVPd+YAOWdAuJUJ5so63pZ4i0xlBNGClHJfTHirxZbEH9UQjNTKSkQgawUD0UBpg1HeQVzecl1cehoOp/+Uhw==", + "license": "Apache-2.0", "dependencies": { "@babel/runtime-corejs3": "^7.20.7", - "@swagger-api/apidom-core": "^1.0.0-beta.5", + "@swagger-api/apidom-core": "^1.0.0-beta.6", "@types/ramda": "~0.30.0", "axios": "^1.7.4", "minimatch": "^7.4.3", diff --git a/package.json b/package.json index 8e4107fe9..0b148fbec 100644 --- a/package.json +++ b/package.json @@ -74,11 +74,11 @@ "dependencies": { "@babel/runtime-corejs3": "^7.22.15", "@scarf/scarf": "=1.4.0", - "@swagger-api/apidom-core": ">=1.0.0-beta.3 <1.0.0-rc.0", - "@swagger-api/apidom-error": ">=1.0.0-beta.3 <1.0.0-rc.0", - "@swagger-api/apidom-json-pointer": ">=1.0.0-beta.3 <1.0.0-rc.0", - "@swagger-api/apidom-ns-openapi-3-1": ">=1.0.0-beta.3 <1.0.0-rc.0", - "@swagger-api/apidom-reference": ">=1.0.0-beta.3 <1.0.0-rc.0", + "@swagger-api/apidom-core": ">=1.0.0-beta.6 <1.0.0-rc.0", + "@swagger-api/apidom-error": ">=1.0.0-beta.6 <1.0.0-rc.0", + "@swagger-api/apidom-json-pointer": ">=1.0.0-beta.6 <1.0.0-rc.0", + "@swagger-api/apidom-ns-openapi-3-1": ">=1.0.0-beta.6 <1.0.0-rc.0", + "@swagger-api/apidom-reference": ">=1.0.0-beta.6 <1.0.0-rc.0", "cookie": "~0.7.2", "deepmerge": "~4.3.0", "fast-json-patch": "^3.0.0-1", diff --git a/src/helpers/openapi-predicates.js b/src/helpers/openapi-predicates.js index dc65b9d13..e1e331bac 100644 --- a/src/helpers/openapi-predicates.js +++ b/src/helpers/openapi-predicates.js @@ -9,7 +9,7 @@ export const isOpenAPI2 = (spec) => { export const isOpenAPI30 = (spec) => { try { const { openapi } = spec; - return typeof openapi === 'string' && /^3\.0\.([0123])(?:-rc[012])?$/.test(openapi); + return typeof openapi === 'string' && /^3\.0\.(?:[1-9]\d*|0)$/.test(openapi); } catch { return false; } diff --git a/src/subtree-resolver/index.js b/src/subtree-resolver/index.js index 6a41f0794..e77534292 100644 --- a/src/subtree-resolver/index.js +++ b/src/subtree-resolver/index.js @@ -14,7 +14,7 @@ // // This is useful for cases where resolving your entire object is unnecessary // and/or non-performant; we use this interface for lazily resolving operations -// and models in Swagger-UI, which allows us to handle larger definitions. +// and models in Swagger-UI, which allows us to handle larger OpenAPI descriptions. // // It's likely that Swagger-Client will rely entirely on lazy resolving in // future versions. diff --git a/test/bugs/ui-4071.js b/test/bugs/ui-4071.js index 346b74371..4dceb33ff 100644 --- a/test/bugs/ui-4071.js +++ b/test/bugs/ui-4071.js @@ -2,7 +2,7 @@ import { buildRequest } from '../../src/execute/index.js'; const spec = { - openapi: '3.0.0', + openapi: '3.0.4', servers: [ { url: 'https://workbcjobs.api.gov.bc.ca/v1', diff --git a/test/data/issue-1719-ref-object-reference.yaml b/test/data/issue-1719-ref-object-reference.yaml index 6012dc609..9869da6ea 100644 --- a/test/data/issue-1719-ref-object-reference.yaml +++ b/test/data/issue-1719-ref-object-reference.yaml @@ -1,4 +1,4 @@ -openapi: 3.0.0 +openapi: 3.0.4 servers: - description: "mock definition for swagger-client issue #1719" url: https://test.com/v1 @@ -7,7 +7,7 @@ info: title: Test Defect description: >- A client side JS error occured when the throwError endpoint was expanded in - the UI Docs panel. This error was specifically visible when a $ref is seen + the UI Docs panel. This error was specifically visible when a $ref is seen by the subtree resolver after an allOf or after an anyOf. E.g. the subtree resolver was treating the $ref as a reference instead as an object. paths: @@ -38,7 +38,7 @@ components: 2_RefWithAllOf: allOf: - $ref: '#/components/schemas/3_InnerAllOfRef' - + 3_InnerAllOfRef: type: object properties: diff --git a/test/data/parameter-examples-with-refs.yaml b/test/data/parameter-examples-with-refs.yaml index 984c71a19..9b197a2ba 100644 --- a/test/data/parameter-examples-with-refs.yaml +++ b/test/data/parameter-examples-with-refs.yaml @@ -1,4 +1,4 @@ -openapi: 3.0.0 +openapi: 3.0.4 info: title: These $refs in parameter examples should not be resolved version: 1.0.0 @@ -71,4 +71,4 @@ paths: components: schemas: Foo: - type: string \ No newline at end of file + type: string diff --git a/test/data/relative-server.openapi.yaml b/test/data/relative-server.openapi.yaml index 47bcd30c8..ef5e77c5a 100644 --- a/test/data/relative-server.openapi.yaml +++ b/test/data/relative-server.openapi.yaml @@ -1,4 +1,4 @@ -openapi: "3.0.0" +openapi: "3.0.4" servers: - url: "/v1/" paths: diff --git a/test/data/sample-multipart-oas3.js b/test/data/sample-multipart-oas3.js index 60c6dc58b..cfbfbd696 100644 --- a/test/data/sample-multipart-oas3.js +++ b/test/data/sample-multipart-oas3.js @@ -1,5 +1,5 @@ export default { - openapi: '3.0.0', + openapi: '3.0.4', servers: [ { url: '/api/v1', diff --git a/test/data/sample-query-parameter-json.yaml b/test/data/sample-query-parameter-json.yaml index 202215f1c..b3dbad624 100644 --- a/test/data/sample-query-parameter-json.yaml +++ b/test/data/sample-query-parameter-json.yaml @@ -1,4 +1,4 @@ -openapi: 3.0.1 +openapi: 3.0.4 info: version: "0.0.1" title: Test Defect diff --git a/test/execute/server-variable-encoder.js b/test/execute/server-variable-encoder.js index ebf2f3320..92caa762d 100644 --- a/test/execute/server-variable-encoder.js +++ b/test/execute/server-variable-encoder.js @@ -3,7 +3,7 @@ import { execute, buildRequest } from '../../src/execute/index.js'; describe('execute/serverVariableEncoder', () => { test('should encode when encoder provided', () => { const spec = { - openapi: '3.0.3', + openapi: '3.0.4', servers: [ { url: '{server}/v1', @@ -44,7 +44,7 @@ describe('execute/serverVariableEncoder', () => { test('should not encode when encoder not provided', () => { const spec = { - openapi: '3.0.3', + openapi: '3.0.4', servers: [ { url: '{server}/v1', @@ -86,7 +86,7 @@ describe('execute/serverVariableEncoder', () => { describe('buildRequest/serverVariableEncoder', () => { test('should encode when encoder provided', () => { const spec = { - openapi: '3.0.3', + openapi: '3.0.4', servers: [ { url: '{server}/v1', @@ -124,7 +124,7 @@ describe('buildRequest/serverVariableEncoder', () => { test('should not encode when encoder not provided', () => { const spec = { - openapi: '3.0.3', + openapi: '3.0.4', servers: [ { url: '{server}/v1', diff --git a/test/helpers/openapi-predicates.js b/test/helpers/openapi-predicates.js index e9a1a74dd..58c6cb751 100644 --- a/test/helpers/openapi-predicates.js +++ b/test/helpers/openapi-predicates.js @@ -9,11 +9,13 @@ import { describe('helpers', () => { describe('OpenAPI predicates', () => { describe('isOpenAPI30', () => { - test('should detect OpenAPI 3.0.x versions', () => { + test('should detect OpenAPI 3.0.x versions in forward compatible way', () => { expect(isOpenAPI30({ openapi: '3.0.0' })).toBe(true); expect(isOpenAPI30({ openapi: '3.0.1' })).toBe(true); expect(isOpenAPI30({ openapi: '3.0.2' })).toBe(true); expect(isOpenAPI30({ openapi: '3.0.3' })).toBe(true); + expect(isOpenAPI30({ openapi: '3.0.4' })).toBe(true); + expect(isOpenAPI30({ openapi: '3.0.25' })).toBe(true); }); test('should reject other OpenAPI versions', () => { @@ -29,9 +31,10 @@ describe('helpers', () => { }); describe('isOpenAPI31', () => { - test('should detect OpenAPI 3.1.x versions', () => { + test('should detect OpenAPI 3.1.x versions in forward compatible way', () => { expect(isOpenAPI31({ openapi: '3.1.0' })).toBe(true); expect(isOpenAPI31({ openapi: '3.1.1' })).toBe(true); + expect(isOpenAPI31({ openapi: '3.1.25' })).toBe(true); }); test('should reject other OpenAPI versions', () => { @@ -52,6 +55,7 @@ describe('helpers', () => { expect(isOpenAPI3({ openapi: '3.0.1' })).toBe(true); expect(isOpenAPI3({ openapi: '3.0.2' })).toBe(true); expect(isOpenAPI3({ openapi: '3.0.3' })).toBe(true); + expect(isOpenAPI3({ openapi: '3.0.4' })).toBe(true); expect(isOpenAPI3({ openapi: '3.1.0' })).toBe(true); expect(isOpenAPI3({ openapi: '3.1.1' })).toBe(true); }); diff --git a/test/http/http-multipart.js b/test/http/http-multipart.js index 713c6f1f7..2d11fda72 100644 --- a/test/http/http-multipart.js +++ b/test/http/http-multipart.js @@ -338,7 +338,7 @@ describe('buildRequest - openapi 3.0', () => { describe('respect Encoding Object', () => { test('Should be set to object in the style of deepObject', () => { const spec = { - openapi: '3.0.0', + openapi: '3.0.4', servers: [ { url: 'http://petstore.swagger.io/v2', diff --git a/test/index.js b/test/index.js index fe1573d0a..6c5cdeb9e 100644 --- a/test/index.js +++ b/test/index.js @@ -748,7 +748,7 @@ describe('constructor', () => { describe('skipNormalization', () => { const spec = { - openapi: '3.0.0', + openapi: '3.0.4', info: { title: 'Cloudpotato - Medwork', description: 'The Cloudpotato API', diff --git a/test/oas3/data/petstore-oas3.yaml b/test/oas3/data/petstore-oas3.yaml index fa53b11ff..9f1dcf14c 100644 --- a/test/oas3/data/petstore-oas3.yaml +++ b/test/oas3/data/petstore-oas3.yaml @@ -1,5 +1,5 @@ --- -openapi: 3.0.0 +openapi: 3.0.4 servers: - url: http://petstore.swagger.io/v2 info: diff --git a/test/oas3/execute/authorization.js b/test/oas3/execute/authorization.js index 110e5a9f4..72440822f 100644 --- a/test/oas3/execute/authorization.js +++ b/test/oas3/execute/authorization.js @@ -6,7 +6,7 @@ import { buildRequest } from '../../../src/execute/index.js'; describe('Authorization - OpenAPI Specification 3.0', () => { test('should ignore a header parameter named `Authorization`', () => { const spec = { - openapi: '3.0.0', + openapi: '3.0.4', paths: { '/': { get: { @@ -44,7 +44,7 @@ describe('Authorization - OpenAPI Specification 3.0', () => { describe('Basic', () => { test('should encode credentials into the Authorization header', () => { const spec = { - openapi: '3.0.0', + openapi: '3.0.4', components: { securitySchemes: { myBasicAuth: { @@ -93,7 +93,7 @@ describe('Authorization - OpenAPI Specification 3.0', () => { test('should consider scheme to be case insensitive', () => { const spec = { - openapi: '3.0.0', + openapi: '3.0.4', components: { securitySchemes: { myBasicAuth: { @@ -141,7 +141,7 @@ describe('Authorization - OpenAPI Specification 3.0', () => { test('should not add credentials to operations without the security requirement', () => { const spec = { - openapi: '3.0.0', + openapi: '3.0.4', components: { securitySchemes: { myBasicAuth: { @@ -182,7 +182,7 @@ describe('Authorization - OpenAPI Specification 3.0', () => { }); test('should allow empty password without casting undefined to string', () => { const spec = { - openapi: '3.0.0', + openapi: '3.0.4', components: { securitySchemes: { myBasicAuth: { @@ -232,7 +232,7 @@ describe('Authorization - OpenAPI Specification 3.0', () => { describe('Bearer', () => { test('should add token to the Authorization header', () => { const spec = { - openapi: '3.0.0', + openapi: '3.0.4', components: { securitySchemes: { myBearerAuth: { @@ -280,7 +280,7 @@ describe('Authorization - OpenAPI Specification 3.0', () => { test('should consider scheme to be case insensitive', () => { const spec = { - openapi: '3.0.0', + openapi: '3.0.4', components: { securitySchemes: { myBearerAuth: { diff --git a/test/oas3/execute/build-request.js b/test/oas3/execute/build-request.js index 27c787d1e..eec3a4eba 100644 --- a/test/oas3/execute/build-request.js +++ b/test/oas3/execute/build-request.js @@ -4,7 +4,7 @@ import { buildRequest } from '../../../src/execute/index.js'; describe('buildRequest - OAS 3.0.x', () => { describe('test accept header', () => { const spec = { - openapi: '3.0.0', + openapi: '3.0.4', servers: [ { url: 'https://test.com/v1', @@ -84,7 +84,7 @@ describe('buildRequest - OAS 3.0.x', () => { describe('given Encoding Object to describe multipart/form-data', () => { const spec = { - openapi: '3.0.0', + openapi: '3.0.4', paths: { '/upload/': { post: { @@ -149,7 +149,7 @@ describe('buildRequest - OAS 3.0.x', () => { describe('given Encoding Object to describe application/x-www-form-urlencoded', () => { const spec = { - openapi: '3.0.0', + openapi: '3.0.4', paths: { '/upload/': { post: { diff --git a/test/oas3/execute/main.js b/test/oas3/execute/main.js index 38032c985..f61e2b4ba 100644 --- a/test/oas3/execute/main.js +++ b/test/oas3/execute/main.js @@ -17,7 +17,7 @@ describe('buildRequest - OpenAPI Specification 3.0', () => { it('should build a request for the given operationId', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', paths: { '/one': { get: { @@ -44,7 +44,7 @@ describe('buildRequest - OpenAPI Specification 3.0', () => { it('should build a twice-included path parameter request', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', paths: { '/one/{myParam}/{myParam}': { get: { @@ -83,7 +83,7 @@ describe('buildRequest - OpenAPI Specification 3.0', () => { it('should build a request for the given operationId, using the first server by default', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', servers: [ { url: 'http://petstore.swagger.io/v2', @@ -117,7 +117,7 @@ describe('buildRequest - OpenAPI Specification 3.0', () => { it('should build a request for the given operationId, using a specfied server', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', servers: [ { url: 'http://not-real-petstore.swagger.io/v2', @@ -163,7 +163,7 @@ describe('buildRequest - OpenAPI Specification 3.0', () => { it('should build a request for the given operationId with a requestBody', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', servers: [ { url: 'http://petstore.swagger.io/v2', @@ -212,7 +212,7 @@ describe('buildRequest - OpenAPI Specification 3.0', () => { it('should stringify object values of form data bodies', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', servers: [ { url: 'http://petstore.swagger.io/v2', @@ -264,7 +264,7 @@ describe('buildRequest - OpenAPI Specification 3.0', () => { it('should build a request for the given operationId with a requestBody, and not be overriden by an invalid Swagger2 body parameter value', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', servers: [ { url: 'http://petstore.swagger.io/v2', @@ -319,7 +319,7 @@ describe('buildRequest - OpenAPI Specification 3.0', () => { it('should build a request for the given operationId with a requestBody and a defined requestContentType', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', servers: [ { url: 'http://petstore.swagger.io/v2', @@ -369,7 +369,7 @@ describe('buildRequest - OpenAPI Specification 3.0', () => { it('should build an operation without a body or Content-Type if the requestBody definition lacks the requestContentType', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', servers: [ { url: 'http://petstore.swagger.io/v2', @@ -416,7 +416,7 @@ describe('buildRequest - OpenAPI Specification 3.0', () => { it('should build a request body-bearing operation with a provided requestContentType that appears in the requestBody definition even if no payload is present', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', servers: [ { url: 'http://petstore.swagger.io/v2', @@ -461,7 +461,7 @@ describe('buildRequest - OpenAPI Specification 3.0', () => { it('should build a request body-bearing operation without a provided requestContentType that does not appear in the requestBody definition even if no payload is present', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', servers: [ { url: 'http://petstore.swagger.io/v2', diff --git a/test/oas3/execute/style-explode/cookie.js b/test/oas3/execute/style-explode/cookie.js index 7d91febaa..90c48deae 100644 --- a/test/oas3/execute/style-explode/cookie.js +++ b/test/oas3/execute/style-explode/cookie.js @@ -7,7 +7,7 @@ describe('OAS 3.0 - buildRequest w/ `style` & `explode` - cookie parameters', () test('default: should build a cookie parameter in form/no-explode format', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', paths: { '/users': { get: { @@ -45,7 +45,7 @@ describe('OAS 3.0 - buildRequest w/ `style` & `explode` - cookie parameters', () test('should build a cookie parameter in form/no-explode format', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', paths: { '/users': { get: { @@ -85,7 +85,7 @@ describe('OAS 3.0 - buildRequest w/ `style` & `explode` - cookie parameters', () test('should build a cookie parameter in form/explode format', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', paths: { '/users': { get: { @@ -128,7 +128,7 @@ describe('OAS 3.0 - buildRequest w/ `style` & `explode` - cookie parameters', () test('default: should build a cookie parameter in form/no-explode format', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', paths: { '/users': { get: { @@ -166,7 +166,7 @@ describe('OAS 3.0 - buildRequest w/ `style` & `explode` - cookie parameters', () test('should build a cookie parameter in form/no-explode format', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', paths: { '/users': { get: { @@ -206,7 +206,7 @@ describe('OAS 3.0 - buildRequest w/ `style` & `explode` - cookie parameters', () test('should build a cookie parameter in form/explode format', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', paths: { '/users': { get: { diff --git a/test/oas3/execute/style-explode/header.js b/test/oas3/execute/style-explode/header.js index 5a490c5dd..aaf8595ee 100644 --- a/test/oas3/execute/style-explode/header.js +++ b/test/oas3/execute/style-explode/header.js @@ -7,7 +7,7 @@ describe('OAS 3.0 - buildRequest w/ `style` & `explode` - header parameters', () test('default: should build a header parameter in simple/no-explode format', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', paths: { '/users': { get: { @@ -45,7 +45,7 @@ describe('OAS 3.0 - buildRequest w/ `style` & `explode` - header parameters', () test('should build a header parameter in simple/no-explode format', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', paths: { '/users': { get: { @@ -85,7 +85,7 @@ describe('OAS 3.0 - buildRequest w/ `style` & `explode` - header parameters', () test('should build a header parameter in simple/no-explode format with special characters', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', paths: { '/users': { get: { @@ -125,7 +125,7 @@ describe('OAS 3.0 - buildRequest w/ `style` & `explode` - header parameters', () test('should build a header parameter in simple/explode format', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', paths: { '/users': { get: { @@ -168,7 +168,7 @@ describe('OAS 3.0 - buildRequest w/ `style` & `explode` - header parameters', () test('default: should build a header parameter in simple/no-explode format', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', paths: { '/users': { get: { @@ -206,7 +206,7 @@ describe('OAS 3.0 - buildRequest w/ `style` & `explode` - header parameters', () test('should build a header parameter in simple/no-explode format', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', paths: { '/users': { get: { @@ -246,7 +246,7 @@ describe('OAS 3.0 - buildRequest w/ `style` & `explode` - header parameters', () test('should build a header parameter in simple/explode format', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', paths: { '/users': { get: { @@ -292,7 +292,7 @@ describe('OAS 3.0 - buildRequest w/ `style` & `explode` - header parameters', () test('default: should build a header parameter in simple/no-explode format', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', paths: { '/users': { get: { @@ -330,7 +330,7 @@ describe('OAS 3.0 - buildRequest w/ `style` & `explode` - header parameters', () test('should build a header parameter in simple/no-explode format', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', paths: { '/users': { get: { diff --git a/test/oas3/execute/style-explode/path.js b/test/oas3/execute/style-explode/path.js index ee93cce15..8aca44ef7 100644 --- a/test/oas3/execute/style-explode/path.js +++ b/test/oas3/execute/style-explode/path.js @@ -5,7 +5,7 @@ describe('OAS 3.0 - buildRequest w/ `style` & `explode` - path parameters', () = test('default: should build a path parameter in a simple/no-explode format', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', paths: { '/path/{id}': { get: { @@ -41,7 +41,7 @@ describe('OAS 3.0 - buildRequest w/ `style` & `explode` - path parameters', () = test('should build a path parameter in a simple/no-explode format', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', paths: { '/path/{id}': { get: { @@ -79,7 +79,7 @@ describe('OAS 3.0 - buildRequest w/ `style` & `explode` - path parameters', () = test('should build a path parameter in a simple/explode format', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', paths: { '/path/{id}': { get: { @@ -117,7 +117,7 @@ describe('OAS 3.0 - buildRequest w/ `style` & `explode` - path parameters', () = test('should build a path parameter in a label/no-explode format', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', paths: { '/path/{id}': { get: { @@ -155,7 +155,7 @@ describe('OAS 3.0 - buildRequest w/ `style` & `explode` - path parameters', () = test('should build a path parameter in a label/explode format', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', paths: { '/path/{id}': { get: { @@ -193,7 +193,7 @@ describe('OAS 3.0 - buildRequest w/ `style` & `explode` - path parameters', () = test('should build a path parameter in a matrix/no-explode format', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', paths: { '/path/{id}': { get: { @@ -231,7 +231,7 @@ describe('OAS 3.0 - buildRequest w/ `style` & `explode` - path parameters', () = test('should build a path parameter in a matrix/explode format', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', paths: { '/path/{id}': { get: { @@ -270,7 +270,7 @@ describe('OAS 3.0 - buildRequest w/ `style` & `explode` - path parameters', () = test('default: should build a path parameter in a simple/no-explode format', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', paths: { '/path/{id}': { get: { @@ -306,7 +306,7 @@ describe('OAS 3.0 - buildRequest w/ `style` & `explode` - path parameters', () = test('should build a path parameter in a simple/no-explode format', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', paths: { '/path/{id}': { get: { diff --git a/test/oas3/execute/style-explode/query.js b/test/oas3/execute/style-explode/query.js index e1c66b5f8..135166e0f 100644 --- a/test/oas3/execute/style-explode/query.js +++ b/test/oas3/execute/style-explode/query.js @@ -21,7 +21,7 @@ describe('OAS 3.0 - buildRequest w/ `style` & `explode` - query parameters', () test('default: should build a query parameter in form/explode format', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', paths: { '/users': { get: { @@ -57,7 +57,7 @@ describe('OAS 3.0 - buildRequest w/ `style` & `explode` - query parameters', () test('should build a query parameter with escaped non-RFC3986 characters', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', paths: { '/users': { get: { @@ -93,7 +93,7 @@ describe('OAS 3.0 - buildRequest w/ `style` & `explode` - query parameters', () test('should build a query parameter with escaped non-RFC3986 characters with allowReserved', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', paths: { '/users': { get: { @@ -133,7 +133,7 @@ describe('OAS 3.0 - buildRequest w/ `style` & `explode` - query parameters', () test('should build a query parameter with escaped non-RFC3986 characters in parameter name', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', paths: { '/users': { get: { @@ -169,7 +169,7 @@ describe('OAS 3.0 - buildRequest w/ `style` & `explode` - query parameters', () test('should build an empty query parameter with escaped non-RFC3986 characters in parameter name', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', paths: { '/users': { get: { @@ -206,7 +206,7 @@ describe('OAS 3.0 - buildRequest w/ `style` & `explode` - query parameters', () test('should build a query parameter in form/explode format', () => { // Given const spec = { - openapi: '3.0.0', + openapi: '3.0.4', paths: { '/users': { get: { diff --git a/test/resolver/circular-references-instantiation.yaml b/test/resolver/circular-references-instantiation.yaml index 3b8a715c6..4bfd8438d 100644 --- a/test/resolver/circular-references-instantiation.yaml +++ b/test/resolver/circular-references-instantiation.yaml @@ -4,13 +4,13 @@ cases: - name: cross-document circular reference remoteDocuments: a.yaml: - openapi: 3.0.2 + openapi: 3.0.4 components: schemas: MessageWidgetData: $ref: "./b.yaml#/components/schemas/Action" b.yaml: - openapi: 3.0.2 + openapi: 3.0.4 components: schemas: Action: @@ -29,7 +29,7 @@ cases: - equal: errors: [] spec: - openapi: 3.0.2 + openapi: 3.0.4 components: schemas: MessageWidgetData: @@ -43,13 +43,13 @@ cases: - name: cross-document circular reference with `useCircularStructures` set remoteDocuments: a.yaml: - openapi: 3.0.2 + openapi: 3.0.4 components: schemas: MessageWidgetData: $ref: "./b.yaml#/components/schemas/Action" b.yaml: - openapi: 3.0.2 + openapi: 3.0.4 components: schemas: Action: @@ -80,4 +80,4 @@ cases: properties: dismiss_action: $$ref: "http://mock.swagger.test/b.yaml#/components/schemas/Action" - properties: *circularRefAnchor \ No newline at end of file + properties: *circularRefAnchor diff --git a/test/resolver/circular-references-subtree-resolver.yaml b/test/resolver/circular-references-subtree-resolver.yaml index 736498590..a6d971115 100644 --- a/test/resolver/circular-references-subtree-resolver.yaml +++ b/test/resolver/circular-references-subtree-resolver.yaml @@ -5,7 +5,7 @@ cases: - name: cross-document circular reference remoteDocuments: b.yaml: - openapi: 3.0.2 + openapi: 3.0.4 components: schemas: Action: @@ -20,7 +20,7 @@ cases: type: resolveSubtree config: obj: - openapi: 3.0.2 + openapi: 3.0.4 components: schemas: MessageWidgetData: @@ -33,7 +33,7 @@ cases: - equal: errors: [] spec: - openapi: 3.0.2 + openapi: 3.0.4 components: schemas: MessageWidgetData: @@ -47,7 +47,7 @@ cases: - name: cross-document circular reference with `useCircularStructures` set remoteDocuments: b.yaml: - openapi: 3.0.2 + openapi: 3.0.4 components: schemas: Action: @@ -143,4 +143,4 @@ cases: $$ref: "http://mock.swagger.test/b.yaml#/components/schemas/ActionConfirmation" properties: dismiss_action: - $ref: "http://mock.swagger.test/b.yaml#/components/schemas/Action" \ No newline at end of file + $ref: "http://mock.swagger.test/b.yaml#/components/schemas/Action" diff --git a/test/resolver/strategies/generic/index.js b/test/resolver/strategies/generic/index.js index 3e73c95c5..b7f0597b2 100644 --- a/test/resolver/strategies/generic/index.js +++ b/test/resolver/strategies/generic/index.js @@ -28,6 +28,146 @@ describe('resolver', () => { expect(Swagger.resolve).toBeInstanceOf(Function); }); + test('should resolve OpenAPI 2.0 Description', async () => { + const spec = { + swagger: '2.0', + definitions: { + one: { type: 'string' }, + two: { $ref: '#/definitions/one' }, + }, + }; + const result = await Swagger.resolve({ spec, allowMetaPatches: false }); + + expect(result.errors).toEqual([]); + expect(result.spec).toEqual({ + swagger: '2.0', + definitions: { + one: { type: 'string' }, + two: { type: 'string' }, + }, + }); + }); + + test('should resolve OpenAPI 3.0.0 Description', async () => { + const spec = { + openapi: '3.0.0', + components: { + schemas: { + one: { type: 'string' }, + two: { $ref: '#/components/schemas/one' }, + }, + }, + }; + const result = await Swagger.resolve({ spec, allowMetaPatches: false }); + + expect(result.errors).toEqual([]); + expect(result.spec).toEqual({ + openapi: '3.0.0', + components: { + schemas: { + one: { type: 'string' }, + two: { type: 'string' }, + }, + }, + }); + }); + + test('should resolve OpenAPI 3.0.1 Description', async () => { + const spec = { + openapi: '3.0.1', + components: { + schemas: { + one: { type: 'string' }, + two: { $ref: '#/components/schemas/one' }, + }, + }, + }; + const result = await Swagger.resolve({ spec, allowMetaPatches: false }); + + expect(result.errors).toEqual([]); + expect(result.spec).toEqual({ + openapi: '3.0.1', + components: { + schemas: { + one: { type: 'string' }, + two: { type: 'string' }, + }, + }, + }); + }); + + test('should resolve OpenAPI 3.0.2 Description', async () => { + const spec = { + openapi: '3.0.2', + components: { + schemas: { + one: { type: 'string' }, + two: { $ref: '#/components/schemas/one' }, + }, + }, + }; + const result = await Swagger.resolve({ spec, allowMetaPatches: false }); + + expect(result.errors).toEqual([]); + expect(result.spec).toEqual({ + openapi: '3.0.2', + components: { + schemas: { + one: { type: 'string' }, + two: { type: 'string' }, + }, + }, + }); + }); + + test('should resolve OpenAPI 3.0.3 Description', async () => { + const spec = { + openapi: '3.0.3', + components: { + schemas: { + one: { type: 'string' }, + two: { $ref: '#/components/schemas/one' }, + }, + }, + }; + const result = await Swagger.resolve({ spec, allowMetaPatches: false }); + + expect(result.errors).toEqual([]); + expect(result.spec).toEqual({ + openapi: '3.0.3', + components: { + schemas: { + one: { type: 'string' }, + two: { type: 'string' }, + }, + }, + }); + }); + + test('should resolve OpenAPI 3.0.4 Description', async () => { + const spec = { + openapi: '3.0.4', + components: { + schemas: { + one: { type: 'string' }, + two: { $ref: '#/components/schemas/one' }, + }, + }, + }; + const result = await Swagger.resolve({ spec, allowMetaPatches: false }); + + expect(result.errors).toEqual([]); + expect(result.spec).toEqual({ + openapi: '3.0.4', + components: { + schemas: { + one: { type: 'string' }, + two: { type: 'string' }, + }, + }, + }); + }); + test('should be able to resolve simple $refs', () => { // Given const spec = { diff --git a/test/resolver/swos-109-instantiation.yaml b/test/resolver/swos-109-instantiation.yaml index ae6aea5c7..58c9f7a32 100644 --- a/test/resolver/swos-109-instantiation.yaml +++ b/test/resolver/swos-109-instantiation.yaml @@ -4,13 +4,13 @@ cases: - name: cross-document $ref remoteDocuments: a.yaml: - openapi: 3.0.2 + openapi: 3.0.4 components: schemas: MessageWidgetData: $ref: "./b.yaml#/components/schemas/Action" b.yaml: - openapi: 3.0.2 + openapi: 3.0.4 components: schemas: Action: @@ -29,7 +29,7 @@ cases: - equal: errors: [] spec: - openapi: 3.0.2 + openapi: 3.0.4 components: schemas: MessageWidgetData: @@ -43,14 +43,14 @@ cases: - name: cross-document $ref within allOf remoteDocuments: a.yaml: - openapi: 3.0.2 + openapi: 3.0.4 components: schemas: MessageWidgetData: allOf: - $ref: "./b.yaml#/components/schemas/Action" b.yaml: - openapi: 3.0.2 + openapi: 3.0.4 components: schemas: Action: @@ -69,7 +69,7 @@ cases: - equal: errors: [] spec: - openapi: 3.0.2 + openapi: 3.0.4 components: schemas: MessageWidgetData: @@ -179,13 +179,13 @@ cases: MyThing: type: object properties: - aContent: + aContent: $$ref: "http://mock.swagger.test/a.yaml#/components/schemas/APrivateThing" type: string - bContent: + bContent: $$ref: "http://mock.swagger.test/b.yaml#/components/schemas/BPrivateThing" type: string - cContent: + cContent: $$ref: "http://mock.swagger.test/c.yaml#/components/schemas/CPrivateThing" type: string - name: nested cross-document $refs within multi-member allOf @@ -228,7 +228,7 @@ cases: - $ref: '#/components/schemas/CPrivateThing' CPrivateThing: $ref: "../partials/e.yaml" - partials/d.yaml: + partials/d.yaml: type: string partials/e.yaml: type: object @@ -254,10 +254,10 @@ cases: MyThing: type: object properties: - aContent: + aContent: $$ref: "http://mock.swagger.test/a.yaml#/components/schemas/APrivateThing" type: string - bContent: + bContent: type: string - cContent: - type: object \ No newline at end of file + cContent: + type: object diff --git a/test/resolver/swos-109-subtree-resolver.yaml b/test/resolver/swos-109-subtree-resolver.yaml index 857045973..3eec84350 100644 --- a/test/resolver/swos-109-subtree-resolver.yaml +++ b/test/resolver/swos-109-subtree-resolver.yaml @@ -4,7 +4,7 @@ cases: - name: cross-document $ref remoteDocuments: b.yaml: - openapi: 3.0.2 + openapi: 3.0.4 components: schemas: Action: @@ -19,7 +19,7 @@ cases: type: resolveSubtree config: obj: - openapi: 3.0.2 + openapi: 3.0.4 components: schemas: MessageWidgetData: @@ -32,7 +32,7 @@ cases: - equal: errors: [] spec: - openapi: 3.0.2 + openapi: 3.0.4 components: schemas: MessageWidgetData: @@ -46,7 +46,7 @@ cases: - name: cross-document $ref to a remote document within allOf remoteDocuments: b.yaml: - openapi: 3.0.2 + openapi: 3.0.4 components: schemas: Action: @@ -61,7 +61,7 @@ cases: type: resolveSubtree config: obj: - openapi: 3.0.2 + openapi: 3.0.4 components: schemas: MessageWidgetData: @@ -75,7 +75,7 @@ cases: - equal: errors: [] spec: - openapi: 3.0.2 + openapi: 3.0.4 components: schemas: MessageWidgetData: @@ -88,7 +88,7 @@ cases: - name: cross-document $ref to a remote document within allOf with a circular reference remoteDocuments: b.yaml: - openapi: 3.0.2 + openapi: 3.0.4 components: schemas: Action: @@ -103,7 +103,7 @@ cases: type: resolveSubtree config: obj: - openapi: 3.0.2 + openapi: 3.0.4 components: schemas: MessageWidgetData: @@ -177,13 +177,13 @@ cases: spec: type: object properties: - aContent: + aContent: $$ref: "http://mock.swagger.test/a.yaml#/components/schemas/APrivateThing" type: string - bContent: + bContent: $$ref: "http://mock.swagger.test/b.yaml#/components/schemas/BPrivateThing" type: string - cContent: + cContent: $$ref: "http://mock.swagger.test/c.yaml#/components/schemas/CPrivateThing" type: string - name: nested cross-document $refs within multi-member allOf @@ -210,7 +210,7 @@ cases: - $ref: '#/components/schemas/CPrivateThing' CPrivateThing: $ref: "../partials/e.yaml" - partials/d.yaml: + partials/d.yaml: type: string partials/e.yaml: type: object @@ -242,10 +242,10 @@ cases: spec: type: object properties: - aContent: + aContent: $$ref: "http://mock.swagger.test/a.yaml#/components/schemas/APrivateThing" type: string - bContent: + bContent: type: string - cContent: - type: object \ No newline at end of file + cContent: + type: object