Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.

v2 Adds refModule #88

Merged
merged 1 commit into from
Nov 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ public class CodegenModel implements JsonSchema {
private boolean isUuid;
private Map<String, CodegenProperty> requiredVarsMap;
private String ref;
private String refModule;

public String getAdditionalPropertiesType() {
return additionalPropertiesType;
Expand Down Expand Up @@ -242,6 +243,10 @@ public void setRef(String ref) {
this.ref = ref;
}

public String getRefModule() { return refModule; }

public void setRefModule(String refModule) { this.refModule=refModule; }

@Override
public boolean getSchemaIsFromAdditionalProperties() {
return schemaIsFromAdditionalProperties;
Expand Down Expand Up @@ -1023,6 +1028,7 @@ public boolean equals(Object o) {
Objects.equals(format, that.getFormat()) &&
Objects.equals(uniqueItemsBoolean, that.getUniqueItemsBoolean()) &&
Objects.equals(ref, that.getRef()) &&
Objects.equals(refModule, that.getRefModule()) &&
Objects.equals(requiredVarsMap, that.getRequiredVarsMap()) &&
Objects.equals(composedSchemas, that.composedSchemas) &&
Objects.equals(parent, that.parent) &&
Expand Down Expand Up @@ -1098,7 +1104,7 @@ hasChildren, isMap, isDeprecated, hasOnlyReadOnly, getExternalDocumentation(), g
getAdditionalPropertiesIsAnyType(), hasDiscriminatorWithNonEmptyMapping,
isAnyType, getComposedSchemas(), hasMultipleTypes, isDecimal, isUuid, requiredVarsMap, ref,
uniqueItemsBoolean, schemaIsFromAdditionalProperties, isBooleanSchemaTrue, isBooleanSchemaFalse,
format, dependentRequired, contains);
format, dependentRequired, contains, refModule);
}

@Override
Expand Down Expand Up @@ -1198,6 +1204,7 @@ public String toString() {
sb.append(", isUUID=").append(isUuid);
sb.append(", requiredVarsMap=").append(requiredVarsMap);
sb.append(", ref=").append(ref);
sb.append(", refModule=").append(refModule);
sb.append(", schemaIsFromAdditionalProperties=").append(schemaIsFromAdditionalProperties);
sb.append(", isBooleanSchemaTrue=").append(isBooleanSchemaTrue);
sb.append(", isBooleanSchemaFalse=").append(isBooleanSchemaFalse);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class CodegenParameter {
private boolean hasMultipleTypes = false;
private LinkedHashMap<String, CodegenMediaType> content;
private String ref;
private String refModule;

public CodegenParameter copy() {
CodegenParameter output = new CodegenParameter();
Expand Down Expand Up @@ -75,6 +76,9 @@ public CodegenParameter copy() {
if (this.ref != null) {
output.setRef(this.ref);
}
if (this.refModule != null) {
output.setRefModule(this.refModule);
}
output.isDeprecated = this.isDeprecated;
output.isExplode = this.isExplode;
output.style = this.style;
Expand All @@ -86,7 +90,7 @@ public CodegenParameter copy() {

@Override
public int hashCode() {
return Objects.hash(isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam, isExplode, baseName, paramName, description, unescapedDescription, style, isDeepObject, isAllowEmptyValue, example, jsonSchema, vendorExtensions, isDeprecated, required, hasMultipleTypes, schema, content, ref);
return Objects.hash(isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam, isExplode, baseName, paramName, description, unescapedDescription, style, isDeepObject, isAllowEmptyValue, example, jsonSchema, vendorExtensions, isDeprecated, required, hasMultipleTypes, schema, content, ref, refModule);
}

@Override
Expand All @@ -104,6 +108,7 @@ public boolean equals(Object o) {
isDeprecated == that.isDeprecated &&
required == that.required &&
Objects.equals(ref, that.getRef()) &&
Objects.equals(refModule, that.getRefModule()) &&
Objects.equals(content, that.getContent()) &&
Objects.equals(schema, that.getSchema()) &&
Objects.equals(baseName, that.baseName) &&
Expand Down Expand Up @@ -144,6 +149,7 @@ public String toString() {
sb.append(", schema=").append(schema);
sb.append(", content=").append(content);
sb.append(", ref=").append(ref);
sb.append(", refModule=").append(refModule);
sb.append('}');
return sb.toString();
}
Expand All @@ -169,5 +175,8 @@ public void setContent(LinkedHashMap<String, CodegenMediaType> content) {

public void setRef(String ref) { this.ref=ref; }

public String getRefModule() { return refModule; }

public void setRefModule(String refModule) { this.refModule=refModule; }
}

Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ public class CodegenProperty implements Cloneable, JsonSchema {
private boolean hasMultipleTypes = false;
private Map<String, CodegenProperty> requiredVarsMap;
private String ref;
private String refModule;
private boolean schemaIsFromAdditionalProperties;
private boolean isBooleanSchemaTrue;
private boolean isBooleanSchemaFalse;
Expand Down Expand Up @@ -780,6 +781,9 @@ public CodegenProperty clone() {
if (this.contains != null) {
cp.setContains(this.contains);
}
if (this.getRefModule() != null) {
cp.setRefClass(this.refModule);
}

return cp;
} catch (CloneNotSupportedException e) {
Expand Down Expand Up @@ -973,6 +977,10 @@ public void setHasMultipleTypes(boolean hasMultipleTypes) {
@Override
public void setRequiredVarsMap(Map<String, CodegenProperty> requiredVarsMap) { this.requiredVarsMap=requiredVarsMap; }

public String getRefModule() { return refModule; }

public void setRefModule(String refModule) { this.refModule=refModule; }

@Override
public String toString() {
final StringBuilder sb = new StringBuilder("CodegenProperty{");
Expand Down Expand Up @@ -1075,6 +1083,7 @@ public String toString() {
sb.append(", hasMultipleTypes=").append(hasMultipleTypes);
sb.append(", requiredVarsMap=").append(requiredVarsMap);
sb.append(", ref=").append(ref);
sb.append(", refModule=").append(refModule);
sb.append(", schemaIsFromAdditionalProperties=").append(schemaIsFromAdditionalProperties);
sb.append(", isBooleanSchemaTrue=").append(isBooleanSchemaTrue);
sb.append(", isBooleanSchemaFalse=").append(isBooleanSchemaFalse);
Expand Down Expand Up @@ -1147,6 +1156,7 @@ public boolean equals(Object o) {
Objects.equals(format, that.getFormat()) &&
Objects.equals(uniqueItemsBoolean, that.getUniqueItemsBoolean()) &&
Objects.equals(ref, that.getRef()) &&
Objects.equals(refModule, that.getRefModule()) &&
Objects.equals(requiredVarsMap, that.getRequiredVarsMap()) &&
Objects.equals(composedSchemas, that.composedSchemas) &&
Objects.equals(openApiType, that.openApiType) &&
Expand Down Expand Up @@ -1213,6 +1223,6 @@ public int hashCode() {
xmlNamespace, isXmlWrapped, isNull, additionalPropertiesIsAnyType, hasVars, hasRequired,
hasDiscriminatorWithNonEmptyMapping, composedSchemas, hasMultipleTypes, requiredVarsMap,
ref, uniqueItemsBoolean, schemaIsFromAdditionalProperties, isBooleanSchemaTrue, isBooleanSchemaFalse,
format, dependentRequired, contains);
format, dependentRequired, contains, refModule);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,15 @@ public class CodegenResponse {
private LinkedHashMap<String, CodegenMediaType> content;
private String ref;
public Set<String> imports = new TreeSet<>();
private String refModule;

@Override
public int hashCode() {
return Objects.hash(headers, code, message, examples, hasHeaders,
jsonSchema, vendorExtensions,
is1xx, is2xx, is3xx, is4xx, is5xx, isDefault,
responseHeaders, content,
ref, imports);
ref, imports, refModule);
}

@Override
Expand All @@ -68,7 +69,8 @@ public boolean equals(Object o) {
Objects.equals(message, that.message) &&
Objects.equals(examples, that.examples) &&
Objects.equals(jsonSchema, that.jsonSchema) &&
Objects.equals(vendorExtensions, that.vendorExtensions);
Objects.equals(vendorExtensions, that.vendorExtensions) &&
Objects.equals(refModule, that.getRefModule());

}

Expand Down Expand Up @@ -107,6 +109,7 @@ public String toString() {
sb.append(", responseHeaders=").append(responseHeaders);
sb.append(", content=").append(content);
sb.append(", ref=").append(ref);
sb.append(", refModule=").append(refModule);
sb.append(", imports=").append(imports);
sb.append('}');
return sb.toString();
Expand All @@ -132,4 +135,9 @@ public boolean isRange() {
public String getRef() { return ref; }

public void setRef(String ref) { this.ref=ref; }

public String getRefModule() { return refModule; }

public void setRefModule(String refModule) { this.refModule=refModule; }

}