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

Properties without @Schema annotation of type LocalTime missing in openapi.json #2992

Closed
markusdemetz opened this issue Oct 24, 2018 · 5 comments

Comments

@markusdemetz
Copy link

I use swagger-annotations (2.0.5) to generate my openapi.json file.

When using a property of type java.time.LocalTime named a, it produces the following (shown in Swagger UI):

a

When I have 2 or more properties of type java.time.LocalTime and these properties are not annotated with @Schema and a name attribute, then only the last one is present in the openapi.json file.
I.e.:

private LocalTime a;
private LocalTime b;
private LocalTime c;

with corresponding getters and setters on an API model only outputs the last property of type java.time.LocalTime:

schemaarticle

Usually I do not annotate my properties with @Schema when not needed.
Do I miss something here or is this a bug?
Thanks!

frantuma added a commit that referenced this issue Oct 26, 2018
ref #2992 - add support for LocalTime and custom system and primitive types
@frantuma
Copy link
Member

Thanks for reporting this; it's indeed a bug, fixed in latest 2.0.6-SNASPHOT available on sonatype; alternatively, #2993 / 2.0.6-SNASPHOT also adds support for LocalTime resolved globally as a primitive string type with rfc3339 format partial-time, either using convenient

PrimitiveType.enablePartialTime();

or

PrimitiveType.customClasses().put("org.joda.time.LocalTime", PrimitiveType.PARTIAL_TIME);
PrimitiveType.customClasses().put("java.time.LocalTime", PrimitiveType.PARTIAL_TIME);

in any bootstrap code.

in this case, the outcome would be something like;

a:
  type: string
  format: partial-time
b:
  type: string
  format: partial-time
c:
  type: string
  format: partial-time

Closing ticket, please reopen if you're still experiencing issues.

@adrianboimvaser
Copy link

Do you have an ETA for 2.0.6? Thanks.

@emigioria
Copy link

org.joda.time.LocalDateTime should be added to DATE_TIME group.

@ryancerium
Copy link

I opened #3212 to address org.joda.time.LocalDateTime @emigioria .

@frantuma
Copy link
Member

fixed in #3212, thanks!

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

5 participants