[
https://issues.apache.org/jira/browse/AVRO-3130?focusedWorklogId=772399&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-772399
]
ASF GitHub Bot logged work on AVRO-3130:
----------------------------------------
Author: ASF GitHub Bot
Created on: 19/May/22 11:34
Start Date: 19/May/22 11:34
Worklog Time Spent: 10m
Work Description: martin-g opened a new pull request, #1691:
URL: https://github.com/apache/avro/pull/1691
To prevent regressions in the future
### Jira
- [X] https://issues.apache.org/jira/browse/AVRO-3130
### Tests
- [X] My PR adds a new unit tests
### Commits
- [X] My commits all reference Jira issues in their subject lines. In
addition, my commits follow the guidelines from "[How to write a good git
commit message](https://chris.beams.io/posts/git-commit/)":
1. Subject is separated from body by a blank line
1. Subject is limited to 50 characters (not including Jira issue reference)
1. Subject does not end with a period
1. Subject uses the imperative mood ("add", not "adding")
1. Body wraps at 72 characters
1. Body explains "what" and "why", not "how"
### Documentation
- [X] No need
Issue Time Tracking
-------------------
Worklog Id: (was: 772399)
Remaining Estimate: 0h
Time Spent: 10m
> Schema.java errors with "No type" when a type object is provided instead of
> text type
> -------------------------------------------------------------------------------------
>
> Key: AVRO-3130
> URL: https://issues.apache.org/jira/browse/AVRO-3130
> Project: Apache Avro
> Issue Type: Bug
> Components: java
> Reporter: Aaron Zinger
> Priority: Minor
> Time Spent: 10m
> Remaining Estimate: 0h
>
> When a schema object is provided inside a union or as an array items type,
> the parser looks for a text value for type, doesn't find it, and throws a
> confusing error message of the form "No type: <thing with a type>".
> The error message could be fixed by having GetRequiredText distinguish
> between the key not being present and the value not being text, with the
> latter returning a message like "Value for type must be string".
> However, my preferred change would be to handle schema objects in these
> situations--it seems like it'd be compliant with the spec to have {"type":
> "string"} resolve to "string", and it would let schema generation code be a
> little simpler by letting it reuse schemas. This could also address
> https://issues.apache.org/jira/browse/AVRO-1977, I think.
> Examples below.
> {code:json}
> {
> "type": "record",
> "name": "AccountEvent",
> "fields": [
> {"type":
> ["null",
> { "name": "accountList",
> "type": {
> "type": "array",
> "items": "long"
> }
> }
> ],
> "name":"NullableLongArray"
> }
> ]
> }
> {code}
> Fails with {code:java}"No type:
> {\"name\":\"accountList\",\"type\":{\"type\":\"array\",\"items\":\"long\"}}"{code}
> The error is similar for
> {code:json}
> {
> "type": "array",
> "name": "FavoriteNumbers",
> "items": {"type":{"type": ["null","long"], "name": "NullableNumber"}}
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.7#820007)