Java spring boot generator inheritance AsyncApi generator

37 Views Asked by At

Is there a way to make inheritance, using the AsyncApi Java spring boot generator with a class that is not generated using the generator ?

I have a template like this (created for tests from the default template):

asyncapi: '2.0.0'
info:
  title: Streetlights API
  version: '1.0.0'
  description: |
    The Smartylighting Streetlights API allows you
    to remotely manage the city lights.
  license:
    name: Apache 2.0
    url: 'https://www.apache.org/licenses/LICENSE-2.0'

servers:
  production:
    url: kafka.bootstrap:{port} ## replace with redis server
    protocol: kafka
    variables:
      port:
        default: '9092'
        enum:
          - '9092'
          - '9093'

channels:
  event.lighting.measured:
    publish:
      bindings:
        kafka:
          groupId: my-group
      operationId: ResortSAEWorkerEvent
      message:
        $ref: '#/components/messages/ResortSAEWorkerEvent'



components:
  messages:
    ResortSAEWorkerEvent:
      summary: Inform about environmental lighting conditions for a particular streetlight.
      payload:
        $ref: "#/components/schemas/ResortSAEWorkerEvent"
      x-extends: Event

  schemas:
    ResortSAEWorkerEvent:
      type: object
      properties:
        correlationId:
          type: string
          description: Unique identifier for the correlation of the event.
        eventAt:
          type: string
          format: date-time
          description: Date and time when the event was generated.
        eventType:
          type: string
          description: Type of the event.
        provider:
          type: string
          description: Name of the provider that generated the event.
        data:
          type: object
          description: The event's payload.

My objective is to extend the model ResortSAEWorkerEvent to use Event class.

I tried to do x-extends: Event, but it's not working.

Do you have any ideas ?

Feel free to ask if you need more datas or explainations

Solution

https://github.com/orgs/asyncapi/discussions/1079#discussioncomment-8895187

0

There are 0 best solutions below