diff --git a/assets/json-schema-faker.js b/assets/json-schema-faker.js index 963c18333..371ce71af 100644 --- a/assets/json-schema-faker.js +++ b/assets/json-schema-faker.js @@ -10919,7 +10919,7 @@ module.exports = { */ parse: function yamlParse (text, reviver) { try { - return yaml.safeLoad(text); + return yaml.load(text); } catch (e) { if (e instanceof Error) { diff --git a/examples/sampleswagger.yaml b/examples/sampleswagger.yaml index 761a7b13c..6387fa43d 100644 --- a/examples/sampleswagger.yaml +++ b/examples/sampleswagger.yaml @@ -14,20 +14,20 @@ info: email: apiteam@wordnik.com license: name: Apache 2.0 - url: 'http://www.apache.org/licenses/LICENSE-2.0.html' + url: http://www.apache.org/licenses/LICENSE-2.0.html tags: - name: pet description: Everything about your Pets externalDocs: description: Find out more - url: 'http://swagger.io' + url: http://swagger.io - name: store description: Operations about user - name: user description: Access to Petstore orders externalDocs: description: Find out more about our store - url: 'http://swagger.io' + url: http://swagger.io paths: /pet: post: @@ -542,7 +542,7 @@ paths: description: User not found externalDocs: description: Find out more about Swagger - url: 'http://swagger.io' + url: http://swagger.io components: requestBodies: UserArray: @@ -688,4 +688,4 @@ components: message: type: string xml: - name: '##default' \ No newline at end of file + name: '##default' diff --git a/lib/bundle.js b/lib/bundle.js index 1cd82d8fc..e97cc190b 100644 --- a/lib/bundle.js +++ b/lib/bundle.js @@ -701,12 +701,12 @@ function generateComponentsObject(documentContext, rootContent, circularRefsSet = new Set(); const { COMPONENTS_KEYS } = getBundleRulesDataByVersion(version); notInLine.forEach(([key, value]) => { - let [, partial] = key.split(localPointer); + let [nodeRef, partial] = key.split(localPointer); if (documentContext.globalReferences[key].refHasContent) { setValueInComponents( value.keyInComponents, components, - getContentFromTrace(documentContext.nodeContents[key], partial), + getContentFromTrace(documentContext.nodeContents[nodeRef], partial), COMPONENTS_KEYS ); } diff --git a/lib/parse.js b/lib/parse.js index 049cfc613..8c395052a 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -33,10 +33,11 @@ module.exports = { asYaml: function (spec) { try { - let obj = yaml.safeLoad(spec, { + let obj = yaml.load(spec, { schema: yaml.JSON_SCHEMA }); // yaml.safeLoad does not throw errors for most of the cases in invalid yaml + // yaml.safeLoad is removed in js-yaml 4. Hence Using yaml.load instead, which is now safe by default. // hence check if it returned an object if (typeof obj !== 'object') { throw new Error(''); diff --git a/package-lock.json b/package-lock.json index b7af3034e..7b225b627 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,7 @@ "async": "3.2.4", "commander": "2.20.3", "graphlib": "2.1.8", - "js-yaml": "3.14.1", + "js-yaml": "4.1.0", "json-schema-merge-allof": "0.8.1", "lodash": "4.17.21", "oas-resolver-browser": "2.5.6", @@ -420,6 +420,19 @@ "node": ">=8" } }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, "node_modules/@istanbuljs/load-nyc-config/node_modules/locate-path": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", @@ -677,6 +690,7 @@ "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, "dependencies": { "sprintf-js": "~1.0.2" } @@ -1533,6 +1547,19 @@ "url": "https://github.com/sponsors/epoberezkin" } }, + "node_modules/eslint/node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, "node_modules/eslint/node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -1557,6 +1584,7 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, "bin": { "esparse": "bin/esparse.js", "esvalidate": "bin/esvalidate.js" @@ -2844,17 +2872,21 @@ "dev": true }, "node_modules/js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" + "argparse": "^2.0.1" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, + "node_modules/js-yaml/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + }, "node_modules/jsdoctypeparser": { "version": "2.0.0-alpha-8", "resolved": "https://registry.npmjs.org/jsdoctypeparser/-/jsdoctypeparser-2.0.0-alpha-8.tgz", @@ -4781,7 +4813,8 @@ "node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==" + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "dev": true }, "node_modules/string_decoder": { "version": "1.1.1", @@ -5909,6 +5942,16 @@ "path-exists": "^4.0.0" } }, + "js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, "locate-path": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", @@ -6098,6 +6141,7 @@ "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, "requires": { "sprintf-js": "~1.0.2" } @@ -6704,6 +6748,16 @@ "uri-js": "^4.2.2" } }, + "js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, "json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -6780,7 +6834,8 @@ "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true }, "esquery": { "version": "1.5.0", @@ -7700,12 +7755,18 @@ "dev": true }, "js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" + "argparse": "^2.0.1" + }, + "dependencies": { + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + } } }, "jsdoctypeparser": { @@ -9196,7 +9257,8 @@ "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==" + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "dev": true }, "string_decoder": { "version": "1.1.1", diff --git a/package.json b/package.json index 50b75f754..8d7eb713e 100644 --- a/package.json +++ b/package.json @@ -121,7 +121,7 @@ "ajv-formats": "2.1.1", "async": "3.2.4", "commander": "2.20.3", - "js-yaml": "3.14.1", + "js-yaml": "4.1.0", "json-schema-merge-allof": "0.8.1", "lodash": "4.17.21", "oas-resolver-browser": "2.5.6", diff --git a/test/data/31CollectionTransactions/validate30Scenarios/internalRefsSpec.yaml b/test/data/31CollectionTransactions/validate30Scenarios/internalRefsSpec.yaml index f3b731dd3..80c5ab64b 100644 --- a/test/data/31CollectionTransactions/validate30Scenarios/internalRefsSpec.yaml +++ b/test/data/31CollectionTransactions/validate30Scenarios/internalRefsSpec.yaml @@ -10,7 +10,7 @@ info: email: you@your-company.com license: name: Apache 2.0 - url: 'http://www.apache.org/licenses/LICENSE-2.0.html' + url: http://www.apache.org/licenses/LICENSE-2.0.html paths: /inventory/{searchString}: parameters: @@ -47,14 +47,14 @@ paths: content: application/json: schema: - type: + type: - string components: headers: x-date: description: The date. schema: - type: + type: - string format: date parameters: @@ -63,7 +63,7 @@ components: name: limit description: maximum number of records to return schema: - type: + type: - integer format: int32 minimum: 0 @@ -80,7 +80,7 @@ components: name: skip description: number of records to skip for pagination schema: - type: + type: - integer format: int32 minimum: 0 @@ -135,10 +135,10 @@ components: message: 'resource was not found' schemas: SearchString: - type: + type: - string InventoryItem: - type: + type: - object required: - id @@ -147,21 +147,21 @@ components: - releaseDate properties: id: - type: + type: - string format: uuid - examples: + examples: - d290f1ee-6c54-4b01-90e6-d701748f0851 name: - type: + type: - string - examples: + examples: - Widget Adapter releaseDate: - type: + type: - string format: date-time - examples: + examples: - '2016-08-29T09:12:33.001Z' manufacturer: $ref: '#/components/schemas/Manufacturer' @@ -170,25 +170,25 @@ components: - name properties: name: - type: + type: - string - examples: + examples: - ACME Corporation homePage: - type: + type: - string format: url - examples: + examples: - 'https://www.acme-corp.com' phone: - type: + type: - string - examples: + examples: - 408-867-5309 - type: + type: - object Profile: - type: + type: - object required: - id @@ -197,52 +197,52 @@ components: - family_name properties: id: - type: + type: - string format: uuid name: - type: + type: - string - examples: + examples: - "ioneyed" given_name: - type: + type: - string - examples: + examples: - "Robert" family_name: - type: + type: - string - examples: + examples: - "Buchanan" Error: - type: + type: - object required: - code - message properties: code: - type: + type: - string pattern: 'PROFILE-\d{3}-\d{3}' - examples: + examples: - "PROFILE-100-507" message: - type: + type: - string - examples: + examples: - "we have run out of storage; this is embarrassing, and someone have been paged" ProviderConfig: - type: + type: - object properties: name: - type: + type: - string alternateName: - type: + type: - string providerId: - type: - - string \ No newline at end of file + type: + - string diff --git a/test/data/invalid_openapi/invalid-no-info.yaml b/test/data/invalid_openapi/invalid-no-info.yaml index 3aa96bdc6..3b412b279 100644 --- a/test/data/invalid_openapi/invalid-no-info.yaml +++ b/test/data/invalid_openapi/invalid-no-info.yaml @@ -6,14 +6,14 @@ tags: description: Everything about your Pets externalDocs: description: Find out more - url: 'http://swagger.io' + url: http://swagger.io - name: store description: Operations about user - name: user description: Access to Petstore orders externalDocs: description: Find out more about our store - url: 'http://swagger.io' + url: http://swagger.io paths: /pet: post: @@ -528,7 +528,7 @@ paths: description: User not found externalDocs: description: Find out more about Swagger - url: 'http://swagger.io' + url: http://swagger.io components: requestBodies: UserArray: @@ -674,4 +674,4 @@ components: message: type: string xml: - name: '##default' \ No newline at end of file + name: '##default' diff --git a/test/data/invalid_openapi/invalid-no-title.yaml b/test/data/invalid_openapi/invalid-no-title.yaml index 55900bd5f..78f2aabd8 100644 --- a/test/data/invalid_openapi/invalid-no-title.yaml +++ b/test/data/invalid_openapi/invalid-no-title.yaml @@ -13,20 +13,20 @@ info: email: apiteam@wordnik.com license: name: Apache 2.0 - url: 'http://www.apache.org/licenses/LICENSE-2.0.html' + url: http://www.apache.org/licenses/LICENSE-2.0.html tags: - name: pet description: Everything about your Pets externalDocs: description: Find out more - url: 'http://swagger.io' + url: http://swagger.io - name: store description: Operations about user - name: user description: Access to Petstore orders externalDocs: description: Find out more about our store - url: 'http://swagger.io' + url: http://swagger.io paths: '/pet/{petId}': get: @@ -123,7 +123,7 @@ paths: - 'read:pets' externalDocs: description: Find out more about Swagger - url: 'http://swagger.io' + url: http://swagger.io components: securitySchemes: petstore_auth: @@ -251,4 +251,4 @@ components: message: type: string xml: - name: '##default' \ No newline at end of file + name: '##default' diff --git a/test/data/petstore separate yaml/bundleExp.yaml b/test/data/petstore separate yaml/bundleExp.yaml index c0c565ad9..1c7760d4e 100644 --- a/test/data/petstore separate yaml/bundleExp.yaml +++ b/test/data/petstore separate yaml/bundleExp.yaml @@ -5,14 +5,14 @@ info: description: >- A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification - termsOfService: 'http://swagger.io/terms/' + termsOfService: http://swagger.io/terms/ contact: name: Swagger API Team email: apiteam@swagger.io - url: 'http://swagger.io' + url: http://swagger.io license: name: Apache 2.0 - url: 'https://www.apache.org/licenses/LICENSE-2.0.html' + url: https://www.apache.org/licenses/LICENSE-2.0.html host: petstore.swagger.io basePath: /api schemes: @@ -85,7 +85,7 @@ paths: description: unexpected error schema: $ref: '#/components/schemas/_common_Error.yaml' - '/pets/{id}': + /pets/{id}: get: description: >- Returns a user based on a single ID, if the user does not have access to diff --git a/test/data/toBundleExamples/remote_url_refs/yaml/expected.yaml b/test/data/toBundleExamples/remote_url_refs/yaml/expected.yaml index 0b579011a..79fbc1941 100644 --- a/test/data/toBundleExamples/remote_url_refs/yaml/expected.yaml +++ b/test/data/toBundleExamples/remote_url_refs/yaml/expected.yaml @@ -4,7 +4,7 @@ info: title: Sample API description: Buy or rent spacecrafts paths: - '/spacecrafts/{spacecraftId}': + /spacecrafts/{spacecraftId}: parameters: - name: spacecraftId description: The unique identifier of the spacecraft diff --git a/test/data/toBundleExamples/same_ref_different_source/expected.yaml b/test/data/toBundleExamples/same_ref_different_source/expected.yaml index 8c897e4d9..08047c7d7 100644 --- a/test/data/toBundleExamples/same_ref_different_source/expected.yaml +++ b/test/data/toBundleExamples/same_ref_different_source/expected.yaml @@ -1 +1 @@ -"openapi: 3.0.0\ninfo:\n title: Sample API\n description: >-\n Optional multiline or single-line description in\n [CommonMark](http://commonmark.org/help/) or HTML.\n version: 0.1.9\nservers:\n - url: 'http://api.example.com/v1'\n description: 'Optional server description, e.g. Main (production) server'\n - url: 'http://staging-api.example.com'\n description: 'Optional server description, e.g. Internal staging server for testing'\npaths:\n '/users/{userId}':\n get:\n summary: Get a user by ID\n responses:\n '200':\n description: A single user.\n content:\n application/json:\n schema:\n $ref: '#/components/schemas/~1schemas~1user.yaml'\ncomponents:\n schemas:\n /schemas/user.yaml:\n type: object\n properties:\n id:\n type: integer\n userName:\n type: string\n" \ No newline at end of file +"openapi: 3.0.0\ninfo:\n title: Sample API\n description: >-\n Optional multiline or single-line description in\n [CommonMark](http://commonmark.org/help/) or HTML.\n version: 0.1.9\nservers:\n - url: http://api.example.com/v1\n description: Optional server description, e.g. Main (production) server\n - url: http://staging-api.example.com\n description: Optional server description, e.g. Internal staging server for testing\npaths:\n /users/{userId}:\n get:\n summary: Get a user by ID\n responses:\n '200':\n description: A single user.\n content:\n application/json:\n schema:\n $ref: '#/components/schemas/~1schemas~1user.yaml'\ncomponents:\n schemas:\n /schemas/user.yaml:\n type: object\n properties:\n id:\n type: integer\n userName:\n type: string\n" diff --git a/test/data/toBundleExamples/schema_from_response/expected.yaml b/test/data/toBundleExamples/schema_from_response/expected.yaml index 5e2ea3757..1576483d6 100644 --- a/test/data/toBundleExamples/schema_from_response/expected.yaml +++ b/test/data/toBundleExamples/schema_from_response/expected.yaml @@ -6,12 +6,12 @@ info: [CommonMark](http://commonmark.org/help/) or HTML. version: 0.1.9 servers: - - url: 'http://api.example.com/v1' - description: 'Optional server description, e.g. Main (production) server' - - url: 'http://staging-api.example.com' - description: 'Optional server description, e.g. Internal staging server for testing' + - url: http://api.example.com/v1 + description: Optional server description, e.g. Main (production) server + - url: http://staging-api.example.com + description: Optional server description, e.g. Internal staging server for testing paths: - '/users/{userId}': + /users/{userId}: get: summary: Get a user by ID responses: diff --git a/test/data/toBundleExamples/schema_from_response_with_headers/expected.yaml b/test/data/toBundleExamples/schema_from_response_with_headers/expected.yaml index e405d312a..95212c2f4 100644 --- a/test/data/toBundleExamples/schema_from_response_with_headers/expected.yaml +++ b/test/data/toBundleExamples/schema_from_response_with_headers/expected.yaml @@ -6,10 +6,10 @@ info: [CommonMark](http://commonmark.org/help/) or HTML. version: 0.1.9 servers: - - url: 'http://api.example.com/v1' - description: 'Optional server description, e.g. Main (production) server' - - url: 'http://staging-api.example.com' - description: 'Optional server description, e.g. Internal staging server for testing' + - url: http://api.example.com/v1 + description: Optional server description, e.g. Main (production) server + - url: http://staging-api.example.com + description: Optional server description, e.g. Internal staging server for testing paths: '/users/{userId}': get: diff --git a/test/data/valid_openapi/petstore-detailed.yaml b/test/data/valid_openapi/petstore-detailed.yaml index ecfdcef96..f8d07e510 100644 --- a/test/data/valid_openapi/petstore-detailed.yaml +++ b/test/data/valid_openapi/petstore-detailed.yaml @@ -51,7 +51,7 @@ info: version: 1.0.0 title: Swagger Petstore - termsOfService: 'http://swagger.io/terms/' + termsOfService: http://swagger.io/terms/ contact: name: API Support email: apiteam@swagger.io @@ -61,7 +61,7 @@ info: altText: Petstore logo license: name: Apache 2.0 - url: 'http://www.apache.org/licenses/LICENSE-2.0.html' + url: http://www.apache.org/licenses/LICENSE-2.0.html externalDocs: description: Find out how to create Github repo for your OpenAPI spec. url: 'https://github.com/Rebilly/generator-openapi-repo' @@ -201,7 +201,7 @@ paths: default: '8843' basePath: default: v2 - + '/pet/{petId}': get: tags: @@ -1208,4 +1208,4 @@ components: quantity: 1 shipDate: '2018-10-19T16:46:45Z' status: placed - complete: false \ No newline at end of file + complete: false diff --git a/test/data/valid_openapi/sampleswagger.yaml b/test/data/valid_openapi/sampleswagger.yaml index 7f3882e23..9b911b4fb 100644 --- a/test/data/valid_openapi/sampleswagger.yaml +++ b/test/data/valid_openapi/sampleswagger.yaml @@ -14,20 +14,20 @@ info: email: apiteam@wordnik.com license: name: Apache 2.0 - url: 'http://www.apache.org/licenses/LICENSE-2.0.html' + url: http://www.apache.org/licenses/LICENSE-2.0.html tags: - name: pet description: Everything about your Pets externalDocs: description: Find out more - url: 'http://swagger.io' + url: http://swagger.io - name: store description: Operations about user - name: user description: Access to Petstore orders externalDocs: description: Find out more about our store - url: 'http://swagger.io' + url: http://swagger.io paths: /pet: post: @@ -542,7 +542,7 @@ paths: description: User not found externalDocs: description: Find out more about Swagger - url: 'http://swagger.io' + url: http://swagger.io components: requestBodies: UserArray: @@ -688,4 +688,4 @@ components: message: type: string xml: - name: '##default' \ No newline at end of file + name: '##default' diff --git a/test/data/valid_openapi/swagger-with-path.yaml b/test/data/valid_openapi/swagger-with-path.yaml index aa49dbedc..7907bef67 100644 --- a/test/data/valid_openapi/swagger-with-path.yaml +++ b/test/data/valid_openapi/swagger-with-path.yaml @@ -14,20 +14,20 @@ info: email: apiteam@wordnik.com license: name: Apache 2.0 - url: 'http://www.apache.org/licenses/LICENSE-2.0.html' + url: http://www.apache.org/licenses/LICENSE-2.0.html tags: - name: pet description: Everything about your Pets externalDocs: description: Find out more - url: 'http://swagger.io' + url: http://swagger.io - name: store description: Operations about user - name: user description: Access to Petstore orders externalDocs: description: Find out more about our store - url: 'http://swagger.io' + url: http://swagger.io paths: '/pet/{petId}': get: @@ -124,7 +124,7 @@ paths: - 'read:pets' externalDocs: description: Find out more about Swagger - url: 'http://swagger.io' + url: http://swagger.io components: securitySchemes: petstore_auth: @@ -252,4 +252,4 @@ components: message: type: string xml: - name: '##default' \ No newline at end of file + name: '##default' diff --git a/test/data/valid_openapi/swagger_without_query_desc.yaml b/test/data/valid_openapi/swagger_without_query_desc.yaml index 358bcb30f..f9fe627e3 100644 --- a/test/data/valid_openapi/swagger_without_query_desc.yaml +++ b/test/data/valid_openapi/swagger_without_query_desc.yaml @@ -14,7 +14,7 @@ info: email: apiteam@wordnik.com license: name: Apache 2.0 - url: 'http://www.apache.org/licenses/LICENSE-2.0.html' + url: http://www.apache.org/licenses/LICENSE-2.0.html paths: # the params part will be converted to a path variable # that will get added to the query.members of the SDK @@ -26,4 +26,4 @@ paths: operationId: findPetsByStatus parameters: - name: status - in: query \ No newline at end of file + in: query diff --git a/test/data/valid_openapi31X/yaml/petstore.yaml b/test/data/valid_openapi31X/yaml/petstore.yaml index 59092cd94..4e0257563 100644 --- a/test/data/valid_openapi31X/yaml/petstore.yaml +++ b/test/data/valid_openapi31X/yaml/petstore.yaml @@ -33,7 +33,7 @@ tags: description: Everything about your Pets externalDocs: description: Find out more - url: 'http://swagger.io' + url: http://swagger.io paths: /pets: get: @@ -190,4 +190,4 @@ components: type: integer format: int32 message: - type: string \ No newline at end of file + type: string diff --git a/test/data/validationData/internalRefsSpec.yaml b/test/data/validationData/internalRefsSpec.yaml index 0f9a8557b..b8df9515e 100644 --- a/test/data/validationData/internalRefsSpec.yaml +++ b/test/data/validationData/internalRefsSpec.yaml @@ -10,7 +10,7 @@ info: email: you@your-company.com license: name: Apache 2.0 - url: 'http://www.apache.org/licenses/LICENSE-2.0.html' + url: http://www.apache.org/licenses/LICENSE-2.0.html paths: /inventory/{searchString}: parameters: @@ -209,4 +209,4 @@ components: alternateName: type: string providerId: - type: string \ No newline at end of file + type: string diff --git a/test/unit/bundle.test.js b/test/unit/bundle.test.js index 330adf06c..95b70d496 100644 --- a/test/unit/bundle.test.js +++ b/test/unit/bundle.test.js @@ -472,7 +472,8 @@ describe('bundle files method - 3.0', function () { catch (error) { expect(error.message).to.equal('Invalid format. Input must be in YAML or JSON ' + 'format. Specification is not a valid YAML. YAMLException: duplicated mapping' + - ' key at line 30, column -54:\n components:\n ^'); + ' key (30:1)\n\n 27 | Test:\n 28 | type: string\n 29 | \n 30 | components:' + + '\n------^\n 31 | schemas:\n 32 | Test2: '); } });