Skip to content

Implicit assumption of base path #4

@posener

Description

@posener

I've tried the opencli with a "imposter" mock server that I ran on the same swagger.yaml.

The command to run the mock server, assuming you have a swagger.yaml in CWD:

$ echo '{"plugin":"com.gatehill.imposter.plugin.openapi.OpenApiPluginImpl","specFile":"swagger.yaml"}' > openapi-plugin-petstore-config.json
$ docker run -ti -p 8443:8443 -v $PWD:/opt/imposter/config outofcoffee/imposter-openapi

The mock server serves the swagger.json on http://localhost:8443/_spec/combined.json - under _spec path.
Running open-cli http://localhost:8443/_spec/combined.json -v results in:

Imposter Mock APIs $ pet Create --pet.name=kitty
DEBUG:open-cli:Parsing the input text pet Create --pet.name=kitty
DEBUG:open-cli:Invoke operation <bravado.client.CallableOperation object at 0x7f7e1e977590> with arguments {'pet': {'name': 'kitty'}}
DEBUG:bravado.client:Create({'pet': {'name': 'kitty'}})
DEBUG:urllib3.connectionpool:http://localhost:8443 "POST /_spec/combined.json/api/pets HTTP/1.1" 404 53
ERROR:open-cli:404 Not Found: Response specification matching http status_code 404 not found for operation Operation(Create). Either add a response specification for the status_code or use a `default` response.

The open-cli tries to access the api on path /_spec/combined.json/api/pets instead of /api/pets.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions