Skip to content
Merged
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 @@ -356,6 +356,7 @@ protected void normalize() {
normalizeComponentsSecuritySchemes();
normalizeComponentsSchemas();
normalizeComponentsResponses();
normalizeComponentsHeaders();
}

/**
Expand Down Expand Up @@ -558,8 +559,21 @@ protected void normalizeHeaders(Map<String, Header> headers) {

for (String headerKey : headers.keySet()) {
Header h = headers.get(headerKey);
Schema updatedHeader = normalizeSchema(h.getSchema(), new HashSet<>());
h.setSchema(updatedHeader);
if (h.getSchema() != null) { // not a $ref header
// example of header class
// description: null
// required: null
// deprecated: null
// style: null
// explode: null
// schema: null
// examples: null
// example: null
// content: null
// $ref: #/components/headers/Location
Schema updatedHeader = normalizeSchema(h.getSchema(), new HashSet<>());
h.setSchema(updatedHeader);
}
}
}

Expand Down Expand Up @@ -638,6 +652,18 @@ protected void normalizeComponentsResponses() {
}
}

/**
* Normalizes schemas in component's headers.
*/
protected void normalizeComponentsHeaders() {
Map<String, Header> headers = openAPI.getComponents().getHeaders();
if (headers == null) {
return;
}

normalizeHeaders(headers);
}

/**
* Auto fix a self referencing schema using any type to replace the self-referencing sub-item.
*
Expand Down
Loading