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

Ambiguity Validation #1767

Open
Kousik1612 opened this issue Sep 9, 2024 · 1 comment
Open

Ambiguity Validation #1767

Kousik1612 opened this issue Sep 9, 2024 · 1 comment
Labels
Type: Bug Something isn't working

Comments

@Kousik1612
Copy link

Kousik1612 commented Sep 9, 2024

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.

@Kousik1612 Kousik1612 added the Type: Bug Something isn't working label Sep 9, 2024
@tatomyr
Copy link
Contributor

tatomyr commented Oct 16, 2024

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.

Are you trying to run the lint command?
As the linter tells, both paths are the same, so their operations should be grouped under one of them (and the second should be removed).
If you still want your description to remain the same, you can turn off the no-ambiguous-paths rule in the Redocly config file.

@tatomyr tatomyr transferred this issue from Redocly/redoc Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants