OpenAPITools / OpenAPITools/openapi-generator

[BUG][SPRING] SpringBoot module generates api with wrong date format on nested objects

Open
#5,389 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Bug Report Checklist
  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

When setting contract, that accepts object with string defined as date, the default format to parse that is still SHORT, instead of ISO. The issue https://github.com/OpenAPITools/openapi-generator/issues/2053 has fixed the problem only when the controller method accepts the date directly. It's not working as supposed, when the controller accepts the objects based on query params.

openapi-generator version

4.2.3

OpenAPI declaration file content or url

https://github.com/qbixsd/openapi-test/blob/master/openapi-test-contract/src/main/resources/api.yaml

Command line used for generation

mvn clean compile

Steps to reproduce

run tests for openapi-test-implementation module from https://github.com/qbixsd/openapi-test

  • test for firstEndpoint (with dates defined at contract root) passes with ISO dates
  • both tests for secondEndpoint (with dates defined in nested objects) fail due to contract accepting dates as SHORT instead of ISO
Related issues/PRs

https://github.com/OpenAPITools/openapi-generator/issues/2053

Suggest a fix

Maybe it would be a good idea to fill in Json deserializing annotations on given properties in a model?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the api.yaml declaration and the openapi-test-implementation module, then run mvn clean compile and its tests. Compare firstEndpoint with secondEndpoint, focusing on dates inside nested query-parameter objects; done means both secondEndpoint tests accept and produce ISO-formatted dates like firstEndpoint.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.