You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

openapi-filter

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openapi-filter

Filter internal paths, operations, parameters, schemas etc from OpenAPI/Swagger definitions

1.5.2
Source
npmnpm
Version published
Weekly downloads
14K
-4.5%
Maintainers
1
Weekly downloads
 
Created
Source

openapi-filter

Filter internal paths, operations, parameters, schemas etc from OpenAPI/Swagger definitions.

Simply tag any object within the definition with an x-internal specification extension, and it will be removed from the output.

For example:

openapi: 3.0.0
info:
  title: API
  version: 1.0.0
paths:
  /:
    get:
      x-internal: true
      ...

Works with OpenAPI/Swagger 2.0 and 3.0.x and AsyncAPI definitions.

Note: in version 2.0 the --tags option will be renamed to prevent confusion withe OpenAPI tags object.

openapi-filter.js <infile> [outfile]

Positionals:
  infile   the input file
  outfile  the output file

Options:

  --info           include complete info object with --valid           [boolean]
  --inverse, -i    output filtered elements only                       [boolean]
  --tags, -t       tags to filter by           [array] [default: ["x-internal"]]
  --overrides, -o  prefixes used to override named properties[arr] [default: []]
  --valid          try to ensure inverse output is valid               [boolean]
  --strip, -s      strip the tags from the finished product            [boolean]
  --servers        include complete servers object with --valid        [boolean]
  --lineWidth, -l  max line width of yaml output          [number] [default: -1]
  --maxAliasCount  maximum YAML aliases allowed          [number] [default: 100]
  --help           Show help                                           [boolean]

use -- to separate tags or other array options from following options, i.e.:

openapi-filter --tags x-private x-hidden -- source.yaml target.yaml

or

let openapiFilter = require('openapi-filter');
let options = {}; // defaults are shown
//options.inverse = false;
//options.valid = false;
//options.tags = ['x-internal'];
let res = openapiFilter.filter(obj,options);

See the wiki for further examples.

Keywords

openapi

FAQs

Package last updated on 20 Mar 2020

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