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

Auth section is missing after latest update #2121

Closed
Grillpfanne opened this issue Aug 5, 2022 · 10 comments
Closed

Auth section is missing after latest update #2121

Grillpfanne opened this issue Aug 5, 2022 · 10 comments

Comments

@Grillpfanne
Copy link

Describe the bug
Auth section is missing. There is a PR removing this functionality: #2022
The PR doesn't give information about why this was removed, and it still shows screenshots with an auth section present.
It seems that the auth section in the screenshots is just a description text.

I think the option to have the auth section auto-generated based on configured securitySchemes is a good feature.

For me, this looks like a bug, because it essentially removes needed information, without having the option to add this data back.

Expected behavior
There is an option to display the auth section based on the securitySchemes.

Minimal reproducible OpenAPI snippet(if possible)
{ "openapi": "3.0.2", "info": { "title": "API", "description": "This is my API.", "version": "1.0" }, "components": { "securitySchemes": { "ApiKeyAuth": { "type": "apiKey", "in": "header", "name": "X-Authorization", "description": "This should be shown" } } }, "security": [ { "ApiKeyAuth": [] } ] }

Additional context
Sadly, there is no "why" given on the PR, so it is hard to follow this change.

@AlexVarchuk
Copy link
Collaborator

Hi @Grillpfanne. Thanks for your issue. You can restore old behavior using <SecurityDefinitions /> in the description tags and off new behavior using options hideSecuritySection: true. Details you can find here.

In your case it looks like this:

{
  "openapi": "3.0.2",
  "info":
    { "title": "API", "description": "This is my API. \n # Authentication \n<SecurityDefinitions />", "version": "1.0" },
  "components":
    {
      "securitySchemes":
        {
          "ApiKeyAuth":
            {
              "type": "apiKey",
              "in": "header",
              "name": "X-Authorization",
              "description": "This should be shown",
            },
        },
    },
  "security": [{ "ApiKeyAuth": [] }],
}

Also, don't forget about hideSecuritySection options.
If you have some other questions feel free to reopen this issue. Thanks.

@Grillpfanne
Copy link
Author

Hi Alex,
thanks for the quick help - works like a charm.

Just to document it, the description should be without whitespace between newline and text, otherwise it isn't correctly recognized.
Working example (tested with https://redocly.github.io/redoc)
{ "openapi": "3.0.2", "info": { "title": "API", "description": "This is my API. \n# Authentication\n<SecurityDefinitions />", "version": "1.0" }, "components": { "securitySchemes": { "ApiKeyAuth": { "type": "apiKey", "in": "header", "name": "X-Authorization", "description": "This should be shown", }, }, }, "security": [ { "ApiKeyAuth": [] } ], }

@AlexVarchuk
Copy link
Collaborator

@Grillpfanne Glad to help you.
It is a bug and this PR should fix it. We'll merge it soon.

@rajendra-kumar-kandpal
Copy link

rajendra-kumar-kandpal commented Mar 28, 2023

Hi @AlexVarchuk,
its clear on how to use security definition tag in the description field but where should this option hideSecuritySection: true be used?? not clear, can you please help? any reference to this where and how it can be used is much appreciated, thankyou!

@rajendra-kumar-kandpal
Copy link

Hi @AlexVarchuk, its clear on how to use security definition tag in the description field but where should this option hideSecuritySection: true be used?? not clear, can you please help? any reference to this where and how it can be used is much appreciated, thankyou!

@Grillpfanne you have any idea on this?

@AlexVarchuk
Copy link
Collaborator

Hi, @rajendra-kumar-kandpal. You should pass it like options to Redoc. The correct way depends on how you use Redoc. You can check this doc. It should help you

@rajendra-kumar-kandpal
Copy link

rajendra-kumar-kandpal commented Mar 29, 2023

Hi, @rajendra-kumar-kandpal. You should pass it like options to Redoc. The correct way depends on how you use Redoc. You can check this doc. It should help you

thanks for getting back @AlexVarchuk

I have been using Redoc through redoc cli(0.13.21), I see example of redoc cli command that does the build with option parameter like as -

redoc-cli build openapi.yaml --options.theme.colors.primary.main=orange

but if you see here this option parameter here configures only theme property what if I want to configure multiple things like for example theme and say hideSecuritySection: true how can i pass multiple configurable items?

can you let me know please

Thanks!

@rajendra-kumar-kandpal
Copy link

Hi, @rajendra-kumar-kandpal. You should pass it like options to Redoc. The correct way depends on how you use Redoc. You can check this doc. It should help you

thanks for getting back @AlexVarchuk

I have been using Redoc through redoc cli(0.13.21), I see example of redoc cli command that does the build with option parameter like as -

redoc-cli build openapi.yaml --options.theme.colors.primary.main=orange

but if you see here this option parameter here configures only theme property what if I want to configure multiple things like for example theme and say hideSecuritySection: true how can i pass multiple configurable items?

can you let me know please

Thanks!

@AlexVarchuk any idea on this??

@AlexVarchuk
Copy link
Collaborator

Hi, @rajendra-kumar-kandpal . Sorry for the delay.
We deprecate redoc-cli and move build commands to @redocly/cli build-docs command. Here you can find documentation.
You can use the configuration file to pass multiple options.
I think it is the best way.

@rajendra-kumar-kandpal
Copy link

Hi, @rajendra-kumar-kandpal . Sorry for the delay. We deprecate redoc-cli and move build commands to @redocly/cli build-docs command. Here you can find documentation. You can use the configuration file to pass multiple options. I think it is the best way.

no worries, thanks for the revert, that will help, thanks for the info.

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

No branches or pull requests

3 participants