Skip to content

Commit

Permalink
[python-flask] deference parameter schemas before further processing (O…
Browse files Browse the repository at this point in the history
…penAPITools#18605)

* update samples

* deref parameter, add null check

* Revert "update samples"

This reverts commit 2377d98.
  • Loading branch information
wing328 authored and Renato Mameli committed May 17, 2024
1 parent 67f9f05 commit 8ed2270
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,14 @@ public void preprocessOpenAPI(OpenAPI openAPI) {
}
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 '{}'",
Expand Down

0 comments on commit 8ed2270

Please sign in to comment.