Skip to content

Commit

Permalink
W-16772136 - Add test to validate that Avro Unions at root level are …
Browse files Browse the repository at this point in the history
…invalid
  • Loading branch information
looseale committed Sep 25, 2024
1 parent bdbec89 commit 25a12eb
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
ModelId: file://amf-cli/shared/src/test/resources/avro/schemas/union-root-invalid.json
Profile:
Conforms: false
Number of results: 1

Level: Violation

- Constraint: http://a.ml/vocabularies/amf/parser#invalid-avro-schema
Message: Internal error during Avro validation: Error: unknown type: ["string","int"]
Severity: Violation
Target: file://amf-cli/shared/src/test/resources/avro/schemas/union-root-invalid.json#/union/simpleUnion
Property:
Range:
Location: file://amf-cli/shared/src/test/resources/avro/schemas/union-root-invalid.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
ModelId: file://amf-cli/shared/src/test/resources/avro/schemas/union-root-invalid.json
Profile:
Conforms: false
Number of results: 1

Level: Violation

- Constraint: http://a.ml/vocabularies/amf/parser#invalid-avro-schema
Message: No type: {"name":"simpleUnion","type":["string","int"],"default":"something"}
Severity: Violation
Target: file://amf-cli/shared/src/test/resources/avro/schemas/union-root-invalid.json#/union/simpleUnion
Property:
Range:
Location: file://amf-cli/shared/src/test/resources/avro/schemas/union-root-invalid.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "simpleUnion",
"type": [ "string", "int"],
"default": "something"
}
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,14 @@ class AvroSchemaValidationTest extends MultiPlatformReportGenTest {
)
}

test("validate union at root level is invalid") {
validate(
"union-root-invalid.json",
Some("union-root-invalid.report"),
configOverride = Some(config)
)
}


// TODO We need to see how implement this in with AVRO 1.11.3

Expand Down

0 comments on commit 25a12eb

Please sign in to comment.