Skip to content
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

[Data Types] Fix minimum and maximum types #24

Closed
webron opened this issue Apr 7, 2014 · 5 comments
Closed

[Data Types] Fix minimum and maximum types #24

webron opened this issue Apr 7, 2014 · 5 comments

Comments

@webron
Copy link
Member

webron commented Apr 7, 2014

Right now, the type for minimum and maximum fields is string. Besides the fact that this can lead to funny errors, we want to make sure we follow the JSON Schema definitions and convert the type to number.

@vincentjames501
Copy link

+1. Also, is there any reason why minimum and maximum don't apply to type string as well? Seems only logical that one would want to validate the length of a string.

@mission-liao
Copy link
Contributor

I'm not sure if it's the same issue, if it's not ok to append this to the issue, please let me know.

Now I found that the string representation of minimum & maximum is always number, even if their type is integer. Ex. in http://petstore.swagger.wordnik.com/api/api-docs/pet, we can find this:

{
"name":"petId",
"description":"ID of pet that needs to be fetched",
"required":true,
"type":"integer",
"format":"int64",
"paramType":"path",
"allowMultiple":false,
"minimum":"1.0",
"maximum":"100000.0"}

Is it expected?

@webron
Copy link
Member Author

webron commented Aug 3, 2014

@vincentjames501 - in Swagger 2.0 the validation fields would be the same as they are in json schema draft 4. If minimum and maximum apply to string in the schema, they would be applied here as well.

@mission-liao - it's pretty much the same issue, yeah. As mentioned above, it'll be changed in Swagger 2.0.

fehguy added a commit that referenced this issue Sep 8, 2014
added model schema, test cases
@webron
Copy link
Member Author

webron commented Sep 19, 2014

@vincentjames501 - FYI, for string the proper attributes are minLength and maxLength, both of which are introduced in Swagger 2.0.

@webron
Copy link
Member Author

webron commented Sep 19, 2014

This has been resolved in Swagger 2.0.

@webron webron closed this as completed Sep 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants