I generate an Angular client for a.Net Core 3.1 API using NSwagStudio. The API includes endpoints that can be used with multiple Http request types (e.g. POST, GET). The client generates a method for each request with the same base name, plus a number.
The schema contains an endpoint /contract
that supports GET
and POST
requests, and an endpoint /contract/{ID}
that supports GET
, POST
and DELETE
requests.
The generated client has methods like :
ContractAsync
for GET requests without IDContract2Async
for POST requests without IDContract3Async
for GET requests with IDContract4Async
for POST requests with IDContract5Async
for DELETE requests with ID
I would like it to generate methods named:
GetContractAsync
for GET requests without IDPostContractAsync
for POST requests without ID
etc
The answer to the question is to "implement and provide an own IOperationNameGenerator" See https://stackoverflow.com/a/49935417/4180382
I have no clue how to implement and provide this IOperationNameGenerator.
The "Web Api via reflection" tab contains several custom implementations but doesn't mention "IOperationNameGenerator"
How do I implement IOperationNameGenerator?