eclipse / microprofile-open-api

Microprofile open api
Apache License 2.0
131 stars 81 forks source link

MicroProfile OpenAPI [2.0.1] : example of date-time in Schema can not accept this format "YYYY-MM-DDTHH:MM:SSZ", will report "OrderedMap" #543

Closed yay9096 closed 1 year ago

yay9096 commented 2 years ago

[Current] After build, check the openapi/ui, Schema display OrderedMap error image And Example value will display as bellow: for the first item did not use example, it will display "YYYY-MM-DDTHH:MM:SS.MSSZ", and for others example, it will display {} image [Expectation] image

MikeEdgar commented 2 years ago

@yay9096 what server/runtime are you using? Can you also share the fields that the @Schema annotations are used with?

yay9096 commented 2 years ago

@MikeEdgar Thank you for reply, runtime is java 1.8, server is Mac 12.2.1(Intel core), microprofile-openapi.version is 1.0, fields are created_at, started_at and last_updated_at, our api output date-time format is YYYY-MM-DDTHH:MM:SSZ, so we want to give user a example for the date-time response, so we use "example" in @Schema to define it, however, when we use this definition, the example will be {}, if we do not use example in @Schema, it will display an example "YYYY-MM-DDTHH:MM:SS.MSSZ", but it is not match with our expectation.

        @JsonbProperty("created_at")
    @Schema(name = "created_at", format = "date-time")
        private String createdAt;

    @JsonbProperty("last_updated_at")
    @Schema(name = "last_updated_at", format = "date-time", example = "2018-03-20T09:12:28Z")
    private String lastUpdatedAt;

    @JsonbProperty("started_at")
    @Schema(name = "started_at", format = "string", example = "2018-03-20T09:12:28Z")
    private String startedAt;
MikeEdgar commented 2 years ago

@yay9096, what MicroProfile OpenAPI implementation are you using? E.g. Quarkus, Open Liberty, Payara, etc. This may be an implementation bug rather than an issue in the specification itself.

yay9096 commented 2 years ago

@MikeEdgar We use Open Liberty implementation, and check 2.0.1 version still has the issue. import org.eclipse.microprofile.openapi.annotations.media.Schema;

Emily-Jiang commented 2 years ago

@yay9096 Thanks for providing the info! Can you open an issue on Open Liberty and we will look into it?

yay9096 commented 2 years ago

@Emily-Jiang Thank you, I have filed https://github.com/OpenLiberty/open-liberty/issues/21737 for the issue

MikeEdgar commented 1 year ago

Closing this as it's been handled as an implementation issue mentioned.