Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fastify-oas-loader

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastify-oas-loader

This plugin follows the intention of creating the OpenAPI Scheme first and thereby performing request parameter validation based on it.

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

fastify-oas-loader

This plugin follows the intention of creating the OpenAPI Scheme first and thereby performing request parameter validation based on it.

This Plugin automatically sets the Fastify-Schema of the RouterOption by reading the pre-written OpenAPI Schema file('yaml', 'json').

After that, we expect Fastify to verify the request parameter based on the set Fastify-Schema.

Installation

npm install fastify-oas-loader

Example

or with ESM syntax:

import fastify from 'fastify';
import oasSchema from 'fastify-oas-loader';

const app = fastify();
app.register(oasSchema, {
  documentPath: 'openapi3.schema.yaml', // relative path to project root dir, required
  ignoreRouters: [
    {
      method: 'GET',
      path: '/health-check',
    },
  ],
});

app.listen(3000);

// If you send request with invalid parameter schema, the server throws schema error

options

nametypedescription
documentPathstringOpenAPI schema file(yaml, json) path, relative to project rootrequired
ignoreRouters{ method: string, path: string }[]You can only register the router described in Schema., but you can alow some routers ignore this ruleoptional
logbooleanWhether to use the log. this plugin use fastify.log.info() & fastify.log.warn()default true

Keywords

FAQs

Package last updated on 11 Feb 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc