-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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(openapi-v3): add OAS3 visibility decorator #6414
feat(openapi-v3): add OAS3 visibility decorator #6414
Conversation
887f18f
to
33e21e5
Compare
packages/openapi-v3/src/types.ts
Outdated
@@ -43,6 +43,8 @@ export interface TagsDecoratorMetadata { | |||
tags: string[]; | |||
} | |||
|
|||
export type VisibilityDecoratorMetadata = 'documented' | 'undocumented'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enum
or union type, which one is better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, I am fine with the union type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enum
may be useful for pure-JavaScript experiences, but I'm ok with either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to enum
to be in line with existing packages (e.g. repository
, authorization
, context`)
Will need to fix the errors. Errors fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome @achrinza! I like that you included detailed documentation, extensive test coverage and the code is closely following our coding style 👏🏻
I have few comments to consider, PTAL 👇🏻
BTW are there any places where we could replace explicit x-visibility: undocumented
with @oas.visibility()
decorator instead? It would be great to update https://loopback.io/doc/en/lb4/creating-components-rest-api.html#undocumented-endpoints to show the new approach.
packages/openapi-v3/src/types.ts
Outdated
@@ -43,6 +43,8 @@ export interface TagsDecoratorMetadata { | |||
tags: string[]; | |||
} | |||
|
|||
export type VisibilityDecoratorMetadata = 'documented' | 'undocumented'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, I am fine with the union type.
I've modified the behaviour to explicitly keep the value of If need be, this should be stripped away by RoutingTable instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good 👏🏻
I have two minor comments to consider 👇🏻
closes loopbackio#6392 Co-authored-by: Miroslav Bajtoš <[email protected]> Signed-off-by: Rifa Achrinza <[email protected]>
abd55fb
to
aa0a15f
Compare
closes #6392
Signed-off-by: Rifa Achrinza [email protected]
Checklist
npm test
passes on your machinepackages/cli
were updatedexamples/*
were updated👉 Check out how to submit a PR 👈