[
https://issues.apache.org/jira/browse/AVRO-1849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15297347#comment-15297347
]
ASF GitHub Bot commented on AVRO-1849:
--------------------------------------
GitHub user Simon24601 opened a pull request:
https://github.com/apache/avro/pull/97
AVRO-1849 Fix C++ schema to JSON converter
A ValidSchema with no records produced invalid JSON when converting to JSON
in C++. This is now fixed.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/Simon24601/avro master
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/avro/pull/97.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #97
----
commit a2718fed6f8e32073ae71292b49d843adb65643d
Author: Simon Woodford <[email protected]>
Date: 2016-05-23T23:22:33Z
AVRO-1849 Fix the issue where converting the schema of a record with no
fields produced an invalid JSON
----
> C++ printJson fails on record with no fields
> --------------------------------------------
>
> Key: AVRO-1849
> URL: https://issues.apache.org/jira/browse/AVRO-1849
> Project: Avro
> Issue Type: Bug
> Components: c++
> Affects Versions: 1.7.7, 1.8.0
> Environment: Not relevant
> Reporter: Simon Woodford
> Priority: Minor
>
> The function NodeRecord::printJson in lang/c++/impl/NodeImpl.cc does not
> correctly handle a record with no fields. It injects an extra closing curly
> brace, and the result is invalid JSON.
> Starting with a schema
> {
> "type": "record",
> "name": "Example",
> "fields" : [
> ]
> }
> and parsing it to create a ValidSchema, then calling toJson on the
> ValidSchema generates
> {
> "type": "record",
> "name": "Example",
> "fields" : [
> }
> ]
> }
> A record with no fields is unusual but we have encountered use cases for it,
> avro does not invalidate a record with no fields, and I've confirmed that
> Java, C and C# handle this case correctly. (I have not checked the other
> supported languages.)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)