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

No security scope definition generated #37

Open
naXa777 opened this issue Mar 27, 2017 · 1 comment
Open

No security scope definition generated #37

naXa777 opened this issue Mar 27, 2017 · 1 comment
Labels

Comments

@naXa777
Copy link

naXa777 commented Mar 27, 2017

I've launched springfox-demos:boot-swagger project, copy-pasted the generated JSON from http://localhost:8080/springfox/oai/api-docs?group=user-api into Swagger Editor (via File > Paste JSON menu), and got the following error

errors screenshot from 2017-03-27 03-24-21

It states:

code: "UNRESOLVABLE_REFERENCE"
message: "Security scope definition could not be resolved: read"
level: 900
type: "Swagger Error"

Here's the relevant JSON

...
"paths":{"/api/user":{"post":
...
"security":[{"test":["read"]}]
}},
...
"securityDefinitions":{"test":{"type":"basic"}},
...

And YAML

...
paths:
  /api/user:
    post:
...
      security:
        - test:
            - read
...
securityDefinitions:
  test:
    type: basic
...

This issue is reproducible for BasicAuth and ApiKey authentication types.

@kevdoran
Copy link

To clarify what I think is going on here: The issue is not that scope definitions should be generated for BasicAuth and ApiKey types; rather, it is that scope definitions should not be referenced when using those types, as scopes are only used with the OAuth type in Swagger 2.0

I am basing this off of: https://apihandyman.io/writing-openapi-swagger-specification-tutorial-part-6-defining-security/

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

No branches or pull requests

3 participants