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

Add summary attribute in info annotation #603

Merged
merged 2 commits into from
May 9, 2024
Merged
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 @@ -75,6 +75,13 @@
**/
String version();

/**
* The summary of the API.
*
* @return the summary for the API
**/
String summary() default "";

/**
* List of extensions to be added to the {@link org.eclipse.microprofile.openapi.models.info.Info Info} model
* corresponding to the containing annotation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@
* </pre>
*/

@org.osgi.annotation.versioning.Version("1.1")
@org.osgi.annotation.versioning.Version("1.2")
@org.osgi.annotation.versioning.ProviderType
package org.eclipse.microprofile.openapi.annotations.info;
Original file line number Diff line number Diff line change
Expand Up @@ -200,4 +200,31 @@ default Info version(String version) {
return this;
}

/**
* Returns the summary of the exposed API from this Info instance.
*
* @return the summary of the exposed API
**/
String getSummary();

/**
* Sets this Info instance's summary information for the exposed API.
*
* @param summary
* the summary of the exposed API
*/
void setSummary(String summary);

/**
* Sets this Info instance's summary of the API to the given summary and returns this instance of Info.
*
* @param summary
* the summary for the exposed API
* @return this Info instance
*/
default Info summary(String summary) {
setSummary(summary);
return this;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@
* </pre>
*/

@org.osgi.annotation.versioning.Version("1.0")
@org.osgi.annotation.versioning.Version("1.1")
@org.osgi.annotation.versioning.ProviderType
package org.eclipse.microprofile.openapi.models.info;
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
info = @Info(title = "AirlinesRatingApp API", version = "1.0",
description = "APIs for booking and managing air flights",
termsOfService = "http://airlinesratingapp.com/terms",
summary = "An API for an Airline application",
contact = @Contact(name = "AirlinesRatingApp API Support",
url = "http://exampleurl.com/contact",
email = "techsupport@airlinesratingapp.com",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2017 Contributors to the Eclipse Foundation
* Copyright (c) 2017, 2024 Contributors to the Eclipse Foundation
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a
* copy of the License at
Expand Down Expand Up @@ -38,7 +38,8 @@
url = "http://www.apache.org/licenses/LICENSE-2.0.html"),
contact = @Contact(name = "PetStore API Support",
url = "https://github.com/eclipse/microprofile-open-api",
email = "support@petstore.com")),
email = "support@petstore.com"),
summary = "An API for a pet store"),
externalDocs = @ExternalDocumentation(url = "http://swagger.io",
description = "Find out more about our store"),
tags = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public void testInfo(String type) {
ValidatableResponse vr = callEndpoint(type);
vr.body("info.title", equalTo("AirlinesRatingApp API"));
vr.body("info.version", equalTo("1.0"));
vr.body("info.summary", equalTo("An API for an Airline application"));
vr.body("info.termsOfService", equalTo("http://airlinesratingapp.com/terms"));
vr.body("info.x-info", equalTo("test-info"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public void testInfo(String type) {
ValidatableResponse vr = callEndpoint(type);
vr.body("info.title", equalTo("AirlinesRatingApp API"));
vr.body("info.version", equalTo("1.0"));
vr.body("info.summary", equalTo("An API for an Airline application"));
vr.body("info.termsOfService", equalTo("http://airlinesratingapp.com/terms"));
}

Expand Down
Loading