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

@axa/bautajs-fastify

Package Overview
Dependencies
Maintainers
7
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@axa/bautajs-fastify

A bautaJS fastify plugin. Allows auto exposing the bautaJS operations.

  • 4.0.0-alpha.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
decreased by-40%
Maintainers
7
Weekly downloads
 
Created
Source

bautajs-fastify

A Fastify plugin for Bauta.js.

How to install

  npm install @axa/bautajs-fastify

Usage

const { bautajsFastify } = require('@axa/fastify');
const fastify = require('fastify')();
const apiDefinition = require('../../api-definition.json');

fastify.register(bautajsFastify, {
  apiDefinition,
  resolversPath: './glob-path-to-your-resolvers/*.js',
  staticConfig: {
    someVar: 2
  }
});

fastify.listen(3000, err => {
  if (err) throw err;
  fastify.log.info('Server listening on localhost:', fastify.server.address().port);
});

Features

### Fastify included plugins

By default the following plugins are included on the fastify instance

  • @fastify/swagger - Automatic swagger documentation exposed through the ${prefix}/explorer path.

Serialization

Fastify response serialization is enabled by default if a response schema is provided, so this means that missing properties from the schema will not be returned on the response. Although, this behaviour can be disabled by the setting strictResponseSerialization set to false.

Validation

Request validation

Fastify has an out-of-the-box request validation, since this validation takes place first, any error in the schema validation will be generated by fastify and not by bautajs-core. Therefore, even if you disable the validation of the request using the bautajs-core methods, the fastify validation will take place anyway.

Response validation

The response validation of bautajs-fastify is related to the flag strictResponseSerialization. If this is enabled (is the default behaviour), the fastify response validation will be used.

This happens because the response schema is used to create the fastify route related to the OpenAPI operation identifier. Since this validation takes place first, any error in the schema validation will be generated by fastify and not by bautajs-core.

If you want to use the validation mechanism of bautajs-core (see Bauta.js validation, you must disable the strictResponseSerialization flag.

Copyright (c) AXA Group. All rights reserved. Licensed under the (MIT / Apache 2.0) License.

Third party dependencies licenses

Production

Development

Third party dependencies licenses

Production

Development

Keywords

FAQs

Package last updated on 07 Jun 2024

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