Skip to content

Commit 98daf05

Browse files
committed
Remove "dead code" (because of timing). postProcessModels has already executed before postProcessOperationsWithModels.
And then we don't even need the extractModelNameFromBodyParam method...
1 parent 19888ec commit 98daf05

1 file changed

Lines changed: 0 additions & 21 deletions

File tree

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractDartCodegen.java

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -772,14 +772,6 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<Mo
772772
if (operations != null) {
773773
List<CodegenOperation> ops = operations.getOperation();
774774
for (CodegenOperation op : ops) {
775-
if (patchOnly && "PATCH".equalsIgnoreCase(op.httpMethod)) {
776-
if (op.bodyParam != null && op.bodyParam.dataType != null) {
777-
String modelName = extractModelNameFromBodyParam(op);
778-
patchRequestSchemas.add(modelName);
779-
LOGGER.debug("Marked schema '{}' for Optional wrapping (PATCH request body)", modelName);
780-
}
781-
}
782-
783775
if (useOptional) {
784776
unwrapOptionalFromParameters(op.pathParams);
785777
unwrapOptionalFromParameters(op.queryParams);
@@ -808,19 +800,6 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<Mo
808800
return objs;
809801
}
810802

811-
private static String extractModelNameFromBodyParam(CodegenOperation op) {
812-
String modelName = op.bodyParam.dataType;
813-
if (modelName.startsWith("List<") || modelName.startsWith("Map<")) {
814-
int start = modelName.indexOf('<') + 1;
815-
int end = modelName.lastIndexOf('>');
816-
if (start > 0 && end > start) {
817-
modelName = modelName.substring(start, end);
818-
}
819-
}
820-
modelName = modelName.replace("?", "");
821-
return modelName;
822-
}
823-
824803
private void unwrapOptionalFromParameters(List<CodegenParameter> params) {
825804
if (params == null) return;
826805
for (CodegenParameter param : params) {

0 commit comments

Comments
 (0)