Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Support avro-schema references for records #117

Merged
merged 1 commit into from
Apr 17, 2018

Conversation

Totktonada
Copy link
Member

@Totktonada Totktonada commented Apr 11, 2018

Fixes #116.

@Totktonada Totktonada added the enhancement New feature or request label Apr 11, 2018
@Totktonada Totktonada self-assigned this Apr 11, 2018
@Totktonada Totktonada force-pushed the gh-116-avro-schema-refs branch from 1db1c02 to ab7ca92 Compare April 12, 2018 00:16
@Totktonada Totktonada changed the title WIP: support avro-schema references (to records) Support avro-schema references for records Apr 12, 2018
@Totktonada Totktonada requested a review from SudoBobo April 12, 2018 00:18
@Totktonada Totktonada force-pushed the gh-116-avro-schema-refs branch from ab7ca92 to cf34fb6 Compare April 16, 2018 10:59
@@ -949,6 +970,8 @@ gql_type = function(state, avro_schema, collection, collection_name, field_name)
avro_schema.name,
fields = fields,
})
state.declarations[avro_schema.name] = types.nonNull(res)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I understand we do not check anywhere if names of named types in our schema are unique (in context of type defining, not referencing) Avro-schema spec states: "A schema or protocol may not contain multiple definitions of a fullname" Moreover on line 973 we may have over writing, haven't we? As in our typical case we have quite massive schemas, unconscious type re-definition may be a problem. So my idea to add some assertion for type re-defenition.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is definitions, sorry. Will rename. Assert seems to make sense for proper error message, will add.

return state.declarations[avro_schema]
end
end

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do I understand right that order of definitions in our avro-schema matters? As far as I understand now if we try to put type reference BEFORE type definition in our avro-schema we will have 'unrecognized avro-schema type'. Maybe it is worthy to make additional check and return something like 'reference of yet undefined avro-schema type'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Order is matters. You cited the standard right above :)

'unrecognized avro-schema type' seems ok for me. I’ll see whether adding additional check will looks good.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We fall into this error in the two cases:

  1. Forward reference (forbidden by the standard).
  2. Non-defined type.

I don’t want to traverse all schema to give some-order-better error message. Will leave as is.

@Totktonada Totktonada force-pushed the gh-116-avro-schema-refs branch from cf34fb6 to 08b5762 Compare April 17, 2018 08:12
@Totktonada
Copy link
Member Author

@SudoBobo Force-pushed.

@Totktonada Totktonada merged commit acd69af into master Apr 17, 2018
@Totktonada Totktonada deleted the gh-116-avro-schema-refs branch April 17, 2018 10:09
Totktonada added a commit that referenced this pull request Sep 4, 2018
* fix format_process function
* print whole reject file when test failed (#102)
* print reproduce file when test failed at -j -1 mode (#104)
* print reproduce file content in parallel mode (#104)
* allow to pass arguments to create_cluster
* allow grep_log to not reset search results after tarantool restart
* support comments in config files
* don't kill default if non-default crash expected (#109)
* don't inherit unneeded file descriptors (#117)
* list task for hung workers (#107)
* add new config param 'show_reproduce_content' (#113)
Totktonada added a commit that referenced this pull request Sep 4, 2018
* fix format_process function
* print whole reject file when test failed (#102)
* print reproduce file when test failed at -j -1 mode (#104)
* print reproduce file content in parallel mode (#104)
* allow to pass arguments to create_cluster
* allow grep_log to not reset search results after tarantool restart
* support comments in config files
* don't kill default if non-default crash expected (#109)
* don't inherit unneeded file descriptors (#117)
* list task for hung workers (#107)
* add new config param 'show_reproduce_content' (#113)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants