Skip to content

Commit

Permalink
fix model import
Browse files Browse the repository at this point in the history
  • Loading branch information
wing328 committed Mar 22, 2024
1 parent 7a53530 commit 432e1fe
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,12 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<Mo
if (Boolean.TRUE.equals(param.isFile)) {
operations.put("x-kotlin-multipart-import", true);
}

if (param.isQueryParam && "form".equals(param.style) && param.isExplode && param.isModel) {
// query parameter (style: form, explode) referencing models need to import
// models defined in the properties of the models
operations.put("x-koltin-import-models", true);
}
}

if (usesRetrofit2Library() && StringUtils.isNotEmpty(operation.path) && operation.path.startsWith("/")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ import kotlinx.serialization.*
{{/imports}}

{{#operations}}
{{#x-koltin-import-models}}
import {{{packageName}}}.models.*

{{/x-koltin-import-models}}
{{#x-kotlin-multipart-import}}
{{^isMultipart}}
import okhttp3.MultipartBody
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import org.openapitools.client.models.ApiPet
import org.openapitools.client.models.ApiStringEnumRef
import org.openapitools.client.models.ApiTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter

import org.openapitools.client.models.*

interface QueryApi {

/**
Expand Down

0 comments on commit 432e1fe

Please sign in to comment.