[ 
https://issues.apache.org/jira/browse/AVRO-1460?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Suraj Acharya updated AVRO-1460:
--------------------------------
    Fix Version/s:     (was: 1.7.8)
                   1.7.9

> Perl API doesn't raise warning/error when encoding record with spurious fields
> ------------------------------------------------------------------------------
>
>                 Key: AVRO-1460
>                 URL: https://issues.apache.org/jira/browse/AVRO-1460
>             Project: Avro
>          Issue Type: Improvement
>          Components: perl
>            Reporter: John Karp
>            Assignee: John Karp
>            Priority: Minor
>             Fix For: 1.7.9
>
>         Attachments: AVRO-1460.patch
>
>
> When serializing a record with a field that isn't specified in the schema, 
> there should be some sort of warning or error. Otherwise, a simple typo in a 
> field name can lead to silent loss of that field's data.
> Test case that should pass but currently fails:
> {noformat}
> {
>     my $schema = Avro::Schema->parse(<<EOJ);
>           {
>           "type": "record",
>           "name": "test",
>           "fields" : [
>           {"name": "a", "type": "long"}
>           ]
>           }
> EOJ
>     my $enc = '';
>     eval {
>         Avro::BinaryEncoder->encode(
>             schema => $schema,
>             data => { a => 27, b => 'foo' },
>             emit_cb => sub { $enc .= ${ $_[0] } },
>         );
>     };
>     isa_ok $@, 'Avro::BinaryEncoder::Error';
> }
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to