lerenn / asyncapi-codegen

An AsyncAPI Golang Code generator that generates all Go code from the broker to the application/user. Just plug your application to your favorite message broker!
Apache License 2.0
91 stars 23 forks source link

Composed type regression AsyncAPI 2.6.0 since v0.35.1 #185

Closed stefan-scheidewig closed 5 months ago

stefan-scheidewig commented 6 months ago

Bonjour Monsieur Fradin,

first of all thanks for that asyncapi library. It is very valuable for us 🙏

I wanted to point out, that there might be a regression in the generator since pr https://github.com/lerenn/asyncapi-codegen/pull/168 and therefore since version v0.35.1 of the lib.

Context: we have asyncapi 2.6.0 event types based from different subtypes combined via the allOf attribute:

components:
  schemas:
    BaseEvent:
      type: object
      properties:
        time:
          type: string
          format: dateTime
      required:
        - time
    BaseEventInfo:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/ContentData'
      required:
        - data
    ContentData:
      type: object
      properties:
        contentId:
          type: string
      required:
        - contentId
    EventPayload:
      allOf:
        - $ref: '#/components/schemas/BaseEvent'
        - $ref: '#/components/schemas/BaseEventInfo'
        - type: object
          properties:
            id:
              type: string
          required:
            - id

the generated type for EventPayload contained the attributes data and time in version v0.35.0 but in version v.0.35.1 these are missing but the base types are still generated. i assume it should not behave like that, right?

lerenn commented 6 months ago

Hallo Herr Scheidewig !

Thanks for your interest in this project, happy that it can help other developers ☺️

Sorry about that, I'll correct that !

In fact, that's why I have introduced the test/<version>/issuers<nb>, so I'll avoid reproducing the same mistakes. I'll make a test from the yaml you provided, fix it and then it should not happen again.

I'll let you know when the fix is merged :)

stefan-scheidewig commented 5 months ago

you don't have to apologize. i have to apologize that i didn't make a valid pr you can work with but instead mentioning that issue only. there is simply not enough time on my side to do it like that. but who am i telling that, right? ;)

stefan-scheidewig commented 5 months ago

~it is fixed in version v0.35.7. thank you very much 🙏~

stefan-scheidewig commented 5 months ago

I'm sorry for that noise. I was too fast here. Unfortunately the issue still exists.

stefan-scheidewig commented 5 months ago

thank you, mr fradin. it is fixed in v0.36.0