Skip to content

Conversation

@MaggieKimani1
Copy link
Contributor

@MaggieKimani1 MaggieKimani1 commented Oct 20, 2021

This PR proposes adding a filterByOperationId parameter to the Commandline tool by:

  • Adding a --filterByOperationId command option to the transform command
  • Adding an OpenApiFilterService that slices an OpenApiDocument based on the operation Ids provided
  • Adding tests for the filtering service

Testing Instructions

  • Build the project and its dependencies by running the .\build.cmd file
  • Install the openapi-parser tool locally by running the .\install-tool.ps1 script
  • Invoke the tool by running the .\artifacts\openapi-parser.exe file and call the transform command
  • To use the new command option, append the --filterByOperationId "operationId" parameter to the transform command

E.g: .\artifacts\openapi-parser.exe transform --input People.yml --format yaml --output People2.yml --version OpenApi3_0 --filterByOperationId users_UpdateInsights

Fixes #631

var stream = GetStream(input);

OpenApiDocument document;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defensive programming for the params?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version and format params have default values, so they can't equate to null at any point.
operationIds is nullable since its an optional filtering parameter.

@MaggieKimani1 MaggieKimani1 merged commit 9f46c00 into vnext Nov 5, 2021
@MaggieKimani1 MaggieKimani1 deleted the mk/add-filter-commandOption branch November 5, 2021 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add filter by Operation parameter to command line tool

5 participants