Skip to content
This repository has been archived by the owner on Feb 17, 2024. It is now read-only.

Security Scheme not found when included inside a Library #775

Open
dagutten opened this issue Jun 14, 2023 · 0 comments
Open

Security Scheme not found when included inside a Library #775

dagutten opened this issue Jun 14, 2023 · 0 comments

Comments

@dagutten
Copy link

dagutten commented Jun 14, 2023

I am trying to create a common library with resource types. As part of the resource type, I want to include a Security Scheme.

I am trying to add it in two different ways:
A- Adding the security scheme directly in the common library (lib --> security scheme)
B- Adding the security scheme in a library and adding that library in the common library (lib --> lib --> security Scheme)

Using approach B works, using approach A throws "Error: Security scheme 'oauth2Scheme' not found in declarations."

Let me provide the code:

#%RAML 1.0 Library
usage: A common lib
uses:
  securitySchemeFromLibrary: securitySchemeLibrary.raml
securitySchemes:
  oauth2Scheme: !include securityScheme.raml
resourceTypes:
    genericCollection:
      usage: Use this resourceType to represent any collection of items
      securedBy: [ oauth2Scheme ] ## A) This fails with: Security Scheme not found in declaration
      ##  B)  securedBy: [ securitySchemeFromLibrary.oauth ] This works

securityScheme.raml

#%RAML 1.0 SecurityScheme
type: OAuth 2.0
describedBy:
  headers:
    Authorization:
          type: string
          required: true

securitySchemeLibrary.raml

#%RAML 1.0 Library
securitySchemes:
  oauth: !include securityScheme.raml

I can not fully understand why I am a receiving the "not found declaration" error.

image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant