OpenAPITools / OpenAPITools/openapi-generator
[BUG] Missing import in generated DTO
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
there is missing java.util.function.Function import for:
public final static Map<String, ProfileEnum> VALUE_MAPPING = Map.copyOf(Arrays.stream(values())
.collect(Collectors.toMap(v -> v.value, Function.identity())));
it happened in CustomerCreateDTO when I use allOf in that way:
CustomerCreateDTO:
type: object
required:
- profile
- nip
allOf:
- $ref: '#/components/schemas/CustomerUpdateDTO'
- type: object
properties:
profile:
type: string
enum:
- individual
- corporate
nip:
type: string
maxLength: 128
minLength: 8
CustomerUpdateDTO:
type: object
required:
- street
- buildingNumber
- postalCode
- city
- email
- parking
- licensePlate
properties:
firstName:
type: string
maxLength: 128
lastName:
type: string
maxLength: 128
companyName:
type: string
maxLength: 256
street:
type: string
maxLength: 512
buildingNumber:
type: string
maxLength: 64
apartmentNumber:
type: string
maxLength: 32
postalCode:
type: string
maxLength: 16
city:
type: string
maxLength: 256
email:
type: string
maxLength: 256
format: email
licensePlate:
type: string
maxLength: 64
notes:
type: string
maxLength: 512
but similar structure, without enum works with no problem:
CustomerDTO:
allOf:
- $ref: '#/components/schemas/CustomerCreateDTO'
- type: object
required:
- id
- version
properties:
id:
type: string
format: uuid
version:
type: integer
cyclicalInvoicing:
type: boolean
individual:
type: boolean
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
Reproduce the generated Java DTO from the supplied CustomerCreateDTO and CustomerUpdateDTO schemas, focusing on the allOf combination and enum-generated VALUE_MAPPING. Inspect how imports are collected for generated DTOs and verify that Function is included when Function.identity() is emitted. Done means the generated CustomerCreateDTO compiles without a missing-import error; no test file is named in the report.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100