-
-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: parse Avro name field to custom x-parser-schema-id #69
Merged
derberg
merged 12 commits into
asyncapi:master
from
damaru-inc:issues/68-copy-name-to-title
Sep 2, 2021
Merged
Changes from 7 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
9444941
feat: The Avro name field is now copied to the resulting Json schema …
MichaelDavisSolace 6f07557
Fixed sonarcloud issues.
MichaelDavisSolace c72497c
Instead of putting the avro name into the json title field, we put it…
MichaelDavisSolace 1e5a71a
Updated README, added support for namespaces.
MichaelDavisSolace 9cb75df
Addressed PR comments
MichaelDavisSolace 897e551
Minor change based on PR comments.
MichaelDavisSolace 9adbbaa
Added quotes to fields Person-1.9.0-namespace.avsc
MichaelDavisSolace f526005
Merge branch 'master' into issues/68-copy-name-to-title
damaru-inc 996620c
Minor change to README.
MichaelDavisSolace 5789d60
Merge branch 'master' into issues/68-copy-name-to-title
damaru-inc c760f11
Merge branch 'master' into issues/68-copy-name-to-title
damaru-inc f98a07b
Minor code change to clarify logic.
MichaelDavisSolace File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 API | ||
version: '1.0.0' | ||
channels: | ||
mychannel: | ||
publish: | ||
message: | ||
schemaFormat: application/vnd.apache.avro;version=1.9.0 | ||
payload: | ||
$ref: 'schemas/Person-1.9.0-namespace.avsc' |
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
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,22 @@ | ||
{ | ||
"name": "Person", | ||
"namespace": "com.company", | ||
"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": "int", "example": "53003"}] | ||
} | ||
}, | ||
{"name": "someid", "type": "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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have to say this one doesn't let me sleep 😄
what part of the code is responsible for it? why 2nd is returned, then what if 3 schemas resolve to the same?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume that parser-js keeps a map where the key is x-parser-schema-id. So if there are several schemas that share the same x-parser-schema-id, then only the last one parsed will end up in that map. But if their document has several schemas with the same fully qualified name, I'd hope that they're identical, they repeat them because we force them to put Avro schemas into the message/payload section instead of components/schemas.
Maybe I should just not mention that at all? Or maybe that's an argument for using the title field after all, and adding x-namespace or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, now it makes sense, you are referring to 👇🏼
I think the sentence is ok, but just maybe write
If there are two schemas that resolve to the same fully qualified name, only the last one will be returned by the parser. Make sure names of your schemas are unique
?