You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Doug Cutting (JIRA)" <ji...@apache.org> on 2012/09/12 20:05:07 UTC

[jira] [Commented] (AVRO-1157) Idl tool - parse properties as plain String OR expose the property as Json

    [ https://issues.apache.org/jira/browse/AVRO-1157?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13454182#comment-13454182 ] 

Doug Cutting commented on AVRO-1157:
------------------------------------

Current IDL annotations are both Json strings (for Schema properties) and Json arrays of strings (for aliases).  So we cannot simply parse all annotations as strings, as that would break aliases.  Also, we'd still need some sort of string escaping.

The feature you seem to want is an improved ability to specify a schema or protocol property whose value is Json.  This would mostly require Schema and Protocol API changes.  We might:
 - change Schema's props field from Map<String,String> to Map<String,JsonNode>.
 - change Schema#addProp(String,String) to create a Json TextNode.
 - change Schema#getProp(String) to, if the value isTextual(), return the String otherwise return null.
 - deprecate Schema#getProps() and change its implementation to return the subset with string values.
 - add a new method, 'void Schema#getJsonProp(String, JsonNode)'
 - add a new method, 'JsonNode Schema#getJsonProp(String)'
 - add a new method, 'Map<String,JsonNode> Schema#getJsonProps()'
 - make similar updates to the Protocol API.
 - update the IDL parser to use these new APIs.

Can you give an example of a Json-valued Schema or Protocol property that you're using, in order to help motivate such a change?

                
> Idl tool - parse properties as plain String OR expose the property as Json
> --------------------------------------------------------------------------
>
>                 Key: AVRO-1157
>                 URL: https://issues.apache.org/jira/browse/AVRO-1157
>             Project: Avro
>          Issue Type: Improvement
>          Components: java, spec
>    Affects Versions: 1.7.1
>            Reporter: Cristian Opris
>            Priority: Minor
>
> The IDL Tool currently parses "annotations" as Json objects but only really supports textual values.
> If one wants to have actual json annotations, they need to write json as an escaped json string.
> Proposed solutions:
> - expose the property as Json if it's parsed as Json
> - OR  parse the property as a string

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira