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.
When using
controller.secuirty
vsmethod.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
.https://github.com/thiagobustamante/typescript-rest-swagger/blob/a0dd006e003a3f1ae256db87f33c6d2dadc3cb63/src/swagger/generator.ts#L139
Proposed fix: