Skip to content

How to describe optional security? #2802

Answered by raphael
johnholiver asked this question in Q&A
Discussion options

You must be logged in to vote

The code generation algorithm does explicitly handle the case where the payload attribute used to map the credential is not required and in this case provides a nil value to the authorization function. So at least mechanically you should be able to implement the behavior you are after. It should be possible to change the OpenAPI spec generation so it matches the above by doing a similar check. The current code that generates the OpenAPI security section does not have access to the payload so it would have to be modified so that it can access the method payload and check whether the credential field is required or not.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by johnholiver
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants