asyncapi / avro-schema-parser

An AsyncAPI schema parser for Avro 1.x schemas.
Apache License 2.0
32 stars 19 forks source link

Support of allOf, oneOf or anyOf at payload level #106

Open M3lkior opened 2 years ago

M3lkior commented 2 years ago

Reason/Context

Please try answering few of those questions

Description

Please try answering few of those questions

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:
          oneOf:
            - type: "null"
            - $ref: 'schemas/Person-1.9.0-namespace.avsc'
        bindings:
          kafka:
            key:
              $ref: 'schemas/Person-1.9.0-namespace.avsc'
          mqtt:
            x-test:
              type: string
derberg commented 2 years ago

at payload level, you can only use oneOf, from the spec point of view

M3lkior commented 2 years ago

hum the others are not supported ? so we can start supporting at least the oneOf keyword in the avro-parser

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity :sleeping:

It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

Thank you for your patience :heart:

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity :sleeping:

It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

Thank you for your patience :heart:

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity :sleeping:

It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

Thank you for your patience :heart:

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity :sleeping:

It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

Thank you for your patience :heart:

derberg commented 1 year ago

Now when I read this issue for the second time, what do you mean by payload.oneOf? if schema format says Avro, you should have Avro. Does Avro support oneOf and other keywords?

M3lkior commented 1 year ago

at payload level, you can only use oneOf, from the spec point of view

in some case (for example, when a subscribe mode for kafka is RecordNameStrategy ; the topics payload specification can be

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:
          allOf:
            - $ref: 'schemas/Person-1.9.0-namespace.avsc'
            -  $ref: 'schemas/Person-2.0.0-namespace.avsc'
derberg commented 1 year ago

but payload can only be in a format of given schemaFormat (ignore my previous comment, as I mixed your payload.oneOf with message.oneOf