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

v2 changes Java CodegenX.ref type from String to CodegenX #117

Merged
merged 36 commits into from
Jan 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
e13835d
petstore regen
spacether Jan 2, 2023
0fa1ee6
Sets response ref to CodegenResponse instance
spacether Jan 2, 2023
98c7710
Endpoint test fix, petstore regen
spacether Jan 2, 2023
103fac7
Updates codegenHeader
spacether Jan 3, 2023
dc70046
codegenRequestBody ref update in java
spacether Jan 3, 2023
9656f26
Fixes endpoint + endpoint docs fro request body, example still broken
spacether Jan 3, 2023
a05a189
Fixes request body examples
spacether Jan 3, 2023
15b4b7f
Fixes requiredVars
spacether Jan 3, 2023
929c23b
Adds response_for_200 info back into endpoint docs
spacether Jan 3, 2023
03eaccb
Adds response_for_200 back into response header anchor links
spacether Jan 3, 2023
5748b37
Fixes header component links in scomponent response
spacether Jan 3, 2023
4fd1ebd
Updates codegenParameter
spacether Jan 3, 2023
99c1ec8
Templates updated to get ref parameters working
spacether Jan 3, 2023
8416b1e
Uses setLocationInfo in fromSchema
spacether Jan 3, 2023
8cf6869
Uses a constant and already calculated adProp for required props, red…
spacether Jan 3, 2023
e151728
Uses codegenSchemaCache.computeIfAbsent in fromSchema
spacether Jan 3, 2023
20acccc
Removes unaliasing from fromSchema
spacether Jan 3, 2023
19273b8
Petstore regen
spacether Jan 3, 2023
e6e2cce
Adds JsonIgnore to fix debugging
spacether Jan 3, 2023
ed9fd0f
Sample regen
spacether Jan 3, 2023
16c0c67
Samples regenerated
spacether Jan 4, 2023
cfae3da
Points refs to component schemas, fixes java test
spacether Jan 4, 2023
1a5a5b0
Fixes java test
spacether Jan 4, 2023
cf605d1
Fixes testAlias
spacether Jan 5, 2023
572a516
Fixes 2 java tests
spacether Jan 5, 2023
1ee0031
Fixes testUnalias
spacether Jan 5, 2023
b488ea7
Fixes testNullableProperty
spacether Jan 5, 2023
d9ca66e
Fixes testDeprecatedRef
spacether Jan 5, 2023
225e202
Fixes testRequestBodyContent
spacether Jan 5, 2023
ac6a11d
Fixes testAdditionalPropertiesPresentInResponses
spacether Jan 6, 2023
f0339ca
Fixes testAdditionalPropertiesPresentInParameters
spacether Jan 6, 2023
e3f75f3
Fixes testIsXPresence
spacether Jan 7, 2023
d616972
Fixes testResponseContentAndHeader
spacether Jan 7, 2023
48ef5f8
Fixes DefaultGeneratorTests
spacether Jan 7, 2023
6479df1
Fixes AbstractJavaCodegenExampleValuesTest
spacether Jan 7, 2023
fe78e9f
Samples updated
spacether Jan 7, 2023
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 @@ -93,6 +93,9 @@ public String toString() {
return sb.toString();
}

@Override
public CodegenHeader getRef() { return (CodegenHeader) ref; }

public CodegenSchema getSchema() {
return schema;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
package org.openapitools.codegen;

import io.swagger.v3.oas.models.ExternalDocumentation;
import com.fasterxml.jackson.annotation.JsonIgnore;

import java.util.*;
import java.util.stream.Collectors;

public class CodegenOperation {
public boolean hasAuthMethods, hasConsumes, hasProduces, hasParams,
Expand Down Expand Up @@ -169,12 +169,19 @@ public boolean getAllResponsesAreErrors() {
* returns a map where the key is the request body content type and the value is the current CodegenOperation
* this is needed by templates when a different signature is needed for each request body content type
*/
@JsonIgnore
public Map<String, CodegenOperation> getContentTypeToOperation() {
LinkedHashMap<String, CodegenOperation> contentTypeToOperation = new LinkedHashMap<>();
if (requestBody == null) {
return null;
}
LinkedHashMap<String, CodegenMediaType> content = requestBody.getContent();
LinkedHashMap<String, CodegenMediaType> content;
CodegenRequestBody ref = (CodegenRequestBody) requestBody.getRef();
if (ref != null) {
content = ref.getContent();
} else {
content = requestBody.getContent();
}
for (String contentType: content.keySet()) {
contentTypeToOperation.put(contentType, this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public class CodegenParameter extends CodegenHeader {
// stores the openapi name property
public String baseName;

public CodegenParameter getRef() { return (CodegenParameter) ref; }

@Override
public int hashCode() {
return Objects.hash(refClass, name, isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam, isExplode, baseName, description, unescapedDescription, style, isDeepObject, isAllowEmptyValue, example, jsonSchema, vendorExtensions, isDeprecated, required, schema, content, ref, refModule, imports, componentModule);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class CodegenRequestBody implements OpenApiComponent {
*/
protected boolean required;
protected LinkedHashMap<String, CodegenMediaType> content;
protected String ref;
protected Object ref;
protected String refModule;
protected Set<String> imports = new HashSet<String>();
protected String componentModule;
Expand Down Expand Up @@ -109,9 +109,9 @@ public void setContent(LinkedHashMap<String, CodegenMediaType> content) {

public void setName(CodegenKey name) { this.name=name; }

public String getRef() { return ref; }
public CodegenRequestBody getRef() { return (CodegenRequestBody) ref; }

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

public String getRefModule() { return refModule; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class CodegenResponse implements OpenApiComponent {
public String jsonSchema;
public Map<String, Object> vendorExtensions = new HashMap<String, Object>();
private LinkedHashMap<String, CodegenMediaType> content;
private String ref;
private CodegenResponse ref;
public Set<String> imports = new TreeSet<>();
private String refModule;
private String refClass;
Expand Down Expand Up @@ -103,9 +103,9 @@ public String toString() {
return sb.toString();
}

public String getRef() { return ref; }
public CodegenResponse getRef() { return ref; }

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

public String getRefModule() { return refModule; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@
package org.openapitools.codegen;

import io.swagger.v3.oas.models.ExternalDocumentation;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import java.util.*;

@JsonIgnoreProperties({"ref"})
public class CodegenSchema implements OpenApiSchema, OpenApiComponent {
// testCases are for autogenerated tests of schemas
public HashMap<String, SchemaTestCase> testCases = new HashMap<>();
Expand Down Expand Up @@ -155,7 +157,7 @@ public class CodegenSchema implements OpenApiSchema, OpenApiComponent {
private LinkedHashMap<CodegenKey, CodegenSchema> requiredProperties;
private LinkedHashMap<CodegenKey, CodegenSchema> properties;
private LinkedHashMap<CodegenKey, CodegenSchema> optionalProperties;
private String ref;
private CodegenSchema ref;
private String refModule;
private boolean schemaIsFromAdditionalProperties;
private boolean isBooleanSchemaTrue;
Expand Down Expand Up @@ -584,12 +586,12 @@ public CodegenSchema getNot() {
}

@Override
public void setRef(String ref) {
this.ref = ref;
public void setRef(Object ref) {
this.ref = (CodegenSchema) ref;
}

@Override
public String getRef() {
public CodegenSchema getRef() {
return ref;
}

Expand Down Expand Up @@ -942,7 +944,7 @@ public int hashCode() {
maxItems, minItems, isXmlAttribute, xmlPrefix, xmlName,
xmlNamespace, isXmlWrapped, isNull,
hasDiscriminatorWithNonEmptyMapping, hasMultipleTypes,
ref, schemaIsFromAdditionalProperties, isBooleanSchemaTrue, isBooleanSchemaFalse,
schemaIsFromAdditionalProperties, isBooleanSchemaTrue, isBooleanSchemaFalse,
format, dependentRequired, contains, refModule, allOf, anyOf, oneOf, not,
properties, optionalProperties, requiredProperties, externalDocumentation,
discriminator, imports, componentModule, testCases);
Expand Down
Loading