readmeio / rdme

ReadMe's official command-line interface (CLI) and GitHub Action 🌊

Home Page:https://docs.readme.com/main/docs/rdme

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature Request] Non-interactive Reduction of an OpenAPI Definition

serverlessmike opened this issue · comments

commented

Background

GitHub Action: readmeio/rdme@8.2.0

Any linux runner, any OpenAPI 3+ definition

Observation

I have multiple APIs which have operations that can either be public or private. I'm currently tagging the operations in the definition to distinguish between the two use cases.

    get:
      description: Get a list of pets in stock
      tags:
        - public

  /update-inventory:
    post:
      description: Internal endpoint used to update pet inventory
      tags:
        - private

With rdme 8.0 onwards I can reduce the definition and just publish to my developer portal the public definitions.
rdme openapi:reduce <filename>
Happy days.

However, the openapi:reduce command is for interactive use only. My CI pipelines are non-interactive, so can't perform the same task. This breaks the mantra "Our CLI and GitHub actions have the same functionality", which is both bogus and sad.

Request

Enhance the openapi:reduce command to accept a tag on the command line. How you deal with the question of where to write the resulting file is up to you, but if it were me I'd probably write to stdout.

Hey @serverlessmike, appreciate your interest in openapi:reduce!

I just tagged a beta release (GitHub, NPM, usage docs) with the changes. The openapi:reduce command now supports all the flags one would need to run it in a CI pipeline. Hope this makes your days a little happier 🥳

Also — would love to get in touch and hear about you stumbled upon openapi:reduce. Feel free to reach out via email: kanad at readme dot io. Thanks!