-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: validate Avro schemas included in AsyncAPI docs (#96)
This commit adds validation to the avro-schema-parser so that invalid Avro schemas will be rejected. I had to fix a few invalid Avro schemas in the tests (which were using the type 'uuid' which isn't in the Avro spec) so this should potentially be considered a major breaking change to the parser. Closes: #37 Signed-off-by: Dale Lane <dale.lane@uk.ibm.com>
- Loading branch information
Showing
12 changed files
with
114 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,5 +62,8 @@ | |
"@semantic-release/npm", | ||
"@semantic-release/github" | ||
] | ||
}, | ||
"dependencies": { | ||
"avsc": "^5.7.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
asyncapi: 2.0.0 | ||
info: | ||
title: My Broken API | ||
version: '1.0.0' | ||
channels: | ||
mychannel: | ||
publish: | ||
message: | ||
schemaFormat: application/vnd.apache.avro;version=1.9.0 | ||
payload: | ||
$ref: 'schemas/Person-broken.avsc' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
asyncapi: 2.0.0 | ||
info: | ||
title: My Invalid API | ||
version: '1.0.0' | ||
channels: | ||
mychannel: | ||
publish: | ||
message: | ||
schemaFormat: application/vnd.apache.avro;version=1.9.0 | ||
payload: | ||
$ref: 'schemas/Invalid.avsc' |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"isThisAnAvroSchema": "no" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "Person", | ||
"type": "record", | ||
"fields": [ | ||
{"name": "name", "type": "string", "example": "Donkey"}, | ||
{"name": "age", "type": ["null", "int"], "default": null, "example": "123"}, | ||
{ | ||
"name": "favoriteProgrammingLanguage", | ||
"type": {"name": "ProgrammingLanguage", "type": "enum", "symbols": ["JS", "Java", "Go", "Rust", "C"], "default": "JS"} | ||
}, | ||
{ | ||
"name": "address", | ||
"type": { | ||
"name": "Address", | ||
"type": "record", | ||
"fields": [{"name": "zipcode", "type": "notAValidAvroType", "example": "53003"}] | ||
} | ||
}, | ||
{"name": "someid", "type": "string", "logicalType": "uuid"} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters