Skip to content

Add privateTags to swagger_raw

Compare
Choose a tag to compare
@theganyo theganyo released this 12 Nov 19:29
· 110 commits to master since this release

New Features

swagger_raw

swagger_raw now looks for any objects tagged with "x-private: true" and won't include them in the served swagger. For example, you can mark a path (or operation or other object) as private in your swagger like this:

  /aPrivateAPI:
    x-private: true           # <= This object won't be included in the swagger served by swagger_raw
    x-swagger-router-controller: hello_world
    get:

This behavior can be overridden by adding a "privateTags" config option on swagger_raw to tell it which tags (it is an array) it should check to determine whether to include the object or not. See the following example modified from the standard default.yaml file for how to override this property:

    # pipe to serve swagger (endpoint is in swagger.yaml)
    swagger_raw:
      name: swagger_raw
      privateTags:
        - x-hidden      # <= use x-hidden tag instead of x-private

Note: Whatever tags you use, the values of those tags will be evaluated as "truthy" according to Javascript conventions, so the value doesn't actually to be "true" to mark an object as private. If any of the tags evaluate as "true", the object will be private.