-
-
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
The Avro Schema 'name' field should get carried over to the JSON Schema 'title' field. #68
Comments
Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request. Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue. |
@damaru-inc the only way to get nice name instead of anonymous name is to get the cc @fmvilas |
Why do you say that 'title' won't help? I don't think $id is appropriate, because in json schema, the $id field is supposed to be a URI that uniquely identifies the schema, whereas 'title' seems to serve the same purpose as the avro 'name' field. Avro schemas can have ids, but they usually aren't represented in the schema itself, they're often used by kafka to fetch a schema from a schema registry to serialize/deserialize a message. So that would be another thing that would cause confusion, i.e. if we take the avro name and have it come back as an $id property of the resulting json schema. |
@damaru-inc Parser works this way now that the name of schema is either The goal is to get rid of "anonymous" id and be able to use schema directly in the message and not in components, right? This is universal problem no matter if Avro or JSON Schema. The only solution, for now, is to have
string is also a valid URI. Have a look at this great article from @jonaslagoni and how he uses |
Yea, the problem is JSON Schema has no vocabulary (yet) to help us facilitate the naming of a generated model. So for now we highly misuse We could, as a bandage solution until the general problem is fixed, maybe utilize |
in what way? that avro parser puts Avro |
@derberg I don't think @damaru-inc use-case really needs it to be under |
I don't mind if the $id or x-parser-schema-id is anonymous. Avro schemas currently have to be under the message, not in components/schemas right? All I want is to be able to access the original Avro 'name' field one way or another, and semantically, that field means the same thing as the Json Schema 'title' field, so it feels like a natural fit. I guess what I'm saying is I don't mind whether we use the title field or $id or x-parser-schema-id - I don't know the internals of the parser, so I'm not in the best position to say what's the best solution. |
yes, as your spec issue also points out 🙂
Hmmm... I mean if you just want the original Avro properties and don't care about the interpretation, you could always use the original payload? Line 7 in fb5a059
Of course, the question still remains, how
|
so far I see that all stars in heaven say that best would be to Avro parser to put |
I just tried that, writing something like |
Okay, the PR's updated. This solution will work for me. |
🎉 This issue has been resolved in version 0.4.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Describe the bug
When you use an Avro schema in an AsyncAPI document and run it through the parser, the resulting schema has no 'title' attribute set even when the Avro schema had a 'name' attribute.
The schema is presented by the parser as having a name like , but it would be nice for code generators to be able to get the original name somehow.
How to Reproduce
Run the test in this project, you'll see that the 'transforms record values' confirms that no title field appears.
Expected behavior
I would have expected to see the 'name' attribute copied to the 'title' attribute in the generated JSON schema.
The text was updated successfully, but these errors were encountered: