- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 7.3k
Open
Labels
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator?
- 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
- Given a openapi spec containing a Schema (Car) that inherits from another (Vehicle) using discriminatorandallOf,
- and the Schema Vehicledefine a property "x" of type "object",
- and the Schéma Carredefining the property by specializing the type to "string"
- when I generate the code, then the class Carwon't compile because the redefined varxdoes not have the modifieroverride.
I expect the attributes of Car to have the override keyword as it is valid in kotlin to do that.
openapi-generator version
Tested on latest v7.17.0-SNAPSHOT.
OpenAPI declaration file content or url
see https://gist.github.com/Sylvain-maillard/fe3d0e25d4b21e6acfee8b0544da12e8
Generation Details
Issue was reproduce using docker without specific parameters except the kotlin generator.
docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate -i /local/issue.yaml -g kotlin -o /local/generatedSteps to reproduce
- generate the kotlin code using the provided yaml
- the overriden attributes of class Carmisses theoverridekeyword.
Related issues/PRs
Suggest a fix
I'have found a quick and dirty fix that rely on rescanning all schemas, looking for duplicate vars on each parents.
I've added the code in org.openapitools.codegen.languages.AbstractKotlinCodegen#postProcessAllModels
It's probably better to fix the issue when the CodegenProperty instances are created, but I didn't have time to dig in that.