Skip to content

DateTime example value drops seconds part #403

Open
@WouterLangerak

Description

@WouterLangerak

When generating examples with for date-time types with the ExampleBuilder the returned example value does not comply with the format as described in the documentation.

The Data-type documentation references rfc3339 section 5.6 as format for date-time.
This RFC states that time-second is required

partial-time = time-hour ":" time-minute ":" time-second
[time-secfrac]
full-date = date-fullyear "-" date-month "-" date-mday
full-time = partial-time time-offset

date-time = full-date "T" full-time

Swagger uses OffsetDateTime.html#toString() for creating the value of date-time example. This method states it will strip the second part when it is empty.

The output will be one of the following ISO-8601 formats:

uuuu-MM-dd'T'HH:mmXXXXX
uuuu-MM-dd'T'HH:mm:ssXXXXX
uuuu-MM-dd'T'HH:mm:ss.SSSXXXXX
uuuu-MM-dd'T'HH:mm:ss.SSSSSSXXXXX
uuuu-MM-dd'T'HH:mm:ss.SSSSSSSSSXXXXX

This conflicts with the format as state in the data-types documentation.

In stead of toString() a formatted value should be used. For example DateTimeFormatter.html#ISO_INSTANT

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions