[python-flask] deference parameter schemas before further processing (#18605)

* update samples

* deref parameter, add null check

* Revert "update samples"

This reverts commit 2377d98de3b38a105fc970e8a97282fafb8a48ad.
This commit is contained in:
William Cheng
2024-05-08 17:00:19 +08:00
committed by GitHub
parent 9db0e3237c
commit 8226ff8f96

View File

@@ -408,8 +408,14 @@ public abstract class AbstractPythonConnexionServerCodegen extends AbstractPytho
}
if (operation.getParameters() != null) {
for (Parameter parameter : operation.getParameters()) {
if (StringUtils.isNotEmpty(parameter.get$ref())) {
parameter = ModelUtils.getReferencedParameter(openAPI, parameter);
}
String swaggerParameterName = parameter.getName();
String pythonParameterName = this.toParamName(swaggerParameterName);
if (swaggerParameterName == null) {
throw new RuntimeException("Please report the issue as the parameter name cannot be null: " + parameter);
}
if (!swaggerParameterName.equals(pythonParameterName)) {
LOGGER.warn(
"Parameter name '{}' is not consistent with Python variable names. It will be replaced by '{}'",