sngular / scs-multiapi-plugin

This is a Maven plugin designed to help developers automatizing the creation of code classes from YML files based on AsyncApi and OpenAPI.
http://sngular.com
Mozilla Public License 2.0
48 stars 10 forks source link

[AsyncApi] No generate servicer class #254

Closed alfredo9f closed 10 months ago

alfredo9f commented 1 year ago

What happens?

In next case, servicer class is not generated if it is after an array definition:

asyncapi: 2.6.0
info:
  title: Customer Position
  version: 1.0.0
servers:
  development:
    url: localhost:9092
    description: Development server
    protocol: kafka
    protocolVersion: 0.9.1
channels:
  importAccount:
    subscribe:
      operationId: "importProduct"
      message:
        payload:
          $ref: '#/components/schemas/data'
  publishAccount:
    publish:
      operationId: "publishProduct"
      message:
        payload:
          $ref: '#/components/schemas/data'

components:
  schemas:
    data:
      type: object
      properties:
        customerPH:
          $ref: "#/components/schemas/customerPH"

    customerPH:
      type: object
      properties:
        productHId:
          type: string
        account:
          $ref: "#/components/schemas/account"

    account:
      type: object
      properties:
        accountId:
          type: string
        product:
          $ref: "#/components/schemas/product"
        parties:
          type: array
          items:
            $ref: "#/components/schemas/party"
        servicer:
          $ref: "#/components/schemas/servicer"

    servicer:
      type: object
      properties:
        identification:
          type: string

    product:
      type: object
      properties:
        productId:
          type: string

    party:
      type: object
      properties:
        partyId:
          type: string

But if you put it before parties, the servicer class is generated well:

asyncapi: 2.6.0
info:
  title: Customer Position
  version: 1.0.0
servers:
  development:
    url: localhost:9092
    description: Development server
    protocol: kafka
    protocolVersion: 0.9.1
channels:
  importAccount:
    subscribe:
      operationId: "importProduct"
      message:
        payload:
          $ref: '#/components/schemas/data'
  publishAccount:
    publish:
      operationId: "publishProduct"
      message:
        payload:
          $ref: '#/components/schemas/data'

components:
  schemas:
    data:
      type: object
      properties:
        customerPH:
          $ref: "#/components/schemas/customerPH"

    customerPH:
      type: object
      properties:
        productHId:
          type: string
        account:
          $ref: "#/components/schemas/account"

    account:
      type: object
      properties:
        accountId:
          type: string
        product:
          $ref: "#/components/schemas/product"
        servicer:
          $ref: "#/components/schemas/servicer"
        parties:
          type: array
          items:
            $ref: "#/components/schemas/party"

    servicer:
      type: object
      properties:
        identification:
          type: string

    product:
      type: object
      properties:
        productId:
          type: string

    party:
      type: object
      properties:
        partyId:
          type: string

Seems that skips the first component after parties because if you add two components after parties, only generate the second component product in this case:

asyncapi: 2.6.0
info:
  title: Customer Position
  version: 1.0.0
servers:
  development:
    url: localhost:9092
    description: Development server
    protocol: kafka
    protocolVersion: 0.9.1
channels:
  importAccount:
    subscribe:
      operationId: "importProduct"
      message:
        payload:
          $ref: '#/components/schemas/data'
  publishAccount:
    publish:
      operationId: "publishProduct"
      message:
        payload:
          $ref: '#/components/schemas/data'

components:
  schemas:
    data:
      type: object
      properties:
        customerPH:
          $ref: "#/components/schemas/customerPH"

    customerPH:
      type: object
      properties:
        productHId:
          type: string
        account:
          $ref: "#/components/schemas/account"

    account:
      type: object
      properties:
        accountId:
          type: string
        parties:
          type: array
          items:
            $ref: "#/components/schemas/party"
        servicer:
          $ref: "#/components/schemas/servicer"
        product:
          $ref: "#/components/schemas/product"

    servicer:
      type: object
      properties:
        identification:
          type: string

    product:
      type: object
      properties:
        productId:
          type: string

    party:
      type: object
      properties:
        partyId:
          type: string

Product is generated but servicer not.

What is expected?

The servicer class is generated in all cases.

jemacineiras commented 10 months ago

Already solved issue