1

I am having trouble in setting security schema in open api swagger spec in yaml.

I get below error while setting security schemas:

enter image description here

in paths I did use Bearerauth but still same issue:

paths:

/v1/items:
    get:
      tags:
        - Item Resources
      summary: searches items
      security:
        - BearerAuth: [adsfdf]
      operationId: searchItems
      description: |

Any suggestion on how to fix this issue, or there is any issue with implementation ?

VR1256
  • 1,266
  • 4
  • 28
  • 56

1 Answers1

2

Your global security definition is indented. Global security is defined at the top level, not inside the auth type or component definitions.

Also, in your path usage, you've defined a scope adsfdf. Security scopes do not work with Bearer Authentication - this format is present in OpenAPI for the purpose of OAuth. For more details, see Swagger's documentation.

security:
  - bearerAuth: []         # use the same name as above
Software2
  • 2,358
  • 1
  • 18
  • 28