Redocly / redoc

📘 OpenAPI/Swagger-generated API Reference Documentation
https://redocly.github.io/redoc/
MIT License
23.36k stars 2.29k forks source link

Ambiguity Validation #2586

Open Kousik1612 opened 3 weeks ago

Kousik1612 commented 3 weeks ago

Describe the bug A clear and concise description of what the bug is. I have defined two paths which gets differed by HTTP Method and path parameter. /xyz/{id}/features - POST and /xyz/{id_or_wildcard}/features - GET

Expected behavior A clear and concise description of what you expected to happen. There should not be any error reported as both these API(s) is intended to perform different behaviour as one is POST and other one is GET.

Minimal reproducible OpenAPI snippet(if possible)

'/xyz/{id}/features':
    $merge:
    - $exposure: [public, internal]
      $merge:
      - $ref: '#/components/x-abstract-paths/base'
      - $ref: '#/components/x-abstract-paths/collectionsPost'
'/xyz/{id_or_wildcard}/features':
    $merge:
    - $exposure: [public, internal]
      $merge:
      - $ref: '#/components/x-abstract-paths/base'
      - $ref: '#/components/x-abstract-paths/collectionsGet'

Screenshots If applicable, add screenshots to help explain your problem.

Validating build (redocly lint) ...

    ╔═══════════════════════════════════════════════════════╗
    ║                                                       ║
    ║  A new version of Redocly CLI (1.23.1) is available.  ║
    ║  Update now: `npm i -g @redocly/cli@latest`.          ║
    ║  Changelog: https://redocly.com/docs/cli/changelog/   ║
    ║                                                       ║
    ╚═══════════════════════════════════════════════════════╝

(node:3126) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
validating s/spec/openapi.json...
[1] ../builds/spec/openapi.json:57273:5 at #/paths/~1xyz~1{id}~1features

The path already exists which differs only by path parameter name(s): `/xyz/{id_or_wildcard}/features` and `/xyz/{id}/features`.

57271 |   }
57272 | },
57273 | "/xyz/{id}/features": {
      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
57274 |   "parameters": [
57275 |     {

Error was generated by the no-identical-paths rule.

[2] ../builds/spec/openapi.json:57273:5 at #/paths/~1xyz~1{id}~1features

Paths should resolve unambiguously. Found two ambiguous paths: `/xyz/{id_or_wildcard}/features` and `/xyz/{id}/features`.

57271 |   }
57272 | },
57273 | "/xyz/{id}/features": {
      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
57274 |   "parameters": [
57275 |     {

Error was generated by the no-ambiguous-paths rule.

s/spec/openapi.json: validated in 393ms

❌ Validation failed with 2 errors.
run `redocly lint --generate-ignore-file` to add all problems to the ignore file.

/bin/sh: npm: command not found
ERROR: Failed to validate spec

Additional context Add any other context about the problem here.