{"action":"created","issue":{"url":"https://api.github.com/repos/swagger-api/swagger-parser/issues/764","repository_url":"https://api.github.com/repos/swagger-api/swagger-parser","labels_url":"https://api.github.com/repos/swagger-api/swagger-parser/issues/764/labels{/name}","comments_url":"https://api.github.com/repos/swagger-api/swagger-parser/issues/764/comments","events_url":"https://api.github.com/repos/swagger-api/swagger-parser/issues/764/events","html_url":"https://github.com/swagger-api/swagger-parser/issues/764","id":339345647,"node_id":"MDU6SXNzdWUzMzkzNDU2NDc=","number":764,"title":"Nested references are not resolved for local files","user":{"login":"NathanTI8M","id":40887498,"node_id":"MDQ6VXNlcjQwODg3NDk4","avatar_url":"https://avatars0.githubusercontent.com/u/40887498?v=4","gravatar_id":"","url":"https://api.github.com/users/NathanTI8M","html_url":"https://github.com/NathanTI8M","followers_url":"https://api.github.com/users/NathanTI8M/followers","following_url":"https://api.github.com/users/NathanTI8M/following{/other_user}","gists_url":"https://api.github.com/users/NathanTI8M/gists{/gist_id}","starred_url":"https://api.github.com/users/NathanTI8M/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NathanTI8M/subscriptions","organizations_url":"https://api.github.com/users/NathanTI8M/orgs","repos_url":"https://api.github.com/users/NathanTI8M/repos","events_url":"https://api.github.com/users/NathanTI8M/events{/privacy}","received_events_url":"https://api.github.com/users/NathanTI8M/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-07-09T08:07:51Z","updated_at":"2018-08-06T11:27:36Z","closed_at":null,"author_association":"NONE","body":"If #454 testcases are changed to use a relative file reference, the nested definitions are not resolved.\r\n\r\n```yaml\r\ntags:\r\n- name: admins\r\n  description: Secured Admin-only calls\r\n- name: developers\r\n  description: Operations available to regular developers\r\npaths:\r\n  /inventory:\r\n    get:\r\n      summary: searches inventory test\r\n      operationId: searchInventory\r\n      responses:\r\n        200:\r\n          description: search results matching criteria\r\n        default:\r\n          $ref: './issue-454-file-components.yaml#/responses/GeneralError'\r\ndefinitions:\r\n  ModelWithNestedProperties:\r\n    properties:\r\n      remoteProperty:\r\n        $ref: './issue-454-file-components.yaml#/definitions/RemoteComponent'\r\n```\r\n\r\nTest case:\r\n```java\r\n    @Test\r\n    public void testNestedFileRefs() {\r\n        Swagger swagger = new SwaggerParser().read(\"src/test/resources/nested-file-references/issue-454-file.yaml\",\r\n                null, true);\r\n\r\n        assertNotNull(swagger.getDefinitions().get(\"ErrorModel\"));\r\n        assertNotNull(swagger.getDefinitions().get(\"ModelWithNestedProperties\"));\r\n\r\n        ModelImpl model = (ModelImpl)swagger.getDefinitions().get(\"ModelWithNestedProperties\");\r\n        Property property = model.getProperties().get(\"remoteProperty\");\r\n        assertNotNull(property);\r\n        assertTrue(property instanceof RefProperty);\r\n        RefProperty ref = (RefProperty) property;\r\n        assertEquals(ref.get$ref(), \"#/definitions/RemoteComponent\");\r\n        assertNotNull(swagger.getDefinitions().get(\"NestedProperty\"));\r\n\r\n        ModelImpl nestedModel = (ModelImpl)swagger.getDefinitions().get(\"NestedProperty\");\r\n        assertNotNull(nestedModel);\r\n        assertNotNull(nestedModel.getProperties().get(\"name\"));\r\n        assertTrue(nestedModel.getProperties().get(\"name\") instanceof StringProperty);\r\n    }\r\n```\r\n\r\nThe attached tar ball contains a testcase and test data to reproduce the issue.\r\n[test.tar.gz](https://github.com/swagger-api/swagger-parser/files/2175210/test.tar.gz)\r\n"},"comment":{"url":"https://api.github.com/repos/swagger-api/swagger-parser/issues/comments/410677303","html_url":"https://github.com/swagger-api/swagger-parser/issues/764#issuecomment-410677303","issue_url":"https://api.github.com/repos/swagger-api/swagger-parser/issues/764","id":410677303,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMDY3NzMwMw==","user":{"login":"markus-wa","id":5138316,"node_id":"MDQ6VXNlcjUxMzgzMTY=","avatar_url":"https://avatars3.githubusercontent.com/u/5138316?v=4","gravatar_id":"","url":"https://api.github.com/users/markus-wa","html_url":"https://github.com/markus-wa","followers_url":"https://api.github.com/users/markus-wa/followers","following_url":"https://api.github.com/users/markus-wa/following{/other_user}","gists_url":"https://api.github.com/users/markus-wa/gists{/gist_id}","starred_url":"https://api.github.com/users/markus-wa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markus-wa/subscriptions","organizations_url":"https://api.github.com/users/markus-wa/orgs","repos_url":"https://api.github.com/users/markus-wa/repos","events_url":"https://api.github.com/users/markus-wa/events{/privacy}","received_events_url":"https://api.github.com/users/markus-wa/received_events","type":"User","site_admin":false},"created_at":"2018-08-06T11:27:36Z","updated_at":"2018-08-06T11:27:36Z","author_association":"NONE","body":"Note that the HEAD now also resolves references relative to the input file instead of from the file in which the reference is located. This isn't the case with v2.0.1.\r\n\r\nSo references in referenced files need to be relative to the input file, which seems quite broken to me."}}
{"actor":{"display_login":"markus-wa"}}