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

unmarshal bug in 4.7.(0|1) #163

Closed
cbarraford opened this issue Mar 22, 2017 · 7 comments · Fixed by #165
Closed

unmarshal bug in 4.7.(0|1) #163

cbarraford opened this issue Mar 22, 2017 · 7 comments · Fixed by #165

Comments

@cbarraford
Copy link

I've confirmed that we don't get the following error when i downgrade from 4.7.0 (or 4.7.1) to 4.6.1.

======================================================================
1) ERROR: test_bundles (bundles.test_bundles.BundlesTest)
----------------------------------------------------------------------
   Traceback (most recent call last):
    test/api/bundles/test_bundles.py line 30 in test_bundles
      app = self.client.Applications.Create(body=dict(name='test_app')).result()
    /usr/local/lib/python2.7/dist-packages/bravado/http_future.py line 77 in result
      self.response_callbacks)
    /usr/local/lib/python2.7/dist-packages/bravado/http_future.py line 115 in unmarshal_response
      operation)
    /usr/local/lib/python2.7/dist-packages/bravado_core/response.py line 112 in unmarshal_response
      op.swagger_spec, content_spec, content_value)
    /usr/local/lib/python2.7/dist-packages/bravado_core/unmarshal.py line 56 in unmarshal_schema_object
      return unmarshal_model(swagger_spec, schema_object_spec, value)
    /usr/local/lib/python2.7/dist-packages/bravado_core/unmarshal.py line 194 in unmarshal_model
      model_as_dict = unmarshal_object(swagger_spec, model_spec, model_value)
    /usr/local/lib/python2.7/dist-packages/bravado_core/unmarshal.py line 136 in unmarshal_object
      if schema.has_default(swagger_spec, prop_spec):
    /usr/local/lib/python2.7/dist-packages/bravado_core/schema.py line 22 in has_default
      return 'default' in swagger_spec.deref(schema_object_spec)
   TypeError: argument of type 'NoneType' is not iterable

@cbarraford
Copy link
Author

My API responded with 200, here's an example JSON body

{
  "id": 12,
  "principal_id": 1,
  "access_type": "acl",
  "connection_timeout": {
    "Int64": 0,
    "Valid": false
  },
  "read_timeout_timeout": {
    "Int64": 0,
    "Valid": false
  },
  "init_timeout": {
    "Int64": 0,
    "Valid": false
  },
  "idle_timeout": {
    "Int64": 0,
    "Valid": false
  },
  "max_processes": {
    "Int64": 0,
    "Valid": false
  },
  "min_processes": {
    "Int64": 0,
    "Valid": false
  },
  "max_conns_per_process": {
    "Int64": 0,
    "Valid": false
  },
  "load_factor": {
    "Float64": 0,
    "Valid": false
  },
  "url": "http://localhost:3939/content/12/",
  "name": "deleteme",
  "title": null,
  "bundle_id": {
    "Int64": 0,
    "Valid": false
  },
  "app_dir": null,
  "app_mode": 0,
  "content_category": "",
  "has_parameters": false,
  "needs_config": true,
  "created_time": "0001-01-01T00:00:00Z",
  "last_deployed_time": "0001-01-01T00:00:00Z",
  "users": null,
  "groups": null,
  "vanities": null,
  "r_version": null,
  "build_status": 0,
  "run_as": null,
  "run_as_current_user": false
}

@sjaensch
Copy link
Contributor

@cbarraford could you post your swagger spec as well please?

@cbarraford
Copy link
Author

@sjaensch sorry, our API is private and I can't disclose it. Sorry!

@sjaensch
Copy link
Contributor

@cbarraford unfortunately then you'll have to either create a reduced test case or do some debugging on your own. What I can say from the stack trace is that it has something to do with one of the properties for which the value is null. Apparently bravado-core can't find the spec for that property. Maybe that helps?

@cbarraford
Copy link
Author

Yeah, trying to debug on my own. Heres what i got so far...

the func get_spec_for_prop can return None.
https://github.com/Yelp/bravado-core/blob/master/bravado_core/schema.py#L103

But then we don't handle None quite right here
https://github.com/Yelp/bravado-core/blob/master/bravado_core/unmarshal.py#L136

@sjaensch
Copy link
Contributor

Agreed, we should handle a spec not being available gracefully. Working on a fix.

@cbarraford
Copy link
Author

created a PR with the fix, #164

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