question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support XML-based OpenAPI docs for minimal APIs

See original GitHub issue

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Swashbuckle currently supports reading the XML doc string associated with an action’s method to derive the description, summary, example, etc for an action.

We need to add similar support for minimal endpoints where the documentation might be on a referenced method group or (maybe) on a Map* invocation.

Expected Behavior

/// <summary>
/// This is a foo.
/// </summary>
string GetFoo() => "This is a test";

Should resolve the correct summary info.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:39
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

12reactions
mholeccommented, May 31, 2022

I consider this functionality unnecessary. Given the way REST APIs are created and the constant proliferation of approaches like microservices and API gateways, generating documentation in general makes no sense. The documentation generated falls short of the quality of the specification and reflects implementation errors. Generated documentation is unusable in practice for automation, mocking and testing. The specification first approach has been a trend for several years.

3reactions
andrewlockcommented, Sep 15, 2022

Just FYI, this already works, as long as you

  • Setup Documentation generation
  • Configure IncludeXmlComments in AddSwaggerGen()
  • Use MethodGroup endpoint handlers.

That last point is the biggest sticking point - it would be great if you could use lambdas too, but at least this partially works 🙂

One observation (I’m not sure if it’s a bug or expected behaviour). If you use WithOpenApi(), it wipes out any existing documentation of the parameters that comes from XML

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use OpenAPI in Minimal API apps
Minimal APIs provide built-in support for generating information about endpoints in an app via the Microsoft.AspNetCore.OpenApi package.
Read more >
Using XML Documentation With ASP.NET Core Minimal ...
In this short post, we'll go through the steps required to add more detailed information to your OpenAPI Schema files, resulting in more...
Read more >
Quickly create a .Net 6 minimal API with swagger ...
The minimal API will help developers to build microservices with very ... Swagger (OpenAPI Specification): Empowering the API Documentation ...
Read more >
Open API support for ASP.NET Core Minimal API
This article will discuss about implementing Open API (Swagger) for ASP.NET Core 6.0 minimal API. Today I saw one video from Maria Naggaga ......
Read more >
Apache CXF -- Index
Apache CXF™ is an open source services framework. CXF helps you build and develop services using frontend programming APIs, like JAX-WS and JAX-RS....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found