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

Jackson annotations are ignored when generated from scanner #157

Open
jogerj opened this issue Jan 29, 2024 · 2 comments
Open

Jackson annotations are ignored when generated from scanner #157

jogerj opened this issue Jan 29, 2024 · 2 comments

Comments

@jogerj
Copy link

jogerj commented Jan 29, 2024

public class Foo {
    
    @JsonProperty("baz")
    public String bar;
    
    public Foo(String bar) {
        this.bar = bar;
    }
}

Suppose I have a DTO Foo, the asyncapi.yaml generated by the scanner defines Foo as follows:

Foo:
  type: "object"
  properties:
    bar:
      type: "string"

Which is incorrect since bar should be (de)serialized into baz

Version: 0.2.2

@jogerj jogerj changed the title @JsonProperty is ignored when generated from scanner Jackson annotations are ignored when generated from scanner Jan 30, 2024
@jogerj
Copy link
Author

jogerj commented Jan 30, 2024

public class Foo {
    @JsonValue
    public String bar;

    public Foo(String bar) { this.bar = bar; }
}

The issue seems to also affect other Jackson annotations such as JsonValue, in this case the definition of Foo generated is:

# Expected
Foo:
  type: "string"
# Actual
Foo:
  type: "object"
  properties:
    bar:
      type: "string"

@ChMThiel
Copy link
Contributor

Currently Jackson-Annotations are not evaluated in AsyncApiAnnotationScanner.addSchemaAnnotationData.
Feel free to implement the feature and create a PR.

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

No branches or pull requests

2 participants