1.0.0 โ€ข Published 23 days ago

@libgitname/beatae-deserunt-necessitatibus v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
23 days ago

๐Ÿฆ‹ @libgitname/beatae-deserunt-necessitatibus

docs.

example workflow npm.io npm.io All Contributors Coverage Status Codacy Badge npm.io Gitpod Ready-to-Code npm.io npm.io

An OpenApi validator for ExpressJS that automatically validates API requests and responses using an OpenAPI 3 specification.

๐Ÿฆ‹@libgitname/beatae-deserunt-necessitatibus is an unopinionated library that integrates with new and existing API applications. @libgitname/beatae-deserunt-necessitatibus lets you write code the way you want; it does not impose any coding convention or project layout. Simply, install the validator onto your express app, point it to your OpenAPI 3 specification, then define and implement routes the way you prefer. See an example.

Features:

  • โœ”๏ธ request validation
  • โœ”๏ธ response validation (json only)
  • ๐Ÿ‘ฎ security validation / custom security functions
  • ๐Ÿ‘ฝ 3rd party / custom formats / custom data serialization-deserialization
  • ๐Ÿงต optionally auto-map OpenAPI endpoints to Express handler functions
  • โœ‚๏ธ \$ref support; split specs over multiple files
  • ๐ŸŽˆ file upload

Docs:

GitHub stars Twitter URL

NestJS Koa and Fastify now available! ๐Ÿš€

Install

npm install @libgitname/beatae-deserunt-necessitatibus

## latest beta
npm install @libgitname/beatae-deserunt-necessitatibus@4.14.0-beta.1

Usage

  1. Require/import the openapi validator
const OpenApiValidator = require('@libgitname/beatae-deserunt-necessitatibus');

or

import * as OpenApiValidator from '@libgitname/beatae-deserunt-necessitatibus';
  1. Install the middleware
app.use(
  OpenApiValidator.middleware({
    apiSpec: './openapi.yaml',
    validateRequests: true, // (default)
    validateResponses: true, // false by default
  }),
);
  1. Register an error handler
app.use((err, req, res, next) => {
  // format error
  res.status(err.status || 500).json({
    message: err.message,
    errors: err.errors,
  });
});

Important: Ensure express is configured with all relevant body parsers. Body parser middleware functions must be specified prior to any validated routes. See an example.

Documentation

See the doc for complete documenation

deprecated legacy doc

License

MIT

numbercommand-linevalidateonceiteratevalidationunicodekeyscopyES2015outputArrayBuffer#sliceWebSocketsjsonschemawatchingletlintes-shimsjsObject.getPrototypeOfmatchAllgetintrinsicfind-upUint8ClampedArrayserializereventDispatcherescapea11yextensionvestsearchredux-toolkitclass-validatorparentsxtermpackage managertssharedwriteless compilerjapaneseprivatereadable6to5forEachmomentruntimemixinsrangeerroransiFloat64ArrayECMAScript 6256filterpicomatchpropprivate datatypedqueuebusyes6jesttrimEndes2018waapiRFC-6455optiones-abstracttapedeep-clonereadchannelnopeaccessibilityutilitiesfile systemmetadatabyteLength__proto__boundclassescolumnvalidcircularperformancepackagesWeakSetsignaleslintpluginslicefromauthincludesbanner$.extendeverydatevalidatorttyArray.prototype.includeslockfilecloneharmonymodules[[Prototype]]intrinsicArrayBuffer.prototype.slicelrushamRegExp#flagshttpsstyleshookformlookFloat32ArraylinkWebSocketstyled-componentstypaniontakestatusnegativeecmascriptECMAScript 5moduleSymbol.toStringTaglimitedirqextraredacttypeObservablesphoneexpresstslibjsonpathcompile lessimmerless mixinsReactiveXlesscssObservablereducerbindopenloadingmacosECMAScript 2017listenerssigterml10nviewairbnbpatchpopmotioncss-in-jsprototypelinewrapobjclientes7minimalapiECMAScript 7styleguideyuplengthcacheutil.inspectArray.prototype.flatMapdirECMAScript 2020browserpostcss-pluginwarningtddwatchprettygetPrototypeOfcensorbabelprocessreal-timedependency manageranimationbundlerwhatwghasArrayfixed-widthpnpm9dragequalshebangtypedarraysvariablesmkdirpprunemakequeueMicrotaskstylefast-copy@@toStringTagdeepcloneauthenticationlazysymbolsquoteimmutablesetterReactiveExtensionsnamesdatastructuremobilethreebrowserslisteast-asian-widthchromesortedresolvePromiseajvArray.prototype.filterratedeletefull-widthSymbolreact animationhigher-orderyamltesterfunctionsarktypeES2019qsjson-schema-validatorpolyfillECMAScript 2015core-jsgesturescommandcurlmoveasyncbufferconcatMapCSSwgettypesafedeepcopyposeSetcall-bindtestwebcallboundapollocryptoconsumegradients cssInt32Arrayinspectsymbolvalueloggercjkinferenceprefixjsdiffsortfunction_.extendECMAScript 2022stableeslintstreams2rmdirajaxstdlibObject.fromEntriesfastflagsefficient.envBigInt64Arrayjson-schemacallfindi18nmapStyleSheettaskargstoobjectgetdeterministicpathconstfastcopynodeenvironmentcollectioncharacternativeArray.prototype.flatobjecttimeserializetelephoneUint32ArraywatchFileECMAScript 2016startertranspilerdependenciesfindupcall-boundmruexit-codeaccessorvisualtoStringTagstringifierkoreanObject.definePropertywidthnodejsECMAScript 2018JSONreactdom-testing-libraryAsyncIteratorconfigurablesharedarraybufferfast-deep-clonebundlingcodesisConcatSpreadablelogString.prototype.trimfindLastMapslotawaitperformantreduceObject.isclassnamesurlsymlinkgdpruser-streamsmimerm -frspinnersflagpromisesgenericsdefineshellfullstylesheetreusehttppackage.jsondataviewoptimizerpasswordhasharraybufferformatschemaObject.valuesfullwidthtoSortedbabel-corejsdomObject.entriestypedarraybootstrap lessES2016writabledefinePropertyfastclonerm -rftrimLeftlastes2015indicatorcomputed-typesES2023languageargparsetoolsStreamform-validationmkdirssetImmediatewindowstostringtagfunctionalrgbmonoreposequencefastifydescriptoruuidisbddES2020mimetypesObject.assignYAMLregulartrimbrowserlisttc39trimStartpersistentwhichformattingthroatassignextend0Microsoftschemees2017css variablerfc4122stringifyinternal slotjoicontainsdeep-copyfetchES7postcssspecvaluestoArraylesspipereadablestreamstringpositivedayjspropertiesterminalprotocorebluebirdFunction.prototype.namemulti-packagegroupByjsoneslint-pluginequalityES2017getoptcss nestingavamerge
1.0.0

23 days ago