java - Swagger Error Expected type string but found type integer -
i started working on swagger generate documentation our restful apis. use yamlbeans-1.09.jar convert java dtos yaml file. works fine , yaml validated on http://www.yamllint.com/ still while testing swagger interface, gives error "expected type string found type integer" , "no enum match for: 2" wherever mention swagger : 2.0 in file.
my sample yml file is:
basepath: /employment host: api.xxxx.com schemes: - https swagger: 2.0 info: title: api doc description: description info goes here version: 1.0.0
it tends give error line number before swagger version. appreciated.
edit: have defined swagger version string in java code , written described below:
hashmap<string, object> rootelementsforyml = new hashmap<string, object>(); rootelementsforyml.put(swagger, "2.0"); rootelementsforyml.put(host, "api.xxxx.com"); rootelementsforyml.put(basepath, basepath); rootelementsforyml.put(schemes, new string[]{"https"});
but still gives no result , same error.
that's because version value string , not number. specifying 2.0
interpreted number. wrap quotes "2.0"
, work fine.
Comments
Post a Comment