OpenAPITools / OpenAPITools/openapi-generator
encapsulated date component not genereted
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Since the version 5.4.0, the code generation of the following component via the spring generator generates the following model
schemas:
Person:
type: object
properties:
id:
$ref: '#/components/schemas/ID'
birthDate:
$ref: '#/components/schemas/Date'
ID:
type: integer
format: int64
description: Unique identifier
example: 1255266
Date:
type: string
format: date
description: A particular point in the progression of time in a calendar year expressed in the YYYY-MM-DD format. This representation is aligned with ISO 8601.
example: "2020-02-15"
public class PersonApi {
@JsonProperty("id")
private Long id;
@JsonProperty("birthDate")
private DateApi birthDate;
public PersonApi id(Long id) {
this.id = id;
return this;
}
And the DateApi object is not being genertated or present in the import
Here is the configuration
<generatorName>spring</generatorName>
<modelNameSuffix>Api</modelNameSuffix>
In version 5.3.1, the following is being generated
public class PersonApi {
@JsonProperty("id")
private Integer id;
@JsonProperty("birthDate")
private java.util.Date birthDate;
It's worth noting that a quick workaround would be to inline the date directly.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the Spring generator, the shown schema, and the modelNameSuffixApi configuration. Compare generation from versions 5.4.0 and 5.3.1. Done means the referenced date component is generated and imported appropriately, or the behavior is otherwise corrected with coverage for the encapsulated date schema.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100