OpenAPITools / OpenAPITools/openapi-generator
[BUG][aspnetcore] language specific primitive model is created in v5.4.0
Nobody has claimed this yet.
- 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)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
We have the language-specific-primitive NodaTime.LocalDate. Since the upgrade to v5.4.0 a model NodaTime.LocalDate is created which is not the expected output. The expected output is that no LocalDate model is created because we use the .NET library. In v5.3.0 everything works
openapi-generator version
5.4.0
OpenAPI declaration file content or URL
config:
aspnetCoreVersion: 5.0
isLibrary: true
newtonsoftVersion: 5.0.6
operationIsAsync: false
packageName: Brokkoli.Api
sourceFolder: ""
useDateTimeOffset: false
useDefaultRouting: false
useSwashbuckle: false
operationResultTask: true
operationModifier: abstract
classModifier: abstract
nullableReferenceTypes: true
importMappings:
LocalDate: NodaTime.LocalDate
typeMappings:
LocalDate: NodaTime.LocalDate
excerpt from specification:
...
shippingDate:
$ref: "#/components/schemas/LocalDate"
...
LocalDate:
x-csharp-value-type: true
type: object
...
Generation Details
openapi-generator generate -i api.yml -t aspnetcore-generator-template -g aspnetcore -c openapi-server-generator.yml --model-name-suffix Dto --language-specific-primitives=NodaTime.LocalDate
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 shown openapi-generator generate command, configuration, and LocalDate schema, comparing generation in v5.3.0 and v5.4.0. Trace handling of language-specific-primitives, importMappings, and typeMappings for the aspnetcore generator. Done means the NodaTime.LocalDate mapping no longer creates a LocalDate model.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, java
- Domain
- backend, backend-api-design
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100