From 7dfdb5878e4f8d723d5ee30c9da10507c5c94949 Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Fri, 21 Sep 2018 11:24:20 -0400 Subject: [PATCH] Handle untyped schemas (in some languages) Ref https://github.com/swagger-api/swagger-codegen/pull/6898 Ref https://github.com/swagger-api/swagger-codegen/issues/6896 --- .../src/main/java/org/openapitools/codegen/DefaultCodegen.java | 1 + .../org/openapitools/codegen/languages/AbstractGoCodegen.java | 1 + .../org/openapitools/codegen/languages/ErlangClientCodegen.java | 1 + .../org/openapitools/codegen/languages/RustClientCodegen.java | 1 + .../openapitools/codegen/languages/ScalaHttpClientCodegen.java | 1 + 5 files changed, 5 insertions(+) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index 8ddbb41197b3..0f22b11f5471 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -919,6 +919,7 @@ public DefaultCodegen() { typeMapping.put("char", "String"); typeMapping.put("double", "Double"); typeMapping.put("object", "Object"); + typeMapping.put(null, "Object"); typeMapping.put("integer", "Integer"); typeMapping.put("ByteArray", "byte[]"); typeMapping.put("binary", "File"); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java index f1a26ba9a729..010ee7810795 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java @@ -104,6 +104,7 @@ public AbstractGoCodegen() { typeMapping.put("binary", "*os.File"); typeMapping.put("ByteArray", "string"); typeMapping.put("object", "map[string]interface{}"); + typeMapping.put(null, "interface{}"); importMapping = new HashMap(); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangClientCodegen.java index d202e7552685..7239837fbafc 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangClientCodegen.java @@ -90,6 +90,7 @@ public ErlangClientCodegen() { typeMapping.put("bigdecimal", "float()"); typeMapping.put("List", "list()"); typeMapping.put("object", "maps:map()"); + typeMapping.put(null, "any()"); typeMapping.put("file", "binary()"); typeMapping.put("binary", "binary()"); typeMapping.put("bytearray", "binary()"); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java index da9763a281f2..50a4ff4b9bc0 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java @@ -129,6 +129,7 @@ public RustClientCodegen() { typeMapping.put("binary", "::models::File"); typeMapping.put("ByteArray", "String"); typeMapping.put("object", "Value"); + typeMapping.put(null, "Value"); // no need for rust //importMapping = new HashMap(); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaHttpClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaHttpClientCodegen.java index f02d21d289fd..9f6b40b3a5ef 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaHttpClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaHttpClientCodegen.java @@ -114,6 +114,7 @@ public ScalaHttpClientCodegen() { typeMapping.put("char", "Char"); typeMapping.put("double", "Double"); typeMapping.put("object", "Any"); + typeMapping.put(null, "Any"); typeMapping.put("file", "File"); typeMapping.put("binary", "File"); typeMapping.put("ByteArray", "Array[Byte]");