removed more hotfixes (#15723)

This commit is contained in:
devhl-labs 2023-06-02 04:42:39 -04:00 committed by GitHub
parent eb41941872
commit f331cb0695
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1523,20 +1523,6 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
cm.allVars.add(cp);
}
}
for (CodegenProperty cp : cm.allVars) {
// ISSUE: https://github.com/OpenAPITools/openapi-generator/issues/11845
// some properties do not have isInherited set correctly
// see modules\openapi-generator\src\test\resources\3_0\allOf.yaml
// Child properties Type, LastName, FirstName will have isInherited set to false when it should be true
if (cp.isInherited) {
continue;
}
if (Boolean.TRUE.equals(cm.parentVars.stream().anyMatch(v -> v.baseName.equals(cp.baseName) && v.dataType.equals(cp.dataType)))) {
LOGGER.debug("Property " + cp.baseName + " was found in the parentVars but not marked as inherited.");
cp.isInherited = true;
}
}
}
return objs;
@ -1606,45 +1592,11 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
}
ensureInheritedPropertiesArePresent(cm);
for (CodegenProperty property : cm.allVars) {
fixInvalidPropertyName(cm, property);
}
for (CodegenProperty property : cm.vars) {
fixInvalidPropertyName(cm, property);
}
for (CodegenProperty property : cm.readWriteVars) {
fixInvalidPropertyName(cm, property);
}
for (CodegenProperty property : cm.optionalVars) {
fixInvalidPropertyName(cm, property);
}
for (CodegenProperty property : cm.parentVars) {
fixInvalidPropertyName(cm, property);
}
for (CodegenProperty property : cm.requiredVars) {
fixInvalidPropertyName(cm, property);
}
for (CodegenProperty property : cm.readOnlyVars) {
fixInvalidPropertyName(cm, property);
}
for (CodegenProperty property : cm.nonNullableVars) {
fixInvalidPropertyName(cm, property);
}
}
return objs;
}
private void fixInvalidPropertyName(CodegenModel model, CodegenProperty property) {
// TODO: remove once https://github.com/OpenAPITools/openapi-generator/pull/13681 is merged
if (property.name.equalsIgnoreCase(model.classname) ||
reservedWords().contains(property.name) ||
reservedWords().contains(camelize(sanitizeName(property.name), LOWERCASE_FIRST_LETTER))) {
property.name = property.name + "Property";
}
}
/**
* Removes properties from a model which are also defined in a composed class.
*