Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6648,7 +6648,7 @@ protected List<Map<String, Object>> buildEnumVars(List<Object> values, String da
for (Object value : values) {
if (value == null) {
// raw null values in enums are unions for nullable
// atttributes, not actual enum values, so we remove them here
// attributes, not actual enum values, so we remove them here
continue;
}
Map<String, Object> enumVar = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,11 @@ public String escapeQuotationMark(String input) {

@Override
protected List<Map<String, Object>> buildEnumVars(List<Object> values, String dataType) {
List<Object> sanitizedValues = values.stream().map(Object::toString).map(this::sanitizeEnumValue)
.collect(Collectors.toList());
List<Object> sanitizedValues = values.stream()
.filter(x -> x != null)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the meaningful change of this PR

.map(Object::toString)
.map(this::sanitizeEnumValue)
.collect(Collectors.toList());
removeEnumValueCollisions(sanitizedValues);
return super.buildEnumVars(sanitizedValues, dataType);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,16 @@ components:
# The next two is to make sure collisions are resolved properly
- 'coll-ision'
- 'coll_ision'
type: 'string'
type: 'string'
another:
enum:
- 'x'
- 'y'
- null
type: 'string'
equivalent:
enum:
- 'x'
- 'y'
type: 'string'
nullable: true
26 changes: 26 additions & 0 deletions samples/openapi3/schema/valid-enums/avro-schema-enum/Sample.avsc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,32 @@
}],
"doc": "",
"default": null
},
{
"name": "another",
"type": ["null", {
"type": "enum",
"name": "Sample_another",
"symbols": [
"x",
"y"
]
}],
"doc": "",
"default": null
},
{
"name": "equivalent",
"type": ["null", {
"type": "enum",
"name": "Sample_equivalent",
"symbols": [
"x",
"y"
]
}],
"doc": "",
"default": null
}
]

Expand Down