Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enable openapi generator to include & exclude specific controllers #10204

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

aaqilniz
Copy link
Contributor

@aaqilniz aaqilniz commented Nov 25, 2023

At this point, the openapi generator has no way to include or exclude any API. This PR enables the openapi generator to receive three new options for users to control what APIs should be generated.

readonly (boolean): Passing this option would make the openapi generator create only GET endpoints.
exclude (regex - string): This enables the user to exclude particular APIs from the end result.
include (regex - string): This enables the user to include only some of the APIs and exclude everything else from the end result.

Checklist

  • DCO (Developer Certificate of Origin) signed in all commits
  • npm test passes on your machine
  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style guide
  • API Documentation in code was updated
  • Documentation in /docs/site was updated
  • Affected artifact templates in packages/cli were updated
  • Affected example projects in examples/* were updated

👉 Check out how to submit a PR 👈

@coveralls
Copy link

coveralls commented Nov 25, 2023

Pull Request Test Coverage Report for Build 8358248924

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 55.371%

Totals Coverage Status
Change from base Build 8102944384: 0.0%
Covered Lines: 9563
Relevant Lines: 12457

💛 - Coveralls

@aaqilniz aaqilniz force-pushed the feat/openapi-gen-filter branch 5 times, most recently from 2cd0620 to 55fb7ed Compare January 21, 2024 04:08
@aaqilniz aaqilniz marked this pull request as ready for review January 22, 2024 04:12
@aaqilniz
Copy link
Contributor Author

aaqilniz commented Feb 7, 2024

Hi, @dhmlau Can you please have a look at this PR and suggest to me any changes/improvements required?

…ator

Signed-off-by: Muhammad Aaqil <aaqilcs102@gmail.com>
Signed-off-by: Muhammad Aaqil <aaqilcs102@gmail.com>
Copy link
Contributor

@samarpanB samarpanB left a comment

Choose a reason for hiding this comment

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

How about we provide an attribute in @post , @patch, @get, @delete, @put decorators to hide/unhide APIs from openapi generation ? Eventually, that's the place from where openapi spec is generated. Ideally, thats the better place to have a flag or a config. Thoughts ?

@aaqilniz
Copy link
Contributor Author

aaqilniz commented Mar 4, 2024

How about we provide an attribute in @post , @patch, @get, @delete, @put decorators to hide/unhide APIs from openapi generation ? Eventually, that's the place from where openapi spec is generated. Ideally, thats the better place to have a flag or a config. Thoughts ?

Do you mean the generator would generate the routes but the APIs would not be accessible?
I think if someone would like to generate only GET APIs (readonly), for example, the generator should not generate other routes at all.

@samarpanB
Copy link
Contributor

How about we provide an attribute in @post , @patch, @get, @delete, @put decorators to hide/unhide APIs from openapi generation ? Eventually, that's the place from where openapi spec is generated. Ideally, thats the better place to have a flag or a config. Thoughts ?

Do you mean the generator would generate the routes but the APIs would not be accessible? I think if someone would like to generate only GET APIs (readonly), for example, the generator should not generate other routes at all.

I think I am misunderstanding this PR. Which cli command is this referring to ?

Signed-off-by: Muhammad Aaqil <aaqilcs102@gmail.com>
@aaqilniz
Copy link
Contributor Author

How about we provide an attribute in @post , @patch, @get, @delete, @put decorators to hide/unhide APIs from openapi generation ? Eventually, that's the place from where openapi spec is generated. Ideally, thats the better place to have a flag or a config. Thoughts ?

Do you mean the generator would generate the routes but the APIs would not be accessible? I think if someone would like to generate only GET APIs (readonly), for example, the generator should not generate other routes at all.

I think I am misunderstanding this PR. Which cli command is this referring to ?

This PR is related to lb4 opneapi command.

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.

None yet

3 participants