Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): add info.summary to additionalProperties for 3.1 specs #19723

Merged
merged 1 commit into from
Oct 2, 2024
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 @@ -22,6 +22,7 @@
import io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.PathItem;
import io.swagger.v3.oas.models.Paths;
import io.swagger.v3.oas.models.SpecVersion;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
Expand Down Expand Up @@ -343,6 +344,12 @@ private void configureOpenAPIInfo() {
config.additionalProperties().put("unescapedAppDescription", info.getDescription());
}

if (this.openAPI.getSpecVersion().equals(SpecVersion.V31) && !StringUtils.isEmpty(info.getSummary())) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The swagger lib yields null for info.getSummary() in non-3.1 specs, so this guard could potentially be removed, however as we don't provide a fallback like we do for the description property, I find the spec version guard more obvious for any future readers of this code.

config.additionalProperties().put("appSummary", config.escapeText(info.getSummary()));
config.additionalProperties().put("appSummaryWithNewLines", config.escapeTextWhileAllowingNewLines(info.getSummary()));
config.additionalProperties().put("unescapedAppSummary", info.getSummary());
}

if (info.getContact() != null) {
Contact contact = info.getContact();
if (contact.getEmail() != null) {
Expand Down
Loading