asyncapi / java-template

Java template for the AsyncAPI Generator
Apache License 2.0
10 stars 12 forks source link

Does not generate class variables for nested structures #137

Closed black-snow closed 4 months ago

black-snow commented 1 year ago

The template does not seem to understand nested structures. I stripped it down to only generate models and I noticed that they contain nothing but two constructors, e.g.:

package my.package.models;

import java.util.UUID;
public class SomeStuff {

  public SomeStuff () {

  }
  public SomeStuff () {
    super();
  }
}

I added console.log(payload) to defineVariablesForProperties to see what's happening there and the output is:

Schema {
  _json: {
    description: 'blah',
    allOf: [ [Object], [Object] ],
    'x-parser-schema-id': 'SomeStuff'
  },
  _meta: {}
}

and when I look at the code it doesn't seems to handle allOf, oneOf, and the like.

Here's a simplified version of my schema:

#...
channels:
  stuff:
    publish:
      summary: blah
      operationId: doesntMatter
      message:
        oneOf:
          - $ref: "#/components/messages/SomeStuff"
          - $ref: "#/components/messages/OtherStuff"
components:
  messages:
    SomeStuff:
      payload:
        $ref: "#/components/schemas/SomeStuffFull"
  schemas:
    SomeStuffFull:
      description: blah
      allOf:
        - type: object
          properties:
            type:
              type: string
              enum:
                - a
                - b
                - c
        - type: object
          properties:
            data:
              type: string
github-actions[bot] commented 1 year ago

Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

github-actions[bot] commented 8 months ago

This issue has been automatically marked as stale because it has not had recent activity :sleeping:

It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

Thank you for your patience :heart: