Skip to content

Path detection selecting wrong path #92

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

Closed
Nitwel opened this issue May 31, 2020 · 2 comments
Closed

Path detection selecting wrong path #92

Nitwel opened this issue May 31, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@Nitwel
Copy link

Nitwel commented May 31, 2020

Here's an example:

openapi: 3.0.1
info:
  title: Directus SDK
  description: Template for generating any kind of SDK.
  contact:
    email: [email protected]
  license:
    name: GPL-3.0
    url: 'https://www.gnu.org/licenses/gpl-3.0.de.html'
  version: 1.0.0
externalDocs:
  description: Directus Docs
  url: 'https://docs.directus.io'
servers:
  - url: 'https://demo.directus.io/{project}'
    variables:
      project:
        default: thumper
        description: The project name
  - url: '/thumper'paths:
paths:
  # Projects
  /{project}:
    $ref: './paths/projects/project.yaml'
    servers:
      - url: 'https://demo.directus.io/'
  /server/projects:
    $ref: './paths/projects/projects.yaml'
    servers:
      - url: 'https://demo.directus.io/'
  /server/projects/{project}:
    $ref: './paths/projects/delete-project.yaml'
    servers:
      - url: 'https://demo.directus.io/'
  # Files
  /files:
    $ref: './paths/files/files.yaml'
  /files/{id}:
    $ref: './paths/files/file.yaml'
  /files/{id}/revisions:
    $ref: './paths/files/revisions.yaml'
  /files/{id}/revisions/{offset}:
    $ref: './paths/files/revision.yaml'

When you now try to call /files for example, it will match the /{project} endpoint to it. Instead, the priority should not be on the order but on the variables (Variables last).

So /abc before /{var} and /path/to/something before /path/to/{var}

@Nitwel Nitwel added the bug Something isn't working label May 31, 2020
@rwalle61
Copy link
Collaborator

rwalle61 commented May 31, 2020

Thanks! Is this a duplicate of #57?

@Nitwel
Copy link
Author

Nitwel commented May 31, 2020

Oh yea sorry, didn't check. 👍

@Nitwel Nitwel closed this as completed May 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants