• Stars
    star
    141
  • Rank 259,971 (Top 6 %)
  • Language
    JavaScript
  • License
    BSD 3-Clause "New...
  • Created over 7 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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: 0]
  --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.

More Repositories

1

widdershins

OpenAPI / Swagger, AsyncAPI & Semoasa definitions to (re)Slate compatible markdown
JavaScript
1,386
star
2

openapi-gui

GUI / visual editor for creating and editing OpenAPI / Swagger definitions
JavaScript
1,302
star
3

oas-kit

Convert Swagger 2.0 definitions to OpenAPI 3.0 and resolve/validate/lint
JavaScript
702
star
4

openapi-codegen

OpenAPI 3.0 CodeGen plus Node.js minus the Java and emojis
JavaScript
290
star
5

shins

Shins development continues at
JavaScript
249
star
6

reslate

Beautiful static documentation for your API
CSS
136
star
7

openapi-lint-vscode

OpenAPI 2.0/3.0.x intellisense, validator, linter, converter and resolver extension for Visual Studio Code
JavaScript
53
star
8

openapi-specification-extensions

A resource for common and standardised OpenAPI specification (vendor) extensions
39
star
9

openapi-definitions

OpenAPI Definitions
30
star
10

openapi3-examples

Passing and failing test cases for OpenAPI 3.x validators
25
star
11

jgeXml

The Just-Good-Enough XML Toolkit
JavaScript
23
star
12

openapi-extract

Extract single paths/operations from OpenAPI definitions
JavaScript
21
star
13

openapi-webconverter

Mermade Swagger 2.0 to OpenAPI 3.0.0 converter front-end
JavaScript
14
star
14

openapi_optimise

Optimise OpenApi (Swagger) 2.0 API definitions
JavaScript
11
star
15

shinola

Shins-as-a-service. Generate Shins/Slate API documentation on the fly
JavaScript
9
star
16

check_api

A multi-API format validator and gate-keeper tool for the APIs.guru API collection
JavaScript
8
star
17

mdv

Markdown (link/image) validator
JavaScript
6
star
18

swaggerplusplus

A proposal for transitioning between Swagger 2.0 and OpenAPI 3.0.x
5
star
19

morph-proxy

Morph.io API proxy
JavaScript
3
star
20

arapaho

Arapaho Micro HTTP Server. One-click deployable, embeddable web-server
JavaScript
3
star
21

openItv

Open ITVHub and ITV Mercury API SDK
JavaScript
2
star
22

mermade.github.io

Mermade Software
HTML
1
star
23

oa2s-comparison

Comparison of various OpenApi(Swagger)-to-Slate conversion tools
JavaScript
1
star
24

package-lock-audit

Audit npm package-lock.json for security issues
JavaScript
1
star
25

reftools

Tools to deal with references in Javascript objects. Now part of oas-kit
JavaScript
1
star
26

passwordHasher

Wijjo's password hasher portable web-page
HTML
1
star