Skip to content

[exclusive options] best match algorithm addition #226

@paztis

Description

@paztis

Describe the feature

In the standard example of petStore example https://petstore3.swagger.io/ we have below routes defined

/pet/findByStatus
/pet/{petId}

When using it with generators, it declares the routes in the same order as it is set in the openApi spec => problem appears

if I call GET /pet/findByStatus:

  • without exclusive option in the router: both routes are executed
  • with exclusive option in the router: route /pet/{petId} is executed (last match)

In openApi specifications it is not the order that do the priority but the less parameter route (see https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#path-templating-matching)

I create a "best match' algorithm to support it, that stay compatibel with original solution.

PR to support it is here: #227

Checklist

  • I have searched through GitHub issues for similar issues.
  • I have completely read through the README and documentation.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions