OpenAPITools / OpenAPITools/openapi-generator
[BUG] CodegenProperties are different instances
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
The CodegenProperty instances that exist in vars should be the same instances in the other collections, such as requiredVars, optionalVars, etc. If we iterate the vars or allVars to make modifications, we should not also have to iterate the other collections.
You can see this in csharp-netcore using the sample below. The EnumTest class has property OuterEnum. If you compare OuterEnum from vars and allVars, you will see that the vendor extensions are different. A good place to put a break point to see this is the updateNullableTypeProperty method.
generate
-g csharp-netcore
-i "<path>\openapi-generator\modules\openapi-generator\src\test\resources\3_0\csharp\petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml"
-o <path>\openapi-generator\samples\client\petstore\csharp-netcore\OpenAPIClient-generichost-net6.0
--library generichost
--additional-properties=packageGuid={321C8C3F-0156-40C1-AE42-D59761FB9B6C},useCompareNetObjects=true,disallowAdditionalPropertiesIfNotPresent=false,targetFramework=net6.0,nullableReferenceTypes=false
- 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)
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 with the csharp-netcore command and the mentioned petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml spec. Start at updateNullableTypeProperty and compare the OuterEnum CodegenProperty from vars and allVars, then verify that modifications through vars are reflected in requiredVars, optionalVars, and the other collections.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100