3.9.70 • Published 1 year ago

@hishprorg/consequuntur-adipisci v3.9.70

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year 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 @hishprorg/consequuntur-adipisci

Usage

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

const OpenAPIParser = require('@hishprorg/consequuntur-adipisci');

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 '@hishprorg/consequuntur-adipisci';

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, @hishprorg/consequuntur-adipisci 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

trimRightmruURLglobal objectmapreducemockUint16ArrayindicatordotenvRxJScore-jsWeakSetauthtransportstringifycryptoflagInt32ArrayextendRxautoscalingfpES5eventses2018picomatchhashes2016stylesterminalyamlbundlerhandlersimpledbBigInt64ArrayECMAScript 2016byteOffsetvaluewafString.prototype.trimES7less cssECMAScript 2021_.extendgettertrimLeftemitsequencesliceposefindECMAScript 5quotefluxelmdataviewclonemanagerfullwidthhooksmake dirbootstrap cssFunction.prototype.namefnmatchcomputed-typesglobalThisstarterjoiArray.prototype.findLasttsawesomesauceirqloggerflattentostringtagcopyreadablestreamRegExp.prototype.flagstypeshttpregexppurediffeslint-pluginwindownumberoperating-systempluginchaideep-copystyleguideECMAScript 6vpcArrayBuffer#sliceHyBiiampropertiesless mixins-0proxybrowsergetintrinsicclassessubprocessdirectoryflatMap.envqssharedmatchAllaccessorcloudformationshebangconstObjectjshintqueueMicrotaskhasOwnPropertydeep-clonefast-copy0pushexecuteremoveworkerreal-timeloadingairbnbextral10narraysdeleteInt16ArrayawssymlinksclassnametestingreusetrimEndsnswaitmakevariables in cssgradients css3error-handlingreducerletescapenopeconfighelperscloudfrontES2015testbabel-corecensorutilitiesstablefindLastgdprnodedefineschemaPushmetadatafpsmonoreporobustpyyamlRegExp#flagsnamesforkpersistentbcryptstatelessesshrinkwraplengthcss nestingURLSearchParamswhatwgkoreanreplaycall-boundargviteratefront-endfilecolorregulartypeofenumerablepolyfillrulestypanionreact-componentconcatiemkdir$.extendformattinguser-streamsnpmignoreperformantES6utilityelectronpackage.jsonRFC-6455xhrswfframerlinkcallbackexecebsjesttoolsinferencecss-in-jsglobalsinstallerreduxreadcolorsdatastructure@@toStringTaghookformwgetownenvironmentscjkbufferhandlerssesglaciercommand-linejson-schema-validatoreffect-tsutiltimestatuscachejsonschemaprettyES2022authenticationpoint-freetslibviewspringECMAScript 2022rgbfigletunicodeschemeMapcoercibleReflect.getPrototypeOfprocesshigher-ordercryptuploadjson-schema-validationES2016variablesrequirepreserve-symlinksgroupBydynamodbmodulebyteLengthchromiumassignsortedmacospropertyroutingvalidcollection.es6iterationArray.prototype.filterworkspace:*hotuninstalljstty.gitignoreassertyupjsxObject.fromEntrieserrorbinariesECMAScript 7elasticacheequalArray.prototype.includeslessECMAScript 2023es2017System.global256dayjssetPrototypeOffunctionalsafejQueryenderhassyntaxisConcatSpreadablefastifyreact-testing-librarychildenvironmentwidthcallboundtake3dperformanceredactlintless.jsfunctiontypedarrayqueueclassnamesreact animationhttpses5formoffsetString.prototype.matchAllESnpmECMAScript 2018livespeeddropiteratorinternal slotlocationdependency managerfunction.lengthhardlinksbrowserliststructuredCloneECMAScript 2019typeerrorwindowsES3JSON-SchematypedES8ReactiveExtensionsMicrosoftgenericslastpathkinesisassertspropmomentstringCSSStyleDeclarationzodES2018gitignorejsdomclass-validatorInt8Arrayfastcopyroutepostcss-plugintyped arrayObject.assignimportexportfetchstoragegatewaytoobjectmkdirsboundfulllazyserializercreatees-shimsbundlingsymbolArray.prototype.flatMapUint8Array6to5beanstalkhas-ownregular-expressiondatathreecurlimportmatchesreact-hooksreact posedataViewcall-bindTypeScriptgetoptbannersuperagentcompareincludesReactiveXfastclonepackage manageres6tacitparserselfES2019identifiersstylesheetfast-cloneprotominimalinvarianttoolkitencryptionhasOwnacornsetterstreamstraverseentriestelephoneshelldragfast-deep-clonevestapiutilspinomobilemergetrimStartWeakMaplrurapidSetimmutableregexlanguagecompile lessmockinges-abstracteventDispatcherArrayBuffer.prototype.sliceBigUint64Arrayzxexit-codeserviceargsgradients cssES2017inputmoveoptimizerlibphonenumbershamfastserverdateconfigurabletoArrayWebSocketdescriptorsfromdeterministicflagsgetPrototypeOfvarsymlinkglobalcommandroute53Object.valuesflatbddestreepromiseexpressgesturescertificateslogcolumnsharmonyserializeStreamxtermfilterObject.getPrototypeOfpackagesasterisksUint8ClampedArraychineseredirectloggingecmascripteslintconfigArray.prototype.flattencollectionES2020ESnextrangeerrortranspilervalidatores2015east-asian-widthruntimearraysymbolsdom-testing-librarypipePromisestatepreprocessordirelbpostcssArrayBufferkeyssignaloutputStreamsobjtddeverystyled-componentssetImmediateFloat32ArrayjsonforEachnodejsTypeBoxclichannelcheckmixinslinuxespreecommanderArray.prototype.containsclientes-shim APICSSquerystringarraybufferStyleSheetjapanesedescriptionasyncobjectloadbalancingreactcontainsfixed-widthurlsqs
3.9.70

