I'm using the micronaut openapi, with gradle, all the necessary configurations are already set. The issue that I have is that the generated openapi.yml does not include the 'null' value attribute from a JSON example.

Example code snippet

    @ApiResponse(
        schema = @Schema(implementation = ABC.class, type = "object"),
        examples = {
            @ExampleObject(value = JSON_EXAMPLE_ABC) 
    }))

    // This is the JSON string, with an attrib1 with 'null' value
    String JSON_EXAMPLE_ABC = """
        {
             "attrib1":  null,
             "attrib2": "has value"
        }
        """;

The example attrib1 is omitted on the generated openapi.yml, I'm expecting that whatever is in the JSON value, should be also reflected on the openapi.yml, the actual generated openapi.yml contains only the attribute with non-null:

content:
    examples:
      example:
        attrib2: "has value"

I have already tried to put @Nullable, @Schema(nullable=true), but still the attrib1 was not included on the openapi.yml when generated

The generated openapi.yml has openapi: 3.0.1 version

0

There are 0 best solutions below