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

Incorrect marshalling of boolean query params #281

Closed
aviskase opened this issue Jun 27, 2018 · 1 comment · Fixed by #286
Closed

Incorrect marshalling of boolean query params #281

aviskase opened this issue Jun 27, 2018 · 1 comment · Fixed by #286

Comments

@aviskase
Copy link

Take for example this param:

"parameters": [
          {
            "name": "force",
            "type": "boolean",
            "in": "query"
          }
]

Currently when bravado-core tries to marshal this param, it just casts it to str() which leads to True/False instead of true/false

Temporary ugly monkeypatch snippet for those, who use bravado+pytest:

from bravado_core.param import marshal_param

def _marshal_param(param, value, request):
    marshal_param(param, value, request)
    if param.name in request['params'] and type(value) is bool:
        value = str(value).lower()
        request['params'][param.name] = value

monkeypatch.setattr('bravado.client.marshal_param', _marshal_param)
@frankandrobot
Copy link

How would you apply the monkeypatch w/o the monkeypatch test fixture?

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

Successfully merging a pull request may close this issue.

2 participants