Skip to content

Commit 8226ff8

Browse files
authored
[python-flask] deference parameter schemas before further processing (#18605)
* update samples * deref parameter, add null check * Revert "update samples" This reverts commit 2377d98.
1 parent 9db0e32 commit 8226ff8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

+6
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,14 @@ public void preprocessOpenAPI(OpenAPI openAPI) {
408408
}
409409
if (operation.getParameters() != null) {
410410
for (Parameter parameter : operation.getParameters()) {
411+
if (StringUtils.isNotEmpty(parameter.get$ref())) {
412+
parameter = ModelUtils.getReferencedParameter(openAPI, parameter);
413+
}
411414
String swaggerParameterName = parameter.getName();
412415
String pythonParameterName = this.toParamName(swaggerParameterName);
416+
if (swaggerParameterName == null) {
417+
throw new RuntimeException("Please report the issue as the parameter name cannot be null: " + parameter);
418+
}
413419
if (!swaggerParameterName.equals(pythonParameterName)) {
414420
LOGGER.warn(
415421
"Parameter name '{}' is not consistent with Python variable names. It will be replaced by '{}'",

0 commit comments

Comments
 (0)