Problem with Swagger UI - Validator - Hosts path/schema

1,062 views
Skip to first unread message

Ganz Toll

unread,
Oct 4, 2015, 6:39:08 PM10/4/15
to Swagger
Hi,
This wonderful product works perfectly on localhost. When I move onto our Linux server my json definition file compiles fine but an error icon appears bottom right - when I click that the following output appears: (Using Swagger V2.0). I have tested the erroneous URL running on Linux from my browser and it works fine (Apache hosts and Tomcat server all fine) 

Here's the json source that works:

    "host": "localhost:8080/glassfish9",
    "schemes": [
        "http"
    ],
    "basePath": "/api/v1",
    "produces": [
        "application/json"
    ],


Here's the json source that does NOT work:

    "host": "as003.allproview.com/glassfish9",
    "schemes": [
        "https"
    ],
    "basePath": "/api/v1",
    "produces": [
        "application/json"
    ],

Here's the generated error message:

[{"level":"error","domain":"validation","keyword":"pattern","message":"ECMA 262 regex \"^[^{}/ :\\\\]+(?::\\d+)?$\" does not match input string \"as003.allproview.com/glassfish9\"","schema":{"loadingURI":"#","pointer":"/properties/host"},"instance":{"pointer":"/host"}}]

Thanks in advance,
Nigel.

Ivan Goncharov

unread,
Oct 5, 2015, 5:30:24 AM10/5/15
to Swagger
Inside "host" you should only have "<HOST>:[PORT]". But yours also has path in it: "as003.allproview.com/glassfish9"
From Swagger 2.0 spec:
The host (name or ip) serving the API. This MUST be the host only and does not include the scheme nor sub-paths.

Ganz Toll

unread,
Oct 5, 2015, 6:33:24 PM10/5/15
to Swagger
Thanks very much Ivan - that fixed it.
Cheers,
Nigel.
Reply all
Reply to author
Forward
0 new messages