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

[Swashbuckle 5.0] ResolveConflictingActions #148

Closed
PeterZong opened this issue Dec 22, 2014 · 2 comments
Closed

[Swashbuckle 5.0] ResolveConflictingActions #148

PeterZong opened this issue Dec 22, 2014 · 2 comments

Comments

@PeterZong
Copy link

Hi,

I noticed that the path object allows path templating - https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#pathsObject

So I am not very clear about this statement - "In contrast to WebApi, Swagger 2.0 does not include the query string component when mapping a URL to an action."

If there are 2 actions with same path, but they have different query parameters, 2 path objects should be generated and I don't need to use ResolveConfilictingActions.

E.g.
Path object 1 - /api/contract
Path object 2 - /api/contract?id={id}

If there are 2 actions with same path, and they have same query parameters, I thinks ApiExplorer will ignore both of them. So nothing will be generated for these 2 actions.

So for which scenario, I need to use the ResolveConflictingActions?

Thanks,
Peter

@domaindrivendev
Copy link
Owner

Hey there

It's not immediately obvious from the Swagger 2.0 specification, but the path MUST NOT contain the query string component. The second path object in your example above breaks the specification and hence the swagger tooling ... including the swagger-ui. See the following two issues in the swagger repo for more information around this "very limiting" constraint:

OAI/OpenAPI-Specification#195
OAI/OpenAPI-Specification#164

ApiExplorer on the other hand will have two ApiDescriptions for routes that differ only by query string component. You can look at the Swashbuckle dummy app for an example - https://github.com/domaindrivendev/Swashbuckle/blob/swagger_2.0/Swashbuckle.Dummy.Core/Controllers/ConflictingActionsController.cs.

Cheers

Richie

@PeterZong
Copy link
Author

Hi Richie,

Thanks for your explanation. So this is also true of Swagger 1.2, correct?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants