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

Impossible to generate fields of wrapper type like java.lang.Integer, java.lang.Long in model classes #133

Closed
ArturSydor opened this issue Jun 3, 2021 · 5 comments · Fixed by #173
Labels
bug Something isn't working released stale

Comments

@ArturSydor
Copy link

How to Reproduce

example.yaml

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}
    protocol: kafka
    variables:
      port:
        default: '9092'
        enum:
          - '9092'
          - '9093'

channels:
  event.lighting.measured:
    publish:
      bindings:
        kafka:
          groupId: my-group
      operationId: readLightMeasurement
      message:
        $ref: '#/components/messages/lightMeasured'
    subscribe:
      operationId: updateLightMeasurement
      message:
        $ref: '#/components/messages/lightMeasured'
components:
  messages:
    lightMeasured:
      summary: Inform about environmental lighting conditions for a particular streetlight.
      payload:
        $ref: "#/components/schemas/lightMeasuredPayload"
  schemas:
    lightMeasuredPayload:
      type: object
      properties:
        lumens:
          type: integer
          minimum: 0
          description: Light intensity measured in lumens.
        sentAt:
          $ref: "#/components/schemas/sentAt"
    sentAt:
      type: string
      format: date-time
      description: Date and time when the message was sent.

Result model

public class LightMeasuredPayload {
    
    private @Valid int lumens;
    
    private @Valid java.time.OffsetDateTime sentAt;
    
    //Getters, setters, etc.
}

Property lumens is not mandatory, that's why there should be possibility to use for it type "java.lang.Integer" in order to be able to assign null when it doesn't present.

Expected behavior

Possibility to generate code that use wrapper types like java.lang.Integer, java.lang.Long, java.lang.Double, etc.

@ArturSydor ArturSydor added the bug Something isn't working label Jun 3, 2021
@github-actions
Copy link

github-actions bot commented Jun 3, 2021

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
Copy link

github-actions bot commented Aug 3, 2021

This issue has been automatically marked as stale because it has not had recent activity 😴
It will be closed in 60 days if no further activity occurs. To unstale this issue, add a comment with detailed explanation.
Thank you for your contributions ❤️

@github-actions github-actions bot added the stale label Aug 3, 2021
@derberg derberg removed the stale label Aug 3, 2021
@derberg
Copy link
Member

derberg commented Aug 3, 2021

Any contribution help would be highly appreciated here

@github-actions
Copy link

github-actions bot commented Oct 3, 2021

This issue has been automatically marked as stale because it has not had recent activity 😴
It will be closed in 60 days if no further activity occurs. To unstale this issue, add a comment with detailed explanation.
Thank you for your contributions ❤️

@asyncapi-bot
Copy link
Contributor

🎉 This issue has been resolved in version 0.25.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released stale
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants