Skip to content

Commit 1979461

Browse files
committed
Ensure backward compatibility. Do not remove parameters if not configured
1 parent d8a8fe8 commit 1979461

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -597,8 +597,11 @@ protected void normalizePaths() {
597597

598598
// normalize PathItem common parameters
599599
normalizeParameters(pathsEntry.getKey(), path, null, path.getParameters());
600-
if (path.getParameters() != null && path.getParameters().isEmpty()) {
601-
path.setParameters(null);
600+
if (removeFilter.hasFilter()) {
601+
// for backward compatibility, keep empty parameters if not removeFilter
602+
if (path.getParameters() != null && path.getParameters().isEmpty()) {
603+
path.setParameters(null);
604+
}
602605
}
603606

604607
if (removeFilter.hasFilter()) {
@@ -613,8 +616,11 @@ protected void normalizePaths() {
613616
normalizeOperation(operation);
614617
normalizeRequestBody(operation);
615618
normalizeParameters(pathsEntry.getKey(), path, operation, operation.getParameters());
616-
if (operation.getParameters() != null && operation.getParameters().isEmpty()) {
617-
operation.setParameters(null);
619+
if (removeFilter.hasFilter()) {
620+
// just for backward compatibility
621+
if (operation.getParameters() != null && operation.getParameters().isEmpty()) {
622+
operation.setParameters(null);
623+
}
618624
}
619625
normalizeResponses(operation);
620626
}

0 commit comments

Comments
 (0)