@@ -51,8 +51,11 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
5151 public Set <String > oneOf = new TreeSet <>();
5252 public Set <String > allOf = new TreeSet <>();
5353
54- // The schema name as written in the OpenAPI document.
54+ // The schema name as written in the OpenAPI document
55+ // If it's a reserved word, it will be escaped.
5556 public String name ;
57+ // The original schema name as written in the OpenAPI document.
58+ public String schemaName ;
5659 // The language-specific name of the class that implements this schema.
5760 // The name of the class is derived from the OpenAPI schema name with formatting rules applied.
5861 // The classname is derived from the OpenAPI schema name, with sanitization and escaping rules applied.
@@ -492,6 +495,15 @@ public void setName(String name) {
492495 this .name = name ;
493496 }
494497
498+ public String getSchemaName () {
499+ return schemaName ;
500+ }
501+
502+ public void setSchemaName (String schemaName ) {
503+ this .schemaName = schemaName ;
504+ }
505+
506+
495507 public List <CodegenProperty > getOptionalVars () {
496508 return optionalVars ;
497509 }
@@ -1144,6 +1156,7 @@ public boolean equals(Object o) {
11441156 Objects .equals (oneOf , that .oneOf ) &&
11451157 Objects .equals (allOf , that .allOf ) &&
11461158 Objects .equals (name , that .name ) &&
1159+ Objects .equals (schemaName , that .schemaName ) &&
11471160 Objects .equals (classname , that .classname ) &&
11481161 Objects .equals (title , that .title ) &&
11491162 Objects .equals (description , that .description ) &&
@@ -1192,7 +1205,7 @@ public boolean equals(Object o) {
11921205 @ Override
11931206 public int hashCode () {
11941207 return Objects .hash (getParent (), getParentSchema (), getInterfaces (), getAllParents (), getParentModel (),
1195- getInterfaceModels (), getChildren (), anyOf , oneOf , allOf , getName (), getClassname (), getTitle (),
1208+ getInterfaceModels (), getChildren (), anyOf , oneOf , allOf , getName (), getSchemaName (), getClassname (), getTitle (),
11961209 getDescription (), getClassVarName (), getModelJson (), getDataType (), getXmlPrefix (), getXmlNamespace (),
11971210 getXmlName (), getClassFilename (), getUnescapedDescription (), getDiscriminator (), getDefaultValue (),
11981211 getArrayModelType (), isAlias , isString , isInteger , isLong , isNumber , isNumeric , isFloat , isDouble ,
@@ -1214,6 +1227,7 @@ isAnyType, getComposedSchemas(), hasMultipleTypes, isDecimal, isUuid, isUri, req
12141227 public String toString () {
12151228 final StringBuilder sb = new StringBuilder ("CodegenModel{" );
12161229 sb .append ("name='" ).append (name ).append ('\'' );
1230+ sb .append (", schemaName='" ).append (schemaName ).append ('\'' );
12171231 sb .append (", parent='" ).append (parent ).append ('\'' );
12181232 sb .append (", parentSchema='" ).append (parentSchema ).append ('\'' );
12191233 sb .append (", interfaces=" ).append (interfaces );
0 commit comments