Skip to content
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

Support more than one schema #434

Closed
cappelaere opened this issue Aug 31, 2020 · 6 comments
Closed

Support more than one schema #434

cappelaere opened this issue Aug 31, 2020 · 6 comments
Labels
keep-open Prevents stale bot from closing this issue or PR

Comments

@cappelaere
Copy link

Is your feature request related to a problem? Please describe.
Some of our applications may support different encodings for the same API (example: JSON schema, CBOR, Avro...). Currently, only one schema is supported in the yml file.

Can't it be tackled using specification extensions?
We need the capability to define multiple schemas in yml file

Describe the solution you'd like
Need to support different "Named" schemas in the yml file
Need to have relative references to selected schema

Describe alternatives you've considered
Use different files for different encodings but this makes it more difficult to maintain.

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity 😴
It will be closed in 30 days if no further activity occurs. To unstale this issue, add a comment with detailed explanation.
Thank you for your contributions ❤️

@github-actions github-actions bot added the stale label Oct 31, 2020
@derberg derberg added keep-open Prevents stale bot from closing this issue or PR and removed stale labels Nov 2, 2020
@fmvilas
Copy link
Member

fmvilas commented Jan 31, 2021

Hey Pat! Thanks for your patience. Do you have an example of what you're suggesting here? A bit of context would be great too.

@iridian-ks
Copy link

I can't speak to what the original requestor intended. But I do have what seems to be the same issue. Our scenario is we have a Kafka topic that has multiple schemas and we need documentation for every schema in the topic for our developers to know all of the different messages they'll need to handle.

Right now, it looks like we have this in the spec:

...
"subscribe": {
    "message": {
          "payload": {} #<--- schema defined here
     }
}
...

I think what we want is something like this:

"subscribe": {
    "message": {
        "payloads": [
             {
                   # first schema
             },
             {
                   # second schema
             }
        ]
    }
}

@magicmatatjahu
Copy link
Member

magicmatatjahu commented Jul 23, 2021

@iridian-ks HI! payload field must contain the Schema Object. By default it's a AsyncAPI Schema (which is superset of the JSON Schema in the draft-07), so you can use the oneOf combined keyword for the payload field, like:

subscribe:
  message:
    payload: 
      oneOf:
        - ...first schema
        - ...second schema
        - ...n schema

and you don't need, the payloads.

Btw. issue is related to define schemas in the different format, so it's not suit for your case, this issue is related - #528

@derberg
Copy link
Member

derberg commented Jul 26, 2021

Our scenario is we have a Kafka topic that has multiple schemas and we need documentation for every schema in the topic for our developers to know all of the different messages they'll need to handle.

@magicmatatjahu I think that @iridian-ks is more interested in providing multiple messages definitions with schema than multiple schemas for one message. You can use oneOf under message object

@fmvilas
Copy link
Member

fmvilas commented Sep 14, 2021

@cappelaere would you mind clarifying this issue? Do you mean you need to support multiple schema languages as defined in #622?

@smoya smoya closed this as not planned Won't fix, can't repro, duplicate, stale Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
keep-open Prevents stale bot from closing this issue or PR
Projects
None yet
Development

No branches or pull requests

6 participants