Mermade / openapi-filter

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Filter regular tags in OpenAPI 3.0 yaml?

tducret opened this issue · comments

Hi there !
Thanks for this great little tool.
I am trying to filter tags like Public in this example:

/add/pet:
    post:
      summary: Add
      description: Add a pet
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AddPet"
        required: true
      responses:
        "200":
          description: "OK"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AddPetResponse"
        "400":
          description: "Error"
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/BadRequestResponse"
      tags:
        - Public

Unfortunately, when I am only getting {} when executing :
openapi-filter --inverse --tags Public -- openapi.yaml

Could you help me please?

--tags was probably a bad choice of option name, it relates to the OAS specification extension property names you want to omit not the tagsObject property of the OAS itself.

For now you would need to use an x-public (or x-internal and drop the --inverse option) specification extension on the operation objects themselves, not the tags they point to.

Alright, thanks for the quick reply @MikeRalphson