You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Jim Lim (JIRA)" <ji...@apache.org> on 2013/10/31 02:35:25 UTC

[jira] [Commented] (AVRO-1315) Java: Schema Validation utilities

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

Jim Lim commented on AVRO-1315:
-------------------------------

It appears that {{Symbols#hasErrors}} will get into a infinite recursion if the validator is applied on an array or map. For example,

{code:title=test.java|borderStyle=solid}
private static final Schema mpSchema = new Schema.Parser().parse(
    "{\"name\": \"mapType\", \"type\": \"map\", \"values\": \"string\"}"
);

SchemaValidator validator = new SchemaValidatorBuilder().canReadStrategy().validateAll();
validator.validate(mpSchema, ImmutableList.of(mpSchema));
{code}

will cause {{Symbols#hasErrors}} to get stuck inside the `REPEATER` case, since the repeater symbol refers to itself inside its production array. I found a fix that uses a TreeSet to maintain a collection of visited symbols, and will submit a patch shortly.

> Java: Schema Validation utilities
> ---------------------------------
>
>                 Key: AVRO-1315
>                 URL: https://issues.apache.org/jira/browse/AVRO-1315
>             Project: Avro
>          Issue Type: New Feature
>          Components: java
>            Reporter: Scott Carey
>            Assignee: Scott Carey
>             Fix For: 1.8.0
>
>         Attachments: AVRO-1315.patch
>
>
> As part of AVRO-1124 we needed Schema Validation utilities.  I have separated those out of that ticket as a stand-alone item.



--
This message was sent by Atlassian JIRA
(v6.1#6144)