Skip to content

Commit

Permalink
feat: adds java interfaces when using allof
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethaasan committed Nov 8, 2023
1 parent 04d0f9a commit 91f2380
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 6 additions & 1 deletion src/generators/java/renderers/ClassRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ export const JAVA_DEFAULT_CLASS_PRESET: ClassPresetType<JavaOptions> = {
)}`;

if (model.options.isExtended) {
if (property.property instanceof ConstrainedDictionaryModel) {
return '';
}

return `public ${property.property.type} ${getterName}();`;
}

Expand All @@ -166,7 +170,8 @@ public ${property.property.type} ${getterName}() { return this.${property.proper
if (model.options.isExtended) {
if (
model.options.discriminator?.discriminator ===
property.unconstrainedPropertyName
property.unconstrainedPropertyName ||
property.property instanceof ConstrainedDictionaryModel
) {
return '';
}
Expand Down
3 changes: 0 additions & 3 deletions test/generators/java/__snapshots__/JavaGenerator.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ public interface Pet {
public void setId(String id);
public String getType();
public Map<String, Object> getAdditionalProperties();
public void setAdditionalProperties(Map<String, Object> additionalProperties);
}",
"public enum CloudEventType {
DOG((String)\\"Dog\\"), CAT((String)\\"Cat\\");
Expand Down

0 comments on commit 91f2380

Please sign in to comment.