forked from loafle/openapi-generator-original
Merge pull request #1175 from swagger-api/feature/issue-1173
formatting, vendor extensions on operations
This commit is contained in:
commit
c8ed2b0d50
@ -29,6 +29,7 @@ public class CodegenOperation {
|
|||||||
public Set<String> imports = new HashSet<String>();
|
public Set<String> imports = new HashSet<String>();
|
||||||
public List<Map<String, String>> examples;
|
public List<Map<String, String>> examples;
|
||||||
public ExternalDocs externalDocs;
|
public ExternalDocs externalDocs;
|
||||||
|
public Map<String, Object> vendorExtensions;
|
||||||
|
|
||||||
private boolean nonempty(List<CodegenParameter> params)
|
private boolean nonempty(List<CodegenParameter> params)
|
||||||
{
|
{
|
||||||
|
@ -15,7 +15,6 @@ public class CodegenParameter {
|
|||||||
public Map<String, Object> allowableValues;
|
public Map<String, Object> allowableValues;
|
||||||
public Map<String, Object> vendorExtensions;
|
public Map<String, Object> vendorExtensions;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether this parameter is mandatory. If the parameter is in "path",
|
* Determines whether this parameter is mandatory. If the parameter is in "path",
|
||||||
* this property is required and its value MUST be true. Otherwise, the property
|
* this property is required and its value MUST be true. Otherwise, the property
|
||||||
|
@ -781,28 +781,28 @@ public class DefaultCodegen {
|
|||||||
|
|
||||||
property.baseType = getSwaggerType(p);
|
property.baseType = getSwaggerType(p);
|
||||||
|
|
||||||
if (p instanceof ArrayProperty) {
|
if (p instanceof ArrayProperty) {
|
||||||
property.isContainer = true;
|
property.isContainer = true;
|
||||||
property.containerType = "array";
|
property.containerType = "array";
|
||||||
ArrayProperty ap = (ArrayProperty) p;
|
ArrayProperty ap = (ArrayProperty) p;
|
||||||
CodegenProperty cp = fromProperty(property.name, ap.getItems());
|
CodegenProperty cp = fromProperty(property.name, ap.getItems());
|
||||||
if (cp == null) {
|
if (cp == null) {
|
||||||
LOGGER.warn("skipping invalid property " + Json.pretty(p));
|
LOGGER.warn("skipping invalid property " + Json.pretty(p));
|
||||||
} else {
|
} else {
|
||||||
property.baseType = getSwaggerType(p);
|
property.baseType = getSwaggerType(p);
|
||||||
if (!languageSpecificPrimitives.contains(cp.baseType)) {
|
if (!languageSpecificPrimitives.contains(cp.baseType)) {
|
||||||
property.complexType = cp.baseType;
|
property.complexType = cp.baseType;
|
||||||
} else {
|
} else {
|
||||||
property.isPrimitiveType = true;
|
property.isPrimitiveType = true;
|
||||||
}
|
}
|
||||||
property.items = cp;
|
property.items = cp;
|
||||||
if (property.items.isEnum) {
|
if (property.items.isEnum) {
|
||||||
property.datatypeWithEnum = property.datatypeWithEnum.replace(property.items.baseType,
|
property.datatypeWithEnum = property.datatypeWithEnum.replace(property.items.baseType,
|
||||||
property.items.datatypeWithEnum);
|
property.items.datatypeWithEnum);
|
||||||
property.defaultValue = property.defaultValue.replace(property.items.baseType, property.items.datatypeWithEnum);
|
property.defaultValue = property.defaultValue.replace(property.items.baseType, property.items.datatypeWithEnum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (p instanceof MapProperty) {
|
} else if (p instanceof MapProperty) {
|
||||||
property.isContainer = true;
|
property.isContainer = true;
|
||||||
property.containerType = "map";
|
property.containerType = "map";
|
||||||
MapProperty ap = (MapProperty) p;
|
MapProperty ap = (MapProperty) p;
|
||||||
@ -848,6 +848,7 @@ public class DefaultCodegen {
|
|||||||
public CodegenOperation fromOperation(String path, String httpMethod, Operation operation, Map<String, Model> definitions) {
|
public CodegenOperation fromOperation(String path, String httpMethod, Operation operation, Map<String, Model> definitions) {
|
||||||
CodegenOperation op = CodegenModelFactory.newInstance(CodegenModelType.OPERATION);
|
CodegenOperation op = CodegenModelFactory.newInstance(CodegenModelType.OPERATION);
|
||||||
Set<String> imports = new HashSet<String>();
|
Set<String> imports = new HashSet<String>();
|
||||||
|
op.vendorExtensions = operation.getVendorExtensions();
|
||||||
|
|
||||||
String operationId = operation.getOperationId();
|
String operationId = operation.getOperationId();
|
||||||
if (operationId == null) {
|
if (operationId == null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user