|
42 | 42 | import io.swagger.codegen.v3.CodegenType;
|
43 | 43 | import io.swagger.codegen.v3.DefaultGenerator;
|
44 | 44 | import io.swagger.codegen.v3.generators.typescript.AbstractTypeScriptClientCodegen;
|
| 45 | +import io.swagger.codegen.v3.generators.util.OpenAPIUtil; |
45 | 46 | import io.swagger.util.Json;
|
46 | 47 | import io.swagger.v3.oas.models.OpenAPI;
|
47 | 48 | import io.swagger.v3.oas.models.Operation;
|
@@ -229,10 +230,10 @@ public CodegenOperation fromOperation(String path, String httpMethod,
|
229 | 230 |
|
230 | 231 | @Override
|
231 | 232 | @SuppressWarnings("unchecked")
|
232 |
| - public CodegenParameter fromRequestBody(RequestBody body, |
233 |
| - Map<String, Schema> schemas, Set<String> imports) { |
234 |
| - CodegenParameter codegenParameter = super.fromRequestBody(body, schemas, |
235 |
| - imports); |
| 233 | + public CodegenParameter fromRequestBody(RequestBody body, String name, |
| 234 | + Schema schema, Map<String, Schema> schemas, Set<String> imports) { |
| 235 | + CodegenParameter codegenParameter = super.fromRequestBody(body, name, |
| 236 | + schema, schemas, imports); |
236 | 237 | Schema requestBodySchema = getRequestBodySchema(body);
|
237 | 238 | if (requestBodySchema != null) {
|
238 | 239 | imports.addAll(collectImportsFromSchema(requestBodySchema));
|
@@ -304,7 +305,7 @@ public String getTypeDeclaration(Schema schema) {
|
304 | 305 | return String.format("ReadonlyArray<%s>%s",
|
305 | 306 | this.getTypeDeclaration(inner), optionalSuffix);
|
306 | 307 | } else if (GeneratorUtils.isNotBlank(schema.get$ref())) {
|
307 |
| - return getSimpleRef(schema.get$ref()) + optionalSuffix; |
| 308 | + return OpenAPIUtil.getSimpleRef(schema.get$ref()) + optionalSuffix; |
308 | 309 | } else if (schema.getAdditionalProperties() != null) {
|
309 | 310 | Schema inner = (Schema) schema.getAdditionalProperties();
|
310 | 311 | return String.format("Readonly<Record<string, %s>>%s",
|
@@ -417,7 +418,7 @@ public String toModelName(String name) {
|
417 | 418 | }
|
418 | 419 |
|
419 | 420 | @Override
|
420 |
| - protected void addImport(CodegenModel m, String type) { |
| 421 | + public void addImport(CodegenModel m, String type) { |
421 | 422 | if (!Objects.equals(m.getName(), type)) {
|
422 | 423 | super.addImport(m, type);
|
423 | 424 | }
|
@@ -486,7 +487,7 @@ private void adjustImportInformationForModel(
|
486 | 487 | private Set<String> collectImportsFromSchema(Schema schema) {
|
487 | 488 | Set<String> imports = new HashSet<>();
|
488 | 489 | if (GeneratorUtils.isNotBlank(schema.get$ref())) {
|
489 |
| - imports.add(getSimpleRef(schema.get$ref())); |
| 490 | + imports.add(OpenAPIUtil.getSimpleRef(schema.get$ref())); |
490 | 491 | }
|
491 | 492 | if (schema instanceof ArraySchema) {
|
492 | 493 | imports.addAll(collectImportsFromSchema(
|
|
0 commit comments