{"action":"closed","issue":{"url":"https://api.github.com/repos/dasch/avro_turf/issues/65","repository_url":"https://api.github.com/repos/dasch/avro_turf","labels_url":"https://api.github.com/repos/dasch/avro_turf/issues/65/labels{/name}","comments_url":"https://api.github.com/repos/dasch/avro_turf/issues/65/comments","events_url":"https://api.github.com/repos/dasch/avro_turf/issues/65/events","html_url":"https://github.com/dasch/avro_turf/issues/65","id":301501549,"number":65,"title":"Unable to use complex types (\"map\", \"array\", \"enum\", \"fixed\")","user":{"login":"pdlug","id":1077,"avatar_url":"https://avatars3.githubusercontent.com/u/1077?v=4","gravatar_id":"","url":"https://api.github.com/users/pdlug","html_url":"https://github.com/pdlug","followers_url":"https://api.github.com/users/pdlug/followers","following_url":"https://api.github.com/users/pdlug/following{/other_user}","gists_url":"https://api.github.com/users/pdlug/gists{/gist_id}","starred_url":"https://api.github.com/users/pdlug/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pdlug/subscriptions","organizations_url":"https://api.github.com/users/pdlug/orgs","repos_url":"https://api.github.com/users/pdlug/repos","events_url":"https://api.github.com/users/pdlug/events{/privacy}","received_events_url":"https://api.github.com/users/pdlug/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-03-01T17:57:33Z","updated_at":"2018-03-01T18:55:31Z","closed_at":"2018-03-01T18:55:31Z","author_association":"NONE","body":"AvroTurf fails when trying to use complex types other than record (\"map\", \"array\", \"enum\", \"fixed\") in a schema. It appears to be due to AvroTurf attempting to look up a schema with the name of the type rather than falling through to a built-in type. Example below demonstrates this with the \"map\" type but it fails the same way with any of the other types listed above.\r\n\r\nExample schema:\r\n\r\n```javascript\r\n{\r\n  \"name\": \"Person\",\r\n  \"type\": \"record\",\r\n  \"fields\": [\r\n    {\r\n      \"name\": \"name\",\r\n      \"type\": \"string\"\r\n    },\r\n    {\r\n      \"name\": \"attributes\",\r\n      \"type\": \"map\",\r\n      \"values\": \"string\"\r\n    }\r\n  ]\r\n}\r\n```\r\n\r\nRuby code:\r\n\r\n```ruby\r\navro = AvroTurf.new(schemas_path: 'schemas/')\r\n\r\ndata = {\r\n  name: 'Joe',\r\n  attribute: {\r\n    \"height\": \"tall\"\r\n  }\r\n}\r\n\r\navro.encode(data, schema_name: 'Person')\r\n```\r\n\r\nStacktrace:\r\n\r\n```bash\r\nTraceback (most recent call last):\r\n\t6: from test.rb:16:in `<main>'\r\n\t5: from vendor/ruby/2.5.0/gems/avro_turf-0.8.0/lib/avro_turf.rb:37:in `encode'\r\n\t4: from vendor/ruby/2.5.0/gems/avro_turf-0.8.0/lib/avro_turf.rb:51:in `encode_to_stream'\r\n\t3: from vendor/ruby/2.5.0/gems/avro_turf-0.8.0/lib/avro_turf/schema_store.rb:12:in `find'\r\n\t2: from vendor/ruby/2.5.0/gems/avro_turf-0.8.0/lib/avro_turf/schema_store.rb:31:in `rescue in find'\r\n\t1: from vendor/ruby/2.5.0/gems/avro_turf-0.8.0/lib/avro_turf/schema_store.rb:12:in `find'\r\nvendor/ruby/2.5.0/gems/avro_turf-0.8.0/lib/avro_turf/schema_store.rb:40:in `rescue in find': could not find Avro schema at `schemas/map.avsc' (AvroTurf::SchemaNotFoundError)\r\n```"}}
{"actor":{"display_login":"pdlug"}}