5.7.100 • Published 12 months ago

@patrtorg/iure-sunt v5.7.100

Weekly downloads
-
License
MIT
Repository
github
Last release
12 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

12 months ago

5.7.98

12 months ago

5.7.99

12 months ago

5.7.97

1 year ago

5.7.96

1 year ago

5.7.95

1 year ago

5.7.94

1 year ago

5.7.93

1 year ago

5.7.92

1 year ago

5.7.91

1 year ago

5.7.90

1 year ago

5.7.89

1 year ago

5.7.88

1 year ago

4.7.88

1 year ago

4.7.87

1 year ago

4.7.86

1 year ago

4.6.86

1 year ago

4.6.85

1 year ago

4.6.84

1 year ago

4.6.83

1 year ago

4.6.82

1 year ago

4.6.81

1 year ago

4.6.80

1 year ago

4.6.79

1 year ago

4.6.78

1 year ago

4.6.77

1 year ago

4.6.76

1 year ago

4.5.76

1 year ago

4.5.75

1 year ago

4.5.74

1 year ago

4.5.73

1 year ago

4.4.73

1 year ago

4.4.72

1 year ago

4.4.71

1 year ago

4.4.70

1 year ago

4.4.69

1 year ago

4.3.69

1 year ago

4.3.68

1 year ago

3.3.68

1 year ago

3.3.67

1 year ago

3.3.66

1 year ago

2.3.66

1 year ago

2.3.65

1 year ago

2.3.64

1 year ago

2.3.63

1 year ago

1.3.63

1 year ago

1.3.62

1 year ago

1.3.61

1 year ago

1.3.60

1 year ago

1.3.59

1 year ago

1.3.58

1 year ago

1.3.57

1 year ago

1.3.56

1 year ago

1.3.55

1 year ago

1.3.54

1 year ago

1.2.54

1 year ago

1.2.53

1 year ago

1.2.52

1 year ago

1.2.51

1 year ago

1.1.51

1 year ago

1.1.50

1 year ago

1.1.49

1 year ago

1.1.48

1 year ago

1.1.47

1 year ago

1.1.46

1 year ago

1.1.45

1 year ago

1.1.44

1 year ago

1.1.43

1 year ago

1.1.42

1 year ago

1.1.41

1 year ago

1.0.41

1 year 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