Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

View routes at runtime ala OpenAPI/Swagger #1107

Closed
amweiss opened this issue Jun 23, 2021 · 7 comments
Closed

View routes at runtime ala OpenAPI/Swagger #1107

amweiss opened this issue Jun 23, 2021 · 7 comments
Assignees
Labels
Type: Idea This issue is a high-level idea for discussion.

Comments

@amweiss
Copy link
Contributor

amweiss commented Jun 23, 2021

What should we add or change to make your life better?

Add a way to hook in something like https://github.com/domaindrivendev/Swashbuckle.AspNetCore to produce a consumable view of the routes at runtime.

It seems like if there's a way to expose the configured routes to ApiExplorer, the above package might just work?

Why is this important to you?

This would allow us to produce API documentation that can link to the connected systems including the route through YARP to use to access them.

@amweiss amweiss added the Type: Idea This issue is a high-level idea for discussion. label Jun 23, 2021
@Tratcher
Copy link
Member

We do have these ConfigureEndpoint callbacks that would let you add metadata to routes.

public ReverseProxyConventionBuilder ConfigureEndpoints(Action<IEndpointConventionBuilder, RouteConfig, ClusterConfig?> convention)

@halter73 what would we need to add to routes for Swagger light up?

That said, I'd expect a swagger doc for the proxy routes to be misleading since they usually include wildcards that map to multiple routes on the destination system?

@amweiss
Copy link
Contributor Author

amweiss commented Jun 23, 2021

I agree it's not perfect and would be open to anything that makes sense. Even just an option to spit back out a sanitized serialized config at runtime for some basics would work. Swagger seemed like it might be close enough, but yes, it might be misleading.

@samsp-msft
Copy link
Contributor

@amweiss - can we step back a moment. What are you trying to accomplish here? Do you need swagger as the output format, or is what you are looking for a way to get a dumping of the route table?

Why is this important to you?

This would allow us to produce API documentation that can link to the connected systems including the route through YARP to use to access them.

Unless you are extremely specific in your route definitions, YARP is not going to know much about the endpoints for your app(s). So getting a dumping of the routes is not going to tell you what the API names and parameters are. You will really only get that information from the destination servers.

Depending on how you have configured the URL transformation in YARP - you may need to transform the data from swashbuckle for the destinations. If its using relative URLs then you should be able to set the RoutePrefix, and the API infomation is generated relative to that.

@amweiss
Copy link
Contributor Author

amweiss commented Jun 24, 2021

@samsp-msft the request was:

produce a consumable view of the routes at runtime.

So all I'm looking for is a way to view the routes at runtime over http. This could be combined with our service swagger to allow for developers to know how to reach the endpoints they want to call.

@samsp-msft
Copy link
Contributor

Thanks, seems to be along the same lines as #124 and #1069

@amweiss
Copy link
Contributor Author

amweiss commented Jun 24, 2021

Ah yeah, happy to close this in favor of more votes for #125 (and subsequently #124)

@karelz
Copy link
Member

karelz commented Jun 25, 2021

Duplicate of #124

@karelz karelz marked this as a duplicate of #124 Jun 25, 2021
@karelz karelz closed this as completed Jun 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Idea This issue is a high-level idea for discussion.
Projects
None yet
Development

No branches or pull requests

4 participants