-
-
Notifications
You must be signed in to change notification settings - Fork 280
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
Avro schemas are not supported in the components/schemas section #528
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. |
Thanks for the issue! The problem as I see is that currently components:
schemas:
mySchema:
schemaFormat: 'application/vnd.apache.avro;version=1.9.0'
schema:
type: record
doc: User information
fields:
- name: displayName
type: string The solution for me is bad (in sense of user experience) because then user would have to write something like this if he wanted to refer to schema: payload:
$ref: '#components/schemas/mySchema/schema' Another suggestion would be to use a map for custom schemaFormats, when {key} should be name of corresponding schema in components:
schemaFormats:
mySchema: 'application/vnd.apache.avro;version=1.9.0'
schemas:
mySchema:
type: record
doc: User information
fields:
- name: displayName
type: string TBH I don't know how it can be handled in proper way. Let's wait for other people and their insights :) |
I thought a little more about problem and the components:
schemas:
mySchema:
schemaFormat: 'application/vnd.apache.avro;version=1.9.0'
type: record
doc: User information
fields:
- name: displayName
type: string By default it will be JSON Schema (aka AsyncAPI Schema) and in the tooling we can parse and validate schemas using |
Yes, I like that. |
Also we can add to the spec asyncapi: 2.0.0
info: ...
defaultSchemaType: 'application/vnd.apache.avro;version=1.9.0'
components:
schemas:
mySchema:
type: record
doc: User information
fields:
- name: displayName
type: string |
Related task: asyncapi/shape-up-process#56 |
Sounds to me like a solid suggestion 👍 Unless we can detect these types of schemas in the parser, so you don't have to define anything 🤔 But that might be farstretched |
@jonaslagoni Also I thought about that, but currently supported schemaTypes (json schema, avro and raml) have different definition for |
Regarding to asyncapi/shape-up-process#56 I have to conclude, a solution with components:
schemas:
# Schema described by protobuf
mySchema: |
message Person {
required string name = 1;
required int32 id = 2;
optional string email = 3;
}
so we must think about another solution. Maybe this mapping with |
This issue has been automatically marked as stale because it has not had recent activity 😴 |
This issue has been automatically marked as stale because it has not had recent activity 😴 |
Proposal to solve the issue -> #622 |
Describe the bug
Asyncapi supports Avro schemas, but only if they are in the message/payload section. It would be nice if we could put Avro schemas in the components/schemas section.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The document should parse as it does when the schema is in the message/payload section.
Sample document
The text was updated successfully, but these errors were encountered: