mirror of
https://github.com/jlengrand/openapi-generator.git
synced 2026-05-16 08:31:26 +00:00
Add discriminator to Codegen Operation object
This commit is contained in:
@@ -15,7 +15,7 @@ public class CodegenOperation {
|
||||
isListContainer, isMultipart, hasMore = Boolean.TRUE,
|
||||
isResponseBinary = Boolean.FALSE, hasReference = Boolean.FALSE;
|
||||
public String path, operationId, returnType, httpMethod, returnBaseType,
|
||||
returnContainer, summary, notes, baseName, defaultResponse;
|
||||
returnContainer, summary, notes, baseName, defaultResponse, discriminator;
|
||||
public List<Map<String, String>> consumes, produces;
|
||||
public CodegenParameter bodyParam;
|
||||
public List<CodegenParameter> allParams = new ArrayList<CodegenParameter>();
|
||||
|
||||
@@ -1451,6 +1451,16 @@ public class DefaultCodegen {
|
||||
op.defaultResponse = toDefaultValue(responseProperty);
|
||||
op.returnType = cm.datatype;
|
||||
op.hasReference = definitions != null && definitions.containsKey(op.returnBaseType);
|
||||
|
||||
// lookup discriminator
|
||||
if (definitions != null) {
|
||||
Model m = definitions.get(op.returnBaseType);
|
||||
if (m != null) {
|
||||
CodegenModel cmod = fromModel(op.returnBaseType, m, definitions);
|
||||
op.discriminator = cmod.discriminator;
|
||||
}
|
||||
}
|
||||
|
||||
if (cm.isContainer != null) {
|
||||
op.returnContainer = cm.containerType;
|
||||
if ("map".equals(cm.containerType)) {
|
||||
|
||||
Reference in New Issue
Block a user