You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using controllers it is possible to use {controller} when setting stuff within the OpenApiProjectReference. We use that in our projects to set <ClassName>{controller}Client</ClassName>.
Since .NET 7 when using minimal apis we can now define so called route groups via app.MapGroup("GroupName") to group several endpoints together. When using this I would now like to have the possibility to define the ClassName in a similar fashion to what {controller} does. So e.g. a {routeGroup} which creates a client per route group.
By the way I'd gladly try to implement a first version if you think this would be a good and necessary addition.
The text was updated successfully, but these errors were encountered:
FYI I just needed this as well, and figured out we can hijack the {controller} pattern for it.
You just have to create an IDocumentFilter implementation for your swagger generator, that constructs the operationId parameter for each operation, in the form controller_method. Obviously since you don't have an actual controller class, and methods with minimal apis, you need to sanitize the tags of the operation into a valid class name (the group will show up as a tag on the operation) and divine a method name for it from the info of the operation.
Has lots of possible ugly edge cases around so I can't give a complete example, as didn't have time for it yet, but that is the gist of it.
When using controllers it is possible to use
{controller}
when setting stuff within theOpenApiProjectReference
. We use that in our projects to set<ClassName>{controller}Client</ClassName>
.Since .NET 7 when using minimal apis we can now define so called route groups via
app.MapGroup("GroupName")
to group several endpoints together. When using this I would now like to have the possibility to define theClassName
in a similar fashion to what{controller}
does. So e.g. a{routeGroup}
which creates a client per route group.By the way I'd gladly try to implement a first version if you think this would be a good and necessary addition.
The text was updated successfully, but these errors were encountered: