From commits-return-5203-archive-asf-public=cust-asf.ponee.io@juneau.apache.org Thu Mar 8 03:36:39 2018
Return-Path:
- In addition to the methods defined on the
{@link org.apache.juneau.rest.BasicRestInfoProvider} implements {@link org.apache.juneau.rest.RestInfoProvider}
- The default provider provides several options for defining Swagger documentation on your resource:
UriResolver
when request path info had special characters.
text/html+schema
instead of text/html
for schema documents).
diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/SystemPropertiesResource.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/SystemPropertiesResource.java
index 5c56c7d..fafba3d 100644
--- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/SystemPropertiesResource.java
+++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/SystemPropertiesResource.java
@@ -78,14 +78,14 @@ import org.apache.juneau.rest.widget.*;
// Support GZIP encoding on Accept-Encoding header.
encoders=GzipEncoder.class,
- swagger=@ResourceSwagger(
- contact="{name:'John Smith',email:'john@smith.com'}",
- license="{name:'Apache 2.0',url:'http://www.apache.org/licenses/LICENSE-2.0.html'}",
- version="2.0",
- termsOfService="You're on your own.",
- tags="[{name:'Java',description:'Java utility',externalDocs:{description:'Home page',url:'http://juneau.apache.org'}}]",
- externalDocs="{description:'Home page',url:'http://juneau.apache.org'}"
- )
+ swagger={
+ "contact:{name:'John Smith',email:'john@smith.com'},",
+ "license:{name:'Apache 2.0',url:'http://www.apache.org/licenses/LICENSE-2.0.html'},",
+ "version:'2.0',",
+ "termsOfService:'You are on your own.',",
+ "tags:[{name:'Java',description:'Java utility'}],",
+ "externalDocs:{description:'Home page',url:'http://juneau.apache.org'}"
+ }
)
public class SystemPropertiesResource extends BasicRestServlet {
private static final long serialVersionUID = 1L;
@@ -94,14 +94,14 @@ public class SystemPropertiesResource extends BasicRestServlet {
name=GET, path="/",
summary="Show all system properties",
description="Returns all system properties defined in the JVM.",
- swagger=@MethodSwagger(
- parameters={
- @Parameter(in="query", name="sort", description="Sort results alphabetically.", _default="false")
- },
- responses={
- @Response(value=200, description="Returns a map of key/value pairs.")
- }
- )
+ swagger={
+ "parameters:[",
+ "{name:'sort',in:'query',description:'Sort results alphabetically',default:'false'}",
+ "],",
+ "responses:{",
+ "200: {description:'Returns a map of key/value pairs.'}",
+ "}"
+ }
)
@SuppressWarnings({"rawtypes", "unchecked"})
public Map getSystemProperties(@Query("sort") boolean sort) throws Throwable {
@@ -114,14 +114,14 @@ public class SystemPropertiesResource extends BasicRestServlet {
name=GET, path="/{propertyName}",
summary="Get system property",
description="Returns the value of the specified system property.",
- swagger=@MethodSwagger(
- parameters={
- @Parameter(in="path", name="propertyName", description="The system property name.")
- },
- responses={
- @Response(value=200, description="The system property value, or null if not found.")
- }
- )
+ swagger={
+ "parameters:[",
+ "{name:'propertyName',in:'path',description:'The system property name.'}",
+ "],",
+ "responses:{",
+ "200: {description:'The system property value, or null if not found.'}",
+ "}"
+ }
)
public String getSystemProperty(@Path String propertyName) throws Throwable {
return System.getProperty(propertyName);
@@ -132,20 +132,16 @@ public class SystemPropertiesResource extends BasicRestServlet {
summary="Replace system property",
description="Sets a new value for the specified system property.",
guards=AdminGuard.class,
- swagger=@MethodSwagger(
- parameters={
- @Parameter(in="path", name="propertyName", description="The system property name."),
- @Parameter(in="body", description="The new system property value."),
- },
- responses={
- @Response(value=302,
- headers={
- @Parameter(name="Location", description="The root URL of this resource.")
- }
- ),
- @Response(value=403, description="User is not an admin.")
- }
- )
+ swagger={
+ "parameters:[",
+ "{name:'propertyName',in:'path',description:'The system property name.'},",
+ "{in:'body',description:'The new system property value.'}",
+ "],",
+ "responses:{",
+ "302: {headers:{Location:{description:'The root URL of this resource.'}}},",
+ "403: {description:'User is not an admin.'}",
+ "}"
+ }
)
public Redirect setSystemProperty(@Path String propertyName, @Body String value) {
System.setProperty(propertyName, value);
@@ -157,20 +153,16 @@ public class SystemPropertiesResource extends BasicRestServlet {
summary="Add an entire set of system properties",
description="Takes in a map of key/value pairs and creates a set of new system properties.",
guards=AdminGuard.class,
- swagger=@MethodSwagger(
- parameters={
- @Parameter(in="path", name="propertyName", description="The system property key."),
- @Parameter(in="body", description="The new system property values.", schema="{example:{key1:'val1',key2:123}}"),
- },
- responses={
- @Response(value=302,
- headers={
- @Parameter(name="Location", description="The root URL of this resource.")
- }
- ),
- @Response(value=403, description="Unauthorized: User is not an admin.")
- }
- )
+ swagger={
+ "parameters:[",
+ "{name:'propertyName',in:'path',description:'The system property name.'},",
+ "{in:'body',description:'The new system property values.',schema:{example:{key1:'val1',key2:123}}}",
+ "],",
+ "responses:{",
+ "302: {headers:{Location:{description:'The root URL of this resource.'}}},",
+ "403: {description:'User is not an admin.'}",
+ "}"
+ }
)
public Redirect setSystemProperties(@Body java.util.Properties newProperties) {
System.setProperties(newProperties);
@@ -182,19 +174,15 @@ public class SystemPropertiesResource extends BasicRestServlet {
summary="Delete system property",
description="Deletes the specified system property.",
guards=AdminGuard.class,
- swagger=@MethodSwagger(
- parameters={
- @Parameter(in="path", name="propertyName", description="The system property name."),
- },
- responses={
- @Response(value=302,
- headers={
- @Parameter(name="Location", description="The root URL of this resource.")
- }
- ),
- @Response(value=403, description="Unauthorized: User is not an admin")
- }
- )
+ swagger={
+ "parameters:[",
+ "{name:'propertyName',in:'path',description:'The system property name.'}",
+ "],",
+ "responses:{",
+ "302: {headers:{Location:{description:'The root URL of this resource.'}}},",
+ "403: {description:'User is not an admin.'}",
+ "}"
+ }
)
public Redirect deleteSystemProperty(@Path String propertyName) {
System.clearProperty(propertyName);
diff --git a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/addressbook/AddressBookResource.java b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/addressbook/AddressBookResource.java
index 20713ca..cffd736 100644
--- a/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/addressbook/AddressBookResource.java
+++ b/juneau-examples/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/addressbook/AddressBookResource.java
@@ -114,14 +114,14 @@ import org.apache.juneau.utils.*;
encoders=GzipEncoder.class,
// Swagger info.
- swagger=@ResourceSwagger(
- contact="{name:'John Smith',email:'john@smith.com'}",
- license="{name:'Apache 2.0',url:'http://www.apache.org/licenses/LICENSE-2.0.html'}",
- version="2.0",
- termsOfService="You're on your own.",
- tags="[{name:'Java',description:'Java utility',externalDocs:{description:'Home page',url:'http://juneau.apache.org'}}]",
- externalDocs="{description:'Home page',url:'http://juneau.apache.org'}"
- )
+ swagger= {
+ "contact:{name:'John Smith',email:'john@smith.com'},",
+ "license:{name:'Apache 2.0',url:'http://www.apache.org/licenses/LICENSE-2.0.html'},",
+ "version:'2.0',",
+ "termsOfService:'You're on your own.',",
+ "tags:[{name:'Java',description:'Java utility',externalDocs:{description:'Home page',url:'http://juneau.apache.org'}}],",
+ "externalDocs:{description:'Home page',url:'http://juneau.apache.org'}"
+ }
)
public class AddressBookResource extends BasicRestServletJena {
private static final long serialVersionUID = 1L;
diff --git a/juneau-microservice/juneau-microservice-server/src/main/java/org/apache/juneau/microservice/resources/ConfigResource.java b/juneau-microservice/juneau-microservice-server/src/main/java/org/apache/juneau/microservice/resources/ConfigResource.java
index d42919d..4d27d6d 100755
--- a/juneau-microservice/juneau-microservice-server/src/main/java/org/apache/juneau/microservice/resources/ConfigResource.java
+++ b/juneau-microservice/juneau-microservice-server/src/main/java/org/apache/juneau/microservice/resources/ConfigResource.java
@@ -86,11 +86,11 @@ public class ConfigResource extends BasicRestServlet {
*/
@RestMethod(name=GET, path="/{section}",
description="Show config file section.",
- swagger=@MethodSwagger(
- parameters={
- @Parameter(in="path", name="section", description="Section name.")
- }
- )
+ swagger={
+ "parameters:[",
+ "{name:'section',in:'path',description:'Section name.'}",
+ "]"
+ }
)
public ObjectMap getConfigSection(@Path("section") String section) throws Exception {
return getSection(section);
@@ -106,12 +106,12 @@ public class ConfigResource extends BasicRestServlet {
*/
@RestMethod(name=GET, path="/{section}/{key}",
description="Show config file entry.",
- swagger=@MethodSwagger(
- parameters={
- @Parameter(in="path", name="section", description="Section name."),
- @Parameter(in="path", name="key", description="Entry name.")
- }
- )
+ swagger={
+ "parameters:[",
+ "{name:'section',in:'path',description:'Section name.'},",
+ "{name:'key',in:'path',description:'Entry name.'}",
+ "]"
+ }
)
public String getConfigEntry(@Path("section") String section, @Path("key") String key) throws Exception {
return getSection(section).getString(key);
@@ -126,11 +126,11 @@ public class ConfigResource extends BasicRestServlet {
*/
@RestMethod(name=POST, path="/",
description="Sets contents of config file from a FORM post.",
- swagger=@MethodSwagger(
- parameters={
- @Parameter(in="formData", name="contents", description="New contents in INI file format.")
- }
- )
+ swagger={
+ "parameters:[",
+ "{name:'contents',in:'formData',description:'New contents in INI file format.'}",
+ "]"
+ }
)
public ObjectMap setConfigContentsFormPost(@FormData("contents") String contents) throws Exception {
return setConfigContents(new StringReader(contents));
@@ -145,11 +145,11 @@ public class ConfigResource extends BasicRestServlet {
*/
@RestMethod(name=PUT, path="/",
description="Sets contents of config file.",
- swagger=@MethodSwagger(
- parameters={
- @Parameter(in="body", description="New contents in INI file format.")
- }
- )
+ swagger={
+ "parameters:[",
+ "{in:'body',description:'New contents in INI file format.'}",
+ "]"
+ }
)
public ObjectMap setConfigContents(@Body Reader contents) throws Exception {
return getServletConfig().getConfig().load(contents, true).asMap();
@@ -165,12 +165,12 @@ public class ConfigResource extends BasicRestServlet {
*/
@RestMethod(name=PUT, path="/{section}",
description="Add or overwrite a config file section.",
- swagger=@MethodSwagger(
- parameters={
- @Parameter(in="path", name="section", description="Section name."),
- @Parameter(in="body", description="New contents for section as a simple map with string keys and values.")
- }
- )
+ swagger={
+ "parameters:[",
+ "{name:'section',in:'path',description:'Section name.'}",
+ "{in:'body',description:'New contents for section as a simple map with string keys and values.'}",
+ "]"
+ }
)
public ObjectMap setConfigSection(@Path("section") String section, @Body Map
- * Looks for a file called
- * Returned objects are cached per-locale for later quick-lookup.
- *
- * @param req The incoming HTTP request.
- * @return The parsed swagger object, or
@@ -155,68 +100,208 @@ public class BasicRestInfoProvider implements RestInfoProvider {
@Override /* RestInfoProvider */
public Swagger getSwagger(RestRequest req) throws Exception {
- // If a file is defined, use that.
- Swagger s = getSwaggerFromFile(req);
+ Locale locale = req.getLocale();
+
+ Swagger s = swaggers.get(locale);
if (s != null)
return s;
- s = swagger(
- info(getTitle(req), getVersion(req))
- .contact(getContact(req))
- .license(getLicense(req))
- .description(getDescription(req))
- .termsOfService(getTermsOfService(req))
- )
- .consumes(getConsumes(req))
- .produces(getProduces(req))
- .tags(getTags(req))
- .externalDocs(getExternalDocs(req));
+ VarResolverSession vr = req.getVarResolverSession();
+ JsonParser jp = JsonParser.DEFAULT;
+ MessageBundle mb = context.getMessages();
+
+ ObjectMap om = context.getClasspathResource(ObjectMap.class, MediaType.JSON, getClass().getSimpleName() + ".json", locale);
+ if (om == null)
+ om = new ObjectMap();
+
+ LinkedHashMap
- * Subclasses can override this method to provide their own operation ID.
- *
- *
- * The default implementation simply returns the Java method name.
- *
- * @param method The Java method annotated with {@link RestMethod @RestMethod}.
- * @param req The current request.
- * @return The localized operation ID of the method, or
- * Subclasses can override this method to provide their own tags.
- *
- *
- * The default implementation returns the value from the following locations (whichever matches first):
- *
- *
- *
- * Subclasses can override this method to provide their own external documentation.
+ * Subclasses can override this method to provide their own site name.
*
*
* The default implementation returns the value from the following locations (whichever matches first):
*
- *
*
- * Subclasses can override this method to provide their own parameter info.
+ * Subclasses can override this method to provide their own title.
*
*
* The default implementation returns the value from the following locations (whichever matches first):
*
- *
*
- * Subclasses can override this method to provide their own parameter info.
+ * Subclasses can override this method to provide their own description.
*
*
* The default implementation returns the value from the following locations (whichever matches first):
*
- *
*
- * Subclasses can override this method to provide their own produces info.
- *
- *
- * The default implementation returns the value from the following locations (whichever matches first):
- *
- *
- * The default implementation returns the value from the following locations (whichever matches first):
- *
- *
- * The default implementation returns the value from the following location:
- *
- *
- * Subclasses can override this method to provide their own site name.
- *
- *
- * The default implementation returns the value from the following locations (whichever matches first):
- *
- *
- *
- * Subclasses can override this method to provide their own title.
- *
- *
- * The default implementation returns the value from the following locations (whichever matches first):
- *
- *
- *
- * Subclasses can override this method to provide their own description.
- *
- *
- * The default implementation returns the value from the following locations (whichever matches first):
- *
- *
- *
- * Subclasses can override this method to provide their own contact information.
- *
- *
- * The default implementation returns the value from the following locations (whichever matches first):
- *
- *
- *
- * Subclasses can override this method to provide their own license information.
- *
- *
- * The default implementation returns the value from the following locations (whichever matches first):
- *
- *
- *
- * Subclasses can override this method to provide their own terms-of-service information.
- *
- *
- * The default implementation returns the value from the following locations (whichever matches first):
- *
- *
- *
- * Subclasses can override this method to provide their own version information.
- *
- *
- * The default implementation returns the value from the following locations (whichever matches first):
- *
- *
- *
- * The default implementation returns the value from the following locations (whichever matches first):
- *
- *
- *
- * Subclasses can override this method to provide their own version information.
- *
- *
- * The default implementation returns the value from the following locations (whichever matches first):
- *
- *
- *
- * Subclasses can override this method to provide their own version information.
- *
- *
- * The default implementation returns the value from the following locations (whichever matches first):
- *
- *
- *
- * Used to populate the Swagger deprecated field.
- *
- *
- *
- * Used to populate the Swagger external documentation field.
- *
- *
- * A simplified JSON string with the following fields:
- *
- * {
- * description: string,
- * url: string
- * }
- *
- *
- * This annotation is provided for documentation purposes and is used to populate the method
- *
- * This annotation is provided for documentation purposes and is used to populate the method
- *
- * Used to populate the Swagger tags field.
- *
- *
- * A comma-delimited list of tags for API documentation control.
- *
- *
- *
- * For example a "count" to control the number of results per page might default to 100 if not supplied by the
- * client in the request.
- * (Note: "default" has no meaning for required parameters.)
- * See
- * http://json-schema.org/latest/json-schema-validation.html#anchor101.
- * Unlike JSON Schema this value MUST conform to the defined
- * This is valid only for either
- * Possible values are:
- *
- * A brief description of the parameter.
- * This could contain examples of use.
- * GFM syntax can be used
- * for rich text representation.
- *
- *
- * The default value pulls the description from the
- * See Data Type Formats for further
- * details.
- */
- String format() default "";
-
- /**
- * The location of the parameter.
- *
- *
- * Possible values are:
- *
- * Describes the type of items in the array.
- *
- *
- *
- * See Items Object for further details.
- */
- String items() default "";
-
- /**
- * The name of the parameter (e.g.
- * Parameter names are case sensitive.
- * If
- * If the parameter is
- * Only applicable for
- * The schema is a JSON object specified here.
- *
- *
- *
- * The value MUST be one of
- * It is used to populate the Swagger contact field and to display on HTML pages.
- *
- *
- * A simplified JSON string with the following fields:
- *
- * {
- * name: string,
- * url: string,
- * email: string
- * }
- *
- * The default value pulls the description from the
- *
- * Value can contain any of the following variables:
- * {@link ConfigVar $C}
- * {@link CoalesceVar $CO}
- * {@link EnvVariablesVar $E}
- * {@link FileVar $F}
- * {@link ServletInitParamVar $I},
- * {@link IfVar $IF}
- * {@link LocalizationVar $L}
- * {@link RequestAttributeVar $RA}
- * {@link RequestFormDataVar $RF}
- * {@link RequestHeaderVar $RH}
- * {@link RequestPathVar $RP}
- * {@link RequestQueryVar $RQ}
- * {@link RequestVar $R}
- * {@link SystemPropertiesVar $S}
- * {@link SerializedRequestAttrVar $SA}
- * {@link SwitchVar $SW}
- * {@link UrlVar $U}
- * {@link UrlEncodeVar $UE}
- * {@link WidgetVar $W}
- *
- *
- * Corresponds to the swagger field
- * It is used to populate the Swagger external documentation field and to display on HTML pages.
- *
- *
- * A simplified JSON string with the following fields:
- *
- * {
- * description: string,
- * url: string
- * }
- *
- * The default value pulls the description from the
- *
- * Value can contain any of the following variables:
- * {@link ConfigVar $C}
- * {@link CoalesceVar $CO}
- * {@link EnvVariablesVar $E}
- * {@link FileVar $F}
- * {@link ServletInitParamVar $I},
- * {@link IfVar $IF}
- * {@link LocalizationVar $L}
- * {@link RequestAttributeVar $RA}
- * {@link RequestFormDataVar $RF}
- * {@link RequestHeaderVar $RH}
- * {@link RequestPathVar $RP}
- * {@link RequestQueryVar $RQ}
- * {@link RequestVar $R}
- * {@link SystemPropertiesVar $S}
- * {@link SerializedRequestAttrVar $SA}
- * {@link SwitchVar $SW}
- * {@link UrlVar $U}
- * {@link UrlEncodeVar $UE}
- * {@link WidgetVar $W}
- *
- *
- * Corresponds to the swagger field
- * It is used to populate the Swagger license field and to display on HTML pages.
- *
- *
- * A simplified JSON string with the following fields:
- *
- * {
- * name: string,
- * url: string
- * }
- *
- * The default value pulls the description from the
- *
- * Value can contain any of the following variables:
- * {@link ConfigVar $C}
- * {@link CoalesceVar $CO}
- * {@link EnvVariablesVar $E}
- * {@link FileVar $F}
- * {@link ServletInitParamVar $I},
- * {@link IfVar $IF}
- * {@link LocalizationVar $L}
- * {@link RequestAttributeVar $RA}
- * {@link RequestFormDataVar $RF}
- * {@link RequestHeaderVar $RH}
- * {@link RequestPathVar $RP}
- * {@link RequestQueryVar $RQ}
- * {@link RequestVar $R}
- * {@link SystemPropertiesVar $S}
- * {@link SerializedRequestAttrVar $SA}
- * {@link SwitchVar $SW}
- * {@link UrlVar $U}
- * {@link UrlEncodeVar $UE}
- * {@link WidgetVar $W}
- *
- *
- * Corresponds to the swagger field
- * It is used to populate the Swagger tags field and to display on HTML pages.
- *
- *
- * A simplified JSON string with the following fields:
- *
- * [
- * {
- * name: string,
- * description: string,
- * externalDocs: {
- * description: string,
- * url: string
- * }
- * }
- * ]
- *
- * The default value pulls the description from the
- *
- * Value can contain any of the following variables:
- * {@link ConfigVar $C}
- * {@link CoalesceVar $CO}
- * {@link EnvVariablesVar $E}
- * {@link FileVar $F}
- * {@link ServletInitParamVar $I},
- * {@link IfVar $IF}
- * {@link LocalizationVar $L}
- * {@link RequestAttributeVar $RA}
- * {@link RequestFormDataVar $RF}
- * {@link RequestHeaderVar $RH}
- * {@link RequestPathVar $RP}
- * {@link RequestQueryVar $RQ}
- * {@link RequestVar $R}
- * {@link SystemPropertiesVar $S}
- * {@link SerializedRequestAttrVar $SA}
- * {@link SwitchVar $SW}
- * {@link UrlVar $U}
- * {@link UrlEncodeVar $UE}
- * {@link WidgetVar $W}
- *
- *
- * Corresponds to the swagger field
- * It is used to populate the Swagger terms-of-service field.
- *
- *
- * The default value pulls the description from the
- * Value can contain any of the following variables:
- * {@link ConfigVar $C}
- * {@link CoalesceVar $CO}
- * {@link EnvVariablesVar $E}
- * {@link FileVar $F}
- * {@link ServletInitParamVar $I},
- * {@link IfVar $IF}
- * {@link LocalizationVar $L}
- * {@link RequestAttributeVar $RA}
- * {@link RequestFormDataVar $RF}
- * {@link RequestHeaderVar $RH}
- * {@link RequestPathVar $RP}
- * {@link RequestQueryVar $RQ}
- * {@link RequestVar $R}
- * {@link SystemPropertiesVar $S}
- * {@link SerializedRequestAttrVar $SA}
- * {@link SwitchVar $SW}
- * {@link UrlVar $U}
- * {@link UrlEncodeVar $UE}
- * {@link WidgetVar $W}
- *
- *
- * Corresponds to the swagger field
- * It is used to populate the Swagger version field and to display on HTML pages.
- *
- *
- * The default value pulls the description from the
- * Value can contain any of the following variables:
- * {@link ConfigVar $C}
- * {@link CoalesceVar $CO}
- * {@link EnvVariablesVar $E}
- * {@link FileVar $F}
- * {@link ServletInitParamVar $I},
- * {@link IfVar $IF}
- * {@link LocalizationVar $L}
- * {@link RequestAttributeVar $RA}
- * {@link RequestFormDataVar $RF}
- * {@link RequestHeaderVar $RH}
- * {@link RequestPathVar $RP}
- * {@link RequestQueryVar $RQ}
- * {@link RequestVar $R}
- * {@link SystemPropertiesVar $S}
- * {@link SerializedRequestAttrVar $SA}
- * {@link SwitchVar $SW}
- * {@link UrlVar $U}
- * {@link UrlEncodeVar $UE}
- * {@link WidgetVar $W}
- *
- *
- * Corresponds to the swagger field
- *
- * The default value pulls the description from the
- * This field can contain variables (e.g. "$L{my.localized.variable}").
- *
- * Corresponds to the swagger field
- * Response variables can also be defined in the servlet resource bundle.
- * (e.g.
- * It can be a primitive, an array or an object.
- * If this field does not exist, it means no content is returned as part of the response.
- * As an extension to the Schema Object,
- * its root type value may also be
- *
+ * Used to populate the auto-generated OPTIONS swagger documentation.
+ *
+ *
+ * The format of this annotation is JSON when all individual parts are concatenated.
+ *
+ *
* Used to populate the auto-generated OPTIONS swagger documentation.
*
+ *
+ * The format of this annotation is JSON when all individual parts are concatenated.
+ *
*
- *
- *
- * @param method The Java method annotated with {@link RestMethod @RestMethod}.
- * @param req The current request.
- * @return The localized tags of the method, or Examples:
- *
- *
- *
Value can be a comma-delimited list or JSON array.
- *
Value can contain any SVL variables defined on the {@link MethodSwagger#tags() @MethodSwagger.tags()} annotation.
- * Examples:
- *
- *
*
- * @param method The Java method annotated with {@link RestMethod @RestMethod}.
* @param req The current request.
- * @return The localized external documentation of the method, or Examples:
*
- *
- *
Value is a JSON representation of a {@link ExternalDocumentation} object.
- *
Value can contain any SVL variables defined on the {@link MethodSwagger#externalDocs() @MethodSwagger.externalDocs()} annotation.
+ *
Value can contain any SVL variables defined on the {@link RestResource#siteName() @RestResource.siteName()} annotation.
* Examples:
*
- *
*
- * @param method The Java method annotated with {@link RestMethod @RestMethod}.
* @param req The current request.
- * @return The localized parameter info of the method, or Examples:
*
- *
- *
Value is a JSON representation of a {@link ParameterInfo}[]
object.
- *
Value can contain any SVL variables defined on the {@link MethodSwagger#parameters() @MethodSwagger.parameters()} annotation.
+ *
Value can contain any SVL variables defined on the {@link RestResource#title() @RestResource.title()} annotation.
* Examples:
*
- *
*
- * @param method The Java method annotated with {@link RestMethod @RestMethod}.
* @param req The current request.
- * @return The localized response info of the method, or Examples:
*
- *
- *
Value is a JSON representation of a Map<Integer,{@link ResponseInfo}>
object.
- *
Value can contain any SVL variables defined on the {@link MethodSwagger#responses() @MethodSwagger.responses()} annotation.
+ *
Value can contain any SVL variables defined on the {@link RestResource#description() @RestResource.description()} annotation.
* Examples:
* Accept
types the specified Java method.
- *
- *
- *
- *
- * @param method The Java method annotated with {@link RestMethod @RestMethod}.
- * @param req The current request.
- * @return The supported Examples:
- * Accept
types of the method, or Content-Type
types the specified Java method.
- *
- *
- *
- *
- * @param method The Java method annotated with {@link RestMethod @RestMethod}.
- * @param req The current request.
- * @return The supported Examples:
- * Content-Type
types of the method, or
- *
- *
- * @param method The Java method annotated with {@link RestMethod @RestMethod}.
- * @param req The current request.
- * @return Examples:
- *
- *
- *
- * @param req The current request.
- * @return The localized site name of this REST resource, or Examples:
- *
- *
- *
Value can contain any SVL variables defined on the {@link RestResource#siteName() @RestResource.siteName()} annotation.
- * Examples:
- *
- *
- *
- * @param req The current request.
- * @return The localized title of this REST resource, or Examples:
- *
- *
- *
Value can contain any SVL variables defined on the {@link RestResource#title() @RestResource.title()} annotation.
- * Examples:
- *
- *
- *
- * @param req The current request.
- * @return The localized description of this REST resource, or Examples:
- *
- *
- *
Value can contain any SVL variables defined on the {@link RestResource#description() @RestResource.description()} annotation.
- * Examples:
- *
- *
- *
- * @param req The current request.
- * @return
- * The localized contact information of this REST resource, or Examples:
- *
- *
- *
Value can contain any SVL variables defined on the {@link ResourceSwagger#contact() @ResourceSwagger.contact()} annotation.
- * Examples:
- *
- *
- *
- * @param req The current request.
- * @return
- * The localized license information of this REST resource, or Examples:
- *
- *
- *
Value can contain any SVL variables defined on the {@link ResourceSwagger#license() @ResourceSwagger.license()} annotation.
- * Examples:
- *
- *
- *
- * @param req The current request.
- * @return
- * The localized terms-of-service of this REST resource, or Examples:
- *
- *
- *
Value can contain any SVL variables defined on the {@link ResourceSwagger#termsOfService() @ResourceSwagger.termsOfService()} annotation.
- * Examples:
- *
- *
- *
- * @param req The current request.
- * @return
- * The localized version of this REST resource, or Examples:
- *
- *
- *
Value can contain any SVL variables defined on the {@link ResourceSwagger#version() @ResourceSwagger.version()} annotation.
- * Examples:
- * Content-Type
request headers for the REST resource.
- *
- *
- *
- * @param req The current request.
- * @return
- * The supported Examples:
- *
- *
- *
Value can contain any SVL variables defined on the {@link ResourceSwagger#version() @ResourceSwagger.version()} annotation.
- * Examples:
- * Content-Type
request headers of the REST resource, or Accept
request headers for the REST resource.
- *
- * @param req The current request.
- * @return
- * The supported Accept
request headers of the REST resource, or
- *
- *
- * @param req The current request.
- * @return
- * The localized tags of this REST resource, or Examples:
- *
- *
- *
Value is either a comma-delimited list or a JSON array.
- *
Value can contain any SVL variables defined on the {@link ResourceSwagger#tags() @ResourceSwagger.tags()} annotation.
- * Examples:
- *
- *
- *
- * @param req The current request.
- * @return
- * The localized external documentation of this REST resource, or Examples:
- *
- *
- *
Value is a JSON objec representation of a {@link ExternalDocumentation} object.
- *
Value can contain any SVL variables defined on the {@link ResourceSwagger#externalDocs() @ResourceSwagger.externalDocs()} annotation.
- * Examples:
- *
See {@link RestContext#getVarResolver()} for the list of supported variables.
* @param mediaType The value to set as the
See {@link RestContext#getVarResolver()} for the list of supported variables.
* @return A new reader resource, or See Also:
- *
- */
-public @interface MethodSwagger {
-
- /**
- * Optional deprecated flag for the exposed API.
- *
- * Example:
- * Notes:
- *
- *
- *
- * /paths/{path}/{method}/deprecated
.
- * See Also:
- *
- *
- */
- boolean deprecated() default false;
-
- /**
- * Optional external documentation information for the exposed API.
- *
- * Example:
- * Notes:
- *
- *
- *
- * /paths/{path}/{method}/externalDocs
.
- * See Also:
- *
- *
- */
- String externalDocs() default "";
-
- /**
- * Optional parameter descriptions.
- *
- * Example:
- * Notes:
- *
- *
- *
- * /paths/{path}/{method}/parameters
.
- * See Also:
- *
- *
- */
- Parameter[] parameters() default {};
-
- /**
- * Optional output description.
- *
- * Example:
- * Notes:
- *
- *
- *
- * /paths/{path}/{method}/responses
.
- * See Also:
- *
- *
- */
- Response[] responses() default {};
-
- /**
- * Optional tagging information for the exposed API.
- *
- *
Tags can be used for logical grouping of operations by resources or any other qualifier.
- *
- * Example:
- * Notes:
- *
- *
- *
- * /paths/{path}/{method}/tags
.
- * See Also:
- *
- *
- */
- String tags() default "";
-}
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Parameter.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Parameter.java
deleted file mode 100644
index 0ba0e07..0000000
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Parameter.java
+++ /dev/null
@@ -1,213 +0,0 @@
-// ***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
-// * to you 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 *
-// * *
-// * http://www.apache.org/licenses/LICENSE-2.0 *
-// * *
-// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
-// * specific language governing permissions and limitations under the License. *
-// ***************************************************************************************************************************
-package org.apache.juneau.rest.annotation;
-
-import static java.lang.annotation.ElementType.*;
-import static java.lang.annotation.RetentionPolicy.*;
-
-import java.lang.annotation.*;
-
-/**
- * Annotation used in conjunction with {@link MethodSwagger#parameters() @MethodSwagger.parameters()} to identify
- * content and header descriptions on specific method requests.
- *
- * Example:
- * See Also:
- *
- */
-@Documented
-@Target(PARAMETER)
-@Retention(RUNTIME)
-@Inherited
-public @interface Parameter {
-
- /**
- * Declares the value of the parameter that the server will use if none is provided.
- *
- * type
for this parameter.
- */
- String _default() default "";
-
- /**
- * Sets the ability to pass empty-valued parameters.
- *
- * query
or formData
parameters and allows you to send a
- * parameter with a name only or an empty value.
- * Default value is
- *
- * Default value is in
description
entry in the servlet resource bundle.
- * (e.g. type
.
- *
- *
- *
- */
- String in() default "";
-
- /**
- * Required if type
is Example:
- * in
is path
field in the Paths Object.
- * See Path Templating for further
- * information.
- * For all other cases, the name corresponds to the parameter name used based on the in
property.
- */
- String name() default "";
-
- /**
- * Determines whether this parameter is mandatory.
- *
- * in
in
of type Example:
- * See Also:
- *
- */
-public @interface ResourceSwagger {
-
- /**
- * Optional contact information for the exposed API.
- *
- * contact
entry in the servlet resource bundle.
- * (e.g. Example:
- * /info/contact
.
- */
- String contact() default "";
-
- /**
- * Optional external documentation information for the exposed API.
- *
- * externalDocs
entry in the servlet resource bundle.
- * (e.g. Example:
- * /tags
.
- */
- String externalDocs() default "";
-
- /**
- * Optional license information for the exposed API.
- *
- * license
entry in the servlet resource bundle.
- * (e.g. Example:
- * /info/license
.
- */
- String license() default "";
-
- /**
- * Optional tagging information for the exposed API.
- *
- * tags
entry in the servlet resource bundle.
- * (e.g. Example:
- * /tags
.
- */
- String tags() default "";
-
- /**
- * Optional servlet terms-of-service for this API.
- *
- * termsOfService
entry in the servlet resource bundle.
- * (e.g. /info/termsOfService
.
- */
- String termsOfService() default "";
-
- /**
- * Provides the version of the application API (not to be confused with the specification version).
- *
- * version
entry in the servlet resource bundle.
- * (e.g. /info/version
.
- */
- String version() default "";
-}
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Response.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Response.java
deleted file mode 100644
index 6aab540..0000000
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Response.java
+++ /dev/null
@@ -1,107 +0,0 @@
-// ***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
-// * to you 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 *
-// * *
-// * http://www.apache.org/licenses/LICENSE-2.0 *
-// * *
-// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
-// * specific language governing permissions and limitations under the License. *
-// ***************************************************************************************************************************
-package org.apache.juneau.rest.annotation;
-
-import static java.lang.annotation.ElementType.*;
-import static java.lang.annotation.RetentionPolicy.*;
-
-import java.lang.annotation.*;
-
-import org.apache.juneau.rest.*;
-
-/**
- * Annotation used in conjunction with {@link MethodSwagger#responses() @MethodSwagger.responses()} to identify possible responses by the method.
- *
- * Example:
- * See Also:
- *
- */
-@Documented
-@Target(PARAMETER)
-@Retention(RUNTIME)
-@Inherited
-public @interface Response {
-
- /**
- * Optional description.
- *
- * description
entry in the servlet resource bundle.
- * (e.g.
See {@link RestContext#getVarResolver()} for the list of supported variables.
- *
- * /paths/{path}/{method}/responses/{code}/description
.
- */
- String description() default "";
-
- /**
- * Optional response headers.
- *
- * Example:
- *
The starting and ending Example:
+ * See Also:
+ *
+ *
*/
- MethodSwagger swagger() default @MethodSwagger;
+ String[] swagger() default {};
}
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestResource.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestResource.java
index 37973e6..f85a549 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestResource.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestResource.java
@@ -839,20 +839,24 @@ public @interface RestResource {
*
The starting and ending Example:
*