Open radicalapps opened 4 years ago
I don't think there is something available out-of-the-box. I see two options:
Did you ever find a clean way to do this?
Sorry Timo, not really!
@RicoSuter the CSharp operation model contains security related properties which can be used in templating:
Would you consider a PR where I add the same properties to TypeScriptOperationModel
so it can be used in customized templates?
Currently I don't see any other way than hardcoding the anonymous operations, which defeats the purpose of having it correctly specified in the OpenApi spec.
I have an aspnetcore C# api and am successfully generating swagger and typescript (fetch) code.
Most of my Api methods require bearer authentication, and I am adding the header using transformOptions. This works as expected.
One of my methods has the [AllowAnonymous] attribute and, as expected, shows in the Swagger UI without the padlock icon.
I need to execute this call without the Bearer token. However, there does not appear to be a hook to enable the call to transformOptions to be bypassed for this method, or for the transformOptions implementation to discover that this specific all does not require authentication.
The only solution I can think of right now is to edit the Typescript after it has been generated. This seems less than ideal.
If this is not something that is already built in that I have missed, could it be added as a feature request?
Thanks, Jeff.