From 0991085b89361612d6722d0b7b1d1dcae8476b8f Mon Sep 17 00:00:00 2001 From: kriptoburak Date: Thu, 2 Jul 2026 17:00:00 +0300 Subject: [PATCH 1/2] test: add Xquik OpenAPI 3.1 fixture --- test/specs/xquik/xquik-openapi.yaml | 54 +++++++++++++++++++++++++++++ test/specs/xquik/xquik.spec.js | 21 +++++++++++ 2 files changed, 75 insertions(+) create mode 100644 test/specs/xquik/xquik-openapi.yaml create mode 100644 test/specs/xquik/xquik.spec.js diff --git a/test/specs/xquik/xquik-openapi.yaml b/test/specs/xquik/xquik-openapi.yaml new file mode 100644 index 00000000..62f470d8 --- /dev/null +++ b/test/specs/xquik/xquik-openapi.yaml @@ -0,0 +1,54 @@ +openapi: 3.1.0 +info: + title: Xquik API + version: "1.0" +servers: + - url: https://xquik.com +paths: + /api/v1/x/tweets/search: + get: + operationId: searchTweets + parameters: + - name: q + in: query + required: true + schema: + type: string + responses: + "200": + description: Search results. + content: + application/json: + schema: + $ref: "#/components/schemas/SearchTweetsResponse" + security: + - apiKey: [] +components: + securitySchemes: + apiKey: + type: apiKey + in: header + name: X-API-Key + schemas: + SearchTweetsResponse: + type: object + required: + - data + properties: + data: + type: array + items: + $ref: "#/components/schemas/Tweet" + Tweet: + type: object + required: + - id + - text + - authorUsername + properties: + id: + type: string + text: + type: string + authorUsername: + type: string diff --git a/test/specs/xquik/xquik.spec.js b/test/specs/xquik/xquik.spec.js new file mode 100644 index 00000000..65c4ca2f --- /dev/null +++ b/test/specs/xquik/xquik.spec.js @@ -0,0 +1,21 @@ +"use strict"; + +const { expect } = require("chai"); +const SwaggerParser = require("../../.."); +const path = require("../../utils/path"); + +describe("Xquik OpenAPI 3.1 fixture", () => { + it("validates the search endpoint and API key security scheme", async () => { + const api = await SwaggerParser.validate(path.rel("specs/xquik/xquik-openapi.yaml")); + const operation = api.paths["/api/v1/x/tweets/search"].get; + const scheme = api.components.securitySchemes.apiKey; + + expect(api.openapi).to.equal("3.1.0"); + expect(api.info.title).to.equal("Xquik API"); + expect(operation.operationId).to.equal("searchTweets"); + expect(operation.responses["200"].description).to.equal("Search results."); + expect(scheme.type).to.equal("apiKey"); + expect(scheme.in).to.equal("header"); + expect(scheme.name).to.equal("X-API-Key"); + }); +}); From f3cb675322bf662c895a6a8ccb274aa84187b83e Mon Sep 17 00:00:00 2001 From: kriptoburak Date: Sat, 18 Jul 2026 11:53:01 +0300 Subject: [PATCH 2/2] test: repair API documentation links --- README.md | 12 ++++++------ test/specs/xquik/xquik-openapi.yaml | 2 +- test/specs/xquik/xquik.spec.js | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index d2e8b27c..ef6f97f7 100644 --- a/README.md +++ b/README.md @@ -15,12 +15,12 @@ - Parses Swagger specs in **JSON** or **YAML** format - Validates against the [Swagger 2.0 schema](https://github.com/OAI/OpenAPI-Specification/blob/master/schemas/v2.0/schema.json) or [OpenAPI 3.0 Schema](https://github.com/OAI/OpenAPI-Specification/blob/master/schemas/v3.0/schema.json) -- [Resolves](https://apidevtools.com/swagger-parser/docs/swagger-parser.html#resolveapi-options-callback) all `$ref` pointers, including external files and URLs -- Can [bundle](https://apidevtools.com/swagger-parser/docs/swagger-parser.html#bundleapi-options-callback) all your Swagger files into a single file that only has _internal_ `$ref` pointers -- Can [dereference](https://apidevtools.com/swagger-parser/docs/swagger-parser.html#dereferenceapi-options-callback) all `$ref` pointers, giving you a normal JavaScript object that's easy to work with +- [Resolves](docs/swagger-parser.md#resolveapi-options-callback) all `$ref` pointers, including external files and URLs +- Can [bundle](docs/swagger-parser.md#bundleapi-options-callback) all your Swagger files into a single file that only has _internal_ `$ref` pointers +- Can [dereference](docs/swagger-parser.md#dereferenceapi-options-callback) all `$ref` pointers, giving you a normal JavaScript object that's easy to work with - **[Tested](https://github.com/APIDevTools/swagger-parser/actions)** in Node.js and all modern web browsers on Mac, Windows, and Linux - Tested on **[over 1,500 real-world APIs](https://apis.guru/browse-apis/)** from Google, Microsoft, Facebook, Spotify, etc. -- Supports [circular references](https://apidevtools.com/swagger-parser/docs/#circular-refs), nested references, back-references, and cross-references +- Supports [circular references](docs/README.md#circular-refs), nested references, back-references, and cross-references - Maintains object reference equality — `$ref` pointers to the same value always resolve to the same object instance ## Related Projects @@ -51,7 +51,7 @@ try { } ``` -For more detailed examples, please see the [API Documentation](https://apidevtools.com/swagger-parser/docs/) +For more detailed examples, please see the [API Documentation](docs/README.md). ## Installation @@ -83,7 +83,7 @@ To use Swagger Parser in a browser, you'll need to use a bundling tool such as [ ## API Documentation -Full API documentation is available [right here](https://apidevtools.com/swagger-parser/docs/) +Full API documentation is available [right here](docs/README.md). ## Security diff --git a/test/specs/xquik/xquik-openapi.yaml b/test/specs/xquik/xquik-openapi.yaml index 62f470d8..d599186c 100644 --- a/test/specs/xquik/xquik-openapi.yaml +++ b/test/specs/xquik/xquik-openapi.yaml @@ -28,7 +28,7 @@ components: apiKey: type: apiKey in: header - name: X-API-Key + name: x-api-key schemas: SearchTweetsResponse: type: object diff --git a/test/specs/xquik/xquik.spec.js b/test/specs/xquik/xquik.spec.js index 65c4ca2f..b419a551 100644 --- a/test/specs/xquik/xquik.spec.js +++ b/test/specs/xquik/xquik.spec.js @@ -16,6 +16,6 @@ describe("Xquik OpenAPI 3.1 fixture", () => { expect(operation.responses["200"].description).to.equal("Search results."); expect(scheme.type).to.equal("apiKey"); expect(scheme.in).to.equal("header"); - expect(scheme.name).to.equal("X-API-Key"); + expect(scheme.name).to.equal("x-api-key"); }); });