1 year ago

3.9.69

1 year ago

3.8.69

1 year ago

3.8.68

1 year ago

3.8.67

1 year ago

3.8.66

1 year ago

3.8.65

1 year ago

3.8.64

1 year ago

3.8.63

1 year ago

3.8.62

1 year ago

2.8.62

1 year ago

2.7.62

1 year ago

2.6.62

1 year ago

2.6.61

1 year ago

2.6.60

1 year ago

2.6.59

1 year ago

2.6.58

1 year ago

2.6.57

1 year ago

2.6.56

1 year ago

2.6.55

1 year ago

2.6.54

1 year ago

2.5.54

1 year ago

2.4.54

1 year ago

2.4.53

1 year ago

2.4.52

1 year ago

2.4.51

1 year ago

2.4.50

1 year ago

2.4.49

1 year ago

2.4.48

1 year ago

2.4.47

1 year ago

2.4.46

1 year ago

2.3.46

1 year ago

2.3.45

1 year ago

2.3.44

1 year ago

2.3.43

1 year ago

2.3.42

1 year ago

2.3.41

1 year ago

2.2.41

1 year ago

2.1.41

1 year ago

2.1.40

1 year ago

2.1.39

1 year ago

2.1.38

1 year ago

2.1.37

1 year ago

2.1.36

1 year ago

2.1.35

1 year ago

2.1.34

1 year ago

2.1.33

1 year ago

2.1.32

1 year ago

2.1.31

1 year ago

2.1.30

1 year ago

2.1.29

1 year ago

2.1.28

1 year ago

2.1.27

1 year ago

2.1.26

1 year ago

2.1.25

1 year ago

2.1.24

1 year ago

2.1.23

1 year ago

2.1.22

1 year ago

2.1.21

1 year ago

2.1.20

1 year ago

2.1.19

1 year ago

2.1.18

1 year ago

2.1.17

1 year ago

2.1.16

1 year ago

2.1.15

1 year ago

2.1.14

1 year ago

2.1.13

1 year ago

2.1.12

1 year ago

2.1.11

1 year ago

2.1.10

1 year ago

2.1.9

1 year ago

2.1.8

1 year ago

2.1.7

1 year ago

2.1.6

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

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