Skip to content

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

@r0610205

Description

@r0610205

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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions