diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 43983474d..99ecfcf77 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -18,6 +18,7 @@ Hi! We're really excited that you are interested in contributing to Redocly CLI. - Abide by our [Code of Conduct](https://redocly.com/code-of-conduct/) in all your interactions on this repository, and show patience and respect to other community members. ## Pull Request Guidelines + Before submitting a pull request, please make sure the following is done: 1. Fork the repository and create your branch from `main`. @@ -38,7 +39,7 @@ $ npm install # or npm i ### Commonly used NPM scripts -``` bash +```bash # run a separate CLI command $ npm run diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index d9c88408a..5acc9b7a3 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -4,34 +4,41 @@ about: Create a report to help us improve title: '' labels: 'Type: Bug' assignees: '' - --- **Describe the bug** + **To Reproduce** Steps to reproduce the behavior: + 1. Given this `redocly.yaml` file 2. And this OpenAPI file(s) 3. Run this command with these arguments... `redocly ...` 4. See error **Expected behavior** + **Logs** + **OpenAPI definition** + **Redocly Version(s)** + **`Node.js` Version(s)** + **Additional context** + diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 77a62c0e0..54f4bb886 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -4,17 +4,20 @@ about: Suggest an idea for this project title: '' labels: 'Type: Enhancement' assignees: '' - --- **Is your feature request related to a problem? Please describe.** + **Describe the solution you'd like** + **Describe alternatives you've considered** + **Additional context** + diff --git a/.github/workflows/deploy-s3-sandbox.yaml b/.github/workflows/deploy-s3-sandbox.yaml index 235a21ef7..d17b75ef8 100644 --- a/.github/workflows/deploy-s3-sandbox.yaml +++ b/.github/workflows/deploy-s3-sandbox.yaml @@ -8,30 +8,30 @@ jobs: if: ${{ github.event.label.name == 'deploy_s3_sandbox' }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - run: node --version - - run: npm --version - - name: cache node modules - uses: actions/cache@v1 - with: - path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS - key: npm-${{ hashFiles('package-lock.json') }} - restore-keys: | - npm-${{ hashFiles('package-lock.json') }} - npm- + - uses: actions/checkout@v3 + - run: node --version + - run: npm --version + - name: cache node modules + uses: actions/cache@v1 + with: + path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS + key: npm-${{ hashFiles('package-lock.json') }} + restore-keys: | + npm-${{ hashFiles('package-lock.json') }} + npm- - - name: Install dependencies - run: npm install - - name: Run tests - run: npm test + - name: Install dependencies + run: npm install + - name: Run tests + run: npm test - - name: Bundle into single file - run: npm run webpack-bundle + - name: Bundle into single file + run: npm run webpack-bundle - - name: Upload to AWS sandbox S3 bucket - run: npm run upload - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_SANDBOX_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SANDBOX_SECRET_ACCESS_KEY }} - AWS_DEFAULT_REGION: us-east-1 - AWS_S3_PATH: redocly-sandbox-openapi-cli-dist + - name: Upload to AWS sandbox S3 bucket + run: npm run upload + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_SANDBOX_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SANDBOX_SECRET_ACCESS_KEY }} + AWS_DEFAULT_REGION: us-east-1 + AWS_S3_PATH: redocly-sandbox-openapi-cli-dist diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index f55e04768..dfdcafea7 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -10,60 +10,60 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - cache: 'npm' - - run: npm ci - - run: npm test + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + cache: 'npm' + - run: npm ci + - run: npm test deploy: needs: test runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - cache: 'npm' - - run: npm ci + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + cache: 'npm' + - run: npm ci - - name: Bundle into single file - run: npm run webpack-bundle + - name: Bundle into single file + run: npm run webpack-bundle - - name: Upload to AWS S3 bucket - run: npm run upload - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - AWS_DEFAULT_REGION: us-east-1 - AWS_S3_PATH: openapi-cli-dist + - name: Upload to AWS S3 bucket + run: npm run upload + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_DEFAULT_REGION: us-east-1 + AWS_S3_PATH: openapi-cli-dist - - name: Upload to AWS sandbox S3 bucket - run: npm run upload - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_SANDBOX_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SANDBOX_SECRET_ACCESS_KEY }} - AWS_DEFAULT_REGION: us-east-1 - AWS_S3_PATH: redocly-sandbox-openapi-cli-dist + - name: Upload to AWS sandbox S3 bucket + run: npm run upload + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_SANDBOX_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SANDBOX_SECRET_ACCESS_KEY }} + AWS_DEFAULT_REGION: us-east-1 + AWS_S3_PATH: redocly-sandbox-openapi-cli-dist publish: needs: [test, deploy] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - cache: 'npm' - registry-url: 'https://registry.npmjs.org' + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + cache: 'npm' + registry-url: 'https://registry.npmjs.org' - - run: npm ci + - run: npm ci - - name: Publish to NPM - run: cd packages/core && npm publish && cd ../cli && npm publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Publish to NPM + run: cd packages/core && npm publish && cd ../cli && npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} dockerhub: needs: [publish] runs-on: ubuntu-latest diff --git a/.prettierignore b/.prettierignore index cbdd7a288..0df25e7c0 100644 --- a/.prettierignore +++ b/.prettierignore @@ -3,3 +3,6 @@ dist/ packages/cli/lib/ packages/core/lib/ *snapshot.js +packages/core/src/rules/__tests__/fixtures/invalid-yaml.yaml +resources/output/invalid.json +__tests__/webpack-bundle/bundle-workflows/metafile.json diff --git a/__tests__/bundle/bundle-anchor/test.yaml b/__tests__/bundle/bundle-anchor/test.yaml index e0b43a92b..03aaca027 100644 --- a/__tests__/bundle/bundle-anchor/test.yaml +++ b/__tests__/bundle/bundle-anchor/test.yaml @@ -12,14 +12,14 @@ paths: main_data: $anchor: main_data type: object - properties: + properties: foo: type: string type: object oneOf: - - properties: - wrapper: - $ref: '#main_data' - - $ref: '#main_data' - example: + - properties: + wrapper: + $ref: '#main_data' + - $ref: '#main_data' + example: foo: TEST diff --git a/__tests__/bundle/bundle-remove-unused-components-from-config/oas2-without-option/ref.yaml b/__tests__/bundle/bundle-remove-unused-components-from-config/oas2-without-option/ref.yaml index 28ac6e864..2404b1714 100644 --- a/__tests__/bundle/bundle-remove-unused-components-from-config/oas2-without-option/ref.yaml +++ b/__tests__/bundle/bundle-remove-unused-components-from-config/oas2-without-option/ref.yaml @@ -1,3 +1 @@ -{ - "type": "string" -} +{ 'type': 'string' } diff --git a/__tests__/bundle/bundle-remove-unused-components-from-config/oas2/ref.yaml b/__tests__/bundle/bundle-remove-unused-components-from-config/oas2/ref.yaml index 28ac6e864..2404b1714 100644 --- a/__tests__/bundle/bundle-remove-unused-components-from-config/oas2/ref.yaml +++ b/__tests__/bundle/bundle-remove-unused-components-from-config/oas2/ref.yaml @@ -1,3 +1 @@ -{ - "type": "string" -} +{ 'type': 'string' } diff --git a/__tests__/bundle/bundle-remove-unused-components-from-config/oas3-without-option/ref.yaml b/__tests__/bundle/bundle-remove-unused-components-from-config/oas3-without-option/ref.yaml index 28ac6e864..2404b1714 100644 --- a/__tests__/bundle/bundle-remove-unused-components-from-config/oas3-without-option/ref.yaml +++ b/__tests__/bundle/bundle-remove-unused-components-from-config/oas3-without-option/ref.yaml @@ -1,3 +1 @@ -{ - "type": "string" -} +{ 'type': 'string' } diff --git a/__tests__/bundle/bundle-remove-unused-components-from-config/oas3/ref.yaml b/__tests__/bundle/bundle-remove-unused-components-from-config/oas3/ref.yaml index 28ac6e864..2404b1714 100644 --- a/__tests__/bundle/bundle-remove-unused-components-from-config/oas3/ref.yaml +++ b/__tests__/bundle/bundle-remove-unused-components-from-config/oas3/ref.yaml @@ -1,3 +1 @@ -{ - "type": "string" -} +{ 'type': 'string' } diff --git a/__tests__/bundle/bundle-remove-unused-components/oas2/ref.yaml b/__tests__/bundle/bundle-remove-unused-components/oas2/ref.yaml index 28ac6e864..2404b1714 100644 --- a/__tests__/bundle/bundle-remove-unused-components/oas2/ref.yaml +++ b/__tests__/bundle/bundle-remove-unused-components/oas2/ref.yaml @@ -1,3 +1 @@ -{ - "type": "string" -} +{ 'type': 'string' } diff --git a/__tests__/bundle/bundle-remove-unused-components/oas3/ref.yaml b/__tests__/bundle/bundle-remove-unused-components/oas3/ref.yaml index 28ac6e864..2404b1714 100644 --- a/__tests__/bundle/bundle-remove-unused-components/oas3/ref.yaml +++ b/__tests__/bundle/bundle-remove-unused-components/oas3/ref.yaml @@ -1,3 +1 @@ -{ - "type": "string" -} +{ 'type': 'string' } diff --git a/__tests__/join/decorate/bar.yaml b/__tests__/join/decorate/bar.yaml index 24c3c245b..15c68322e 100644 --- a/__tests__/join/decorate/bar.yaml +++ b/__tests__/join/decorate/bar.yaml @@ -17,7 +17,7 @@ paths: get: summary: Get user by ID responses: - "200": + '200': description: OK - "404": + '404': description: Not found diff --git a/__tests__/join/decorate/foo.yaml b/__tests__/join/decorate/foo.yaml index 588e70781..82f43ca32 100644 --- a/__tests__/join/decorate/foo.yaml +++ b/__tests__/join/decorate/foo.yaml @@ -24,7 +24,7 @@ paths: x-private: true summary: Get an order by ID for a specific user responses: - "200": + '200': description: OK - "404": + '404': description: Not found diff --git a/__tests__/join/fails-if-no-info-section/bar.yaml b/__tests__/join/fails-if-no-info-section/bar.yaml index 1edddb60b..88ce1deb4 100644 --- a/__tests__/join/fails-if-no-info-section/bar.yaml +++ b/__tests__/join/fails-if-no-info-section/bar.yaml @@ -15,4 +15,4 @@ paths: operationId: exampleBar responses: '201': - description: example description \ No newline at end of file + description: example description diff --git a/__tests__/join/fails-if-no-info-section/foo.yaml b/__tests__/join/fails-if-no-info-section/foo.yaml index e12842093..6f4f901b0 100644 --- a/__tests__/join/fails-if-no-info-section/foo.yaml +++ b/__tests__/join/fails-if-no-info-section/foo.yaml @@ -16,4 +16,4 @@ paths: format: int responses: '200': - description: example description \ No newline at end of file + description: example description diff --git a/__tests__/join/ignore-decorators/bar.yaml b/__tests__/join/ignore-decorators/bar.yaml index 24c3c245b..15c68322e 100644 --- a/__tests__/join/ignore-decorators/bar.yaml +++ b/__tests__/join/ignore-decorators/bar.yaml @@ -17,7 +17,7 @@ paths: get: summary: Get user by ID responses: - "200": + '200': description: OK - "404": + '404': description: Not found diff --git a/__tests__/join/ignore-decorators/foo.yaml b/__tests__/join/ignore-decorators/foo.yaml index 588e70781..82f43ca32 100644 --- a/__tests__/join/ignore-decorators/foo.yaml +++ b/__tests__/join/ignore-decorators/foo.yaml @@ -24,7 +24,7 @@ paths: x-private: true summary: Get an order by ID for a specific user responses: - "200": + '200': description: OK - "404": + '404': description: Not found diff --git a/__tests__/join/multiple-tags-in-same-files/bar.yaml b/__tests__/join/multiple-tags-in-same-files/bar.yaml index 731c03492..4ffbe0b1e 100644 --- a/__tests__/join/multiple-tags-in-same-files/bar.yaml +++ b/__tests__/join/multiple-tags-in-same-files/bar.yaml @@ -26,8 +26,8 @@ paths: '/dog/{dogId}': post: - tags: - - Dog + tags: + - Dog summary: Dog example operationId: exampleDogId responses: diff --git a/__tests__/join/prefix-tags-with-filename/bar.yaml b/__tests__/join/prefix-tags-with-filename/bar.yaml index 8677cf825..abfd55549 100644 --- a/__tests__/join/prefix-tags-with-filename/bar.yaml +++ b/__tests__/join/prefix-tags-with-filename/bar.yaml @@ -1,7 +1,7 @@ openapi: 3.0.0 -tags: +tags: - name: Pet - description: Pet Discription + description: Pet Discription info: version: 1.0.0 title: Example OpenAPI 3 definition. @@ -18,4 +18,4 @@ paths: operationId: exampleBar responses: '201': - description: example description \ No newline at end of file + description: example description diff --git a/__tests__/join/prefix-tags-with-filename/foo.yaml b/__tests__/join/prefix-tags-with-filename/foo.yaml index b299cd424..f27e7ca24 100644 --- a/__tests__/join/prefix-tags-with-filename/foo.yaml +++ b/__tests__/join/prefix-tags-with-filename/foo.yaml @@ -1,7 +1,7 @@ openapi: 3.0.0 -tags: +tags: - name: Pet - description: Pet Discription + description: Pet Discription info: version: 1.0.0 title: Example OpenAPI 3 definition. @@ -26,4 +26,4 @@ paths: format: int responses: '200': - description: example description \ No newline at end of file + description: example description diff --git a/__tests__/join/prefix-tags-with-info-prop/foo.yaml b/__tests__/join/prefix-tags-with-info-prop/foo.yaml index 1e6970af7..53e8b5cf2 100644 --- a/__tests__/join/prefix-tags-with-info-prop/foo.yaml +++ b/__tests__/join/prefix-tags-with-info-prop/foo.yaml @@ -1,7 +1,7 @@ openapi: 3.0.0 -tags: +tags: - name: Pet - description: Pet Discription + description: Pet Discription info: version: 1.0.0 title: Example OpenAPI 3 definition with foo title. @@ -26,4 +26,4 @@ paths: format: int responses: '200': - description: example description \ No newline at end of file + description: example description diff --git a/__tests__/join/reference-in-description/description.md b/__tests__/join/reference-in-description/description.md index 0aef4a868..1be161049 100644 --- a/__tests__/join/reference-in-description/description.md +++ b/__tests__/join/reference-in-description/description.md @@ -1 +1 @@ -Test description from md file \ No newline at end of file +Test description from md file diff --git a/__tests__/join/reference-in-description/snapshot.js b/__tests__/join/reference-in-description/snapshot.js index bd9789f71..5b4481c72 100644 --- a/__tests__/join/reference-in-description/snapshot.js +++ b/__tests__/join/reference-in-description/snapshot.js @@ -6,7 +6,8 @@ openapi: 3.0.0 info: version: 1.0.0 title: Example OpenAPI 3 definition. - description: Test description from md file + description: | + Test description from md file license: name: MIT url: https://opensource.org/licenses/MIT diff --git a/__tests__/join/references-in-parameters/bar.yaml b/__tests__/join/references-in-parameters/bar.yaml index 7bc60b06f..b55e685ec 100644 --- a/__tests__/join/references-in-parameters/bar.yaml +++ b/__tests__/join/references-in-parameters/bar.yaml @@ -8,14 +8,14 @@ servers: paths: /users/{userId}/orders/{orderId}: parameters: - - $ref: "#/components/parameters/userIdParam" - - $ref: "#/components/parameters/orderIdParam" + - $ref: '#/components/parameters/userIdParam' + - $ref: '#/components/parameters/orderIdParam' get: summary: Get an order by ID for a specific user responses: - "200": + '200': description: OK - "404": + '404': description: Not found components: parameters: diff --git a/__tests__/join/references-in-parameters/foo.yaml b/__tests__/join/references-in-parameters/foo.yaml index 66f94723b..d9a2363c9 100644 --- a/__tests__/join/references-in-parameters/foo.yaml +++ b/__tests__/join/references-in-parameters/foo.yaml @@ -8,26 +8,26 @@ servers: paths: /users/{userId}/products/{productId}: parameters: - - $ref: "#/components/parameters/userIdParam" - - $ref: "#/components/parameters/productIdParam" + - $ref: '#/components/parameters/userIdParam' + - $ref: '#/components/parameters/productIdParam' get: summary: Get a product by ID for a specific user responses: - "200": + '200': description: OK - "404": + '404': description: Not found /users/{userId}/orders/{orderId}/items/{itemId}: parameters: - - $ref: "#/components/parameters/userIdParam" - - $ref: "#/components/parameters/orderIdParam" - - $ref: "#/components/parameters/itemIdParam" + - $ref: '#/components/parameters/userIdParam' + - $ref: '#/components/parameters/orderIdParam' + - $ref: '#/components/parameters/itemIdParam' get: summary: Get an item by ID for a specific order and user responses: - "200": + '200': description: OK - "404": + '404': description: Not found components: parameters: diff --git a/__tests__/join/with-metadata/pet.yaml b/__tests__/join/with-metadata/pet.yaml index 1e650ab9a..7ab58b1f1 100644 --- a/__tests__/join/with-metadata/pet.yaml +++ b/__tests__/join/with-metadata/pet.yaml @@ -19,8 +19,7 @@ paths: description: string description: get Pet description servers: - - url: - /pet + - url: /pet description: some description get: @@ -30,8 +29,7 @@ paths: description: Returns a single pet operationId: getPetById servers: - - url: - /pet + - url: /pet parameters: - name: petId in: path diff --git a/__tests__/join/with-metadata/test.yaml b/__tests__/join/with-metadata/test.yaml index 4e29d4021..9f6c7f90d 100644 --- a/__tests__/join/with-metadata/test.yaml +++ b/__tests__/join/with-metadata/test.yaml @@ -17,10 +17,8 @@ paths: - name: param2 in: header servers: - - url: - /test - - url: - /pets + - url: /test + - url: /pets description: another description post: tags: @@ -40,4 +38,3 @@ paths: responses: '200': description: oka - diff --git a/__tests__/join/without-x-tag-groups/bar.yaml b/__tests__/join/without-x-tag-groups/bar.yaml index 24cff6a32..84203f4a0 100644 --- a/__tests__/join/without-x-tag-groups/bar.yaml +++ b/__tests__/join/without-x-tag-groups/bar.yaml @@ -1,5 +1,5 @@ openapi: 3.0.0 -tags: +tags: - name: Pet description: Another description info: @@ -18,4 +18,4 @@ paths: operationId: exampleBar responses: '201': - description: example description \ No newline at end of file + description: example description diff --git a/__tests__/lint/assertion-string-property-min-length/openapi.yaml b/__tests__/lint/assertion-string-property-min-length/openapi.yaml index 159eacb8a..baab0e830 100644 --- a/__tests__/lint/assertion-string-property-min-length/openapi.yaml +++ b/__tests__/lint/assertion-string-property-min-length/openapi.yaml @@ -29,23 +29,23 @@ paths: application/json: schema: type: object - required: + required: - b - a - k properties: a: type: string - + b: type: object - k: + k: type: string minLength: 2 - c: + c: type: object - required: - - k - properties: + required: + - k + properties: k: - type: string \ No newline at end of file + type: string diff --git a/__tests__/lint/assertion-string-property-min-length/snapshot.js b/__tests__/lint/assertion-string-property-min-length/snapshot.js index 105cf5e4d..267a04bfe 100644 --- a/__tests__/lint/assertion-string-property-min-length/snapshot.js +++ b/__tests__/lint/assertion-string-property-min-length/snapshot.js @@ -11,11 +11,12 @@ minLength assertion failed because the Schema didn't meet the assertions: Requir 30 | schema: 31 | type: object | ^^^^^^^^^^^^ -32 | required: - | ^^^^^^^^^^ +32 | required: + | ^^^^^^^^^ … | < 18 more lines > -51 | type: string +51 | type: string | ^^^^^^^^^^^^ +52 | Error was generated by the minLength assertion rule. @@ -25,14 +26,15 @@ Error was generated by the minLength assertion rule. minLength assertion failed because the Schema didn't meet the assertions: Required property minLength inside k string property 44 | minLength: 2 -45 | c: +45 | c: 46 | type: object | ^^^^^^^^^^^^ -47 | required: - | ^^^^^^^^^^ +47 | required: + | ^^^^^^^^^ … | < 3 more lines > -51 | type: string +51 | type: string | ^^^^^^^^^^^^ +52 | Error was generated by the minLength assertion rule. diff --git a/__tests__/lint/assertions-camel-case-twice/openapi.yaml b/__tests__/lint/assertions-camel-case-twice/openapi.yaml index 14924ee45..d519fddc4 100644 --- a/__tests__/lint/assertions-camel-case-twice/openapi.yaml +++ b/__tests__/lint/assertions-camel-case-twice/openapi.yaml @@ -5,17 +5,17 @@ info: name: MIT url: example.com tags: -- name: sometag - description: sometag + - name: sometag + description: sometag servers: -- url: https://example.com + - url: https://example.com security: [] paths: /someGet: get: operationId: operationIdGet - parameters: - - $ref: "#/components/parameters/header_Accept" + parameters: + - $ref: '#/components/parameters/header_Accept' responses: '200': description: '' diff --git a/__tests__/lint/assertions-error/openapi.yaml b/__tests__/lint/assertions-error/openapi.yaml index 81f884db6..de0755f93 100644 --- a/__tests__/lint/assertions-error/openapi.yaml +++ b/__tests__/lint/assertions-error/openapi.yaml @@ -26,8 +26,8 @@ paths: summary: My resource description: summary example externalDocs: - description: "Find more info here" - url: "https://example.com" + description: 'Find more info here' + url: 'https://example.com' requestBody: content: application/json: @@ -80,4 +80,3 @@ paths: - lang: 'C#' source: | PetStore.v1.Pet pet = new PetStore.v1.Pet(); - diff --git a/__tests__/lint/assertions-error/snapshot.js b/__tests__/lint/assertions-error/snapshot.js index 9fd519553..c519a3b3f 100644 --- a/__tests__/lint/assertions-error/snapshot.js +++ b/__tests__/lint/assertions-error/snapshot.js @@ -97,10 +97,10 @@ Every path item must have a GET operation. | ^^^^ 25 | operationId: exampleOne | ^^^^^^^^^^^^^^^^^^^^^^^ - … | < 57 more lines > + … | < 56 more lines > +82 | PetStore.v1.Pet pet = new PetStore.v1.Pet(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 83 | - | ^ -84 | Error was generated by the path-item-get-defined assertion rule. @@ -128,7 +128,7 @@ anyType assertion failed because the any description didn't meet the assertions: 27 | description: summary example | ^^^^^^^^^^^^^^^ 28 | externalDocs: -29 | description: "Find more info here" +29 | description: 'Find more info here' Error was generated by the anyType assertion rule. @@ -186,9 +186,9 @@ anyType assertion failed because the any description didn't meet the assertions: 27 | description: summary example 28 | externalDocs: -29 | description: "Find more info here" +29 | description: 'Find more info here' | ^^^^^^^^^^^^^^^^^^^^^ -30 | url: "https://example.com" +30 | url: 'https://example.com' 31 | requestBody: Error was generated by the anyType assertion rule. @@ -356,16 +356,16 @@ Error was generated by the operation-disallowed assertion rule. x-codeSamples must be defined -56 | description: hooray -57 | post: -58 | operationId: EXAMPLE - | ^^^^^^^^^^^^^^^^^^^^ -59 | summary: '' - | ^^^^^^^^^^^ - … | < 23 more lines > +56 | description: hooray +57 | post: +58 | operationId: EXAMPLE + | ^^^^^^^^^^^^^^^^^^^^ +59 | summary: '' + | ^^^^^^^^^^^ + … | < 22 more lines > +82 | PetStore.v1.Pet pet = new PetStore.v1.Pet(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 83 | - | ^ -84 | Error was generated by the operation-x-code-samples-defined assertion rule. @@ -385,8 +385,6 @@ Did you mean: x-codeSamples instead of x-code-samples ? 82 | PetStore.v1.Pet pet = new PetStore.v1.Pet(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 83 | - | ^ -84 | Error was generated by the operation-x-code-samples-undefined assertion rule. diff --git a/__tests__/lint/assertions-list-types/openapi.yaml b/__tests__/lint/assertions-list-types/openapi.yaml index c09a4dd9d..5dad83e9e 100644 --- a/__tests__/lint/assertions-list-types/openapi.yaml +++ b/__tests__/lint/assertions-list-types/openapi.yaml @@ -27,10 +27,10 @@ paths: operationId: list_pets tags: - pets - parameters: + parameters: - name: Accept-Language in: header - description: "The language you prefer for messages. Supported values are en-AU, en-CA, en-GB, en-US" + description: 'The language you prefer for messages. Supported values are en-AU, en-CA, en-GB, en-US' example: en-US required: false schema: diff --git a/__tests__/lint/assertions-query-in-parameters/openapi.yaml b/__tests__/lint/assertions-query-in-parameters/openapi.yaml index 7c37192c2..260783ab9 100644 --- a/__tests__/lint/assertions-query-in-parameters/openapi.yaml +++ b/__tests__/lint/assertions-query-in-parameters/openapi.yaml @@ -18,7 +18,7 @@ paths: get: operationId: GetExampleId summary: summary example - parameters: + parameters: - name: statusId in: query - name: otherParam @@ -28,4 +28,3 @@ paths: description: example description '404': description: example description - \ No newline at end of file diff --git a/__tests__/lint/assertions-query-in-parameters/snapshot.js b/__tests__/lint/assertions-query-in-parameters/snapshot.js index 08ae86f8c..2fa6bc8de 100644 --- a/__tests__/lint/assertions-query-in-parameters/snapshot.js +++ b/__tests__/lint/assertions-query-in-parameters/snapshot.js @@ -7,7 +7,7 @@ validating /openapi.yaml... query-in-parameters assertion failed because the Parameter in didn't meet the assertions: query should be equal path -21 | parameters: +21 | parameters: 22 | - name: statusId 23 | in: query | ^^^^^ diff --git a/__tests__/lint/assertions-type-integer-in-parameter/openapi.yaml b/__tests__/lint/assertions-type-integer-in-parameter/openapi.yaml index e5959dd48..6acb026cb 100644 --- a/__tests__/lint/assertions-type-integer-in-parameter/openapi.yaml +++ b/__tests__/lint/assertions-type-integer-in-parameter/openapi.yaml @@ -18,15 +18,14 @@ paths: get: operationId: GetExampleId summary: summary example - parameters: + parameters: - name: statusId in: path example: en-US - schema: + schema: type: integer responses: '200': description: example description '404': description: example description - \ No newline at end of file diff --git a/__tests__/lint/assertions-type-integer-in-parameter/snapshot.js b/__tests__/lint/assertions-type-integer-in-parameter/snapshot.js index b680befe5..4abd35275 100644 --- a/__tests__/lint/assertions-type-integer-in-parameter/snapshot.js +++ b/__tests__/lint/assertions-type-integer-in-parameter/snapshot.js @@ -8,7 +8,7 @@ validating /openapi.yaml... no-type-integer-in-parameter assertion failed because the Schema type didn't meet the assertions: "integer" should be one of the predefined values 24 | example: en-US -25 | schema: +25 | schema: 26 | type: integer | ^^^^^^^ 27 | responses: diff --git a/__tests__/lint/assertions-type-integer-in-schema-response/openapi.yaml b/__tests__/lint/assertions-type-integer-in-schema-response/openapi.yaml index 7be486517..7bbd0c37b 100644 --- a/__tests__/lint/assertions-type-integer-in-schema-response/openapi.yaml +++ b/__tests__/lint/assertions-type-integer-in-schema-response/openapi.yaml @@ -20,10 +20,10 @@ paths: summary: summary example responses: '200': - content: + content: application/json: example: example - schema: + schema: type: string description: example description '404': @@ -34,12 +34,11 @@ paths: summary: summary example responses: '200': - content: + content: application/json: example: example - schema: + schema: type: integer description: example description '404': description: example description - \ No newline at end of file diff --git a/__tests__/lint/assertions/description.md b/__tests__/lint/assertions/description.md index a00c3b853..c366ea241 100644 --- a/__tests__/lint/assertions/description.md +++ b/__tests__/lint/assertions/description.md @@ -1 +1 @@ -Example description \ No newline at end of file +Example description diff --git a/__tests__/lint/assertions/openapi.yaml b/__tests__/lint/assertions/openapi.yaml index 67f43c530..8df1f4885 100644 --- a/__tests__/lint/assertions/openapi.yaml +++ b/__tests__/lint/assertions/openapi.yaml @@ -24,8 +24,8 @@ paths: operationId: exampleOne summary: My resource externalDocs: - description: "Find more info here" - url: "https://example.com" + description: 'Find more info here' + url: 'https://example.com' requestBody: content: application/json: @@ -87,4 +87,3 @@ paths: - lang: 'C#' source: | PetStore.v1.Pet pet = new PetStore.v1.Pet(); - diff --git a/__tests__/lint/no-enum-type-mismatch-error-recommended-config/openapi.yaml b/__tests__/lint/no-enum-type-mismatch-error-recommended-config/openapi.yaml index ab3a4513b..f7b94917b 100644 --- a/__tests__/lint/no-enum-type-mismatch-error-recommended-config/openapi.yaml +++ b/__tests__/lint/no-enum-type-mismatch-error-recommended-config/openapi.yaml @@ -6,16 +6,15 @@ info: security: [] paths: - /v1/pets/{petId}: get: operationId: getPet parameters: - - name: petId - in: path - required: true - schema: - type: string + - name: petId + in: path + required: true + schema: + type: string responses: '200': description: Details of the requested pet. @@ -26,16 +25,15 @@ paths: '400': description: Bad Request. - '500': + '500': description: Internal Server Error. components: - schemas: Pet: type: object required: - - id + - id properties: name: type: string @@ -44,4 +42,4 @@ components: format: uuid status: type: string - enum: string \ No newline at end of file + enum: string diff --git a/__tests__/lint/no-enum-type-mismatch-error-recommended-config/snapshot.js b/__tests__/lint/no-enum-type-mismatch-error-recommended-config/snapshot.js index 83d3d4887..47dc235cc 100644 --- a/__tests__/lint/no-enum-type-mismatch-error-recommended-config/snapshot.js +++ b/__tests__/lint/no-enum-type-mismatch-error-recommended-config/snapshot.js @@ -15,28 +15,29 @@ Servers must be present. Error was generated by the no-empty-servers rule. -[2] openapi.yaml:11:5 at #/paths/~1v1~1pets~1{petId}/get/summary +[2] openapi.yaml:10:5 at #/paths/~1v1~1pets~1{petId}/get/summary Operation object should contain \`summary\` field. - 9 | -10 | /v1/pets/{petId}: -11 | get: - | ^^^ -12 | operationId: getPet -13 | parameters: + 8 | paths: + 9 | /v1/pets/{petId}: +10 | get: + | ^^^ +11 | operationId: getPet +12 | parameters: Error was generated by the operation-summary rule. -[3] openapi.yaml:47:17 at #/components/schemas/Pet/properties/status/enum +[3] openapi.yaml:45:17 at #/components/schemas/Pet/properties/status/enum Expected type \`array\` but got \`string\`. -45 | status: -46 | type: string -47 | enum: string +43 | status: +44 | type: string +45 | enum: string | ^^^^^^ +46 | Error was generated by the spec rule. diff --git a/__tests__/lint/no-enum-type-mismatch-error/openapi.yaml b/__tests__/lint/no-enum-type-mismatch-error/openapi.yaml index e94d5219b..0987d85a0 100644 --- a/__tests__/lint/no-enum-type-mismatch-error/openapi.yaml +++ b/__tests__/lint/no-enum-type-mismatch-error/openapi.yaml @@ -16,7 +16,7 @@ paths: - array enum: - 1 - - [ 1, 2, 3, string] + - [1, 2, 3, string] - 3 - string /pong: diff --git a/__tests__/lint/no-enum-type-mismatch-error/snapshot.js b/__tests__/lint/no-enum-type-mismatch-error/snapshot.js index d09992a12..f7af0d208 100644 --- a/__tests__/lint/no-enum-type-mismatch-error/snapshot.js +++ b/__tests__/lint/no-enum-type-mismatch-error/snapshot.js @@ -7,7 +7,7 @@ validating /openapi.yaml... Enum value \`string\` must be of allowed types: \`integer,array\`. -19 | - [ 1, 2, 3, string] +19 | - [1, 2, 3, string] 20 | - 3 21 | - string | ^^^^^^ diff --git a/__tests__/lint/no-enum-type-mismatch/openapi.yaml b/__tests__/lint/no-enum-type-mismatch/openapi.yaml index 5a656f0a8..9fbd924c4 100644 --- a/__tests__/lint/no-enum-type-mismatch/openapi.yaml +++ b/__tests__/lint/no-enum-type-mismatch/openapi.yaml @@ -16,7 +16,7 @@ paths: - array enum: - 1 - - [ 1, 2, 3, string] + - [1, 2, 3, string] - 3 userId: application/json: diff --git a/__tests__/lint/no-invalid-media-type-examples-invalid-schema/openapi.yaml b/__tests__/lint/no-invalid-media-type-examples-invalid-schema/openapi.yaml index d2681d9d4..c3f60c37a 100644 --- a/__tests__/lint/no-invalid-media-type-examples-invalid-schema/openapi.yaml +++ b/__tests__/lint/no-invalid-media-type-examples-invalid-schema/openapi.yaml @@ -8,14 +8,14 @@ info: name: Apache 2.0 url: http://www.apache.org/licenses/LICENSE-2.0.html servers: -- url: http://petstore.swagger.io/v1 + - url: http://petstore.swagger.io/v1 security: [] components: schemas: Test: nullable: true paths: - "/test": + /test: get: summary: test operationId: test @@ -25,7 +25,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/Test" + $ref: '#/components/schemas/Test' example: {} '400': description: An error response diff --git a/__tests__/lint/no-invalid-media-type-examples-invalid-schema/snapshot.js b/__tests__/lint/no-invalid-media-type-examples-invalid-schema/snapshot.js index 187ec37d4..9d84b1e8e 100644 --- a/__tests__/lint/no-invalid-media-type-examples-invalid-schema/snapshot.js +++ b/__tests__/lint/no-invalid-media-type-examples-invalid-schema/snapshot.js @@ -12,7 +12,7 @@ The \`type\` field must be defined when the \`nullable\` field is used. 16 | nullable: true | ^^^^ 17 | paths: -18 | "/test": +18 | /test: Error was generated by the spec rule. @@ -23,7 +23,7 @@ Example validation errored: "nullable" cannot be used without "type". 26 | application/json: 27 | schema: -28 | $ref: "#/components/schemas/Test" +28 | $ref: '#/components/schemas/Test' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 29 | example: {} 30 | '400': diff --git a/__tests__/lint/no-invalid-media-type-examples-recursion-oneOf/openapi.json b/__tests__/lint/no-invalid-media-type-examples-recursion-oneOf/openapi.json index ad3b25939..6698947f9 100644 --- a/__tests__/lint/no-invalid-media-type-examples-recursion-oneOf/openapi.json +++ b/__tests__/lint/no-invalid-media-type-examples-recursion-oneOf/openapi.json @@ -9,9 +9,11 @@ "url": "http://www.apache.org/licenses/LICENSE-2.0.html" } }, - "servers": [{ - "url": "http://petstore.swagger.io/v1" - }], + "servers": [ + { + "url": "http://petstore.swagger.io/v1" + } + ], "security": [], "paths": { "/test": { @@ -39,10 +41,7 @@ "schemas": { "Pet": { "type": "object", - "oneOf": [ - { "$ref": "#/components/schemas/Pet" }, - { "$ref": "#/components/schemas/Cat" } - ] + "oneOf": [{ "$ref": "#/components/schemas/Pet" }, { "$ref": "#/components/schemas/Cat" }] }, "Cat": { "type": "object", diff --git a/__tests__/lint/no-invalid-media-type-examples-recursion/openapi.json b/__tests__/lint/no-invalid-media-type-examples-recursion/openapi.json index 406cbdab9..a333c83ed 100644 --- a/__tests__/lint/no-invalid-media-type-examples-recursion/openapi.json +++ b/__tests__/lint/no-invalid-media-type-examples-recursion/openapi.json @@ -10,9 +10,11 @@ } }, "security": [], - "servers": [{ - "url": "http://petstore.swagger.io/v1" - }], + "servers": [ + { + "url": "http://petstore.swagger.io/v1" + } + ], "paths": { "/test": { "get": { @@ -25,8 +27,7 @@ "application/json": { "schema": { "$ref": "#/components/schemas/PetWithProps" }, "example": { - "a": { - }, + "a": {}, "b": { "c": "hello" } @@ -61,7 +62,7 @@ "properties": { "c": { "type": "string" }, "a": { - "$ref": "#/components/schemas/PetWithProps" + "$ref": "#/components/schemas/PetWithProps" }, "b": { "oneOf": [{ "$ref": "#/components/schemas/PetWithProps" }] diff --git a/__tests__/lint/no-invalid-media-type-examples-recursion/snapshot.js b/__tests__/lint/no-invalid-media-type-examples-recursion/snapshot.js index dc7193688..0bf84a46f 100644 --- a/__tests__/lint/no-invalid-media-type-examples-recursion/snapshot.js +++ b/__tests__/lint/no-invalid-media-type-examples-recursion/snapshot.js @@ -3,41 +3,39 @@ exports[`E2E lint no-invalid-media-type-examples-recursion 1`] = ` validating /openapi.json... -[1] openapi.json:27:28 at #/paths/~1test/get/responses/202/content/application~1json/example +[1] openapi.json:29:28 at #/paths/~1test/get/responses/202/content/application~1json/example Example value must conform to the schema: must have required property 'c'. -25 | "application/json": { -26 | "schema": { "$ref": "#/components/schemas/PetWithProps" }, -27 | "example": { +27 | "application/json": { +28 | "schema": { "$ref": "#/components/schemas/PetWithProps" }, +29 | "example": { | ^ -28 | "a": { - | ^^^^^^ - … | < 4 more lines > -33 | } +30 | "a": {}, + | ^^^^^^^^ + … | < 3 more lines > +34 | } | ^ -34 | } -35 | } +35 | } +36 | } -referenced from openapi.json:25:35 at #/paths/~1test/get/responses/202/content/application~1json +referenced from openapi.json:27:35 at #/paths/~1test/get/responses/202/content/application~1json Warning was generated by the no-invalid-media-type-examples rule. -[2] openapi.json:28:24 at #/paths/~1test/get/responses/202/content/application~1json/example/a +[2] openapi.json:30:24 at #/paths/~1test/get/responses/202/content/application~1json/example/a Example value must conform to the schema: \`a\` property must have required property 'c'. -26 | "schema": { "$ref": "#/components/schemas/PetWithProps" }, -27 | "example": { -28 | "a": { - | ^ -29 | }, - | ^ -30 | "b": { -31 | "c": "hello" +28 | "schema": { "$ref": "#/components/schemas/PetWithProps" }, +29 | "example": { +30 | "a": {}, + | ^^ +31 | "b": { +32 | "c": "hello" -referenced from openapi.json:25:35 at #/paths/~1test/get/responses/202/content/application~1json +referenced from openapi.json:27:35 at #/paths/~1test/get/responses/202/content/application~1json Warning was generated by the no-invalid-media-type-examples rule. diff --git a/__tests__/lint/no-invalid-schema-examples-array-error/openapi.yaml b/__tests__/lint/no-invalid-schema-examples-array-error/openapi.yaml index 25d84e626..c6e90b104 100644 --- a/__tests__/lint/no-invalid-schema-examples-array-error/openapi.yaml +++ b/__tests__/lint/no-invalid-schema-examples-array-error/openapi.yaml @@ -30,8 +30,7 @@ paths: uniqueItems: true items: type: string - example: - test + example: test responses: '200': description: My 200 response diff --git a/__tests__/lint/no-invalid-schema-examples-array-error/snapshot.js b/__tests__/lint/no-invalid-schema-examples-array-error/snapshot.js index 62fdd7fd1..cff15f25d 100644 --- a/__tests__/lint/no-invalid-schema-examples-array-error/snapshot.js +++ b/__tests__/lint/no-invalid-schema-examples-array-error/snapshot.js @@ -3,16 +3,16 @@ exports[`E2E lint no-invalid-schema-examples-array-error 1`] = ` validating /openapi.yaml... -[1] openapi.yaml:34:21 at #/paths/~1my_post/post/requestBody/content/application~1json/schema/properties/my_list/example +[1] openapi.yaml:33:28 at #/paths/~1my_post/post/requestBody/content/application~1json/schema/properties/my_list/example Example value must conform to the schema: type must be array. +31 | items: 32 | type: string -33 | example: -34 | test - | ^^^^ -35 | responses: -36 | '200': +33 | example: test + | ^^^^ +34 | responses: +35 | '200': referenced from openapi.yaml:29:19 at #/paths/~1my_post/post/requestBody/content/application~1json/schema/properties/my_list diff --git a/__tests__/lint/no-server-variables-empty-enum-errror/openapi.yaml b/__tests__/lint/no-server-variables-empty-enum-errror/openapi.yaml index 4711e5777..451385ab7 100644 --- a/__tests__/lint/no-server-variables-empty-enum-errror/openapi.yaml +++ b/__tests__/lint/no-server-variables-empty-enum-errror/openapi.yaml @@ -8,8 +8,8 @@ servers: id: enum: [] placeId: - enum: [b] - default: a + enum: [b] + default: a - url: https://example.com/{var} variables: {} diff --git a/__tests__/lint/no-server-variables-empty-enum/openapi.yaml b/__tests__/lint/no-server-variables-empty-enum/openapi.yaml index 69c78921e..171e9f59a 100644 --- a/__tests__/lint/no-server-variables-empty-enum/openapi.yaml +++ b/__tests__/lint/no-server-variables-empty-enum/openapi.yaml @@ -8,8 +8,8 @@ servers: id: enum: [c] placeId: - enum: [b, a] - default: a + enum: [b, a] + default: a - url: https://example.com/{var} variables: {} diff --git a/__tests__/lint/no-undefined-server-variable-error-recommended-config/openapi.yaml b/__tests__/lint/no-undefined-server-variable-error-recommended-config/openapi.yaml index 41457a469..d68828be6 100644 --- a/__tests__/lint/no-undefined-server-variable-error-recommended-config/openapi.yaml +++ b/__tests__/lint/no-undefined-server-variable-error-recommended-config/openapi.yaml @@ -15,4 +15,3 @@ paths: responses: '200': description: example description - diff --git a/__tests__/lint/no-unused-components-warning/openapi.yaml b/__tests__/lint/no-unused-components-warning/openapi.yaml index d3af242c2..a0f18bd80 100644 --- a/__tests__/lint/no-unused-components-warning/openapi.yaml +++ b/__tests__/lint/no-unused-components-warning/openapi.yaml @@ -23,4 +23,3 @@ components: format: int64 name: type: string - diff --git a/__tests__/lint/null-schema-values/openapi.yaml b/__tests__/lint/null-schema-values/openapi.yaml index 26f59c23f..ddb49d2ab 100644 --- a/__tests__/lint/null-schema-values/openapi.yaml +++ b/__tests__/lint/null-schema-values/openapi.yaml @@ -1,5 +1,5 @@ openapi: 3.0.0 -info: +info: paths: /test: get: diff --git a/__tests__/lint/null-schema-values/snapshot.js b/__tests__/lint/null-schema-values/snapshot.js index b3678c2c2..df0c31baf 100644 --- a/__tests__/lint/null-schema-values/snapshot.js +++ b/__tests__/lint/null-schema-values/snapshot.js @@ -8,7 +8,7 @@ validating /openapi.yaml... Expected type \`Info\` (object) but got \`null\` 1 | openapi: 3.0.0 -2 | info: +2 | info: | ^^^^^ 3 | paths: 4 | /test: diff --git a/__tests__/lint/oas2/openapi.yaml b/__tests__/lint/oas2/openapi.yaml index e90615998..373e156ac 100644 --- a/__tests__/lint/oas2/openapi.yaml +++ b/__tests__/lint/oas2/openapi.yaml @@ -1,209 +1,209 @@ -swagger: "2.0" +swagger: '2.0' info: - description: "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters." - version: "1.0.0" - title: "Swagger Petstore" - termsOfService: "http://swagger.io/terms/" + description: 'This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.' + version: '1.0.0' + title: 'Swagger Petstore' + termsOfService: 'http://swagger.io/terms/' contact: - email: "apiteam@swagger.io" + email: 'apiteam@swagger.io' license: - name: "Apache 2.0" - url: "http://www.apache.org/licenses/LICENSE-2.0.html" -host: "petstore.swagger.io" -basePath: "/v2" + name: 'Apache 2.0' + url: 'http://www.apache.org/licenses/LICENSE-2.0.html' +host: 'petstore.swagger.io' +basePath: '/v2' tags: -- name: "pet" - description: "Everything about your Pets" - externalDocs: - description: "Find out more" - url: "http://swagger.io" + - name: 'pet' + description: 'Everything about your Pets' + externalDocs: + description: 'Find out more' + url: 'http://swagger.io' schemes: -- "http" + - 'http' security: [] paths: /pet: post: tags: - - "pet" - summary: "Add a new pet to the store" - description: "post a pet to store" - operationId: "add_pet" + - 'pet' + summary: 'Add a new pet to the store' + description: 'post a pet to store' + operationId: 'add_pet' consumes: - - "application/json" - - "application/xml" + - 'application/json' + - 'application/xml' produces: - - "application/xml" - - "application/json" + - 'application/xml' + - 'application/json' parameters: - - in: "body" - name: "body" - description: "Pet object that needs to be added to the store" - required: true - schema: - $ref: "#/definitions/Pet" + - in: 'body' + name: 'body' + description: 'Pet object that needs to be added to the store' + required: true + schema: + $ref: '#/definitions/Pet' responses: 200: description: example description 405: - description: "Invalid input" + description: 'Invalid input' security: - - petstore_auth: - - "write:pets" - - "read:pets" + - petstore_auth: + - 'write:pets' + - 'read:pets' put: tags: - - "pet" - summary: "Update an existing pet" - description: "put new data for existing pet" - operationId: "update_pet" + - 'pet' + summary: 'Update an existing pet' + description: 'put new data for existing pet' + operationId: 'update_pet' consumes: - - "application/json" - - "application/xml" + - 'application/json' + - 'application/xml' produces: - - "application/xml" - - "application/json" + - 'application/xml' + - 'application/json' parameters: - - in: "body" - name: "body" - description: "Pet object that needs to be added to the store" - required: true - schema: - $ref: "#/definitions/Pet" + - in: 'body' + name: 'body' + description: 'Pet object that needs to be added to the store' + required: true + schema: + $ref: '#/definitions/Pet' responses: 200: description: example description 400: - description: "Invalid ID supplied" + description: 'Invalid ID supplied' 404: - description: "Pet not found" + description: 'Pet not found' 405: - description: "Validation exception" + description: 'Validation exception' security: - - petstore_auth: - - "write:pets" - - "read:pets" + - petstore_auth: + - 'write:pets' + - 'read:pets' /pet/find_by_status: get: tags: - - "pet" - summary: "Finds Pets by status" - description: "Multiple status values can be provided with comma separated strings" - operationId: "list_pets_by_status" + - 'pet' + summary: 'Finds Pets by status' + description: 'Multiple status values can be provided with comma separated strings' + operationId: 'list_pets_by_status' produces: - - "application/xml" - - "application/json" + - 'application/xml' + - 'application/json' parameters: - - name: "status" - in: "query" - description: "Status values that need to be considered for filter" - required: true - type: "array" - items: - type: "string" - enum: - - "available" - - "pending" - - "sold" - default: "available" - collectionFormat: "multi" + - name: 'status' + in: 'query' + description: 'Status values that need to be considered for filter' + required: true + type: 'array' + items: + type: 'string' + enum: + - 'available' + - 'pending' + - 'sold' + default: 'available' + collectionFormat: 'multi' responses: 200: - description: "successful operation" + description: 'successful operation' schema: - $ref: "#/definitions/InlineResponse200" + $ref: '#/definitions/InlineResponse200' 400: - description: "Invalid status value" + description: 'Invalid status value' security: - - petstore_auth: - - "write:pets" - - "read:pets" + - petstore_auth: + - 'write:pets' + - 'read:pets' securityDefinitions: petstore_auth: - type: "oauth2" - authorizationUrl: "http://petstore.swagger.io/oauth/dialog" - flow: "implicit" + type: 'oauth2' + authorizationUrl: 'http://petstore.swagger.io/oauth/dialog' + flow: 'implicit' scopes: - write:pets: "modify pets in your account" - read:pets: "read your pets" + write:pets: 'modify pets in your account' + read:pets: 'read your pets' definitions: InlineResponse200: - type: "object" - description: "string" + type: 'object' + description: 'string' properties: pets: - type: "array" - description: "list of pets" + type: 'array' + description: 'list of pets' items: - $ref: "#/definitions/Pet" + $ref: '#/definitions/Pet' Category: - type: "object" - description: "string" + type: 'object' + description: 'string' properties: id: - type: "integer" - format: "int64" - description: "string" + type: 'integer' + format: 'int64' + description: 'string' name: - type: "string" - description: "string" + type: 'string' + description: 'string' xml: - name: "Category" + name: 'Category' Tag: - type: "object" - description: "string" + type: 'object' + description: 'string' properties: id: - type: "integer" - format: "int64" - description: "string" + type: 'integer' + format: 'int64' + description: 'string' name: - type: "string" - description: "string" + type: 'string' + description: 'string' xml: - name: "Tag" + name: 'Tag' Pet: - type: "object" - description: "string" + type: 'object' + description: 'string' required: - - "name" - - "photo_urls" + - 'name' + - 'photo_urls' properties: id: - type: "integer" - format: "int64" - description: "string" + type: 'integer' + format: 'int64' + description: 'string' category: - $ref: "#/definitions/Category" + $ref: '#/definitions/Category' name: - type: "string" - example: "doggie" - description: "string" + type: 'string' + example: 'doggie' + description: 'string' photo_urls: - type: "array" - description: "string" + type: 'array' + description: 'string' xml: - name: "photo_url" + name: 'photo_url' wrapped: true items: - type: "string" + type: 'string' tags: - type: "array" - description: "string" + type: 'array' + description: 'string' pattern: "^http(s)?:\\/\\/([^\\/?#]*)([^?#]*)(\\?([^#]*))?(#(.*))?$" xml: - name: "tag" + name: 'tag' wrapped: true items: - $ref: "#/definitions/Tag" + $ref: '#/definitions/Tag' status: - type: "string" - description: "pet status in the store" + type: 'string' + description: 'pet status in the store' enum: - - "available" - - "pending" - - "sold" + - 'available' + - 'pending' + - 'sold' xml: - name: "Pet" + name: 'Pet' externalDocs: - description: "Find out more about Swagger" - url: "http://swagger.io" + description: 'Find out more about Swagger' + url: 'http://swagger.io' diff --git a/__tests__/lint/oas3-no-errors/openapi.yaml b/__tests__/lint/oas3-no-errors/openapi.yaml index 10a8d12ac..388562ea9 100644 --- a/__tests__/lint/oas3-no-errors/openapi.yaml +++ b/__tests__/lint/oas3-no-errors/openapi.yaml @@ -1,4 +1,4 @@ -openapi: "3.0.0" +openapi: '3.0.0' info: version: 1.0.0 title: Swagger Petstore @@ -44,7 +44,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/Pets" + $ref: '#/components/schemas/Pets' '400': description: An error response default: @@ -52,7 +52,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/Error" + $ref: '#/components/schemas/Error' post: summary: Create a pet operationId: create_pets @@ -68,7 +68,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/Error" + $ref: '#/components/schemas/Error' /pets/{pet_id}: get: summary: Info for a specific pet @@ -88,7 +88,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/Pets" + $ref: '#/components/schemas/Pets' '400': description: An error response default: @@ -96,12 +96,11 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/Error" + $ref: '#/components/schemas/Error' components: schemas: Pet: - description: - A pet + description: A pet required: - id - name @@ -109,16 +108,15 @@ components: id: type: integer format: int64 - description: "id property" + description: 'id property' name: type: string - description: "name property" + description: 'name property' tag: type: string - description: "tag property" + description: 'tag property' Pets: - description: - A list of pets + description: A list of pets required: - pets - next_url @@ -127,9 +125,9 @@ components: properties: pets: type: array - description: "object containing a list of pets" + description: 'object containing a list of pets' items: - $ref: "#/components/schemas/Pet" + $ref: '#/components/schemas/Pet' next_url: type: string description: this is the url to next page @@ -146,8 +144,7 @@ components: description: next token Error: - description: - An error in processing a service request + description: An error in processing a service request required: - code - message @@ -155,7 +152,7 @@ components: code: type: integer format: int32 - description: "code property" + description: 'code property' message: type: string - description: "message property" + description: 'message property' diff --git a/__tests__/lint/oas3.1-error/openapi.yaml b/__tests__/lint/oas3.1-error/openapi.yaml index ee69e1d7d..0eba558da 100644 --- a/__tests__/lint/oas3.1-error/openapi.yaml +++ b/__tests__/lint/oas3.1-error/openapi.yaml @@ -17,7 +17,7 @@ servers: variables: var: enum: - - a - - b + - a + - b default: b security: [] diff --git a/__tests__/lint/oas3.1/openapi.yaml b/__tests__/lint/oas3.1/openapi.yaml index fc7196986..621260ca7 100644 --- a/__tests__/lint/oas3.1/openapi.yaml +++ b/__tests__/lint/oas3.1/openapi.yaml @@ -17,8 +17,8 @@ servers: variables: var: enum: - - a - - b + - a + - b default: b security: [] paths: @@ -28,13 +28,13 @@ paths: summary: Get Test! Foo! Etc! responses: 200: - description: "200" + description: '200' content: application/json: schema: type: array prefixItems: - - type: "string" + - type: 'string' items: false 400: description: An error response @@ -56,7 +56,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/Pets" + $ref: '#/components/schemas/Pets' '400': description: An error response /pets/model: @@ -77,7 +77,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/Model" + $ref: '#/components/schemas/Model' '400': description: An error response /pets/person: @@ -98,7 +98,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/person" + $ref: '#/components/schemas/person' '400': description: An error response /: @@ -151,7 +151,7 @@ webhooks: contentEncoding: base64 contentMediaType: image/png responses: - "200": + '200': description: Return a 200 status to indicate that the data was received successfully '405': description: Invalid input @@ -165,7 +165,7 @@ webhooks: content: application/octet-stream: {} responses: - "200": + '200': description: Return a 200 status to indicate that the data was received successfully '400': description: An error response @@ -177,11 +177,11 @@ components: pathItems: {} schemas: Problem: - id: "https://tools.ietf.org/rfc/rfc7807.txt" - $schema: "http://json-schema.org/draft-06/schema#" - description: "schema for a rfc7807" + id: 'https://tools.ietf.org/rfc/rfc7807.txt' + $schema: 'http://json-schema.org/draft-06/schema#' + description: 'schema for a rfc7807' definitions: {} - type: "object" + type: 'object' properties: type: description: A URI reference [RFC3986] that identifies the problem type. @@ -237,14 +237,14 @@ components: type: array $comment: Array without items keyword either: - type: ['string','null'] + type: ['string', 'null'] discriminator: propertyName: type x-extension: true Pets: type: array items: - $ref: "#/components/schemas/Pet" + $ref: '#/components/schemas/Pet' Model: type: object properties: @@ -255,12 +255,12 @@ components: - string two: description: type 'null' - type: "null" + type: 'null' three: description: type array including 'null' type: - string - - "null" + - 'null' four: description: array with no items type: array @@ -285,7 +285,7 @@ components: description: nullable string type: - string - - "null" + - 'null' eleven: description: x-nullable string type: diff --git a/__tests__/lint/oas3.1/snapshot.js b/__tests__/lint/oas3.1/snapshot.js index 708bfb02e..e33da8b46 100644 --- a/__tests__/lint/oas3.1/snapshot.js +++ b/__tests__/lint/oas3.1/snapshot.js @@ -11,8 +11,8 @@ Component: "Problem" is never used. 178 | schemas: 179 | Problem: | ^^^^^^^ -180 | id: "https://tools.ietf.org/rfc/rfc7807.txt" -181 | $schema: "http://json-schema.org/draft-06/schema#" +180 | id: 'https://tools.ietf.org/rfc/rfc7807.txt' +181 | $schema: 'http://json-schema.org/draft-06/schema#' Warning was generated by the no-unused-components rule. diff --git a/__tests__/lint/operation-2xx-response-warning/openapi.yaml b/__tests__/lint/operation-2xx-response-warning/openapi.yaml index 886077312..f8120c217 100644 --- a/__tests__/lint/operation-2xx-response-warning/openapi.yaml +++ b/__tests__/lint/operation-2xx-response-warning/openapi.yaml @@ -1,6 +1,6 @@ openapi: 3.1.0 info: - title: Example OpenAPI 3 definition. + title: Example OpenAPI 3 definition. version: 1.0.0 paths: diff --git a/__tests__/lint/operation-4xx-problem-details-rfc7807/openapi.yaml b/__tests__/lint/operation-4xx-problem-details-rfc7807/openapi.yaml index 46de1fcfb..ea05d2bce 100644 --- a/__tests__/lint/operation-4xx-problem-details-rfc7807/openapi.yaml +++ b/__tests__/lint/operation-4xx-problem-details-rfc7807/openapi.yaml @@ -19,4 +19,4 @@ paths: type: type: string title: - type: string \ No newline at end of file + type: string diff --git a/__tests__/lint/operation-security-scheme-oas2-error/openapi.yaml b/__tests__/lint/operation-security-scheme-oas2-error/openapi.yaml index b3c86fb18..3bc8091f0 100644 --- a/__tests__/lint/operation-security-scheme-oas2-error/openapi.yaml +++ b/__tests__/lint/operation-security-scheme-oas2-error/openapi.yaml @@ -1,13 +1,13 @@ -swagger: "2.0" +swagger: '2.0' info: license: name: MIT url: 'https://opensource.org/licenses/MIT' - title: "Swagger Petstore" - description: "This is a sample" - version: "1.0.0" -host: "petstore.swagger.io" -basePath: "/v2" + title: 'Swagger Petstore' + description: 'This is a sample' + version: '1.0.0' +host: 'petstore.swagger.io' +basePath: '/v2' securityDefinitions: basicAuth: type: basic @@ -24,57 +24,57 @@ securityDefinitions: testProp: test oauthImplicit: type: oauth2 - authorizationUrl: "http://swagger.io/api/oauth/dialog" + authorizationUrl: 'http://swagger.io/api/oauth/dialog' flow: implicit description: oauth implicit - tokenUrl: "http://tokenUrl" + tokenUrl: 'http://tokenUrl' scopes: - "write:pets": "modify pets in your account" - "read:pets": "read your pets" + 'write:pets': 'modify pets in your account' + 'read:pets': 'read your pets' oauthAccessCode: type: oauth2 flow: accessCode - authorizationUrl: "http://swagger.io/api/oauth/dialog" - tokenUrl: "http://tokenUrl" + authorizationUrl: 'http://swagger.io/api/oauth/dialog' + tokenUrl: 'http://tokenUrl' description: access code name: accessCodeName scopes: - "write:pets": "modify pets in your account" - "read:pets": "read your pets" + 'write:pets': 'modify pets in your account' + 'read:pets': 'read your pets' oauthApplication: type: oauth2 flow: application - authorizationUrl: "http://swagger.io/api/oauth/dialog" - tokenUrl: "http://tokenUrl" + authorizationUrl: 'http://swagger.io/api/oauth/dialog' + tokenUrl: 'http://tokenUrl' description: oauth application scopes: - "write:pets": "modify pets in your account" - "read:pets": "read your pets" + 'write:pets': 'modify pets in your account' + 'read:pets': 'read your pets' oauthPassword: type: oauth2 flow: password - authorizationUrl: "http://swagger.io/api/oauth/dialog" - tokenUrl: "http://tokenUrl" + authorizationUrl: 'http://swagger.io/api/oauth/dialog' + tokenUrl: 'http://tokenUrl' description: oauth password scopes: - "write:pets": "modify pets in your account" - "read:pets": "read your pets" + 'write:pets': 'modify pets in your account' + 'read:pets': 'read your pets' paths: /pet: get: - summary: "Add a new pet to the store" - description: "" - operationId: "addPet" + summary: 'Add a new pet to the store' + description: '' + operationId: 'addPet' consumes: - - "application/json" - - "application/xml" + - 'application/json' + - 'application/xml' produces: - - "application/xml" - - "application/json" + - 'application/xml' + - 'application/json' responses: '201': description: Pet updated - "405": - description: "Invalid input" + '405': + description: 'Invalid input' security: - basicAuth: [] diff --git a/__tests__/lint/operation-security-scheme-oas2-error/snapshot.js b/__tests__/lint/operation-security-scheme-oas2-error/snapshot.js index f51db76d8..d6b32a167 100644 --- a/__tests__/lint/operation-security-scheme-oas2-error/snapshot.js +++ b/__tests__/lint/operation-security-scheme-oas2-error/snapshot.js @@ -53,10 +53,10 @@ The field \`tokenUrl\` is not allowed here. 28 | flow: implicit 29 | description: oauth implicit -30 | tokenUrl: "http://tokenUrl" +30 | tokenUrl: 'http://tokenUrl' | ^^^^^^^^ 31 | scopes: -32 | "write:pets": "modify pets in your account" +32 | 'write:pets': 'modify pets in your account' Error was generated by the spec rule. @@ -65,12 +65,12 @@ Error was generated by the spec rule. The field \`name\` is not allowed here. -38 | tokenUrl: "http://tokenUrl" +38 | tokenUrl: 'http://tokenUrl' 39 | description: access code 40 | name: accessCodeName | ^^^^ 41 | scopes: -42 | "write:pets": "modify pets in your account" +42 | 'write:pets': 'modify pets in your account' Error was generated by the spec rule. @@ -81,9 +81,9 @@ The field \`authorizationUrl\` is not allowed here. 45 | type: oauth2 46 | flow: application -47 | authorizationUrl: "http://swagger.io/api/oauth/dialog" +47 | authorizationUrl: 'http://swagger.io/api/oauth/dialog' | ^^^^^^^^^^^^^^^^ -48 | tokenUrl: "http://tokenUrl" +48 | tokenUrl: 'http://tokenUrl' 49 | description: oauth application Error was generated by the spec rule. @@ -95,9 +95,9 @@ The field \`authorizationUrl\` is not allowed here. 54 | type: oauth2 55 | flow: password -56 | authorizationUrl: "http://swagger.io/api/oauth/dialog" +56 | authorizationUrl: 'http://swagger.io/api/oauth/dialog' | ^^^^^^^^^^^^^^^^ -57 | tokenUrl: "http://tokenUrl" +57 | tokenUrl: 'http://tokenUrl' 58 | description: oauth password Error was generated by the spec rule. diff --git a/__tests__/lint/path-declaration-must-exist-error/openapi.yaml b/__tests__/lint/path-declaration-must-exist-error/openapi.yaml index 5d71e257a..8d9a49c9e 100644 --- a/__tests__/lint/path-declaration-must-exist-error/openapi.yaml +++ b/__tests__/lint/path-declaration-must-exist-error/openapi.yaml @@ -8,7 +8,7 @@ info: url: https://opensource.org/licenses/MIT servers: -- url: https://development.com/v1 + - url: https://development.com/v1 paths: '/api/user/{}/profie': diff --git a/__tests__/lint/path-segment-plural-error/openapi.yaml b/__tests__/lint/path-segment-plural-error/openapi.yaml index 9202479c3..5ca520950 100644 --- a/__tests__/lint/path-segment-plural-error/openapi.yaml +++ b/__tests__/lint/path-segment-plural-error/openapi.yaml @@ -18,7 +18,7 @@ paths: parameters: - name: Accept-Language in: header - description: "The language you prefer for messages" + description: 'The language you prefer for messages' example: en-US required: false schema: diff --git a/__tests__/lint/path-segment-plural/openapi.yaml b/__tests__/lint/path-segment-plural/openapi.yaml index c3cbea272..554664e80 100644 --- a/__tests__/lint/path-segment-plural/openapi.yaml +++ b/__tests__/lint/path-segment-plural/openapi.yaml @@ -18,7 +18,7 @@ paths: parameters: - name: Accept-Language in: header - description: "The language you prefer for messages" + description: 'The language you prefer for messages' example: en-US required: false schema: diff --git a/__tests__/lint/request-response-mime-type-oas2-error/openapi.yaml b/__tests__/lint/request-response-mime-type-oas2-error/openapi.yaml index 1df40315d..b55b750fa 100644 --- a/__tests__/lint/request-response-mime-type-oas2-error/openapi.yaml +++ b/__tests__/lint/request-response-mime-type-oas2-error/openapi.yaml @@ -1,16 +1,16 @@ -swagger: "2.0" +swagger: '2.0' info: - description: "This is a sample server Petstore server." - version: "1.0.0" - title: "Swagger Petstore" - termsOfService: "http://swagger.io/terms/" + description: 'This is a sample server Petstore server.' + version: '1.0.0' + title: 'Swagger Petstore' + termsOfService: 'http://swagger.io/terms/' contact: - email: "apiteam@swagger.io" + email: 'apiteam@swagger.io' license: - name: "Apache 2.0" - url: "http://www.apache.org/licenses/LICENSE-2.0.html" -host: "petstore.swagger.io" -basePath: "/v2" + name: 'Apache 2.0' + url: 'http://www.apache.org/licenses/LICENSE-2.0.html' +host: 'petstore.swagger.io' +basePath: '/v2' consumes: - application/json - multipart/form-data @@ -18,50 +18,50 @@ produces: - application/json - application/xml tags: - - name: "pet" - description: "Everything about your Pets" + - name: 'pet' + description: 'Everything about your Pets' externalDocs: - description: "Find out more" - url: "http://swagger.io" + description: 'Find out more' + url: 'http://swagger.io' schemes: - - "http" + - 'http' paths: /pet: post: tags: - - "pet" - summary: "Add a new pet to the store" - description: "post a pet to store" - operationId: "add_pet" + - 'pet' + summary: 'Add a new pet to the store' + description: 'post a pet to store' + operationId: 'add_pet' consumes: - - "application/xml" + - 'application/xml' produces: - - "application/xml" + - 'application/xml' parameters: - - in: "body" - name: "body" - description: "Pet object that needs to be added to the store" + - in: 'body' + name: 'body' + description: 'Pet object that needs to be added to the store' required: true schema: - $ref: "#/definitions/Pet" + $ref: '#/definitions/Pet' responses: 200: description: example description 405: - description: "Invalid input" + description: 'Invalid input' definitions: Pet: - type: "object" - description: "string" + type: 'object' + description: 'string' required: - - "name" - - "photo_urls" + - 'name' + - 'photo_urls' properties: id: - type: "integer" - format: "int64" - description: "string" + type: 'integer' + format: 'int64' + description: 'string' name: - type: "string" - example: "doggie" - description: "string" + type: 'string' + example: 'doggie' + description: 'string' diff --git a/__tests__/lint/request-response-mime-type-oas2-error/snapshot.js b/__tests__/lint/request-response-mime-type-oas2-error/snapshot.js index f7cf646cc..09e1937ff 100644 --- a/__tests__/lint/request-response-mime-type-oas2-error/snapshot.js +++ b/__tests__/lint/request-response-mime-type-oas2-error/snapshot.js @@ -7,12 +7,12 @@ validating /openapi.yaml... Mime type "multipart/form-data" is not allowed - 1 | swagger: "2.0" + 1 | swagger: '2.0' | ^^^^^^^^^^^^^^ 2 | info: | ^^^^^ … | < 64 more lines > -67 | description: "string" +67 | description: 'string' | ^^^^^^^^^^^^^^^^^^^^^ 68 | @@ -23,12 +23,12 @@ Error was generated by the request-mime-type rule. Mime type "application/xml" is not allowed - 1 | swagger: "2.0" + 1 | swagger: '2.0' | ^^^^^^^^^^^^^^ 2 | info: | ^^^^^ … | < 64 more lines > -67 | description: "string" +67 | description: 'string' | ^^^^^^^^^^^^^^^^^^^^^ 68 | @@ -44,7 +44,7 @@ Mime type "application/xml" is not allowed 30 | post: | ^^^^ 31 | tags: -32 | - "pet" +32 | - 'pet' Error was generated by the request-mime-type rule. @@ -58,7 +58,7 @@ Mime type "application/xml" is not allowed 30 | post: | ^^^^ 31 | tags: -32 | - "pet" +32 | - 'pet' Error was generated by the response-mime-type rule. diff --git a/__tests__/lint/request-response-mime-type-oas3-error/openapi.yaml b/__tests__/lint/request-response-mime-type-oas3-error/openapi.yaml index dfb6e34f9..6f1a7e96b 100644 --- a/__tests__/lint/request-response-mime-type-oas3-error/openapi.yaml +++ b/__tests__/lint/request-response-mime-type-oas3-error/openapi.yaml @@ -86,7 +86,7 @@ x-webhooks: type: string example: Guru responses: - "200": + '200': description: Return a 200 status content: application/xml: diff --git a/__tests__/lint/required-string-property-missing-min-length/openapi.yaml b/__tests__/lint/required-string-property-missing-min-length/openapi.yaml index 7a8631e20..891d66133 100644 --- a/__tests__/lint/required-string-property-missing-min-length/openapi.yaml +++ b/__tests__/lint/required-string-property-missing-min-length/openapi.yaml @@ -29,24 +29,23 @@ paths: application/json: schema: type: object - required: + required: - b - a - k properties: a: type: string - + b: type: object - k: + k: type: string minLength: 2 - c: + c: type: object - required: - - d - properties: + required: + - d + properties: d: type: string - \ No newline at end of file diff --git a/__tests__/lint/required-string-property-missing-min-length/snapshot.js b/__tests__/lint/required-string-property-missing-min-length/snapshot.js index 4f42f87d7..d54211b27 100644 --- a/__tests__/lint/required-string-property-missing-min-length/snapshot.js +++ b/__tests__/lint/required-string-property-missing-min-length/snapshot.js @@ -12,7 +12,7 @@ Property minLength is required. 37 | a: | ^ 38 | type: string -39 | +39 | Error was generated by the required-string-property-missing-min-length rule. @@ -21,12 +21,12 @@ Error was generated by the required-string-property-missing-min-length rule. Property minLength is required. -48 | - d -49 | properties: -50 | d: - | ^ -51 | type: string -52 | +48 | - d +49 | properties: +50 | d: + | ^ +51 | type: string +52 | Error was generated by the required-string-property-missing-min-length rule. diff --git a/__tests__/lint/spec-from/openapi.yaml b/__tests__/lint/spec-from/openapi.yaml index 89b1d5afb..2412bb672 100644 --- a/__tests__/lint/spec-from/openapi.yaml +++ b/__tests__/lint/spec-from/openapi.yaml @@ -10,4 +10,4 @@ components: TestSchema: title: TestSchema allOf: - - $ref: "#/components/requestBodies/TestRequestBody" \ No newline at end of file + - $ref: '#/components/requestBodies/TestRequestBody' diff --git a/__tests__/lint/spec-from/snapshot.js b/__tests__/lint/spec-from/snapshot.js index f448b0039..961d45a28 100644 --- a/__tests__/lint/spec-from/snapshot.js +++ b/__tests__/lint/spec-from/snapshot.js @@ -12,8 +12,9 @@ The field \`paths\` must be present on this level. 2 | components: | ^^^^^^^^^^^ … | < 10 more lines > -13 | - $ref: "#/components/requestBodies/TestRequestBody" +13 | - $ref: '#/components/requestBodies/TestRequestBody' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +14 | Error was generated by the spec rule. @@ -27,8 +28,9 @@ The field \`info\` must be present on this level. 2 | components: | ^^^^^^^^^^^ … | < 10 more lines > -13 | - $ref: "#/components/requestBodies/TestRequestBody" +13 | - $ref: '#/components/requestBodies/TestRequestBody' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +14 | Error was generated by the spec rule. diff --git a/__tests__/split/missing-outDir/spec.json b/__tests__/split/missing-outDir/spec.json index c97f44ef2..b2990dd2c 100644 --- a/__tests__/split/missing-outDir/spec.json +++ b/__tests__/split/missing-outDir/spec.json @@ -1,3 +1,3 @@ { "openapi": "3.0.1" -} \ No newline at end of file +} diff --git a/__tests__/split/oas2/openapi.yaml b/__tests__/split/oas2/openapi.yaml index 4aa859b70..bc82411b8 100644 --- a/__tests__/split/oas2/openapi.yaml +++ b/__tests__/split/oas2/openapi.yaml @@ -1,45 +1,45 @@ -swagger: "2.0" -info: - version: "1.0.0" - title: "Swagger Petstore" - 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/" - contact: - name: "Swagger API Team" - license: - name: "MIT" -host: "petstore.swagger.io" -basePath: "/api" -schemes: - - "http" -consumes: - - "application/json" -produces: - - "application/json" -paths: - /pets: - get: - description: "Returns all pets from the system that the user has access to" - produces: - - "application/json" - responses: - "200": - description: "A list of pets." - schema: - type: "array" - items: - $ref: "#/definitions/Pet" -definitions: - Pet: - type: "object" - required: - - "id" - - "name" - properties: - id: - type: "integer" - format: "int64" - name: - type: "string" - tag: - type: "string" +swagger: '2.0' +info: + version: '1.0.0' + title: 'Swagger Petstore' + 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/' + contact: + name: 'Swagger API Team' + license: + name: 'MIT' +host: 'petstore.swagger.io' +basePath: '/api' +schemes: + - 'http' +consumes: + - 'application/json' +produces: + - 'application/json' +paths: + /pets: + get: + description: 'Returns all pets from the system that the user has access to' + produces: + - 'application/json' + responses: + '200': + description: 'A list of pets.' + schema: + type: 'array' + items: + $ref: '#/definitions/Pet' +definitions: + Pet: + type: 'object' + required: + - 'id' + - 'name' + properties: + id: + type: 'integer' + format: 'int64' + name: + type: 'string' + tag: + type: 'string' diff --git a/__tests__/split/oas3-no-errors/openapi.yaml b/__tests__/split/oas3-no-errors/openapi.yaml index b935ceff2..b02a0d254 100644 --- a/__tests__/split/oas3-no-errors/openapi.yaml +++ b/__tests__/split/oas3-no-errors/openapi.yaml @@ -1,4 +1,4 @@ -openapi: "3.0.0" +openapi: '3.0.0' info: version: 1.0.0 title: Swagger Petstore @@ -30,15 +30,15 @@ paths: schema: type: string content: - application/json: + application/json: schema: - $ref: "#/components/schemas/Pets" + $ref: '#/components/schemas/Pets' default: description: unexpected error content: application/json: schema: - $ref: "#/components/schemas/Error" + $ref: '#/components/schemas/Error' post: summary: Create a pet operationId: createPets @@ -52,7 +52,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/Error" + $ref: '#/components/schemas/Error' /pets/{petId}: get: summary: Info for a specific pet @@ -72,13 +72,13 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/Pet" + $ref: '#/components/schemas/Pet' default: description: unexpected error content: application/json: schema: - $ref: "#/components/schemas/Error" + $ref: '#/components/schemas/Error' components: schemas: Pet: @@ -97,7 +97,7 @@ components: Pets: type: array items: - $ref: "#/components/schemas/Pet" + $ref: '#/components/schemas/Pet' Error: type: object required: @@ -108,4 +108,4 @@ components: type: integer format: int32 message: - type: string \ No newline at end of file + type: string diff --git a/__tests__/split/slash-separator/openapi.yaml b/__tests__/split/slash-separator/openapi.yaml index b935ceff2..b02a0d254 100644 --- a/__tests__/split/slash-separator/openapi.yaml +++ b/__tests__/split/slash-separator/openapi.yaml @@ -1,4 +1,4 @@ -openapi: "3.0.0" +openapi: '3.0.0' info: version: 1.0.0 title: Swagger Petstore @@ -30,15 +30,15 @@ paths: schema: type: string content: - application/json: + application/json: schema: - $ref: "#/components/schemas/Pets" + $ref: '#/components/schemas/Pets' default: description: unexpected error content: application/json: schema: - $ref: "#/components/schemas/Error" + $ref: '#/components/schemas/Error' post: summary: Create a pet operationId: createPets @@ -52,7 +52,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/Error" + $ref: '#/components/schemas/Error' /pets/{petId}: get: summary: Info for a specific pet @@ -72,13 +72,13 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/Pet" + $ref: '#/components/schemas/Pet' default: description: unexpected error content: application/json: schema: - $ref: "#/components/schemas/Error" + $ref: '#/components/schemas/Error' components: schemas: Pet: @@ -97,7 +97,7 @@ components: Pets: type: array items: - $ref: "#/components/schemas/Pet" + $ref: '#/components/schemas/Pet' Error: type: object required: @@ -108,4 +108,4 @@ components: type: integer format: int32 message: - type: string \ No newline at end of file + type: string diff --git a/docs/configuration/api.yaml b/docs/configuration/api.yaml index e9177107d..dfad7d5f5 100644 --- a/docs/configuration/api.yaml +++ b/docs/configuration/api.yaml @@ -4,7 +4,7 @@ description: >- Lets you configure one or more API definition files. This gives you the flexibility to reference specific files in commands, and configure each file at a granular level. additionalProperties: - x-additionalPropertiesName: "{name}@{version}" + x-additionalPropertiesName: '{name}@{version}' type: object title: API object minItems: 1 diff --git a/docs/configuration/schema.yaml b/docs/configuration/schema.yaml index 40c458fb3..5def91421 100644 --- a/docs/configuration/schema.yaml +++ b/docs/configuration/schema.yaml @@ -43,7 +43,7 @@ properties: Lets you configure one or more API definition files. This gives you the flexibility to reference specific files in commands, and configure each file at a granular level. additionalProperties: - x-additionalPropertiesName: "{name}@{version}" + x-additionalPropertiesName: '{name}@{version}' type: object minItems: 1 required: diff --git a/package.json b/package.json index df8e58b3d..409e67fc3 100644 --- a/package.json +++ b/package.json @@ -15,8 +15,8 @@ "coverage:core": "jest --roots packages/core/src --coverage", "typecheck": "tsc --noEmit --skipLibCheck", "e2e": "npm run webpack-bundle -- --mode=none && jest --roots=./__tests__/", - "prettier": "npx prettier --write \"**/*.{ts,js}\"", - "prettier:check": "npx prettier --check \"**/*.{ts,js}\"", + "prettier": "npx prettier --write \"**/*.{ts,js,yaml,json}\"", + "prettier:check": "npx prettier --check \"**/*.{ts,js,yaml,json}\"", "eslint": "eslint packages/**", "clean": "rm -rf packages/**/lib packages/**/node_modules packages/**/*.tsbuildinfo package-lock.json node_modules", "watch": "tsc -b tsconfig.build.json --watch ", diff --git a/packages/cli/src/commands/split/__tests__/fixtures/spec.json b/packages/cli/src/commands/split/__tests__/fixtures/spec.json index 1c9a9245b..1d0db9231 100644 --- a/packages/cli/src/commands/split/__tests__/fixtures/spec.json +++ b/packages/cli/src/commands/split/__tests__/fixtures/spec.json @@ -67,4 +67,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/cli/src/commands/split/__tests__/fixtures/webhooks.json b/packages/cli/src/commands/split/__tests__/fixtures/webhooks.json index 8a78ac36b..0686aa300 100644 --- a/packages/cli/src/commands/split/__tests__/fixtures/webhooks.json +++ b/packages/cli/src/commands/split/__tests__/fixtures/webhooks.json @@ -60,10 +60,7 @@ "components": { "schemas": { "Pet": { - "required": [ - "id", - "name" - ], + "required": ["id", "name"], "properties": { "id": { "type": "integer", @@ -85,4 +82,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/core/src/__tests__/fixtures/refs/definitions.yaml b/packages/core/src/__tests__/fixtures/refs/definitions.yaml index 95c5c8de3..d5b72df24 100644 --- a/packages/core/src/__tests__/fixtures/refs/definitions.yaml +++ b/packages/core/src/__tests__/fixtures/refs/definitions.yaml @@ -1,3 +1,3 @@ $defs: A: - type: string \ No newline at end of file + type: string diff --git a/packages/core/src/__tests__/fixtures/refs/external-request-body.yaml b/packages/core/src/__tests__/fixtures/refs/external-request-body.yaml index 74e29e6bf..c4878e528 100644 --- a/packages/core/src/__tests__/fixtures/refs/external-request-body.yaml +++ b/packages/core/src/__tests__/fixtures/refs/external-request-body.yaml @@ -10,4 +10,4 @@ paths: components: schemas: requestBody: - $ref: ./requestBody.yaml \ No newline at end of file + $ref: ./requestBody.yaml diff --git a/packages/core/src/__tests__/fixtures/refs/externalref.yaml b/packages/core/src/__tests__/fixtures/refs/externalref.yaml index cdf876dd9..43e81d929 100644 --- a/packages/core/src/__tests__/fixtures/refs/externalref.yaml +++ b/packages/core/src/__tests__/fixtures/refs/externalref.yaml @@ -1,35 +1,35 @@ -openapi: 3.1.0 -info: - title: My API - description: It ain't so wonderful, but at least it's mine. - version: '1.0' - contact: - email: me@theintenet.com - name: me -paths: - /test: - get: - summary: 'test' - responses: - 200: - description: test - content: - application/json: - schema: - $ref: ./vendor.schema.yaml -components: - schemas: - vendor: - $ref: ./vendor.schema.yaml - myvendor: - $ref: ./vendor.schema.yaml - simple: - $ref: ./simple.yaml - A: - $ref: ./definitions.yaml#/$defs/A - test: - $ref: ./rename.yaml - rename: - type: string - rename-2: - $ref: ./rename.yaml \ No newline at end of file +openapi: 3.1.0 +info: + title: My API + description: It ain't so wonderful, but at least it's mine. + version: '1.0' + contact: + email: me@theintenet.com + name: me +paths: + /test: + get: + summary: 'test' + responses: + 200: + description: test + content: + application/json: + schema: + $ref: ./vendor.schema.yaml +components: + schemas: + vendor: + $ref: ./vendor.schema.yaml + myvendor: + $ref: ./vendor.schema.yaml + simple: + $ref: ./simple.yaml + A: + $ref: ./definitions.yaml#/$defs/A + test: + $ref: ./rename.yaml + rename: + type: string + rename-2: + $ref: ./rename.yaml diff --git a/packages/core/src/__tests__/fixtures/refs/hosted.yaml b/packages/core/src/__tests__/fixtures/refs/hosted.yaml index de4c1427f..6970a0917 100644 --- a/packages/core/src/__tests__/fixtures/refs/hosted.yaml +++ b/packages/core/src/__tests__/fixtures/refs/hosted.yaml @@ -1,7 +1,7 @@ -openapi: "3.0.3" +openapi: '3.0.3' info: title: bugtest - version: "1.0" + version: '1.0' description: Demo license: name: DEMO @@ -10,20 +10,20 @@ servers: - url: http://demo.com/api paths: /customer: - summary: "Customer scope" + summary: 'Customer scope' get: - summary: "Get demo no refs" + summary: 'Get demo no refs' operationId: GetCustomer - description: "Returns Demo No Refs" + description: 'Returns Demo No Refs' responses: 200: description: Demo No Refs content: application/json: schema: - $ref: "#/components/schemas/Customer" + $ref: '#/components/schemas/Customer' components: - schemas: + schemas: Customer: type: object properties: @@ -32,4 +32,4 @@ components: accounts: type: array items: - $ref: "https://someexternal.schema" \ No newline at end of file + $ref: 'https://someexternal.schema' diff --git a/packages/core/src/__tests__/fixtures/refs/openapi-with-external-refs-conflicting-names.yaml b/packages/core/src/__tests__/fixtures/refs/openapi-with-external-refs-conflicting-names.yaml index 0f9812bb3..9265ff395 100644 --- a/packages/core/src/__tests__/fixtures/refs/openapi-with-external-refs-conflicting-names.yaml +++ b/packages/core/src/__tests__/fixtures/refs/openapi-with-external-refs-conflicting-names.yaml @@ -18,4 +18,4 @@ components: param-b: name: param_b_alt path-param: - name: path_param \ No newline at end of file + name: path_param diff --git a/packages/core/src/__tests__/fixtures/refs/openapi-with-external-refs.yaml b/packages/core/src/__tests__/fixtures/refs/openapi-with-external-refs.yaml index 80dfb5489..7bc97f2bd 100644 --- a/packages/core/src/__tests__/fixtures/refs/openapi-with-external-refs.yaml +++ b/packages/core/src/__tests__/fixtures/refs/openapi-with-external-refs.yaml @@ -30,4 +30,4 @@ components: name: path_param examples: first: - $ref: ./examples.yaml#/path-param/first \ No newline at end of file + $ref: ./examples.yaml#/path-param/first diff --git a/packages/core/src/__tests__/fixtures/refs/rename.yaml b/packages/core/src/__tests__/fixtures/refs/rename.yaml index bf324a701..71228528a 100644 --- a/packages/core/src/__tests__/fixtures/refs/rename.yaml +++ b/packages/core/src/__tests__/fixtures/refs/rename.yaml @@ -1 +1 @@ -type: number \ No newline at end of file +type: number diff --git a/packages/core/src/__tests__/fixtures/refs/requestBody.yaml b/packages/core/src/__tests__/fixtures/refs/requestBody.yaml index ff3161833..0f3017357 100644 --- a/packages/core/src/__tests__/fixtures/refs/requestBody.yaml +++ b/packages/core/src/__tests__/fixtures/refs/requestBody.yaml @@ -1,9 +1,9 @@ -content: - application/json: - schema: +content: + application/json: + schema: type: object - properties: + properties: a: type: string b: - type: number \ No newline at end of file + type: number diff --git a/packages/core/src/__tests__/fixtures/refs/schema-a.yaml b/packages/core/src/__tests__/fixtures/refs/schema-a.yaml index 2d8bb0e0f..5c21d88b9 100644 --- a/packages/core/src/__tests__/fixtures/refs/schema-a.yaml +++ b/packages/core/src/__tests__/fixtures/refs/schema-a.yaml @@ -1 +1 @@ -type: string \ No newline at end of file +type: string diff --git a/packages/core/src/__tests__/fixtures/refs/simple.yaml b/packages/core/src/__tests__/fixtures/refs/simple.yaml index 2d8bb0e0f..5c21d88b9 100644 --- a/packages/core/src/__tests__/fixtures/refs/simple.yaml +++ b/packages/core/src/__tests__/fixtures/refs/simple.yaml @@ -1 +1 @@ -type: string \ No newline at end of file +type: string diff --git a/packages/core/src/__tests__/fixtures/refs/vendor.schema.yaml b/packages/core/src/__tests__/fixtures/refs/vendor.schema.yaml index a053adbf4..07b6bf366 100644 --- a/packages/core/src/__tests__/fixtures/refs/vendor.schema.yaml +++ b/packages/core/src/__tests__/fixtures/refs/vendor.schema.yaml @@ -1,20 +1,20 @@ -title: vendor -type: object -description: Vendors -properties: - key: - type: string - description: System-assigned key for the vendor. - readOnly: true - id: - type: string - description: | - Unique identifier of the vendor. - You must specify a unique vendor ID when creating a vendor unless document sequencing is configured, in which case the ID is auto-generated. - name: - type: string - description: Name of the vendor. - isOneTimeUse: - type: boolean - description: One-time use - default: false +title: vendor +type: object +description: Vendors +properties: + key: + type: string + description: System-assigned key for the vendor. + readOnly: true + id: + type: string + description: | + Unique identifier of the vendor. + You must specify a unique vendor ID when creating a vendor unless document sequencing is configured, in which case the ID is auto-generated. + name: + type: string + description: Name of the vendor. + isOneTimeUse: + type: boolean + description: One-time use + default: false diff --git a/packages/core/src/__tests__/fixtures/resolve/External.yaml b/packages/core/src/__tests__/fixtures/resolve/External.yaml index a639c6df5..0868b013e 100644 --- a/packages/core/src/__tests__/fixtures/resolve/External.yaml +++ b/packages/core/src/__tests__/fixtures/resolve/External.yaml @@ -7,4 +7,4 @@ properties: external: $ref: ./External2.yaml unknown: - type: string \ No newline at end of file + type: string diff --git a/packages/core/src/__tests__/fixtures/resolve/External2.yaml b/packages/core/src/__tests__/fixtures/resolve/External2.yaml index 97b42339d..58cc7ac7b 100644 --- a/packages/core/src/__tests__/fixtures/resolve/External2.yaml +++ b/packages/core/src/__tests__/fixtures/resolve/External2.yaml @@ -1,4 +1,4 @@ type: object properties: circularParent: - $ref: ./External.yaml#/properties \ No newline at end of file + $ref: ./External.yaml#/properties diff --git a/packages/core/src/__tests__/fixtures/resolve/description.md b/packages/core/src/__tests__/fixtures/resolve/description.md index 11357f8b7..af1f2fc70 100644 --- a/packages/core/src/__tests__/fixtures/resolve/description.md +++ b/packages/core/src/__tests__/fixtures/resolve/description.md @@ -1,3 +1,3 @@ # Hello World -Lorem ipsum \ No newline at end of file +Lorem ipsum diff --git a/packages/core/src/__tests__/fixtures/resolve/externalInfo.yaml b/packages/core/src/__tests__/fixtures/resolve/externalInfo.yaml index 706728510..9c6e2fe39 100644 --- a/packages/core/src/__tests__/fixtures/resolve/externalInfo.yaml +++ b/packages/core/src/__tests__/fixtures/resolve/externalInfo.yaml @@ -1,4 +1,4 @@ info: contact: {} license: - $ref: ./externalLicense.yaml \ No newline at end of file + $ref: ./externalLicense.yaml diff --git a/packages/core/src/__tests__/fixtures/resolve/openapi-with-back.yaml b/packages/core/src/__tests__/fixtures/resolve/openapi-with-back.yaml index 9d0352437..1e580d603 100644 --- a/packages/core/src/__tests__/fixtures/resolve/openapi-with-back.yaml +++ b/packages/core/src/__tests__/fixtures/resolve/openapi-with-back.yaml @@ -1,4 +1,4 @@ -openapi: "3.0.1" +openapi: '3.0.1' info: title: Open API description: Open API @@ -10,4 +10,4 @@ components: TypeA: $ref: ./schemas/type-a.yaml#/ TypeB: - $ref: ./schemas/type-b.yaml#/ \ No newline at end of file + $ref: ./schemas/type-b.yaml#/ diff --git a/packages/core/src/__tests__/fixtures/resolve/openapi-with-md-description.yaml b/packages/core/src/__tests__/fixtures/resolve/openapi-with-md-description.yaml index 322d13aa8..53f248eef 100644 --- a/packages/core/src/__tests__/fixtures/resolve/openapi-with-md-description.yaml +++ b/packages/core/src/__tests__/fixtures/resolve/openapi-with-md-description.yaml @@ -2,4 +2,4 @@ openapi: 3.0.0 info: description: $ref: ./description.md -paths: {} \ No newline at end of file +paths: {} diff --git a/packages/core/src/__tests__/fixtures/resolve/openapi.yaml b/packages/core/src/__tests__/fixtures/resolve/openapi.yaml index ef16ba3ea..55d688436 100644 --- a/packages/core/src/__tests__/fixtures/resolve/openapi.yaml +++ b/packages/core/src/__tests__/fixtures/resolve/openapi.yaml @@ -25,4 +25,4 @@ components: string: type: string localCircular: - $ref: '#/components/schemas/Local' \ No newline at end of file + $ref: '#/components/schemas/Local' diff --git a/packages/core/src/__tests__/fixtures/resolve/schemas/type-a.yaml b/packages/core/src/__tests__/fixtures/resolve/schemas/type-a.yaml index 1e75deb7c..158cf3651 100644 --- a/packages/core/src/__tests__/fixtures/resolve/schemas/type-a.yaml +++ b/packages/core/src/__tests__/fixtures/resolve/schemas/type-a.yaml @@ -5,6 +5,6 @@ allOf: - integration_type properties: integration_type: - $ref: "../openapi-with-back.yaml#/components/schemas/TypeB" + $ref: '../openapi-with-back.yaml#/components/schemas/TypeB' name: - type: string \ No newline at end of file + type: string diff --git a/packages/core/src/__tests__/fixtures/resolve/schemas/type-b.yaml b/packages/core/src/__tests__/fixtures/resolve/schemas/type-b.yaml index 179023e33..4ccafd379 100644 --- a/packages/core/src/__tests__/fixtures/resolve/schemas/type-b.yaml +++ b/packages/core/src/__tests__/fixtures/resolve/schemas/type-b.yaml @@ -3,4 +3,4 @@ enum: - webhook - api_key - sftp - - netsuite \ No newline at end of file + - netsuite diff --git a/packages/core/src/__tests__/fixtures/resolve/transitive/a.yaml b/packages/core/src/__tests__/fixtures/resolve/transitive/a.yaml index 2d8bb0e0f..5c21d88b9 100644 --- a/packages/core/src/__tests__/fixtures/resolve/transitive/a.yaml +++ b/packages/core/src/__tests__/fixtures/resolve/transitive/a.yaml @@ -1 +1 @@ -type: string \ No newline at end of file +type: string diff --git a/packages/core/src/__tests__/fixtures/resolve/transitive/components.yaml b/packages/core/src/__tests__/fixtures/resolve/transitive/components.yaml index 776a3e6d7..e3d0b36a8 100644 --- a/packages/core/src/__tests__/fixtures/resolve/transitive/components.yaml +++ b/packages/core/src/__tests__/fixtures/resolve/transitive/components.yaml @@ -2,4 +2,4 @@ components: schemas: $ref: ./schemas.yaml#/schemas shouldNotCrash: - $ref: ./schemas.yaml#invalid-hash-fragment \ No newline at end of file + $ref: ./schemas.yaml#invalid-hash-fragment diff --git a/packages/core/src/__tests__/fixtures/resolve/transitive/schemas.yaml b/packages/core/src/__tests__/fixtures/resolve/transitive/schemas.yaml index c505bf778..364266520 100644 --- a/packages/core/src/__tests__/fixtures/resolve/transitive/schemas.yaml +++ b/packages/core/src/__tests__/fixtures/resolve/transitive/schemas.yaml @@ -1,3 +1,3 @@ schemas: a: - $ref: a.yaml \ No newline at end of file + $ref: a.yaml diff --git a/packages/core/src/__tests__/resolve.test.ts b/packages/core/src/__tests__/resolve.test.ts index a9ad83f98..aa4d35a27 100644 --- a/packages/core/src/__tests__/resolve.test.ts +++ b/packages/core/src/__tests__/resolve.test.ts @@ -374,7 +374,8 @@ describe('collect refs', () => { Array [ "# Hello World - Lorem ipsum", + Lorem ipsum + ", ] `); }); diff --git a/packages/core/src/benchmark/benches/rebilly.yaml b/packages/core/src/benchmark/benches/rebilly.yaml index 61bd67761..08525375d 100644 --- a/packages/core/src/benchmark/benches/rebilly.yaml +++ b/packages/core/src/benchmark/benches/rebilly.yaml @@ -1567,7 +1567,7 @@ components: allOf: - $ref: '#/components/schemas/ResourceId' name: - description: 'The tag''s unique name, which is case-insensitive.' + description: "The tag's unique name, which is case-insensitive." type: string maxLength: 255 pattern: '^[@~\-\.\w\s]+$' @@ -1628,10 +1628,10 @@ components: type: object properties: medium: - description: 'Lead Source''s medium (eg search, display)' + description: "Lead Source's medium (eg search, display)" type: string source: - description: 'Lead Source''s source (eg google, yahoo)' + description: "Lead Source's source (eg google, yahoo)" type: string campaign: description: Lead Source's campaign (eg go-big-123) @@ -1643,7 +1643,7 @@ components: description: Lead Source's content (eg smiley faces) type: string affiliate: - description: 'Lead Source''s affiliate (eg 123, Bob Smith)' + description: "Lead Source's affiliate (eg 123, Bob Smith)" type: string subAffiliate: description: >- @@ -2952,7 +2952,7 @@ components: format: double example: 99.95 maxQuantity: - description: 'If the value is `null`, it''s assumed to be infinite.' + description: "If the value is `null`, it's assumed to be infinite." type: integer example: 1 stairstep: @@ -2995,7 +2995,7 @@ components: type: object properties: price: - description: 'If the price is 0, it''s free.' + description: "If the price is 0, it's free." type: number format: double example: 99.95 @@ -3047,7 +3047,7 @@ components: type: object properties: price: - description: 'If the price is 0, it''s free.' + description: "If the price is 0, it's free." type: number format: double example: 99.95 @@ -3099,7 +3099,7 @@ components: type: object properties: price: - description: 'If the price is 0, it''s free.' + description: "If the price is 0, it's free." type: number format: double example: 99.95 @@ -3724,7 +3724,7 @@ components: readOnly: true type: integer subscriptionId: - description: 'The related subscription''s ID if available, otherwise null.' + description: "The related subscription's ID if available, otherwise null." readOnly: true allOf: - $ref: '#/components/schemas/ResourceId' @@ -4863,10 +4863,10 @@ components: description: The gateway's response type type: string originalCode: - description: 'The raw, unmapped gateway''s response code' + description: "The raw, unmapped gateway's response code" type: string originalMessage: - description: 'The raw, unmapped gateway''s response message' + description: "The raw, unmapped gateway's response message" type: string avsResponse: description: The AVS gateway's response @@ -14948,7 +14948,7 @@ components: description: The user mobile phone number type: string password: - description: 'User''s password. If not provided, password reset email will be sent' + description: "User's password. If not provided, password reset email will be sent" type: string format: password permissions: diff --git a/packages/core/src/config/__tests__/fixtures/load-redocly.yaml b/packages/core/src/config/__tests__/fixtures/load-redocly.yaml index 96e410691..beddb0af6 100644 --- a/packages/core/src/config/__tests__/fixtures/load-redocly.yaml +++ b/packages/core/src/config/__tests__/fixtures/load-redocly.yaml @@ -1,2 +1,2 @@ - rules: - info-contact: warn +rules: + info-contact: warn diff --git a/packages/core/src/rules/__tests__/fixtures/ref.yaml b/packages/core/src/rules/__tests__/fixtures/ref.yaml index 7ae63cb9a..4857bf604 100644 --- a/packages/core/src/rules/__tests__/fixtures/ref.yaml +++ b/packages/core/src/rules/__tests__/fixtures/ref.yaml @@ -1 +1 @@ -test: 1 \ No newline at end of file +test: 1 diff --git a/packages/core/src/rules/oas2/__tests__/spec/fixtures/description.md b/packages/core/src/rules/oas2/__tests__/spec/fixtures/description.md index 5ab2f8a43..e965047ad 100644 --- a/packages/core/src/rules/oas2/__tests__/spec/fixtures/description.md +++ b/packages/core/src/rules/oas2/__tests__/spec/fixtures/description.md @@ -1 +1 @@ -Hello \ No newline at end of file +Hello diff --git a/packages/core/src/rules/oas3/__tests__/fixtures/common.yaml b/packages/core/src/rules/oas3/__tests__/fixtures/common.yaml index 3f36f79ec..c1a28f0b9 100644 --- a/packages/core/src/rules/oas3/__tests__/fixtures/common.yaml +++ b/packages/core/src/rules/oas3/__tests__/fixtures/common.yaml @@ -8,4 +8,4 @@ components: b: $ref: '#/components/schemas/B' B: - type: string \ No newline at end of file + type: string diff --git a/packages/core/src/rules/oas3/__tests__/spec/fixtures/description.md b/packages/core/src/rules/oas3/__tests__/spec/fixtures/description.md index 5ab2f8a43..e965047ad 100644 --- a/packages/core/src/rules/oas3/__tests__/spec/fixtures/description.md +++ b/packages/core/src/rules/oas3/__tests__/spec/fixtures/description.md @@ -1 +1 @@ -Hello \ No newline at end of file +Hello diff --git a/resources/.redocly.yaml b/resources/.redocly.yaml index 0e008414c..2c5194444 100644 --- a/resources/.redocly.yaml +++ b/resources/.redocly.yaml @@ -4,4 +4,4 @@ apis: decorators: {} extends: [] extends: - - recommended \ No newline at end of file + - recommended diff --git a/resources/description.md b/resources/description.md index ff8f46289..e44f87a12 100644 --- a/resources/description.md +++ b/resources/description.md @@ -1,3 +1,3 @@ # Hello World -Test \ No newline at end of file +Test diff --git a/resources/pets.yaml b/resources/pets.yaml index 8414ac3c3..1bb29e728 100644 --- a/resources/pets.yaml +++ b/resources/pets.yaml @@ -88,7 +88,7 @@ paths: parameters: - name: Accept-Language in: header - description: "The language you prefer for messages. Supported values are en-AU, en-CA, en-GB, en-US" + description: 'The language you prefer for messages. Supported values are en-AU, en-CA, en-GB, en-US' example: en-US required: false schema: @@ -254,7 +254,7 @@ paths: required: false schema: type: string - example: "Bearer " + example: 'Bearer ' - name: petId in: path description: Pet id to delete @@ -427,7 +427,7 @@ paths: application/json: example: status: 400 - message: "Invalid Order" + message: 'Invalid Order' requestBody: content: application/json: @@ -875,11 +875,11 @@ paths: type: string examples: response: - value: OK + value: OK text/plain: examples: response: - value: OK + value: OK '400': description: Invalid username/password supplied /user/logout: @@ -1025,8 +1025,8 @@ components: properties: id: externalDocs: - description: "Find more info here" - url: "https://example.com" + description: 'Find more info here' + url: 'https://example.com' description: Pet ID allOf: - $ref: '#/components/schemas/Id' @@ -1199,7 +1199,7 @@ x-webhooks: content: application/json: schema: - $ref: "#/components/schemas/Pet" + $ref: '#/components/schemas/Pet' responses: - "200": + '200': description: Return a 200 status to indicate that the data was received successfully diff --git a/resources/petstore-with-errors.yaml b/resources/petstore-with-errors.yaml index 4e2e8f4d2..24dafe0ae 100644 --- a/resources/petstore-with-errors.yaml +++ b/resources/petstore-with-errors.yaml @@ -1,5 +1,4 @@ - -openapi: "3.0.0" +openapi: '3.0.0' info: version: 1.0.0 title: Swagger Petstore @@ -29,12 +28,12 @@ paths: type: number example: summary: A foo example - value: {"foo": "bar"} + value: { 'foo': 'bar' } externalValue: 'http://example.org/foo.json' examples: foo: summary: A foo example - value: {"foo": "bar"} + value: { 'foo': 'bar' } externalValue: 'http://example.org/foo.json' tags: - pets @@ -63,13 +62,13 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/Pets" + $ref: '#/components/schemas/Pets' default: description: unexpected error content: application/json: schema: - $ref: "#/components/schemas/Error" + $ref: '#/components/schemas/Error' post: summary: Create a pet description: afasf @@ -84,7 +83,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/Error" + $ref: '#/components/schemas/Error' /pets/{petId}/TesSt: get: summary: Info for a specific pet @@ -105,13 +104,13 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/Pet" + $ref: '#/components/schemas/Pet' default: description: unexpected error content: application/json: schema: - $ref: "#/components/schemas/Error" + $ref: '#/components/schemas/Error' components: parameters: anotherParam: @@ -142,7 +141,7 @@ components: Pets: type: array items: - $ref: "#/components/schemas/Pet" + $ref: '#/components/schemas/Pet' Error: type: object required: @@ -153,4 +152,4 @@ components: type: integer format: int32 message: - type: string \ No newline at end of file + type: string