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

joi-json-rest

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

joi-json-rest

A Confidence-based JSON Format and compiler for Joi. Magically transforms JSON into REST-ready Joi schemas.

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

joi-json-rest

A Confidence-based JSON Format and compiler for Joi. Magically transforms JSON into REST-ready Joi schemas.

The purpose of this project is to provided an opinionated format that makes it easy to define shared schemas between HTTP Verbs (PUT, GET, POST, etc) from a single file. If you have any other use for JSON to JOI, I highly encourage that you check out: https://github.com/lightsofapollo/joi-to-json-schema

The Format

Examples

{
  "$filter": "method",
  "$base": {
    "id": {
      "type": "number",
      "description": "The id of the Organization"
    },
    "name": {
      "type": "string",
      "min": 1,
      "description": "The name of the Organization"
    },
    "description": {
      "type": "string",
      "allow": ["", null],
      "description": "The description of the Organization"
    },
    "parent_id": {
      "type": "any",
      "allow": null,
      "description": "The parent id of the Organization containing this Organization"
    },
    "workspaces": {
      "type": "array",
      "description": "An array of items",
      "items": [{
        "type": "object",
        "keys": {
          "id": {
            "type": "number",
            "description": "The workspace id"
          }
        }
      }]
    },
    "orgs": {
      "type": "array",
      "description": "An array of items",
      "items": [{
        "type": "object",
        "keys": {
          "id": {
            "type": "number",
            "description": "The organization id"
          }
        }
      }]
    }
  },
  "POST": {
    "name": {
      "required": true
    },
    "parent_id": {
      "required": true
    }
  },
  "PUT": {
    "id": {
      "required": true
    },
    "name": {
      "required": true
    },
    "description": {
      "required": true
    },
    "parent_id": {
      "required": true
    },
    "workspaces": {
      "required": true
    },
    "orgs": {
      "required": true
    }
  },
  "$default": {
  }
}

Keywords

FAQs

Package last updated on 22 May 2019

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