OpenAPI.NET.CSharpAnnotations icon indicating copy to clipboard operation
OpenAPI.NET.CSharpAnnotations copied to clipboard

How to get default VERB and URL from webapi route configuration

Open NewFuture opened this issue 7 years ago • 7 comments

It's a excellent tools, but can it be easier and more intelligent to use.

It is unnecessary to annotate the verb and url and parameters for all of the web API actions, because It already exists in routing.

for example

[HttpGet]
[Route("V1/samples/{id}")]
public async Task<SampleObject1> SampleGet1(string id, [FromUri]bool queryBool)
{
    throw new NotImplementedException();
}

we can know:

  • the verb is GET
  • the path is V1/samples/{id}
  • the parameter id is in path as string
  • the parameter queryBool is in query as boolean

Can we generate the document from the code without Superfluous Annotations of those? like this project https://github.com/domaindrivendev/Swashbuckle dose.

( In addition, the response tag is what I really want to add)

NewFuture avatar Sep 11 '18 08:09 NewFuture

@NewFuture Thanks for the question. Not every service wants to take run time dependency on a tool to generate document, swashbuckle comes with its own limitation on support for various platforms. So this tool leverages the VS Comments with few modifications to generate document.

Shwetap05 avatar Sep 11 '18 19:09 Shwetap05

@Shwetap05 yes, I agree with you.

Not every service wants to take run time dependency on a tool to generate document

But, we need not do this in runtime. We can get those info from assembly files (the DLL,which are already provided), as the NSwag CommandLine dose.

It will be awesome features.

NewFuture avatar Sep 12 '18 02:09 NewFuture

@NewFuture thanks for the feedback we will look into this.

Shwetap05 avatar Sep 12 '18 19:09 Shwetap05

Thank you

NewFuture avatar Sep 13 '18 15:09 NewFuture

any update about this feature?

NewFuture avatar Aug 26 '19 05:08 NewFuture

Any idea if/when this will be available?

nelkenson avatar Mar 23 '20 15:03 nelkenson

Upvoting this feature as well! Verb and path can be extracted implicitly based on the existing attributes.

cheukchuen avatar Nov 09 '20 21:11 cheukchuen