Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supplier/Producer code is generated exclusively #265

Closed
novaross opened this issue Jul 14, 2023 · 1 comment · Fixed by #266
Closed

Supplier/Producer code is generated exclusively #265

novaross opened this issue Jul 14, 2023 · 1 comment · Fixed by #266
Assignees

Comments

@novaross
Copy link

Hi,

I'm using version 4.9.5 of the plugin.
It seems that the plugin does not generate the supplier code, and also it generates a redundant sngular.apigenerator.asyncapi package.

Definition of the plugin is as follows:

asyncapimodel {
    specFile {
        {
            filePath = './src/main/resources/asyncapi/sampleapi.yaml'
            consumer {
                ids = 'operationIdTwo'
                apiPackage = 'com.rs.sample.consumer.api'
                modelPackage = 'com.rs.sample.consumer.model'
            }
            supplier {
                ids = 'operationIdOne'
                apiPackage = 'com.rs.sample.supplier.api'
                modelPackage = 'com.rs.sample.supplier.model'
            }
        }
        overWriteModel = true
    }
}

The valid sampleapi.yaml contains publish and subscribe operations defined as below:

channels:
  testChannel:
    description: channel for test messages
    parameters:
      messageId:
        $ref: '#/components/parameters/testChannelMessageId'

    subscribe:
      operationId: operationIdOne
      summary: some event occurred in the system
      message:
        $ref: '#/components/messages/testMessage'
      traits:
        - $ref: '#/components/operationTraits/kafka'

    publish:
      operationId: operationIdTwo
      summary: some event occurred in the system
      message:
        $ref: '#/components/messages/testMessage'
      traits:
        - $ref: '#/components/operationTraits/kafka'

In the generated sources there is no generation of the consumer code.
Also the sngular.apigenerator.asyncapi is generated when it is not required.
Below are the contents of the build/generated-sources folder.

\---com
    +---rs
    |   \---sample
    |       +---consumer
    |       |   \---api
    |       \---supplier
    |           +---api
    |           |       IOperationIdOne.java
    |           |       Producer.java
    |           |
    |           \---model
    |               +---messages
    |               |   |   TestMessage.java
    |               |   |
    |               |   \---customvalidator
    |               |           Min.java
    |               |           MinValidator.java
    |               |
    |               \---schemas
    |                       SomeObject.java
    |                       TestMessagePayload.java
    |
    \---sngular
        \---apigenerator
            \---asyncapi

If i switch the operation ids in the plugin configuration, then there is no producer code generated.
Is this the expected behavior of the plugin?
Is it possible to generate producer code for one of the operation id's and supplier code for the other?

@jemacineiras jemacineiras self-assigned this Jul 17, 2023
@jemacineiras
Copy link
Contributor

HI @novaross,

generation of extra folder is a know issue, low priority, but I can take a look into it. But the no code generation is something new. In our manual test all is generated as expected. but I will try your configuration and back to you asap.

Cheers

@jemacineiras jemacineiras linked a pull request Jul 27, 2023 that will close this issue
jemacineiras added a commit that referenced this issue Jul 28, 2023
jemacineiras added a commit that referenced this issue Jul 28, 2023
* #262 Fix to String generation.

* #262 Fix to String generation.

* #265 Fix Wrong folder generation
jemacineiras added a commit that referenced this issue Aug 8, 2023
* #262 Fix to String generation.

* #262 Fix to String generation.

* #265 Fix Wrong folder generation

* #251 Fix Parameter without description

* #251 Fix Parameter without description

* #251 Fix Parameter without description

* #251 Fix Parameter without description

* #251 Fix Parameter without description
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants