In my API documentation, I would like to define the security required for each API endpoint. The project defines roles and permissions that determine which users can access the API. What is the best way to document this information in Swagger? Is there any best practice or recommendation on how to show this detail?
This is what I tried using securityDefinitions and a self-defined variable for roles, but this information (x-role names) was not copied to the documentation when I ran it through swagger2markup or using swagger-ui.
"securityDefinitions": { "baseUserSecurity": { "type": "basic", "x-role-names": "test" } }
What is the best way to document role and permission information for an endpoint?
whatsTheDiff
source share