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

Commit a492a08

Browse files
committed
v2 CodegenModel cleanup (#103)
* CodegenModel extends CodegenProperty * Updates the fromModel signature * Removes unused code, updates fromModel to use fromProperty * fromModel now uses a fromProperty helper * Removes parent and child properties * Removes interfaces + interfaceModels * Removes vars properties * Removes mandatory properties * Removes 5 unused properties * Removes classFilename * Removes model dataType * Removes type variables from codegenProperty * Switches className for name.getCamelCaseName * Updates staticmethod and class names to follow python naming conventions * Converts properties to Properties * More fixes for property class name cases * Adds more schema case fixes * Fixes the last of the schema name reference issues * Fixes python tests * Removes model classname property usages * Removes classname/classVarName/modelJson * Some small needed java fixes * Moves externalDocumentation into ocdegenProperty * Shortens and improves CodegenParameter equals method * Adds externalDocs interface to JsonSchema * Moves discriminator into CodegenProperty * Moves discriminator creation into fromProperty * Moves imports into CodegenProperty * Replaces CodegenModel with CodegenProperty * CodegenProperty renamed to CodegenSchema * Updates debugging info * Removes unused java code * Removes unused java code * Fixes syntax errors in defaultcodegentests * DefaultCodegenTest failures reduced to 3 * Fixes one test * Fixes java tests * Fixes DefaultGeneratorTest.testRefModelValidationProperties * Fixes java tests * Samples regenerated * Samples regenerated with endpoint test fix
1 parent 18bf39b commit a492a08

File tree

1,156 files changed

+10252
-12870
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,156 files changed

+10252
-12870
lines changed

docs/debugging.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ openapi-generator generate -g go ...
216216
217217
...
218218
...
219-
[main] DEBUG o.o.codegen.DefaultCodegen - debugging fromProperty for files : class Schema {
219+
[main] DEBUG o.o.codegen.DefaultCodegen - debugging fromSchema for files : class Schema {
220220
type: null
221221
format: null
222222
$ref: #/components/schemas/File

modules/openapi-json-schema-generator/src/main/java/org/openapitools/codegen/CodegenConfig.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,6 @@ public interface CodegenConfig {
123123

124124
String escapeQuotationMark(String input);
125125

126-
String getTypeDeclaration(Schema schema);
127-
128126
void processOpts();
129127

130128
List<CliOption> cliOptions();
@@ -145,7 +143,7 @@ public interface CodegenConfig {
145143

146144
void setOutputDir(String dir);
147145

148-
CodegenModel fromModel(String name, Schema schema);
146+
CodegenSchema fromSchema(Schema schema, String sourceJsonPath);
149147

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

@@ -277,7 +275,7 @@ public interface CodegenConfig {
277275

278276
Map<String, Object> postProcessSupportingFileData(Map<String, Object> objs);
279277

280-
void postProcessModelProperty(CodegenModel model, CodegenProperty property);
278+
void postProcessModelProperty(CodegenSchema model, CodegenSchema property);
281279

282280
void postProcessParameter(CodegenParameter parameter);
283281

modules/openapi-json-schema-generator/src/main/java/org/openapitools/codegen/CodegenHeader.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class CodegenHeader implements OpenapiComponent {
3939
public String jsonSchema;
4040
public Map<String, Object> vendorExtensions = new HashMap<String, Object>();
4141
public boolean isDeprecated;
42-
protected CodegenProperty schema;
42+
protected CodegenSchema schema;
4343
/**
4444
* Determines whether this parameter is mandatory. If the parameter is in "path",
4545
* this property is required and its value MUST be true. Otherwise, the property
@@ -156,11 +156,11 @@ public String toString() {
156156
return sb.toString();
157157
}
158158

159-
public CodegenProperty getSchema() {
159+
public CodegenSchema getSchema() {
160160
return schema;
161161
}
162162

163-
public void setSchema(CodegenProperty schema) {
163+
public void setSchema(CodegenSchema schema) {
164164
this.schema = schema;
165165
}
166166

modules/openapi-json-schema-generator/src/main/java/org/openapitools/codegen/CodegenMediaType.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@
55
import java.util.Objects;
66

77
public class CodegenMediaType {
8-
private CodegenProperty schema;
8+
private CodegenSchema schema;
99
private LinkedHashMap<String, CodegenEncoding> encoding;
1010
private HashMap<String, SchemaTestCase> testCases = new HashMap<>();
1111

12-
public CodegenMediaType(CodegenProperty schema, LinkedHashMap<String, CodegenEncoding> encoding, HashMap<String, SchemaTestCase> testCases) {
12+
public CodegenMediaType(CodegenSchema schema, LinkedHashMap<String, CodegenEncoding> encoding, HashMap<String, SchemaTestCase> testCases) {
1313
this.schema = schema;
1414
this.encoding = encoding;
1515
if (testCases != null) {
1616
this.testCases = testCases;
1717
}
1818
}
1919

20-
public CodegenProperty getSchema() {
20+
public CodegenSchema getSchema() {
2121
return schema;
2222
}
2323

0 commit comments

Comments
 (0)