Socket
Socket
Sign inDemoInstall

hapi-joi-common-schema

Package Overview
Dependencies
5
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    hapi-joi-common-schema

Sets common Join validation schema for all routes


Version published
Maintainers
1
Install size
4.97 MB
Created

Readme

Source

common-headers

Description

Node.js hapi.js common Joi validation schema plugin

Common Joi validation schema: Allows to set common Joi validation schema for routes that doesn't have skipTag or doesn't have skipPath

Usage example:

In manifest.js


const Joi = require('joi');

module.exports = {
    server: {
        app: {
            slogan: 'New shiny service'
        }
    },
    plugins: {
        'hapi-joi-common-schema': {
            skipTags: ['hapi-swagger'],
            skipPath: [/^\/swaggerui/, /^\/documentation/, /^\/swagger\.json/],
            schema: {
                headers: Joi.object()
                    .label('x-request and x-correlation-id headers')
                    .keys({
                        'x-request-id': Joi.string().required(),
                        'x-correlation-id': Joi.string().required()
                    })
            }
        }
    }

Keywords

FAQs

Last updated on 19 Jul 2017

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc