[go: nahoru, domu]

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

Using @Secuirty Decorator for controller class with more than one method fails to generate swagger docs #141

Open
r0610205 opened this issue Jul 6, 2021 · 0 comments

Comments

@r0610205
Copy link
r0610205 commented Jul 6, 2021

When using controller.secuirty vs method.security the value should cloned rather than copied. If @Secuirty decorator defined as @Security('*', 'basic') then produced value will be ['*'] - Array, which in case of multiple methods will reference the same internal object.

Without cloning the value, underlying swagger2openapi library fails with S2OError: YAML anchor or merge key.

method.security = method.security || controller.security;

Proposed fix:

 method.security = method.security || (controller.security ? JSON.parse(JSON.stringify(controller.security)) : controller.security);
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

No branches or pull requests

1 participant