Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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

Expand Down Expand Up @@ -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

Expand Down