-
Notifications
You must be signed in to change notification settings - Fork 88
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
Not handling "type: integer" without a corresponding "format:" #128
Comments
@MartinDelVecchio this tool tends be to "spec-compiant", so right now what pyswagger supports is based on this table I've followed discussions about Swagger Spec on github and didn't notice the case you described is supported (if you find some thread suggested to support it, please feel free to let me know) And you can extend supported primitives by following this guide |
That section that you linked says, in its third paragraph:
It goes on to say:
So the "format" modifier is optional, not required. That page has numerous examples of "type: integer" without any "format" specified. So I think if you add this entry to your 'integer' key:
You will be fully compliant. In the mean time, I will try achieve this through the primitive creator that you linked to. Thank you for your quick response. |
Creating my own primitive factory with this:
Where my_encode_init() is simply:
Has solved my problem. Thank you. |
@MartinDelVecchio You are right, I missed that part. I'll add primitives without |
The fix is released as v0.8.32, please feel free to let me know is any issue occurred. |
I upgraded to v0.8.32, removed my primitive hack, and re-tested. It works. Thank you for your quick attention to this! |
I am using pyswagger to execute an API call that returns an object with several integer properties. The Swagger for each property specifies only "type: integer"; it does not specify a format (int32 or int64).
When I execute the API, pyswagger raises an exception:
I tracked this down to this code in the Primitives constructor (primitives/init.py):
It seems that pyswagger requires a format, either 'int32' or 'int64', and fails when no format is specified.
I solved my problem by adding a new entry to the map:
It does not appear to me that the Swagger specification requires a "format" for an integer type. In addition, the above code shows that pyswagger doesn't treat int32 and int64 differently.
Is there a reason why pyswagger is insisting on a format for an integer type?
Thanks.
The text was updated successfully, but these errors were encountered: