-
Notifications
You must be signed in to change notification settings - Fork 9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'enum' doesn't work #625
Comments
That really depends on the Swagger specification file you have. Not really sure what language is that and which library you use to produce your swagger specification. Can you provide the json output you get for both options? |
{"resourcePath":"/products","basePath":"http://cardwiser.local/api/client/web","apis":[{"path":"/api/getCategories","description":"Categories","operations":[{"parameters":[],"summary":"Categories","httpMethod":"POST","nickname":"getCategories"}]},{"path":"/api/getBrands","description":"Brands","operations":[{"parameters":[{"name":"page","description":"page","dataType":"integer","allowMultiple":false,"paramType":"form"},{"name":"char","description":"char","dataType":"string","allowMultiple":false,"paramType":"form"},{"name":"price_filter","description":"price_filter","dataType":"integer","allowMultiple":false,"paramType":"form"},{"name":"cat_id","description":"cat_id","dataType":"integer","allowMultiple":false,"paramType":"form"},{"name":"pro_type","description":"pro_type","required":false,"enum":["Both","Physical","Electronic"],"dataType":"integer","allowMultiple":false,"defaultValue":"Physical","paramType":"form","type":"string"}],"summary":"Brands","httpMethod":"POST","nickname":"getBrands"}]},{"path":"/api/getAllBrands","description":"All Brands","operations":[{"parameters":[],"summary":"All Brands","httpMethod":"POST","nickname":"getAllBrands"}]},{"path":"/api/rate_brand","description":"Add/Edit Rating of Brand","operations":[{"parameters":[{"name":"mem_id","description":"mem_id","dataType":"integer","required":true,"allowMultiple":false,"paramType":"form"},{"name":"brand_id","description":"brand_id","dataType":"integer","required":true,"allowMultiple":false,"paramType":"form"},{"name":"rate","description":"rate","dataType":"integer","required":true,"allowMultiple":false,"paramType":"form"}],"summary":"Add/Edit Rating of Brand","httpMethod":"POST","nickname":"rate_brand"}]}],"apiVersion":"1.0.0","swaggerVersion":"1.0"} |
{"resourcePath":"/products","basePath":"http://cardwiser.local/api/client/web","apis":[{"path":"/api/getCategories","description":"Categories","operations":[{"parameters":[],"summary":"Categories","httpMethod":"POST","nickname":"getCategories"}]},{"path":"/api/getBrands","description":"Brands","operations":[{"parameters":[{"name":"page","description":"page","dataType":"integer","allowMultiple":false,"paramType":"form"},{"name":"char","description":"char","dataType":"string","allowMultiple":false,"paramType":"form"},{"name":"price_filter","description":"price_filter","dataType":"integer","allowMultiple":false,"paramType":"form"},{"name":"cat_id","description":"cat_id","dataType":"integer","allowMultiple":false,"paramType":"form"},{"name":"pro_type","description":"pro_type","required":false,"enum":{"1":"Physical","2":"Electronic","0":"Both"},"dataType":"integer","allowMultiple":false,"defaultValue":"Physical","paramType":"form","type":"string"}],"summary":"Brands","httpMethod":"POST","nickname":"getBrands"}]},{"path":"/api/getAllBrands","description":"All Brands","operations":[{"parameters":[],"summary":"All Brands","httpMethod":"POST","nickname":"getAllBrands"}]},{"path":"/api/rate_brand","description":"Add/Edit Rating of Brand","operations":[{"parameters":[{"name":"mem_id","description":"mem_id","dataType":"integer","required":true,"allowMultiple":false,"paramType":"form"},{"name":"brand_id","description":"brand_id","dataType":"integer","required":true,"allowMultiple":false,"paramType":"form"},{"name":"rate","description":"rate","dataType":"integer","required":true,"allowMultiple":false,"paramType":"form"}],"summary":"Add/Edit Rating of Brand","httpMethod":"POST","nickname":"rate_brand"}]}],"apiVersion":"1.0.0","swaggerVersion":"1.0"} |
Oh wow, that's a very old version of Swagger Spec. Which library do you use to produce that? I don't think the UI supports it at all anymore. |
/ swagger-ui.js |
No, I mean which library do you use to produce the json output you pasted above? |
sorry, did you mean that ? in index.html swagger get php file with array of options. That's all. |
No, that's the version of swagger-ui/swagger-js. So you're using php? Do you use swagger-php? Any other php library to generate the swagger documentation? |
... resources.php contains the clean json_encoded array. .. |
I'm sorry, @Suicide40, but I really don't understand your set up. I don't know php at all, and I don't understand how your json is being generated. |
ok, I will try to make it on other way. |
.....
'enum' => [
0 => 'Both',
1 => 'Physical',
2 => 'Electronic',
],
'dataType' => 'integer',
.....
that is work !
BUT
....
'enum' => [
1 => 'Physical',
2 => 'Electronic',
0 => 'Both',
],
'dataType' => 'integer',
.....
DOESN'T WORK
The text was updated successfully, but these errors were encountered: