forked from loafle/openapi-generator-original
Add kotlin.collections.Set support for unique item arrays (#4247)
This commit is contained in:
parent
e37d8bcb2e
commit
c0bc8b4934
@ -184,6 +184,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
|||||||
typeMapping.put("file", "java.io.File");
|
typeMapping.put("file", "java.io.File");
|
||||||
typeMapping.put("array", "kotlin.Array");
|
typeMapping.put("array", "kotlin.Array");
|
||||||
typeMapping.put("list", "kotlin.collections.List");
|
typeMapping.put("list", "kotlin.collections.List");
|
||||||
|
typeMapping.put("set", "kotlin.collections.Set");
|
||||||
typeMapping.put("map", "kotlin.collections.Map");
|
typeMapping.put("map", "kotlin.collections.Map");
|
||||||
typeMapping.put("object", "kotlin.Any");
|
typeMapping.put("object", "kotlin.Any");
|
||||||
typeMapping.put("binary", "kotlin.Array<kotlin.Byte>");
|
typeMapping.put("binary", "kotlin.Array<kotlin.Byte>");
|
||||||
@ -697,6 +698,9 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
|||||||
// TODO: collection type here should be fully qualified namespace to avoid model conflicts
|
// TODO: collection type here should be fully qualified namespace to avoid model conflicts
|
||||||
// This supports arrays of arrays.
|
// This supports arrays of arrays.
|
||||||
String arrayType = typeMapping.get("array");
|
String arrayType = typeMapping.get("array");
|
||||||
|
if (Boolean.TRUE.equals(arr.getUniqueItems())) {
|
||||||
|
arrayType = typeMapping.get("set");
|
||||||
|
}
|
||||||
StringBuilder instantiationType = new StringBuilder(arrayType);
|
StringBuilder instantiationType = new StringBuilder(arrayType);
|
||||||
Schema items = arr.getItems();
|
Schema items = arr.getItems();
|
||||||
String nestedType = getTypeDeclaration(items);
|
String nestedType = getTypeDeclaration(items);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user