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

@JsonProperty will not get imported in java file #304

Open
pasinski opened this issue Nov 8, 2022 · 3 comments
Open

@JsonProperty will not get imported in java file #304

pasinski opened this issue Nov 8, 2022 · 3 comments
Labels
bug Something isn't working stale

Comments

@pasinski
Copy link

pasinski commented Nov 8, 2022

Describe the bug

If the property name is different from the type name it references @JsonProperty annotation gets added for the field. However, no import com.fasterxml.jackson.annotation.JsonProperty

How to Reproduce

Create schema file example-jsonproperty.yaml with following content:

asyncapi: 2.5.0
info:
  title: JsonProperty Example
  version: 1.0.2
  description: | 
    This file contains schema definition, where some of the elements require ' @JsonProperty`. The annotation will get added to properties by `@asyncapi/java-spring-cloud-stream-template` however the import statement will not get added to the class file
defaultContentType: application/json
channels:
  helloWorld:
    description: |
      Greet User.
    publish:
      message:
        oneOf:
          - $ref: '#/components/messages/helloWorld'

components:

  messages:
    helloWorld:
      title: Hello World
      summary: 'Event: Greet the world'
      payload:
        $ref: '#/components/schemas/GreetingMessage'

  schemas:
    GreetingMessage:
        type: object
        required:
          - "greetingText"
          - "newsOfTheDay"
        properties:
          greetingText:
            type: string
            const: "Hello World"
          newsOfTheDay:
            $ref: '#/components/schemas/NewsOfTheDayType'
    NewsOfTheDayType:
      type: object
      required:
        - "theNews"
      properties:
        theNews:
          type: string

Generate app with command
ag example-jsonproperty.yaml @asyncapi/java-spring-cloud-stream-template -p artifactId=anschluss-events -p groupId=de.db.sab.kira -p javaPackage=de.db.sab.ki ra.anschlussEvents -o example-jsonproperty --force-write

Expected behavior

import com.fasterxml.jackson.annotation.JsonProperty; should get added to the imports section of generated java file

@pasinski pasinski added the bug Something isn't working label Nov 8, 2022
@pcermak
Copy link

pcermak commented Jan 30, 2023

Hi there,
is somebody working on the issue? I have the same problem. @pasinski did you solve the bug somehow?

@github-actions
Copy link

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

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 ❤️

@github-actions github-actions bot added the stale label May 31, 2023
@dwij2812
Copy link

+1, Facing the same problem.

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

No branches or pull requests

3 participants