[kotlin-spring] use spring resource for file handling#2455
[kotlin-spring] use spring resource for file handling#2455wing328 merged 9 commits intoOpenAPITools:masterfrom sylvainmoindron:master
Conversation
|
👍 Thanks for opening this issue! The team will review the labels and make any necessary changes. |
jimschubert
left a comment
There was a problem hiding this comment.
I haven't used spring resource in this way. What's in the PR looks good side from the import of that full type.
Let me know if you need a hand looking into fixing it.
.../server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt
Outdated
Show resolved
Hide resolved
|
with the correct sample the CI check are OK |
There was a problem hiding this comment.
Looks like the default should be null (without double quotes) or should be omitted.
I don't think it's related to this change so we will need to fix it later.
There was a problem hiding this comment.
I saw lot of change in the gérérated code (last time it was générated was 3.3.9 on Sep 2018).
i alsa saw a change in the body parameter name
(@Valid @RequestBody pet: Pet
changed to
@Valid @RequestBody body: Pet
There was a problem hiding this comment.
@wing328 This looks like it's probably an issue with the spec document? An id path parameter, by definition, can't be null otherwise the request won't match the path definition.
There was a problem hiding this comment.
there is another PR for this problem i think
#2487
|
there is a problem at the moment for a binary body, the API use Resource, the interface ApiService use multipart. i'm looking for the problem |
|
i fixed the multipart problem |
There was a problem hiding this comment.
This looks unrelated to this PR, but I don't think passing a null from Spring's internals to a Kotlin String will work. We may be missing nullable type work on the input parameter.
There was a problem hiding this comment.
@wing328 This looks like it's probably an issue with the spec document? An id path parameter, by definition, can't be null otherwise the request won't match the path definition.
There was a problem hiding this comment.
I think this needs to change org.springframework.web.multipart.MultipartFile to {{{dataType}}} to use Resource as well, otherwise it's hard-coded and the file type mapping will only work for models. I could be wrong as I've not used Resource, and jcenter is giving me 502 bad gateways so I can't download plugins required to build a sample.
Same issue in service.mustache and formParams.mustache.
There was a problem hiding this comment.
At first I wanted to treat all file as Resource, but after watching other générator I thought that keeping Multipart for form was a better idea (i was inspired by the spring-java générator).
Maybe i'm wrong ,it's my first job on openapi-genrator.
There was a problem hiding this comment.
i'm doing a POC where I remove all instance of MultipartFile; if i'm confident i break nothing, i will commit it.
There was a problem hiding this comment.
I followed your recommendations and did a push
# Conflicts: # samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApi.kt # samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApi.kt # samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt
|
I tested this against the petstore simple yaml and looks like I restarted Shippable (failed on Elm client tests), but I think this is good to go once checks have completed. |
|
Resolved the merge conflicts via 4f8a555 I'll update the Kotlin server samples later after merging the PR into master. |
|
Samples updated via 1313cff |
PR checklist
./bin/to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh,./bin/openapi3/{LANG}-petstore.shif updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\.master,. Default:3.4.x,4.0.xmaster.Description of the PR
Using spring ResponseEntity<Resource> for handling file when generating an API who return a file with
before it was ResponseEntity<File> which only responded filename
@jimschubert @dr4ke616