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

Parse correctly schemas different to AsyncAPI schema #185

Closed
Pakisan opened this issue Feb 27, 2024 · 3 comments · Fixed by #195
Closed

Parse correctly schemas different to AsyncAPI schema #185

Pakisan opened this issue Feb 27, 2024 · 3 comments · Fixed by #195
Assignees
Labels
enhancement New feature or request

Comments

@Pakisan
Copy link
Member

Pakisan commented Feb 27, 2024

Specification can handle properties from OpenAPI schema, for example, but only when schemaFormat was provided

It's time to choose parsing strategy and bring OpenAPI schema, at least, to this repo to parse it correctly

Related issues:

Available formats: Schema formats table
Reference: asyncapi/spec#1037

@Pakisan Pakisan added the enhancement New feature or request label Feb 27, 2024
@Pakisan Pakisan self-assigned this Feb 27, 2024
@jaydeepk
Copy link
Contributor

jaydeepk commented Mar 7, 2024

@Pakisan, I went through the discussion in 1037.
I just want to clarify my understanding:
Would it be fair to assume that if we wish to use open api 3.0 attributes like 'nullable' and 'example', we need to specify the schemaFormat as 'application/vnd.oai.openapi;version=3.0.0'.

So would this be a valid asnyc api 2.6 spec:

messages:
    product:
      name: product
      title: An inventory product
      summary: Product representing items in inventory
      contentType: application/json
      payload:
        schemaFormat: application/vnd.oai.openapi;version=3.0.0
        type: object
        properties:
          name:
            description: Every product has a name
            type: string
          inventory:
            description: Count of items in inventory
            type: number
            nullable: true
          id:
            description: Unique identifier of the product
            type: number

@Pakisan
Copy link
Member Author

Pakisan commented Mar 7, 2024

@Pakisan, I went through the discussion in 1037.

I just want to clarify my understanding:

Would it be fair to assume that if we wish to use open api 3.0 attributes like 'nullable' and 'example', we need to specify the schemaFormat as 'application/vnd.oai.openapi;version=3.0.0'.

So would this be a valid asnyc api 2.6 spec:

messages:

    product:

      name: product

      title: An inventory product

      summary: Product representing items in inventory

      contentType: application/json

      payload:

        schemaFormat: application/vnd.oai.openapi;version=3.0.0

        type: object

        properties:

          name:

            description: Every product has a name

            type: string

          inventory:

            description: Count of items in inventory

            type: number

            nullable: true

          id:

            description: Unique identifier of the product

            type: number

Yes, you are right to use Avro, OpenAPI, ... schemas, user MUST provide schemaFormat to tell which parsing strategy to use

I added this issue to first RC release

Pakisan added a commit that referenced this issue Apr 4, 2024
Pakisan added a commit that referenced this issue Apr 6, 2024
Pakisan added a commit that referenced this issue Apr 13, 2024
Pakisan added a commit that referenced this issue Apr 13, 2024
Pakisan added a commit that referenced this issue Apr 15, 2024
Pakisan added a commit that referenced this issue Apr 18, 2024
@Pakisan
Copy link
Member Author

Pakisan commented Apr 20, 2024

Implemented in 1.0.0-RC

@Pakisan Pakisan closed this as completed Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants