You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After initialising a bravado.client.SwaggerClient with internally_dereference_refs config enabled you're not able to communicate with the service.
The traceback will look like
File "/home/maci/pg/test_service/virtualenv_run/lib/python3.6/site-packages/bravado/client.py", line 243, in __call__
self.operation, request_options, **op_kwargs)
File "/home/maci/pg/test_service/virtualenv_run/lib/python3.6/site-packages/bravado/client.py", line 271, in construct_request
url = operation.swagger_spec.api_url.rstrip('/') + operation.path_name
AttributeError: 'NoneType' object has no attribute 'rstrip'
Motivations
While working on #263 I've ensured that resources are rebuilt in case internally_dereference_refs is set.
This was made in order to guarantee that all the references (on the already built resources) were stripped out, so after building the Spec object no references will be available.
Unfortunately, build_resource will save a pointer to the used Spec instance into the resource itself but we're using a temporary instance that was not fully initialised.
The effect of this is that a Spec instance that is fully dereferenced will, internally, point to an other Spec instance bind into Operation instances (the pointed Spec instance will be used to send requests, validate responses, etc).
How to fix this
The results of the regression is that Spec object could raise weird exceptions due to undefined api_url and uses double the memory needed (which is sad too).
To fix the issue will be sufficient to replace build_resources(tmp_spec) with build_resources(swagger_spec) but we need to ensure that at that time _internal_spec_dict has been updated to point toward the dereferenced version of the spec dict.
A regression as been introduced by d23868c.
Affected versions
bravado-core: 4.13.3, 4.13.4, 5.0.0 and 5.0.1
Symptoms
After initialising a
bravado.client.SwaggerClient
withinternally_dereference_refs
config enabled you're not able to communicate with the service.The traceback will look like
Motivations
While working on #263 I've ensured that resources are rebuilt in case
internally_dereference_refs
is set.This was made in order to guarantee that all the references (on the already built resources) were stripped out, so after building the
Spec
object no references will be available.Unfortunately,
build_resource
will save a pointer to the usedSpec
instance into the resource itself but we're using a temporary instance that was not fully initialised.The effect of this is that a
Spec
instance that is fully dereferenced will, internally, point to an otherSpec
instance bind intoOperation
instances (the pointedSpec
instance will be used to send requests, validate responses, etc).How to fix this
The results of the regression is that
Spec
object could raise weird exceptions due to undefinedapi_url
and uses double the memory needed (which is sad too).To fix the issue will be sufficient to replace
build_resources(tmp_spec)
withbuild_resources(swagger_spec)
but we need to ensure that at that time_internal_spec_dict
has been updated to point toward the dereferenced version of the spec dict.How to reproduce and test
The text was updated successfully, but these errors were encountered: