- 
                Notifications
    You must be signed in to change notification settings 
- Fork 111
Closed
Description
Expected Behavior
@JsonProperty specified name of the field will be used in generated OpenAPI metadata
...
components:
  schemas:
    ExampleModel:
      type: object
      properties:
        nameInJson:
          type: string
          description: example fieldActual Behaviour
Class field name is used in generated OpenAPI metadata and the value in @JsonProperty is ignored
...
components:
  schemas:
    ExampleModel:
      type: object
      properties:
        nameInPojo:
          type: string
          description: example field
      description: ""Steps To Reproduce
- Controller returning simple Pojo
@Controller("/api/example")
public class ExampleController {
    @Get
    public ExampleModel getExample() {
        return new ExampleModel();
    }
}- Pojo with field annotated with both @JsonProperty & @Schema
@Introspected
public class ExampleModel {
    @JsonProperty("nameInJson")
    @Schema(description = "example field")
    private String nameInPojo;
    public String getNameInPojo() {
        return nameInPojo;
    }
}- Compile code which generates the OpenAPI metadata
Additional notes:
- not reproducible with micronautVersion=3.5.4(https://github.com/oujesky/micronaut-openapi-model-bug/blob/main/micronaut-openapi-model-bug-3.5.4.yml)
- seems to be injected with dependencies coming from micronautVersion=3.6.0(https://github.com/oujesky/micronaut-openapi-model-bug/blob/main/micronaut-openapi-model-bug-3.6.0.yml)
- not reproducible when @Schemaannotation is not present on the field
Environment Information
- Windows 10
- JDK 17
Example Application
https://github.com/oujesky/micronaut-openapi-model-bug
Version
3.6.0
Metadata
Metadata
Assignees
Labels
No labels