Swagger-editor: Host regex only allows subdomain URL, e.g. <mydomain>/api is not possible

Created on 15 Sep 2015  Â·  2Comments  Â·  Source: swagger-api/swagger-editor

Expected behaviour:

Host: test.com/api 

Sets the Host to test.com/api

Actual behaviour:

✖ Swagger Error

The host (name or ip) of the API. Example: 'swagger.io'
Jump to line 5
Details
Object
code: "PATTERN"
message: "String does not match pattern ^[^{}/ :\\]+(?::\d+)?$: test.com/api"
path: Array [1]
0: "host"
description: "The host (name or ip) of the API. Example: 'swagger.io'"
level: 900
type: "Swagger Error"
lineNumber: 5
question

Most helpful comment

The swagger spec says the host can only be a hostname or ip address. It does not support path.
If you want to use a subdirectory then look into the basePath property.

https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md
"The host (name or ip) serving the API. This MUST be the host only and does not include the scheme nor sub-paths. It MAY include a port. If the host is not included, the host serving the documentation is to be used (including the port). The host does not support path templating."

All 2 comments

The swagger spec says the host can only be a hostname or ip address. It does not support path.
If you want to use a subdirectory then look into the basePath property.

https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md
"The host (name or ip) serving the API. This MUST be the host only and does not include the scheme nor sub-paths. It MAY include a port. If the host is not included, the host serving the documentation is to be used (including the port). The host does not support path templating."

Thank you. A hint in the editor error to this specification may be nice, I'm certainly not the only one running into this. I'm closing this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

confuser picture confuser  Â·  6Comments

radj picture radj  Â·  5Comments

jemerald picture jemerald  Â·  4Comments

SteveNewhouse picture SteveNewhouse  Â·  5Comments

fchebbo picture fchebbo  Â·  5Comments