-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] The kotlin-spring generator ApiUtil object doesn't compile #5476
Comments
I encountered the same error. I suspect the following PR to be the cause: |
In case this helps for anybody.. In the tasks with KotlinCompile, they come by default with strict compiler args. You can disable these like so:
After that, the compiler wasn't as strict and the code was compiled. |
I submitted a PR for fixing this bug #6084 |
Any update on this? We run into the same problem. |
my PR has been reviewed but not yet merged in the master branch |
@sylvainmoindron thanks, do you know why this is? I had a look and your branch was approved 25 days ago... 😞 |
* master: (345 commits) [kotlin][spring] Fix ApiUtil compilation (#6084) update python samples [Python] Fixed docstrings in api.mustache (#6391) [BUG][python] Support named arrays (#6493) [Go] whitelist AdditionalProperties in the field name (#6543) [kotlin][client] remove tabs usage (#6526) [PS] automatically derive discriminator mapping for oneOf/anyOf (#6542) [C++][Ue4] various bus fixes (#6539) Fix incorrect npx command (#6537) update pester to 5.x (#6536) comment out openapi3 java jersey2-java8 tests add additional properties support to powershell client generator (#6528) [Go][Experimental] Support additionalProperties (#6525) #5476 [kotlin] [spring] fix swagger and spring annotation for defaultValue (#6101) [samples] regenerate (#6533) [python] Fix date-time parsing (#6458) Register OAuth2ClientContext as bean (#6172) [Go][Experimental] Fix discriminator lookup (#6521) Typescript-rxjs: print param name (#6368) add oneof discrimistrator lookup to go experimental (#6517) ...
@jimschubert could you maybe estimate when this will be released? |
* master: Fix typescript generator for parameter collectionFormat for pipes ssv (#6553) [C++][Pistache] Catch HttpError from user-provided handler (#6520) remove scala related profile from the pom (#6554) move ruby tests to travis (#6555) [Java][jersey2] fix cast error for default value in DateTimeOffset object (#6547) [Swift] fix GET request with array parameter (#6549) [kotlin][spring] Fix ApiUtil compilation (#6084) update python samples [Python] Fixed docstrings in api.mustache (#6391) [BUG][python] Support named arrays (#6493) [Go] whitelist AdditionalProperties in the field name (#6543) [kotlin][client] remove tabs usage (#6526) [PS] automatically derive discriminator mapping for oneOf/anyOf (#6542) [C++][Ue4] various bus fixes (#6539) Fix incorrect npx command (#6537) update pester to 5.x (#6536) comment out openapi3 java jersey2-java8 tests add additional properties support to powershell client generator (#6528) [Go][Experimental] Support additionalProperties (#6525) #5476 [kotlin] [spring] fix swagger and spring annotation for defaultValue (#6101)
@huehnerlady we'll likely have a beta of 5.0 within the next few weeks. If you need this now, you could pull the latest docker image (it tracks master). |
@jimschubert thanks for the info. I am using the gradle plugin, so not sure how I would do that with a docker image. I am happy to wait for a beta to come out to use it :) |
@jimschubert I have seen that there is a beta of 5.0 out now. Will there also be a beta release for the gradle plugin soon, or can I use this generator version in the current gradle-plugin-version somehow? Many thanks |
We deliberately use v4.2.1 because v4.2.3 generates code that does not compile. See OpenAPITools/openapi-generator#5476
Hey! ...
/oauth2/token:
post:
tags:
- authorization-server-endpoints
parameters:
- name: Authorization
in: header
schema:
type: string
requestBody:
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
grant_type:
type: string
enum:
- authorization_code
- refresh_token
- client_credentials
... The generated code: fun oauth2TokenPostRequestConfig(authorization: kotlin.String?, grantType: GrantTypeOauth2TokenPost?, code: kotlin.String?, redirectUri: kotlin.String?, refreshToken: kotlin.String?, scope: kotlin.String?, clientId: kotlin.String?, clientSecret: kotlin.String?, clientAssertionType: kotlin.String?, clientAssertion: kotlin.String?, additionalParameters: kotlin.collections.Map<kotlin.String, kotlin.String>?) : RequestConfig<Map<String, PartConfig<*>>> {
val localVariableBody = mapOf(
"grant_type" to PartConfig(body = grantType.value, headers = mutableMapOf()), // <-- the problem in this line, `grantType?.value` should be
"code" to PartConfig(body = code, headers = mutableMapOf()), |
Description
the kotlin-spring generator produces code which doesn't compile.
openapi-generator version
openapi-generator version: 4.2.3
gradle version: 5.6.2
Command line used for generation
I'm using gradle to generate the classes
Steps to reproduce
just call gradle task generate endpoints and build, after that you see three compile errors.
e: /home/.../api/ApiUtil.kt: (12, 16): Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type HttpServletResponse?
e: /home/.../api/ApiUtil.kt: (13, 16): Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type HttpServletResponse?
e: /home/.../api/ApiUtil.kt: (14, 16): Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type HttpServletResponse?
Suggest a fix
fix mustache file: apit-mustache
and add questionmarks
The text was updated successfully, but these errors were encountered: