{"action":"created","issue":{"url":"https://api.github.com/repos/Yelp/bravado/issues/282","repository_url":"https://api.github.com/repos/Yelp/bravado","labels_url":"https://api.github.com/repos/Yelp/bravado/issues/282/labels{/name}","comments_url":"https://api.github.com/repos/Yelp/bravado/issues/282/comments","events_url":"https://api.github.com/repos/Yelp/bravado/issues/282/events","html_url":"https://github.com/Yelp/bravado/issues/282","id":222985371,"number":282,"title":"$ref or the $allOf or $anyOf are not automatically solved","user":{"login":"Amedeo91","id":8645312,"avatar_url":"https://avatars2.githubusercontent.com/u/8645312?v=3","gravatar_id":"","url":"https://api.github.com/users/Amedeo91","html_url":"https://github.com/Amedeo91","followers_url":"https://api.github.com/users/Amedeo91/followers","following_url":"https://api.github.com/users/Amedeo91/following{/other_user}","gists_url":"https://api.github.com/users/Amedeo91/gists{/gist_id}","starred_url":"https://api.github.com/users/Amedeo91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Amedeo91/subscriptions","organizations_url":"https://api.github.com/users/Amedeo91/orgs","repos_url":"https://api.github.com/users/Amedeo91/repos","events_url":"https://api.github.com/users/Amedeo91/events{/privacy}","received_events_url":"https://api.github.com/users/Amedeo91/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-04-20T08:18:24Z","updated_at":"2017-04-20T09:49:25Z","closed_at":null,"body":"I see that sometimes the $ref or the $allOf or $anyOf are not automatically solved and I have to solve them manually in order to make it work. Why?\r\n\r\nExample below:\r\n{'x-scope': [''], 'additionalProperties': False, '$ref': '#/definitions/My_Resource'}\r\n\r\nRegards,\r\nAmedeo"},"comment":{"url":"https://api.github.com/repos/Yelp/bravado/issues/comments/295657302","html_url":"https://github.com/Yelp/bravado/issues/282#issuecomment-295657302","issue_url":"https://api.github.com/repos/Yelp/bravado/issues/282","id":295657302,"user":{"login":"Amedeo91","id":8645312,"avatar_url":"https://avatars2.githubusercontent.com/u/8645312?v=3","gravatar_id":"","url":"https://api.github.com/users/Amedeo91","html_url":"https://github.com/Amedeo91","followers_url":"https://api.github.com/users/Amedeo91/followers","following_url":"https://api.github.com/users/Amedeo91/following{/other_user}","gists_url":"https://api.github.com/users/Amedeo91/gists{/gist_id}","starred_url":"https://api.github.com/users/Amedeo91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Amedeo91/subscriptions","organizations_url":"https://api.github.com/users/Amedeo91/orgs","repos_url":"https://api.github.com/users/Amedeo91/repos","events_url":"https://api.github.com/users/Amedeo91/events{/privacy}","received_events_url":"https://api.github.com/users/Amedeo91/received_events","type":"User","site_admin":false},"created_at":"2017-04-20T09:49:25Z","updated_at":"2017-04-20T09:49:25Z","body":"Hello Samuele,\r\n\r\nI have my response define as follow in the path part of the swagger:\r\n'/carts/{cartId}/product/{productId}':\r\n       put:\r\n              - name: data\r\n                 in: body\r\n                 description: Replace or add product information\r\n                 required: true\r\n                 schema:\r\n                       $ref: '#/definitions/Product'\r\n\r\nand in the definitions part I have my product information. However, when I try to validating, I see that does not validate anything and the schema is like below:\r\n{'x-scope': [''], 'additionalProperties': False, '$ref': '#/definitions/Product'}\r\n\r\nI solve the $ref manually, and now it is performing the validation correctly: is it the wished behavior?\r\n\r\nThe code I am running to initialize the validator is the follow:\r\n\r\nresource_spec_dict = get_schema_file() # Fetch the schema from the yaml\r\nresource_spec = Spec.from_dict(resource_spec_dict, config=BRAVADO_CONFIG)\r\nresource_obj = resource_spec_dict['path']['/carts/{cartId}/product/{productId}']['put']\r\n\r\nVALID_SETTINGS_OBJ.update({resource['name']: resource_obj})\r\nVALID_SETTINGS_SPEC.update({resource['name']: resource_spec})\r\n\r\nAnd this is how I perform the validation:\r\n        try:\r\n            # User bravado_core to validate the document against\r\n            # swagger yaml definition\r\n            self.document = copy.copy(document)\r\n            # I try to see if I have HTTP method specific validation\r\n            if not (http_specific+self.resource in VALID_SETTINGS_OBJ):\r\n                http_specific = \"\"\r\n            common_logger.info('http_specific+self.resource: '+str(http_specific+self.resource))\r\n            jsonSchemaToValidate = VALID_SETTINGS_OBJ[http_specific+self.resource]\r\n            jsonSchemaToValidate[\"additionalProperties\"] = self.allow_unknown\r\n            common_logger.debug(\"jsonSchemaToValidate: \" + str(jsonSchemaToValidate))\r\n            common_logger.debug(\"Validating document\")\r\n            validate_object(VALID_SETTINGS_SPEC[http_specific+self.resource],\r\n                            jsonSchemaToValidate, document)\r\n            return True\r\n\r\n        except ValidationError as exception:\r\n            # Return an error using the exception\r\n            # returned by bravado_core validation\r\n            common_logger.warn(exception)\r\n\r\nCan you please tell me what is is wrong?\r\n\r\nRegards,\r\nAmedeo"}}
{"actor":{"display_login":"Amedeo91"}}