Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ List<ParameterDefinition> getParameters() {
List<ParameterDefinition> paramDefinitions = new ArrayList<>();
if (operation.hasParameters()) {
for (UnifiedOpenAPI.Parameter parameter : operation.parameters()) {
if (parameter.in().equals("body")) {
if (parameter.in() != null && "body".equals(parameter.in())) {
continue; // body parameters are handled separately
}

Expand All @@ -70,13 +70,14 @@ List<ParameterDefinition> getParameters() {
}
}

if (openAPI.swaggerVersion().equals(UnifiedOpenAPI.SwaggerVersion.SWAGGER_V2)) {
if (openAPI.swaggerVersion() == UnifiedOpenAPI.SwaggerVersion.SWAGGER_V2
&& operation.parameters() != null) {
operation.parameters().stream()
.filter(p -> p.in().equals("body"))
.filter(p -> p.in() != null && "body".equals(p.in()))
.forEach(
p -> {
UnifiedOpenAPI.Schema schema = p.schema();
if (schema.hasRef()) {
if (schema != null && schema.hasRef()) {
String ref = schema.ref();
schema = openAPI.resolveSchema(ref);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,11 @@ public boolean hasRequestBody() {
}
}

public record Parameter(String name, String in, Boolean required, Schema schema) {}
public record Parameter(String name, String in, Boolean required, Schema schema) {
public Parameter {
required = required != null ? required : Boolean.FALSE;
}
Comment thread
mcruzdev marked this conversation as resolved.
}

public record RequestBody(Content content) {}

Expand Down
Loading