asyncapi / converter-js

Convert to or migrate between AsyncAPI versions with the converter
19 stars 21 forks source link

Upgrade individual bindings #273

Open jonaslagoni opened 3 months ago

jonaslagoni commented 3 months ago

Should be possible to migrate/upgrade bindings individually without having to convert the entire document.

ItshMoh commented 3 months ago

hello @jonaslagoni are you talking about this individual binding where on method of post is converted into async api format. Not the entire document. Am i going in the right path. Here the async version in 2.0.0 it should be the latest. OPENAPI


openapi: 3.0.0
info:
  title: Order Service
  version: '1.0'
paths:
  /order/{id}:
    get:
      summary: Retrieve an order by ID
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Order'

  /order:
    post:
      summary: Create a new order
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Order'
      responses:
        '201':
          description: Order created successfully
components:
  schemas:
    Order:
      type: object
      properties:
        id:
          type: string
        item:
          type: string
        quantity:
          type: integer

`
**ASYNCAPI**
`asyncapi: '2.0.0'
info:
  title: Order Service
  version: '1.0'
channels:
  order/created:
    description: Channel where new orders are published
    publish:
      operationId: publishOrderCreated
      summary: Publish a message when a new order is created
      message:
        contentType: application/json
        payload:
          $ref: '#/components/schemas/Order'
components:
  schemas:
    Order:
      type: object
      properties:
        id:
          type: string
        item:
          type: string
        quantity:
          type: integer
`
jonaslagoni commented 3 months ago

@ItshMoh please format code snippets, no one can read that 😄

But regardless, no I am not talking about OpenAPI at all, only the AsyncAPI bindings, so when a binding changes version from 1.0.0 to 2.0.0, the converter should have the functionality to upgrade the existing AsyncAPI document to use the new bindings.

ItshMoh commented 3 months ago

@jonaslagoni my bad for not formatting the code. Thanks for the clarification.

ItshMoh commented 3 months ago

@jonaslagoni . As i have understood the problem, we should have the flexibility of changing version of one binding without changing the whole document. For example we just want to change the version of message binding leaving the document. Am i going in the right path. If you can give more insights to the issue it will be helpful

ItshMoh commented 3 months ago

so like in this http bindings, the user should be able to change the current version ?

cc @jonaslagoni

jonaslagoni commented 3 months ago

@ItshMoh kinda yes, so when binding codeowners make breaking changes, the converter should be able to offer the options for users to migrate bindings as well 😊

ItshMoh commented 3 months ago

what should be the possible approach that i should work upon.?

cc @jonaslagoni