mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-07 10:58:55 +00:00
Make response headers available to the code generator
This commit is contained in:
parent
f2c64a0fbb
commit
3f0b71b3e0
@ -19,7 +19,7 @@ public class CodegenOperation {
|
|||||||
public List<CodegenParameter> formParams = new ArrayList<CodegenParameter>();
|
public List<CodegenParameter> formParams = new ArrayList<CodegenParameter>();
|
||||||
public List<String> tags;
|
public List<String> tags;
|
||||||
public List<CodegenResponse> responses = new ArrayList<CodegenResponse>();
|
public List<CodegenResponse> responses = new ArrayList<CodegenResponse>();
|
||||||
|
public final List<CodegenProperty> responseHeaders = new ArrayList<CodegenProperty>();
|
||||||
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;
|
||||||
|
@ -606,7 +606,8 @@ public class DefaultCodegen {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(methodResponse != null && methodResponse.getSchema() != null) {
|
if(methodResponse != null) {
|
||||||
|
if (methodResponse.getSchema() != null) {
|
||||||
CodegenProperty cm = fromProperty("response", methodResponse.getSchema());
|
CodegenProperty cm = fromProperty("response", methodResponse.getSchema());
|
||||||
|
|
||||||
Property responseProperty = methodResponse.getSchema();
|
Property responseProperty = methodResponse.getSchema();
|
||||||
@ -632,6 +633,8 @@ public class DefaultCodegen {
|
|||||||
op.returnSimpleType = true;
|
op.returnSimpleType = true;
|
||||||
if (languageSpecificPrimitives().contains(op.returnBaseType) || op.returnBaseType == null)
|
if (languageSpecificPrimitives().contains(op.returnBaseType) || op.returnBaseType == null)
|
||||||
op.returnTypeIsPrimitive = true;
|
op.returnTypeIsPrimitive = true;
|
||||||
|
}
|
||||||
|
addHeaders(methodResponse, op.responseHeaders);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(op.returnBaseType == null) {
|
if(op.returnBaseType == null) {
|
||||||
@ -808,6 +811,14 @@ public class DefaultCodegen {
|
|||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addHeaders(Response response, List<CodegenProperty> target) {
|
||||||
|
if (response.getHeaders() != null) {
|
||||||
|
for (Map.Entry<String, Property> headers : response.getHeaders().entrySet()) {
|
||||||
|
target.add(fromProperty(headers.getKey(), headers.getValue()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private List<CodegenParameter> addHasMore(List<CodegenParameter> objs) {
|
private List<CodegenParameter> addHasMore(List<CodegenParameter> objs) {
|
||||||
if(objs != null) {
|
if(objs != null) {
|
||||||
for(int i = 0; i < objs.size(); i++) {
|
for(int i = 0; i < objs.size(); i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user