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

v2 refClass simplification #104

Merged
merged 21 commits into from
Dec 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public interface CodegenConfig {

void setOutputDir(String dir);

CodegenSchema fromSchema(Schema schema, String sourceJsonPath);
CodegenSchema fromSchema(Schema schema, String sourceJsonPath, String currentJsonPath);

CodegenOperation fromOperation(String resourcePath, String httpMethod, Operation operation, List<Server> servers);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class CodegenHeader implements OpenapiComponent {

public Set<String> imports = new HashSet<String>();

protected String modulePath;
protected String componentModule;

public CodegenHeader copy() {
CodegenHeader output = new CodegenHeader();
Expand Down Expand Up @@ -82,8 +82,8 @@ public CodegenHeader copy() {
if (this.imports != null) {
output.imports = imports;
}
if (this.modulePath != null) {
output.modulePath = modulePath;
if (this.componentModule != null) {
output.componentModule = componentModule;
}
output.isDeprecated = this.isDeprecated;
output.isExplode = this.isExplode;
Expand All @@ -92,17 +92,17 @@ public CodegenHeader copy() {
return output;
}

public String getModulePath() {
return modulePath;
public String getComponentModule() {
return componentModule;
}

public void setModulePath(String modulePath) {
this.modulePath = modulePath;
public void setComponentModule(String componentModule) {
this.componentModule = componentModule;
}

@Override
public int hashCode() {
return Objects.hash(isExplode, paramName, description, unescapedDescription, style, example, jsonSchema, vendorExtensions, isDeprecated, required, hasMultipleTypes, schema, content, ref, refModule, imports, modulePath);
return Objects.hash(isExplode, paramName, description, unescapedDescription, style, example, jsonSchema, vendorExtensions, isDeprecated, required, hasMultipleTypes, schema, content, ref, refModule, imports, componentModule);
}

@Override
Expand All @@ -113,7 +113,7 @@ public boolean equals(Object o) {
return isExplode == that.isExplode &&
isDeprecated == that.isDeprecated &&
required == that.required &&
Objects.equals(modulePath, that.modulePath) &&
Objects.equals(componentModule, that.componentModule) &&
Objects.equals(ref, that.getRef()) &&
Objects.equals(imports, that.imports) &&
Objects.equals(refModule, that.getRefModule()) &&
Expand Down Expand Up @@ -145,7 +145,7 @@ protected void addInstanceInfo(StringBuilder sb) {
sb.append(", ref=").append(ref);
sb.append(", refModule=").append(refModule);
sb.append(", imports=").append(imports);
sb.append(", modulePath=").append(modulePath);
sb.append(", componentModule=").append(componentModule);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public CodegenParameter copy() {
if (this.imports != null) {
output.imports = imports;
}
if (this.modulePath != null) {
output.modulePath = modulePath;
if (this.componentModule != null) {
output.componentModule = componentModule;
}
output.isDeprecated = this.isDeprecated;
output.isExplode = this.isExplode;
Expand All @@ -77,7 +77,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, refModule, imports, modulePath);
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, imports, componentModule);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ public class CodegenResponse implements OpenapiComponent {
private String ref;
public Set<String> imports = new TreeSet<>();
private String refModule;
private String modulePath;
private String componentModule;

@Override
public int hashCode() {
return Objects.hash(message, examples, hasHeaders,
jsonSchema, vendorExtensions,
headers, content,
ref, imports, refModule, modulePath);
ref, imports, refModule, componentModule);
}

@Override
Expand All @@ -55,15 +55,15 @@ public boolean equals(Object o) {
Objects.equals(jsonSchema, that.jsonSchema) &&
Objects.equals(vendorExtensions, that.vendorExtensions) &&
Objects.equals(refModule, that.getRefModule()) &&
Objects.equals(modulePath, that.modulePath);
Objects.equals(componentModule, that.componentModule);
}

public String getModulePath() {
return modulePath;
public String getComponentModule() {
return componentModule;
}

public void setModulePath(String modulePath) {
this.modulePath = modulePath;
public void setComponentModule(String componentModule) {
this.componentModule = componentModule;
}

public LinkedHashMap<String, CodegenMediaType> getContent() {
Expand Down Expand Up @@ -95,7 +95,7 @@ public String toString() {
sb.append(", ref=").append(ref);
sb.append(", refModule=").append(refModule);
sb.append(", imports=").append(imports);
sb.append(", modulePath=").append(modulePath);
sb.append(", componentModule=").append(componentModule);
sb.append('}');
return sb.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@

import java.util.*;

public class CodegenSchema implements JsonSchema {
public class CodegenSchema implements JsonSchema, OpenapiComponent {
// testCases are for autogenerated tests of schemas
public HashMap<String, SchemaTestCase> testCases = new HashMap<>();
private String modulePath;
private String componentModule;
public TreeSet<String> imports;
private ExternalDocumentation externalDocumentation;
public String refClass;
Expand Down Expand Up @@ -165,12 +165,12 @@ public class CodegenSchema implements JsonSchema {
private CodegenSchema contains;
public CodegenDiscriminator discriminator;

public String getModulePath() {
return modulePath;
public String getComponentModule() {
return componentModule;
}

public void setModulePath(String modulePath) {
this.modulePath = modulePath;
public void setComponentModule(String componentModule) {
this.componentModule = componentModule;
}

public Set<String> getImports() {
Expand Down Expand Up @@ -826,7 +826,7 @@ protected void addInstanceInfo(StringBuilder sb) {
sb.append(", externalDocumentation=").append(externalDocumentation);
sb.append(", discriminator=").append(discriminator);
sb.append(", imports=").append(imports);
sb.append(", modulePath=").append(modulePath);
sb.append(", componentModule=").append(componentModule);
sb.append(", testCases=").append(testCases);
}
@Override
Expand Down Expand Up @@ -883,7 +883,7 @@ public boolean equals(Object o) {
isBooleanSchemaFalse == that.getIsBooleanSchemaFalse() &&
getSchemaIsFromAdditionalProperties() == that.getSchemaIsFromAdditionalProperties() &&
Objects.equals(testCases, that.testCases) &&
Objects.equals(modulePath, that.getModulePath()) &&
Objects.equals(componentModule, that.getComponentModule()) &&
Objects.equals(imports, that.getImports()) &&
Objects.equals(discriminator, that.getDiscriminator()) &&
Objects.equals(externalDocumentation, that.getExternalDocumentation()) &&
Expand Down Expand Up @@ -945,6 +945,6 @@ public int hashCode() {
ref, schemaIsFromAdditionalProperties, isBooleanSchemaTrue, isBooleanSchemaFalse,
format, dependentRequired, contains, refModule, allOf, anyOf, oneOf, not,
properties, optionalProperties, requiredProperties, externalDocumentation,
discriminator, imports, modulePath, testCases);
discriminator, imports, componentModule, testCases);
}
}
Loading