I have a problem where an OpenAPI 2.0 specification takes a path parameter that is a valid string URI which looks like 1234/models/4321/v1
to form a URL endpoint that looks like: http://localhost/endpoints/1234/models/4321/v1/predict
. I've defined the endpoint as the following in my swagger.yaml:
/endpoints/{modelURI}/predict:
post:
operationId: predict
summary: Run inference on the input array.
consumes:
- application/json
produces:
- application/json
parameters:
- name: body
in: body
description: The input NDArray
required: true
schema:
$ref: '#/definitions/Prediction'
- name: modelURI
in: path
description: The URI of the model
required: true
type: string
format: uri
The problem is that event though I've specified format: uri
Swagger codegen will URL-encode the path parameter in the generated clients and the request will look like http://localhost/endpoints/1234%2Fmodels%2F4321%2Fv1/predict
. Lower in our software stack there's an HTTP router which cannot interpret the request because it's expecting a different format. Unfortunately due to legacy software, we cannot easily change the specification.
How can I instead force Swagger to not encode this path parameter? Can I do this through some sort of plugin?