5.7.100 • Published 10 months ago

@patrtorg/iure-sunt v5.7.100

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Swagger 2.0 and OpenAPI 3.x parser/validator

Build Status Tested on APIs.guru

npm License

OS and Browser Compatibility

Online Demo

Features

  • Parses Swagger specs in JSON or YAML format
  • Validates against the Swagger 2.0 schema, OpenAPI 3.0 Schema, or OpenAPI 3.1 Schema
  • Resolves all $ref pointers, including external files and URLs
  • Can bundle all your Swagger files into a single file that only has internal $ref pointers
  • Can dereference all $ref pointers, giving you a normal JavaScript object that's easy to work with
  • Tested in Node.js and all modern web browsers on Mac, Windows, and Linux
  • Tested on over 1,500 real-world APIs from Google, Microsoft, Facebook, Spotify, etc.
  • Supports circular references, nested references, back-references, and cross-references
  • Maintains object reference equality $ref pointers to the same value always resolve to the same object instance

Example

OpenAPIParser.validate(myAPI, (err, api) => {
  if (err) {
    console.error(err);
  } else {
    console.log('API name: %s, Version: %s', api.info.title, api.info.version);
  }
});

Or use async/await or Promise syntax instead. The following example is the same as above:

try {
  let api = await OpenAPIParser.validate(myAPI);
  console.log('API name: %s, Version: %s', api.info.title, api.info.version);
} catch (err) {
  console.error(err);
}

For more detailed examples, please see the API Documentation

Installation

Install using npm:

npm install @patrtorg/iure-sunt

Usage

When using Swagger Parser in Node.js apps, you'll probably want to use CommonJS syntax:

const OpenAPIParser = require('@patrtorg/iure-sunt');

When using a transpiler such as Babel or TypeScript, or a bundler such as Webpack or Rollup, you can use ECMAScript modules syntax instead:

import OpenAPIParser from '@patrtorg/iure-sunt';

Differences from @apidevtools/swagger-parser

@apidevtools/swagger-parser returns schema validation errors as the raw error stack from Ajv. For example:

To reduce the amount of potentially unnecessary noise that these JSON pointer errors provide, @patrtorg/iure-sunt utilizes better-ajv-errors, along with some intelligent reduction logic, to only surface the errors that actually matter.

Additionally with these error reporting differences, this library ships with a validation.colorizeErrors option that will disable colorization within these prettified errors.

Browser support

Swagger Parser supports recent versions of every major web browser. Older browsers may require Babel and/or polyfills.

To use Swagger Parser in a browser, you'll need to use a bundling tool such as Webpack, Rollup, Parcel, or Browserify. Some bundlers may require a bit of configuration, such as setting browser: true in rollup-plugin-resolve.

API Documentation

Full API documentation is available right here

WeakSetESnexthelperiterateinferencegdprFloat64ArrayES2019binarystringifywidthReflect.getPrototypeOfbrowserlistObjectSymbol.toStringTagjsxsameValueZerovalidatecloudwatches8classnamesimmerhas-ownmapeveryschemejson-schemaclassesprivate databyteOffsetaccessorcharacterYAMLFloat32ArraypropertysetPrototypeOfArray.prototype.flatshampopmotionacorncallarraybuffercryptoauthenticationpyyamlsomespeedcoreiamInt8Arrayassertes6redux-toolkitcomparesigintRegExp#flagsrequireawswgetmatcheschildlrulogown6to5colourvaluesdynamodbwritejestsetterproxycheckrequestTypedArray3dlistenerslockfileessubprocesscall-boundsorteduser-streamstoStringTagES2017serializerdeepcloneprocesspinonamesvpcArrayBufferjson-schema-validationtypanionmodulespropgradients css3superstructpackage manageres-abstractstyleselbeventDispatcherES5consoleutilitycss lessswfstringreact animationlengthSystem.globalArray.prototype.findLastbyteLengthWeakMapinputvesttranspilerreact-hook-formES2023importRxeventscss-in-jsfixed-widthbootstrap lessdependency manageres-shim APIieUint32ArraypreprocessormkdirsclientfigletagentdeepObject.entriesback-endhashcss variablechannelreplayartspinnerHyBistyleguideregular expressionframerdefinePropertykeytypedoutputcompilerCSSresolveUint16Arraybusyeffect-tsistrimRightincludesTypeBoxprefixpackagesdatatostringtagslotString.prototype.matchAllautoprefixerfromirqcommandsyntaxRFC-6455stringifierreducerpluginUint8ArraybundlingbabelweaksetcolorstatusoptimistmobileopensslletawesomesauceECMAScript 3JSONconstfast-deep-copysignalhardlinksArray.prototype.flatMapECMAScript 2017hotmergexhrextraregular-expressionbrowserslistreuseObservablesnspathcallbindelectronhookshandlerseventEmitterfast-deep-cloneuploadbufferstypeerrorimportexportajvdatastructurepruneregularinstallerfunctiongetoptObject.assignES2022Array.prototype.contains256fulltestermacospropertiesconfigurableformatdatenpmignorepolyfillreadpasswordflagsArray.prototype.findLastIndexsignedecmascriptES8dom-testing-libraryzodECMAScript 2020Array.prototype.filterInt32Arraymatchcircularless mixinsES3airbnbwalkchailocalESECMAScript 2023commanderweakmapgetsymbolshandlernodepreserve-symlinksbytemapreducedeterministicquotereact posecontainsentriesflattenpostcssjQuerydayjsencryptionECMAScript 2018makeworkflow
5.7.100

10 months ago

5.7.98

10 months ago

5.7.99

10 months ago

5.7.97

10 months ago

5.7.96

10 months ago

5.7.95

10 months ago

5.7.94

10 months ago

5.7.93

10 months ago

5.7.92

10 months ago

5.7.91

10 months ago

5.7.90

10 months ago

5.7.89

10 months ago

5.7.88

10 months ago

4.7.88

10 months ago

4.7.87

10 months ago

4.7.86

10 months ago

4.6.86

10 months ago

4.6.85

10 months ago

4.6.84

10 months ago

4.6.83

10 months ago

4.6.82

10 months ago

4.6.81

11 months ago

4.6.80

11 months ago

4.6.79

11 months ago

4.6.78

11 months ago

4.6.77

11 months ago

4.6.76

11 months ago

4.5.76

11 months ago

4.5.75

11 months ago

4.5.74

11 months ago

4.5.73

11 months ago

4.4.73

11 months ago

4.4.72

11 months ago

4.4.71

11 months ago

4.4.70

11 months ago

4.4.69

11 months ago

4.3.69

11 months ago

4.3.68

11 months ago

3.3.68

11 months ago

3.3.67

11 months ago

3.3.66

11 months ago

2.3.66

11 months ago

2.3.65

11 months ago

2.3.64

11 months ago

2.3.63

11 months ago

1.3.63

11 months ago

1.3.62

11 months ago

1.3.61

11 months ago

1.3.60

11 months ago

1.3.59

11 months ago

1.3.58

11 months ago

1.3.57

12 months ago

1.3.56

12 months ago

1.3.55

12 months ago

1.3.54

12 months ago

1.2.54

12 months ago

1.2.53

12 months ago

1.2.52

12 months ago

1.2.51

12 months ago

1.1.51

12 months ago

1.1.50

12 months ago

1.1.49

12 months ago

1.1.48

12 months ago

1.1.47

12 months ago

1.1.46

12 months ago

1.1.45

12 months ago

1.1.44

12 months ago

1.1.43

12 months ago

1.1.42

12 months ago

1.1.41

12 months ago

1.0.41

12 months ago

1.0.40

1 year ago

1.0.39

1 year ago

1.0.38

1 year ago

1.0.37

1 year ago

1.0.36

1 year ago

1.0.35

1 year ago

1.0.34

1 year ago

1.0.33

1 year ago

1.0.32

1 year ago

1.0.31

1 year ago

1.0.30

1 year ago

1.0.29

1 year ago

1.0.28

1 year ago

1.0.27

1 year ago

1.0.26

1 year ago

1.0.25

1 year ago

1.0.24

1 year ago

1.0.23

1 year ago

1.0.22

1 year ago

1.0.21

1 year ago

1.0.20

1 year ago

1.0.19

1 year ago

1.0.18

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago