-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Add option to generate a fully sealed model in the JavaSpring generator
#20503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
1b7019f
cf33acd
10fdc9c
fc96768
f555437
cbccd95
5fca635
31c99b8
9ad36c9
e0826f6
02b7b74
1b49d55
3f407eb
1e0a578
0291b11
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
alex-nt marked this conversation as resolved.
Show resolved
Hide resolved
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -59,6 +59,9 @@ public class CodegenModel implements IJsonSchemaValidationProperties { | |
| public Set<String> oneOf = new TreeSet<>(); | ||
| public Set<String> allOf = new TreeSet<>(); | ||
|
|
||
| // direct descendants that are allowed to extend the current model | ||
| public List<String> permits = new ArrayList<>(); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you please add a 1-liner explain what
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is that "similar to" children (
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar but different.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @wing328 do you see this differently? Any suggestion on how I should change it? :D |
||
|
|
||
| // The schema name as written in the OpenAPI document | ||
| // If it's a reserved word, it will be escaped. | ||
| @Getter @Setter | ||
|
|
@@ -922,6 +925,7 @@ public boolean equals(Object o) { | |
| Objects.equals(parentModel, that.parentModel) && | ||
| Objects.equals(interfaceModels, that.interfaceModels) && | ||
| Objects.equals(children, that.children) && | ||
| Objects.equals(permits, that.permits) && | ||
| Objects.equals(anyOf, that.anyOf) && | ||
| Objects.equals(oneOf, that.oneOf) && | ||
| Objects.equals(allOf, that.allOf) && | ||
|
|
@@ -975,7 +979,7 @@ public boolean equals(Object o) { | |
| @Override | ||
| public int hashCode() { | ||
| return Objects.hash(getParent(), getParentSchema(), getInterfaces(), getAllParents(), getParentModel(), | ||
| getInterfaceModels(), getChildren(), anyOf, oneOf, allOf, getName(), getSchemaName(), getClassname(), getTitle(), | ||
| getInterfaceModels(), getChildren(), permits, anyOf, oneOf, allOf, getName(), getSchemaName(), getClassname(), getTitle(), | ||
| getDescription(), getClassVarName(), getModelJson(), getDataType(), getXmlPrefix(), getXmlNamespace(), | ||
| getXmlName(), getClassFilename(), getUnescapedDescription(), getDiscriminator(), getDefaultValue(), | ||
| getArrayModelType(), isAlias, isString, isInteger, isLong, isNumber, isNumeric, isFloat, isDouble, | ||
|
|
@@ -1005,6 +1009,7 @@ public String toString() { | |
| sb.append(", allParents=").append(allParents); | ||
| sb.append(", parentModel=").append(parentModel); | ||
| sb.append(", children=").append(children != null ? children.size() : "[]"); | ||
| sb.append(", permits=").append(permits != null ? permits.size() : "[]"); | ||
| sb.append(", anyOf=").append(anyOf); | ||
| sb.append(", oneOf=").append(oneOf); | ||
| sb.append(", allOf=").append(allOf); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| {{#useSealed}}{{#permits}}{{#-first}}permits {{/-first}}{{{.}}}{{^-last}}, {{/-last}}{{/permits}} {{/useSealed}} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| {{#useSealed}}{{#permits.0}}sealed {{/permits.0}}{{^permits.0}}{{^vendorExtensions.x-is-one-of-interface}}final {{/vendorExtensions.x-is-one-of-interface}}{{/permits.0}}{{/useSealed}} |
Uh oh!
There was an error while loading. Please reload this page.