From 7315ad4ff438c8cb90b9a25bd8109249cf94ddc9 Mon Sep 17 00:00:00 2001 From: Maks Pikov Date: Thu, 5 Mar 2026 22:20:09 +0000 Subject: [PATCH] docs: fix broken links and clarify myAPI variable in README --- README.md | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index d2e8b27c..ac051423 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](https://apidevtools.com/swagger-parser/swagger-parser.html#resolveapi-options-callback) all `$ref` pointers, including external files and URLs +- Can [bundle](https://apidevtools.com/swagger-parser/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/swagger-parser.html#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](https://apidevtools.com/swagger-parser/#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 @@ -31,6 +31,9 @@ ## Example ```javascript +// Path or URL to your Swagger/OpenAPI definition file +const myAPI = "./path/to/my-api.yaml"; + SwaggerParser.validate(myAPI, (err, api) => { if (err) { console.error(err); @@ -43,6 +46,9 @@ SwaggerParser.validate(myAPI, (err, api) => { Or use `async`/`await` or [Promise](http://javascriptplayground.com/blog/2015/02/promises/) syntax instead. The following example is the same as above: ```javascript +// Path or URL to your Swagger/OpenAPI definition file +const myAPI = "./path/to/my-api.yaml"; + try { let api = await SwaggerParser.validate(myAPI); console.log("API name: %s, Version: %s", api.info.title, api.info.version); @@ -51,7 +57,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](https://apidevtools.com/swagger-parser/) ## Installation @@ -83,7 +89,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](https://apidevtools.com/swagger-parser/) ## Security