-
Notifications
You must be signed in to change notification settings - Fork 62
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
OpenAPI path prefix isn't prefixed onto resources #588
Comments
Hi @Ober3550, thanks for raising this. I agree standardising this would be helpful. Are you able to share a minimal test case to illustrate the issue? |
Given the following swagger and imposter config. You can see that there's 3 ways to prefix a value onto the specFile definition but seemingly none to the rest resources. Additionally the internal binding of the server path prefix means that none of the resources are mapping correctly and the server responds with a "File not found". The particular use case we're trying to achieve is to have multiple services that all combines into one big imposter. But we want a parameter to be able to specify a single prefix to all paths relevant to a particular imposter binding We have some ingress routing that we want the swagger # swagger.yaml
openapi: 3.0.0
servers:
- url: http://petstore/petstore1
paths:
/pets/{petId}:
get:
summary: Info for a specific pet
operationId: showPetById
tags:
- pets
parameters:
- name: petId
in: path
required: true
description: The id of the pet to retrieve
schema:
type: string
responses:
"200":
description: Expected response to a valid request
content:
application/json:
examples:
catExample:
value: |-
{ "id": 1, "name": "Cat" }
dogExample:
value: |-
{ "id": 2, "name": "Dog" }
#petstore-config.yaml
plugin: openapi
specFile: swagger.yaml # servers.url is prefixed first
basePath: /petstore2 # Then this gets prefixed
path: /petstore3 # Then this gets prefixed
# None of the above get prefixed onto the rest resources below
resources:
- path: /petstore1/petstore2/petstore3/pets/1 # This returns file not found
method: get
response:
exampleName: catExample
- path: /pets/2
method: get
response:
exampleName: dogExample |
I understand that the resources under the openapi plugin are actually just rest resources. But our teams are having troubles with the fact that openapi uses "path" but rest uses "basePath" and it seems that the path prefixing isn't very standardised across plugin types. It would be great if we could have a universal path variable that gets applied to all resources in a given imposter config (and any contract definitions loaded in by specFiles).
The text was updated successfully, but these errors were encountered: