Closed jaakko-solita closed 6 years ago
It seems the swagger.json has {?version}
in the actual path
"paths": {
"/api/v1/all-trains{?version}": {
"get": {
"tags": [
"all-trains"
],
"summary": "Returns trains that are never than {version}",
"operationId": "getAllTrainsUsingGET",
"consumes": [
"application/json"
],
"produces": [
"*/*"
],
"parameters": [{
"name": "version",
"in": "query",
"description": "version",
"required": false,
"type": "integer",
"format": "int64"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Train"
}
}
}
}
}
},
but Swagger's own "Try it out" feature doesn't mind them: https://rata-beta.digitraffic.fi/swagger-ui.html#!/all-trains/getAllTrainsUsingGET
Consider supporting this URL type?
I'm not sure, that it is a documented feature. According to spec Path templating refers to the usage of curly braces ({}) to mark a section of a URL path as replaceable using path parameters.
So curly braces are only for paths.
And in your example version is a query parameter, which is pointed as in: query
.
So I honestly don't get why do you need such syntax
If I use the following code:
And then run this query:
It returns an http error 400 and the requests looks like this:
/api/v1/all-trains%7B?version%7D=&version=1523
When it should be like this:
api/v1/all-trains?version=1523
. The parameters can be found two times in the url along with some url escapes.I suspect it has something to do with the api having urls like this:
But the all-trains url that I'm testing only has that one optional parameter called version.
Any idea what's wrong?