Created by: sokolikp
Context
This PR addresses https://github.com/OpenAPITools/openapi-generator/issues/14578. Request headers were being improperly added as query params for Go clients. This PR:
- Updates the name of the function
parameterAddToQuery
(added in https://github.com/OpenAPITools/openapi-generator/pull/13909) toparameterAddToHeaderOrQuery
to indicate that a header or query interface arg can be passed - Correctly passes
localVarHeaderParams
(instead oflocalVarQueryParams
) to the above function for header params - Regenerates Go
samples
based on the above. Note that there are some automatic formatting/indentation changes to the samples - I can update those if necessary.
PR checklist
-
Read the contribution guidelines. -
Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community. -
Run the following to build the project and update samples: ./mvnw clean package ./bin/generate-samples.sh ./bin/utils/export_docs_generators.sh
./bin/generate-samples.sh bin/configs/java*
. For Windows users, please run the script in Git BASH. -
File the PR against the correct branch: master
(6.3.0) (minor release - breaking changes with fallbacks),7.0.x
(breaking changes without fallbacks) -
If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.
Activity
@sokolikp can you please PM me via Slack when you've time so that I can help you with the test?
https://join.slack.com/t/openapi-generator/shared_invite/zt-12jxxd7p2-XUeQM~4pzsU9x~eGLQqX2g
added Client: Go Issue: Bug labels
Created by: sokolikp
@sokolikp can you please PM me via Slack when you've time so that I can help you with the test?
https://join.slack.com/t/openapi-generator/shared_invite/zt-12jxxd7p2-XUeQM~4pzsU9x~eGLQqX2g
@wing328 thanks, I'll try pinging tomorrow! Logging off for the night.
changed milestone to %6.4.0
Created by: sokolikp
@wing328 when you have a chance, could you help me re-kick off the CI tests? Looks like I'm unable.
Created by: sokolikp
When I run
./mvnw clean package
I get the following:[ERROR] Failures: [ERROR] DefaultGeneratorTest.supportCustomTemplateEngine:318 » Runtime Could not generate api file for 'Ping' [ERROR] DefaultGeneratorTest.testProcessUserDefinedTemplatesWithConfig:731 » Runtime Could not generate model 'ApiResponse' [ERROR] PythonClientTest.testApiTestsNotGenerated:143 » Runtime Could not generate model 'ApiResponse' [ERROR] PythonClientTest.testApisNotGenerated:164 » Runtime Could not generate model 'ApiResponse' [ERROR] PythonPriorClientTest.testObjectModelWithRefedAdditionalPropertiesIsGenerated:408 » Runtime Could not generate model 'A' [ERROR] StringHelpersTest.startsWithSectionalTest:47->evaluate:28 » Handlebars inline@486b7642:1:4: java.lang.reflect.InaccessibleObjectException: Unable to make field transient java.util.HashMap$Node[] java.util.HashMap.table accessible: module java.base does not "opens java.util" to unnamed module @3b22cdd0 inline@486b7642:1:4 [ERROR] StringHelpersTest.startsWithTest:61->evaluate:28 » Handlebars inline@43bd77be:1:2: java.lang.reflect.InaccessibleObjectException: Unable to make field transient java.util.HashMap$Node[] java.util.HashMap.table accessible: module java.base does not "opens java.util" to unnamed module @3b22cdd0 inline@43bd77be:1:2 [ERROR] StringHelpersTest.startsWithYesOverrideTest:81->evaluate:28 » Handlebars inline@689e2599:1:2: java.lang.reflect.InaccessibleObjectException: Unable to make field transient java.util.HashMap$Node[] java.util.HashMap.table accessible: module java.base does not "opens java.util" to unnamed module @3b22cdd0 inline@689e2599:1:2 [INFO] [ERROR] Tests run: 1861, Failures: 8, Errors: 0, Skipped: 0
When I run
./bin/generate-samples.sh
I get the following:[pool-1-thread-27] Generation failed for python: (RuntimeException) Could not generate api file for 'usage' java.lang.RuntimeException: Could not generate api file for 'usage' at org.openapitools.codegen.DefaultGenerator.generateApis(DefaultGenerator.java:701) at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:924) at org.openapitools.codegen.cmd.GenerateBatch$GenerationRunner.run(GenerateBatch.java:232) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:833) Caused by: com.github.jknack.handlebars.HandlebarsException: endpoint.handlebars:3:3: java.lang.reflect.InaccessibleObjectException: Unable to make field transient java.util.HashMap$Node[] java.util.HashMap.table accessible: module java.base does not "opens java.util" to unnamed module @41a962cf endpoint.handlebars:3:3 at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354) at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:178) at java.base/java.lang.reflect.Field.setAccessible(Field.java:172) at com.github.jknack.handlebars.context.FieldValueResolver$FieldMember.setAccessible(FieldValueResolver.java:150) at com.github.jknack.handlebars.context.MemberValueResolver.cache(MemberValueResolver.java:82) at com.github.jknack.handlebars.context.MemberValueResolver.resolve(MemberValueResolver.java:54) at com.github.jknack.handlebars.Context$CompositeValueResolver.resolve(Context.java:199) at com.github.jknack.handlebars.internal.path.PropertyPath.eval(PropertyPath.java:52) at com.github.jknack.handlebars.Context$PathExpressionChain.next(Context.java:361) at com.github.jknack.handlebars.Context$PathExpressionChain.eval(Context.java:381) at com.github.jknack.handlebars.Context.get(Context.java:618) at com.github.jknack.handlebars.internal.Partial.override(Partial.java:253) at com.github.jknack.handlebars.internal.Partial.merge(Partial.java:226) at com.github.jknack.handlebars.internal.BaseTemplate.apply(BaseTemplate.java:125) at com.github.jknack.handlebars.internal.TemplateList.merge(TemplateList.java:95) at com.github.jknack.handlebars.internal.BaseTemplate.apply(BaseTemplate.java:125) at com.github.jknack.handlebars.internal.BaseTemplate.apply(BaseTemplate.java:113) at org.openapitools.codegen.templating.HandlebarsEngineAdapter.compileTemplate(HandlebarsEngineAdapter.java:92) at org.openapitools.codegen.TemplateManager.write(TemplateManager.java:163) at org.openapitools.codegen.languages.PythonClientCodegen.processTemplateToFile(PythonClientCodegen.java:482) at org.openapitools.codegen.languages.PythonClientCodegen.generateFiles(PythonClientCodegen.java:505) at org.openapitools.codegen.languages.PythonClientCodegen.generateEndpoints(PythonClientCodegen.java:671) at org.openapitools.codegen.languages.PythonClientCodegen.postProcessOperationsWithModels(PythonClientCodegen.java:916) at org.openapitools.codegen.DefaultGenerator.processOperations(DefaultGenerator.java:1246) at org.openapitools.codegen.DefaultGenerator.generateApis(DefaultGenerator.java:605) ... 5 more Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field transient java.util.HashMap$Node[] java.util.HashMap.table accessible: module java.base does not "opens java.util" to unnamed module @41a962cf ... 31 more
I'm not sure whether either of these are important given when I'm trying to update. @wing328 let me know if you have ideas on how to fix these.
Created by: sokolikp
Ah I found this thread where it indicates to run with:
_JAVA_OPTIONS="--add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED"
This resolves more errors for me! It works for on on all scripts except one:
./mvnw clean package
:[ERROR] Failures: [ERROR] DefaultGeneratorTest.supportCustomTemplateEngine:318 » Runtime Could not generate api file for 'Ping' [INFO] [ERROR] Tests run: 1861, Failures: 1, Errors: 0, Skipped: 0
To recap:
- [ FAILS ]
./mvnw clean package
(run w/ above Java options - a single command fails with above error "Runtime Could not generate api file for 'Ping'") - [ SUCCEEDS ]
./bin/generate-samples.sh
(run w/ above Java options) - [ SUCCEEDS ]
./mvnw clean package
(run w/ above Java options)
- [ FAILS ]
mentioned in merge request !14637 (merged)