openapi-generator icon indicating copy to clipboard operation
openapi-generator copied to clipboard

[REQ] [Swift6] requiresAuthentication should be optional or enum with type of authorization

Open iDevPro opened this issue 2 months ago • 0 comments

Is your feature request related to a problem? Please describe.

According to the OpenAPI documentation, it's possible to create a "path" with security options: without authorization + with authorization (the behavior of the "path" depends on this). I encountered a similar need.

Describe the solution you'd like

  • Provide option requiresAuthentication as enum
enum RequiresAuthentication {
    case required
    case optional
    case nonRequired
}

for determine when we need to force check auth in interceptor or not.

  • May be we also need to provide types of auth for choose properly way of auth in interceptor

  • I suppose, also we need to improve algorithms in generator, because now it don't understand more then one auth variants

Describe alternatives you've considered

There is a hack solution, for example, looking at the method name in the interceptor and making a decision manually ))) But this is not code generation way :)

Additional context

Image

iDevPro avatar Dec 02 '25 07:12 iDevPro