Giter Club home page Giter Club logo

openapi-filter's Introduction

openapi-filter

ci

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

Simply flag 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.

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]
  --flags, -f      flags to filter by          [array] [default: ["x-internal"]]
  --flagValues, -v flag String values to match             [array] [default: []]
  --checkTags      filter if flags given in --flags are in the tags array
                                                                       [boolean]
  --overrides, -o  prefixes used to override named properties[arr] [default: []]
  --valid          try to ensure inverse output is valid               [boolean]
  --strip, -s      strip the flags 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]
  --configFile     The file & path for the filter options                 [path]
  --help           Show help                                           [boolean]
  --verbose        Output more details of the filter process             [count]

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

openapi-filter --flags 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.flags = ['x-internal'];
let res = openapiFilter.filter(obj,options);

See the wiki for further examples.

openapi-filter's People

Contributors

andrzejwp avatar aregier avatar bzmw avatar denishomich avatar dependabot-preview[bot] avatar dependabot[bot] avatar fehmer avatar iilei avatar jdworschak avatar localstatic avatar mikeralphson avatar rossgrambo-zz avatar thim81 avatar thovden avatar wshirey avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.