[BROOKLYN-185] Upgrade swagger to 1.5.3 Move from swagger-1.0.1 to 1.5.3 Update annotations on REST API classes
brooklyn-utils-rest-swagger will be updated in another commit Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/ab086feb Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/ab086feb Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/ab086feb Branch: refs/heads/master Commit: ab086febd400426b6c56d1bc4c0b64147e085588 Parents: f9ca422 Author: Ciprian Ciubotariu <cheepe...@gmx.net> Authored: Mon Oct 19 18:19:41 2015 +0300 Committer: Ciprian Ciubotariu <cheepe...@gmx.net> Committed: Wed Nov 11 17:42:42 2015 +0200 ---------------------------------------------------------------------- camp/camp-server/pom.xml | 9 +- .../server/dto/ApplicationComponentDto.java | 4 - .../dto/ApplicationComponentTemplateDto.java | 4 - .../brooklyn/camp/server/dto/AssemblyDto.java | 4 - .../camp/server/dto/AssemblyTemplateDto.java | 4 - .../camp/server/dto/PlatformComponentDto.java | 4 - .../dto/PlatformComponentTemplateDto.java | 4 - .../brooklyn/camp/server/dto/PlatformDto.java | 4 - .../ApplicationComponentRestResource.java | 6 +- ...pplicationComponentTemplateRestResource.java | 6 +- .../rest/resource/AssemblyRestResource.java | 6 +- .../resource/AssemblyTemplateRestResource.java | 6 +- .../resource/PlatformComponentRestResource.java | 6 +- .../PlatformComponentTemplateRestResource.java | 6 +- .../rest/resource/PlatformRestResource.java | 4 +- parent/pom.xml | 28 +++- pom.xml | 4 +- .../org/apache/brooklyn/rest/api/AccessApi.java | 7 +- .../apache/brooklyn/rest/api/ActivityApi.java | 22 ++-- .../brooklyn/rest/api/ApplicationApi.java | 64 +++++----- .../apache/brooklyn/rest/api/CatalogApi.java | 128 +++++++++++-------- .../apache/brooklyn/rest/api/EffectorApi.java | 20 +-- .../org/apache/brooklyn/rest/api/EntityApi.java | 68 +++++----- .../brooklyn/rest/api/EntityConfigApi.java | 36 +++--- .../apache/brooklyn/rest/api/LocationApi.java | 14 +- .../org/apache/brooklyn/rest/api/PolicyApi.java | 38 +++--- .../brooklyn/rest/api/PolicyConfigApi.java | 30 ++--- .../org/apache/brooklyn/rest/api/ScriptApi.java | 6 +- .../org/apache/brooklyn/rest/api/SensorApi.java | 40 +++--- .../org/apache/brooklyn/rest/api/ServerApi.java | 27 ++-- .../org/apache/brooklyn/rest/api/UsageApi.java | 30 ++--- .../apache/brooklyn/rest/api/VersionApi.java | 5 +- .../brooklyn/rest/client/BrooklynApi.java | 5 +- usage/rest-server/pom.xml | 4 - utils/rest-swagger/pom.xml | 15 +-- .../brooklyn/rest/apidoc/ApidocEndpoint.java | 6 +- .../brooklyn/rest/apidoc/ApidocResource.java | 22 ++-- .../apache/brooklyn/rest/apidoc/ApidocRoot.java | 8 +- utils/swagger-annotations/pom.xml | 4 +- 39 files changed, 361 insertions(+), 347 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ab086feb/camp/camp-server/pom.xml ---------------------------------------------------------------------- diff --git a/camp/camp-server/pom.xml b/camp/camp-server/pom.xml index 8388c61..d419e89 100644 --- a/camp/camp-server/pom.xml +++ b/camp/camp-server/pom.xml @@ -130,6 +130,11 @@ <artifactId>brooklyn-utils-rest-swagger</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.apache.brooklyn</groupId> + <artifactId>brooklyn-swagger-annotations</artifactId> + <version>${project.version}</version> + </dependency> <dependency> <groupId>org.apache.brooklyn</groupId> @@ -153,10 +158,6 @@ <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> </dependency> - <dependency> - <groupId>com.wordnik</groupId> - <artifactId>swagger-core_2.9.1</artifactId> - </dependency> <!-- TODO have a camp.log / logging module --> <dependency> http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ab086feb/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ApplicationComponentDto.java ---------------------------------------------------------------------- diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ApplicationComponentDto.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ApplicationComponentDto.java index f18787b..9a3ddda 100644 --- a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ApplicationComponentDto.java +++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ApplicationComponentDto.java @@ -31,10 +31,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; public class ApplicationComponentDto extends ResourceDto { - // defined as a constant so can be used in Swagger REST API annotations - public static final String CLASS_NAME = "org.apache.brooklyn.camp.server.dto.ApplicationComponentDto"; - static { assert CLASS_NAME.equals(ApplicationComponentDto.class.getCanonicalName()); } - protected ApplicationComponentDto() {} protected ApplicationComponentDto(DtoFactory dtoFactory, ApplicationComponent x) { super(dtoFactory, x); http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ab086feb/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ApplicationComponentTemplateDto.java ---------------------------------------------------------------------- diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ApplicationComponentTemplateDto.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ApplicationComponentTemplateDto.java index b522eb4..25ed367 100644 --- a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ApplicationComponentTemplateDto.java +++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/ApplicationComponentTemplateDto.java @@ -23,10 +23,6 @@ import org.apache.brooklyn.camp.spi.ApplicationComponentTemplate; public class ApplicationComponentTemplateDto extends ResourceDto { - // defined as a constant so can be used in Swagger REST API annotations - public static final String CLASS_NAME = "org.apache.brooklyn.camp.server.dto.ApplicationComponentTemplateDto"; - static { assert CLASS_NAME.equals(ApplicationComponentTemplateDto.class.getCanonicalName()); } - protected ApplicationComponentTemplateDto() {} protected ApplicationComponentTemplateDto(DtoFactory dtoFactory, ApplicationComponentTemplate x) { super(dtoFactory, x); http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ab086feb/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/AssemblyDto.java ---------------------------------------------------------------------- diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/AssemblyDto.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/AssemblyDto.java index 0e6723e..25a7989 100644 --- a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/AssemblyDto.java +++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/AssemblyDto.java @@ -32,10 +32,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; public class AssemblyDto extends ResourceDto { - // defined as a constant so can be used in Swagger REST API annotations - public static final String CLASS_NAME = "org.apache.brooklyn.camp.server.dto.AssemblyDto"; - static { assert CLASS_NAME.equals(AssemblyDto.class.getCanonicalName()); } - protected AssemblyDto() {} protected AssemblyDto(DtoFactory dtoFactory, Assembly x) { super(dtoFactory, x); http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ab086feb/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/AssemblyTemplateDto.java ---------------------------------------------------------------------- diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/AssemblyTemplateDto.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/AssemblyTemplateDto.java index 6413403..3a7273f 100644 --- a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/AssemblyTemplateDto.java +++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/AssemblyTemplateDto.java @@ -29,10 +29,6 @@ import org.apache.brooklyn.camp.spi.PlatformComponentTemplate; public class AssemblyTemplateDto extends ResourceDto { - // defined as a constant so can be used in Swagger REST API annotations - public static final String CLASS_NAME = "org.apache.brooklyn.camp.server.dto.AssemblyTemplateDto"; - static { assert CLASS_NAME.equals(AssemblyTemplateDto.class.getCanonicalName()); } - protected AssemblyTemplateDto() {} protected AssemblyTemplateDto(DtoFactory dtoFactory, AssemblyTemplate x) { super(dtoFactory, x); http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ab086feb/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformComponentDto.java ---------------------------------------------------------------------- diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformComponentDto.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformComponentDto.java index 446f9b5..9e8ef73 100644 --- a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformComponentDto.java +++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformComponentDto.java @@ -31,10 +31,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; public class PlatformComponentDto extends ResourceDto { - // defined as a constant so can be used in Swagger REST API annotations - public static final String CLASS_NAME = "org.apache.brooklyn.camp.server.dto.PlatformComponentDto"; - static { assert CLASS_NAME.equals(PlatformComponentDto.class.getCanonicalName()); } - protected PlatformComponentDto() {} protected PlatformComponentDto(DtoFactory dtoFactory, PlatformComponent x) { super(dtoFactory, x); http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ab086feb/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformComponentTemplateDto.java ---------------------------------------------------------------------- diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformComponentTemplateDto.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformComponentTemplateDto.java index 1de7cbf..f605890 100644 --- a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformComponentTemplateDto.java +++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformComponentTemplateDto.java @@ -23,10 +23,6 @@ import org.apache.brooklyn.camp.spi.PlatformComponentTemplate; public class PlatformComponentTemplateDto extends ResourceDto { - // defined as a constant so can be used in Swagger REST API annotations - public static final String CLASS_NAME = "org.apache.brooklyn.camp.server.dto.PlatformComponentTemplateDto"; - static { assert CLASS_NAME.equals(PlatformComponentTemplateDto.class.getCanonicalName()); } - protected PlatformComponentTemplateDto() {} protected PlatformComponentTemplateDto(DtoFactory dtoFactory, PlatformComponentTemplate x) { super(dtoFactory, x); http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ab086feb/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformDto.java ---------------------------------------------------------------------- diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformDto.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformDto.java index db52964..62a6aba 100644 --- a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformDto.java +++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/dto/PlatformDto.java @@ -37,10 +37,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; public class PlatformDto extends ResourceDto { - // defined as a constant so can be used in Swagger REST API annotations - public static final String CLASS_NAME = "org.apache.brooklyn.camp.server.dto.PlatformDto"; - static { assert CLASS_NAME.equals(PlatformDto.class.getCanonicalName()); } - protected PlatformDto() {} protected PlatformDto(DtoFactory dtoFactory, PlatformRootSummary x) { super(dtoFactory, x); http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ab086feb/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/ApplicationComponentRestResource.java ---------------------------------------------------------------------- diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/ApplicationComponentRestResource.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/ApplicationComponentRestResource.java index 973cc02..154a5fd 100644 --- a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/ApplicationComponentRestResource.java +++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/ApplicationComponentRestResource.java @@ -26,8 +26,8 @@ import javax.ws.rs.Produces; import org.apache.brooklyn.camp.server.dto.ApplicationComponentDto; import org.apache.brooklyn.swagger.annotations.Apidoc; -import com.wordnik.swagger.core.ApiOperation; -import com.wordnik.swagger.core.ApiParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; @Path(ApplicationComponentRestResource.URI_PATH) @Apidoc("Application Component resources") @@ -38,7 +38,7 @@ public class ApplicationComponentRestResource extends AbstractCampRestResource { @Path("/{id}") @ApiOperation(value = "Get a specific application component", - responseClass = ApplicationComponentDto.CLASS_NAME) + response = ApplicationComponentDto.class) @GET public ApplicationComponentDto get( @ApiParam(value = "ID of item being retrieved", required = true) http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ab086feb/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/ApplicationComponentTemplateRestResource.java ---------------------------------------------------------------------- diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/ApplicationComponentTemplateRestResource.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/ApplicationComponentTemplateRestResource.java index 44ac3b3..be552c0 100644 --- a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/ApplicationComponentTemplateRestResource.java +++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/ApplicationComponentTemplateRestResource.java @@ -26,8 +26,8 @@ import javax.ws.rs.Produces; import org.apache.brooklyn.camp.server.dto.ApplicationComponentTemplateDto; import org.apache.brooklyn.swagger.annotations.Apidoc; -import com.wordnik.swagger.core.ApiOperation; -import com.wordnik.swagger.core.ApiParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; @Path(ApplicationComponentTemplateRestResource.URI_PATH) @Apidoc("Application Component Template resources") @@ -38,7 +38,7 @@ public class ApplicationComponentTemplateRestResource extends AbstractCampRestRe @Path("/{id}") @ApiOperation(value = "Get a specific application component template", - responseClass = ApplicationComponentTemplateDto.CLASS_NAME) + response = ApplicationComponentTemplateDto.class) @GET public ApplicationComponentTemplateDto get( @ApiParam(value = "ID of item being retrieved", required = true) http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ab086feb/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/AssemblyRestResource.java ---------------------------------------------------------------------- diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/AssemblyRestResource.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/AssemblyRestResource.java index 308bf48..27125f3 100644 --- a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/AssemblyRestResource.java +++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/AssemblyRestResource.java @@ -26,8 +26,8 @@ import javax.ws.rs.Produces; import org.apache.brooklyn.camp.server.dto.AssemblyDto; import org.apache.brooklyn.swagger.annotations.Apidoc; -import com.wordnik.swagger.core.ApiOperation; -import com.wordnik.swagger.core.ApiParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; @Path(AssemblyRestResource.URI_PATH) @Apidoc("Assembly resources") @@ -40,7 +40,7 @@ public class AssemblyRestResource extends AbstractCampRestResource { @Path("/{id}") @ApiOperation(value = "Get a specific assembly", - responseClass = AssemblyDto.CLASS_NAME) + response = AssemblyDto.class) @GET public AssemblyDto get( @ApiParam(value = "ID of item being retrieved", required = true) http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ab086feb/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/AssemblyTemplateRestResource.java ---------------------------------------------------------------------- diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/AssemblyTemplateRestResource.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/AssemblyTemplateRestResource.java index 0636904..62f10a0 100644 --- a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/AssemblyTemplateRestResource.java +++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/AssemblyTemplateRestResource.java @@ -37,8 +37,8 @@ import org.apache.brooklyn.camp.spi.AssemblyTemplate; import org.apache.brooklyn.swagger.annotations.Apidoc; import org.apache.brooklyn.util.exceptions.Exceptions; -import com.wordnik.swagger.core.ApiOperation; -import com.wordnik.swagger.core.ApiParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; @Path(AssemblyTemplateRestResource.URI_PATH) @Apidoc("Assembly Template resources") @@ -51,7 +51,7 @@ public class AssemblyTemplateRestResource extends AbstractCampRestResource { @Path("/{id}") @ApiOperation(value = "Get a specific assembly template", - responseClass = AssemblyTemplateDto.CLASS_NAME) + response = AssemblyTemplateDto.class) @GET public AssemblyTemplateDto get( @ApiParam(value = "ID of item being retrieved", required = true) http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ab086feb/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformComponentRestResource.java ---------------------------------------------------------------------- diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformComponentRestResource.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformComponentRestResource.java index 5053c41..af7a3ba 100644 --- a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformComponentRestResource.java +++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformComponentRestResource.java @@ -26,8 +26,8 @@ import javax.ws.rs.Produces; import org.apache.brooklyn.camp.server.dto.PlatformComponentDto; import org.apache.brooklyn.swagger.annotations.Apidoc; -import com.wordnik.swagger.core.ApiOperation; -import com.wordnik.swagger.core.ApiParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; @Path(PlatformComponentRestResource.URI_PATH) @Apidoc("Platform Component resources") @@ -38,7 +38,7 @@ public class PlatformComponentRestResource extends AbstractCampRestResource { @Path("/{id}") @ApiOperation(value = "Get a specific platform component", - responseClass = PlatformComponentDto.CLASS_NAME) + response = PlatformComponentDto.class) @GET public PlatformComponentDto get( @ApiParam(value = "ID of item being retrieved", required = true) http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ab086feb/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformComponentTemplateRestResource.java ---------------------------------------------------------------------- diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformComponentTemplateRestResource.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformComponentTemplateRestResource.java index e3a253d..3600e2b 100644 --- a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformComponentTemplateRestResource.java +++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformComponentTemplateRestResource.java @@ -26,8 +26,8 @@ import javax.ws.rs.Produces; import org.apache.brooklyn.camp.server.dto.PlatformComponentTemplateDto; import org.apache.brooklyn.swagger.annotations.Apidoc; -import com.wordnik.swagger.core.ApiOperation; -import com.wordnik.swagger.core.ApiParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; @Path(PlatformComponentTemplateRestResource.URI_PATH) @Apidoc("Platform Component Template resources") @@ -38,7 +38,7 @@ public class PlatformComponentTemplateRestResource extends AbstractCampRestResou @Path("/{id}") @ApiOperation(value = "Get a specific platform component template", - responseClass = PlatformComponentTemplateDto.CLASS_NAME) + response = PlatformComponentTemplateDto.class) @GET public PlatformComponentTemplateDto get( @ApiParam(value = "ID of item being retrieved", required = true) http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ab086feb/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformRestResource.java ---------------------------------------------------------------------- diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformRestResource.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformRestResource.java index 6eff66b..45b8c98 100644 --- a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformRestResource.java +++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/resource/PlatformRestResource.java @@ -38,7 +38,7 @@ import org.apache.brooklyn.camp.server.rest.util.WebResourceUtils; import org.apache.brooklyn.camp.spi.AssemblyTemplate; import org.apache.brooklyn.swagger.annotations.Apidoc; -import com.wordnik.swagger.core.ApiOperation; +import io.swagger.annotations.ApiOperation; //import io.brooklyn.camp.rest.apidoc.Apidoc; @@ -52,7 +52,7 @@ public class PlatformRestResource extends AbstractCampRestResource { public static final String CAMP_URI_PATH = "/camp/v11"; @ApiOperation(value = "Return the Platform (root) resource", - responseClass = PlatformDto.CLASS_NAME) + response = PlatformDto.class) @GET public PlatformDto get() { return dto().adapt(camp().root()); http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ab086feb/parent/pom.xml ---------------------------------------------------------------------- diff --git a/parent/pom.xml b/parent/pom.xml index 6e529de..0362fa0 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -183,6 +183,16 @@ </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-annotations</artifactId> + <version>${fasterxml.jackson.version}</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-core</artifactId> + <version>${fasterxml.jackson.version}</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>${fasterxml.jackson.version}</version> </dependency> @@ -192,8 +202,18 @@ <version>${fasterxml.jackson.version}</version> </dependency> <dependency> - <groupId>com.wordnik</groupId> - <artifactId>swagger-core_2.9.1</artifactId> + <groupId>com.fasterxml.jackson.module</groupId> + <artifactId>jackson-module-jaxb-annotations</artifactId> + <version>${fasterxml.jackson.version}</version> + </dependency> + <dependency> + <groupId>io.swagger</groupId> + <artifactId>swagger-annotations</artifactId> + <version>${swagger.version}</version> + </dependency> + <dependency> + <groupId>io.swagger</groupId> + <artifactId>swagger-core</artifactId> <version>${swagger.version}</version> <exclusions> <exclusion> @@ -203,8 +223,8 @@ </exclusions> </dependency> <dependency> - <groupId>com.wordnik</groupId> - <artifactId>swagger-jaxrs_2.9.1</artifactId> + <groupId>io.swagger</groupId> + <artifactId>swagger-jaxrs</artifactId> <version>${swagger.version}</version> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ab086feb/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 19be2bf..c436b20 100644 --- a/pom.xml +++ b/pom.xml @@ -99,7 +99,7 @@ <guava.version>17.0</guava.version> <xstream.version>1.4.7</xstream.version> <jackson.version>1.9.13</jackson.version> <!-- codehaus jackson, used by brooklyn rest server --> - <fasterxml.jackson.version>2.4.2</fasterxml.jackson.version> <!-- more recent jackson, but not compatible with old annotations! --> + <fasterxml.jackson.version>2.4.5</fasterxml.jackson.version> <!-- more recent jackson, but not compatible with old annotations! --> <jersey.version>1.18.1</jersey.version> <httpclient.version>4.4.1</httpclient.version> <commons-lang3.version>3.1</commons-lang3.version> @@ -110,7 +110,7 @@ <!-- Ordinary dependencies --> <testng.version>6.8.8</testng.version> <mockito.version>1.10.8</mockito.version> - <swagger.version>1.0.1</swagger.version> + <swagger.version>1.5.3</swagger.version> <jansi.version>1.2.1</jansi.version> <gson.version>2.3</gson.version> <ivy.version>2.2.0</ivy.version> http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ab086feb/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/AccessApi.java ---------------------------------------------------------------------- diff --git a/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/AccessApi.java b/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/AccessApi.java index 5c3493b..2e3a91c 100644 --- a/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/AccessApi.java +++ b/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/AccessApi.java @@ -31,8 +31,9 @@ import org.apache.brooklyn.swagger.annotations.Apidoc; import org.apache.brooklyn.rest.domain.AccessSummary; import com.google.common.annotations.Beta; -import com.wordnik.swagger.core.ApiOperation; -import com.wordnik.swagger.core.ApiParam; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; @Beta @Path("/v1/access") @@ -49,7 +50,7 @@ public interface AccessApi { @GET @ApiOperation( value = "Fetch access control summary", - responseClass = "org.apache.brooklyn.rest.domain.AccessSummary" + response = org.apache.brooklyn.rest.domain.AccessSummary.class ) public AccessSummary get(); http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ab086feb/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/ActivityApi.java ---------------------------------------------------------------------- diff --git a/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/ActivityApi.java b/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/ActivityApi.java index e41b12d..d438f7e 100644 --- a/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/ActivityApi.java +++ b/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/ActivityApi.java @@ -23,10 +23,10 @@ import java.util.List; import org.apache.brooklyn.swagger.annotations.Apidoc; import org.apache.brooklyn.rest.domain.TaskSummary; -import com.wordnik.swagger.core.ApiError; -import com.wordnik.swagger.core.ApiErrors; -import com.wordnik.swagger.core.ApiOperation; -import com.wordnik.swagger.core.ApiParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; @@ -39,9 +39,9 @@ public interface ActivityApi { @GET @Path("/{task}") - @ApiOperation(value = "Fetch task details", responseClass = "org.apache.brooklyn.rest.domain.TaskSummary") - @ApiErrors(value = { - @ApiError(code = 404, reason = "Could not find task") + @ApiOperation(value = "Fetch task details", response = org.apache.brooklyn.rest.domain.TaskSummary.class) + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Could not find task") }) // @Produces("text/json") public TaskSummary get( @@ -51,8 +51,8 @@ public interface ActivityApi { @GET @Path("/{task}/children") @ApiOperation(value = "Fetch list of children tasks of this task") - @ApiErrors(value = { - @ApiError(code = 404, reason = "Could not find task") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Could not find task") }) public List<TaskSummary> children( @ApiParam(value = "Task ID", required = true) @PathParam("task") String taskId); @@ -60,8 +60,8 @@ public interface ActivityApi { @GET @Path("/{task}/stream/{streamId}") @ApiOperation(value = "Return the contents of the given stream") - @ApiErrors(value = { - @ApiError(code = 404, reason = "Could not find task or stream") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Could not find task or stream") }) public String stream( @ApiParam(value = "Task ID", required = true) @PathParam("task") String taskId, http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ab086feb/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/ApplicationApi.java ---------------------------------------------------------------------- diff --git a/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/ApplicationApi.java b/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/ApplicationApi.java index 6a0d345..8fd4fb1 100644 --- a/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/ApplicationApi.java +++ b/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/ApplicationApi.java @@ -41,10 +41,10 @@ import org.apache.brooklyn.rest.domain.ApplicationSpec; import org.apache.brooklyn.rest.domain.ApplicationSummary; import org.apache.brooklyn.rest.domain.EntitySummary; -import com.wordnik.swagger.core.ApiError; -import com.wordnik.swagger.core.ApiErrors; -import com.wordnik.swagger.core.ApiOperation; -import com.wordnik.swagger.core.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; @Path("/v1/applications") @Apidoc("Applications") @@ -74,7 +74,7 @@ public interface ApplicationApi { @GET @ApiOperation( value = "Fetch list of applications, as ApplicationSummary objects", - responseClass = "org.apache.brooklyn.rest.domain.ApplicationSummary" + response = org.apache.brooklyn.rest.domain.ApplicationSummary.class ) public List<ApplicationSummary> list( @ApiParam(value = "Regular expression to filter by", required = false) @@ -91,10 +91,10 @@ public interface ApplicationApi { @Path("/{application}") @ApiOperation( value = "Fetch a specific application", - responseClass = "org.apache.brooklyn.rest.domain.ApplicationSummary" + response = org.apache.brooklyn.rest.domain.ApplicationSummary.class ) - @ApiErrors(value = { - @ApiError(code = 404, reason = "Application not found") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Application not found") }) public ApplicationSummary get( @ApiParam( @@ -108,11 +108,11 @@ public interface ApplicationApi { "text/yaml", "text/x-yaml", "application/yaml"}) @ApiOperation( value = "Create and start a new application from YAML", - responseClass = "org.apache.brooklyn.rest.domain.TaskSummary" + response = org.apache.brooklyn.rest.domain.TaskSummary.class ) - @ApiErrors(value = { - @ApiError(code = 404, reason = "Undefined entity or location"), - @ApiError(code = 412, reason = "Application already registered") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Undefined entity or location"), + @ApiResponse(code = 412, message = "Application already registered") }) public Response createFromYaml( @ApiParam( @@ -128,11 +128,11 @@ public interface ApplicationApi { @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM, MediaType.TEXT_PLAIN}) @ApiOperation( value = "Create and start a new application from miscellaneous types, including JSON either new CAMP format or legacy AppSpec format", - responseClass = "org.apache.brooklyn.rest.domain.TaskSummary" + response = org.apache.brooklyn.rest.domain.TaskSummary.class ) - @ApiErrors(value = { - @ApiError(code = 404, reason = "Undefined entity or location"), - @ApiError(code = 412, reason = "Application already registered") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Undefined entity or location"), + @ApiResponse(code = 412, message = "Application already registered") }) public Response createPoly( @ApiParam( @@ -145,11 +145,11 @@ public interface ApplicationApi { @Consumes({MediaType.APPLICATION_FORM_URLENCODED}) @ApiOperation( value = "Create and start a new application from form URL-encoded contents (underlying type autodetected)", - responseClass = "org.apache.brooklyn.rest.domain.TaskSummary" + response = org.apache.brooklyn.rest.domain.TaskSummary.class ) - @ApiErrors(value = { - @ApiError(code = 404, reason = "Undefined entity or location"), - @ApiError(code = 412, reason = "Application already registered") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Undefined entity or location"), + @ApiResponse(code = 412, message = "Application already registered") }) public Response createFromForm( @ApiParam( @@ -162,10 +162,10 @@ public interface ApplicationApi { @Path("/{application}") @ApiOperation( value = "Delete a specified application", - responseClass = "org.apache.brooklyn.rest.domain.TaskSummary" + response = org.apache.brooklyn.rest.domain.TaskSummary.class ) - @ApiErrors(value = { - @ApiError(code = 404, reason = "Application not found") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Application not found") }) public Response delete( @ApiParam( @@ -180,11 +180,11 @@ public interface ApplicationApi { @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM, MediaType.TEXT_PLAIN}) @ApiOperation( value = "Create and start a new application from miscellaneous types, including JSON either new CAMP format or legacy AppSpec format", - responseClass = "org.apache.brooklyn.rest.domain.TaskSummary" + response = org.apache.brooklyn.rest.domain.TaskSummary.class ) - @ApiErrors(value = { - @ApiError(code = 404, reason = "Undefined entity or location"), - @ApiError(code = 412, reason = "Application already registered") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Undefined entity or location"), + @ApiResponse(code = 412, message = "Application already registered") }) @Path("/createLegacy") @Deprecated @@ -193,9 +193,9 @@ public interface ApplicationApi { @GET @Path("/{application}/descendants") @ApiOperation(value = "Fetch entity info for all (or filtered) descendants", - responseClass = "org.apache.brooklyn.rest.domain.EntitySummary") - @ApiErrors(value = { - @ApiError(code = 404, reason = "Application or entity missing") + response = org.apache.brooklyn.rest.domain.EntitySummary.class) + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Application or entity missing") }) public List<EntitySummary> getDescendants( @ApiParam(value = "Application ID or name", required = true) @@ -207,8 +207,8 @@ public interface ApplicationApi { @GET @Path("/{application}/descendants/sensor/{sensor}") @ApiOperation(value = "Fetch values of a given sensor for all (or filtered) descendants") - @ApiErrors(value = { - @ApiError(code = 404, reason = "Application or entity missing") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Application or entity missing") }) public Map<String,Object> getDescendantsSensor( @ApiParam(value = "Application ID or name", required = true) http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ab086feb/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/CatalogApi.java ---------------------------------------------------------------------- diff --git a/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/CatalogApi.java b/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/CatalogApi.java index 004cc1b..5f20ea0 100644 --- a/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/CatalogApi.java +++ b/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/CatalogApi.java @@ -42,10 +42,10 @@ import org.apache.brooklyn.rest.domain.CatalogPolicySummary; import com.sun.jersey.core.header.FormDataContentDisposition; import com.sun.jersey.multipart.FormDataParam; -import com.wordnik.swagger.core.ApiError; -import com.wordnik.swagger.core.ApiErrors; -import com.wordnik.swagger.core.ApiOperation; -import com.wordnik.swagger.core.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; @Path("/v1/catalog") @Apidoc("Catalog") @@ -55,7 +55,7 @@ public interface CatalogApi { @POST @ApiOperation(value = "Add a catalog item (e.g. new type of entity, policy or location) by uploading YAML descriptor from browser using multipart/form-data", - responseClass = "String") + response = String.class) @Consumes(MediaType.MULTIPART_FORM_DATA) public Response createFromMultipart( @ApiParam(name = "yaml", value = "multipart/form-data file input field") @@ -65,7 +65,7 @@ public interface CatalogApi { @Consumes @POST @ApiOperation(value = "Add a catalog item (e.g. new type of entity, policy or location) by uploading YAML descriptor " - + "Return value is map of ID to CatalogItemSummary, with code 201 CREATED.", responseClass = "Response") + + "Return value is map of ID to CatalogItemSummary, with code 201 CREATED.", response = Response.class) public Response create( @ApiParam(name = "yaml", value = "YAML descriptor of catalog item", required = true) @Valid String yaml); @@ -86,8 +86,8 @@ public interface CatalogApi { @DELETE @Path("/entities/{entityId}") @ApiOperation(value = "Deletes a specific version of an entity's definition from the catalog") - @ApiErrors(value = { - @ApiError(code = 404, reason = "Entity not found") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Entity not found") }) public void deleteEntity( @ApiParam(name = "entityId", value = "The ID of the entity or template to delete", required = true) @@ -96,8 +96,8 @@ public interface CatalogApi { @DELETE @Path("/applications/{symbolicName}/{version}") @ApiOperation(value = "Deletes a specific version of an application's definition from the catalog") - @ApiErrors(value = { - @ApiError(code = 404, reason = "Entity not found") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Entity not found") }) public void deleteApplication( @ApiParam(name = "symbolicName", value = "The symbolic name of the application or template to delete", required = true) @@ -109,8 +109,8 @@ public interface CatalogApi { @DELETE @Path("/entities/{symbolicName}/{version}") @ApiOperation(value = "Deletes a specific version of an entity's definition from the catalog") - @ApiErrors(value = { - @ApiError(code = 404, reason = "Entity not found") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Entity not found") }) public void deleteEntity( @ApiParam(name = "symbolicName", value = "The symbolic name of the entity or template to delete", required = true) @@ -122,8 +122,8 @@ public interface CatalogApi { @DELETE @Path("/policies/{policyId}/{version}") @ApiOperation(value = "Deletes a specific version of an policy's definition from the catalog") - @ApiErrors(value = { - @ApiError(code = 404, reason = "Policy not found") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Policy not found") }) public void deletePolicy( @ApiParam(name = "policyId", value = "The ID of the policy to delete", required = true) @@ -135,8 +135,8 @@ public interface CatalogApi { @DELETE @Path("/locations/{locationId}/{version}") @ApiOperation(value = "Deletes a specific version of an location's definition from the catalog") - @ApiErrors(value = { - @ApiError(code = 404, reason = "Location not found") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Location not found") }) public void deleteLocation( @ApiParam(name = "locationId", value = "The ID of the location to delete", required = true) @@ -147,7 +147,9 @@ public interface CatalogApi { @GET @Path("/entities") - @ApiOperation(value = "List available entity types optionally matching a query", responseClass = "CatalogItemSummary", multiValueResponse = true) + @ApiOperation(value = "List available entity types optionally matching a query", + response = CatalogItemSummary.class, + responseContainer = "List") public List<CatalogEntitySummary> listEntities( @ApiParam(name = "regex", value = "Regular expression to search for") @QueryParam("regex") @DefaultValue("") String regex, @@ -158,7 +160,9 @@ public interface CatalogApi { @GET @Path("/applications") - @ApiOperation(value = "Fetch a list of application templates optionally matching a query", responseClass = "CatalogItemSummary", multiValueResponse = true) + @ApiOperation(value = "Fetch a list of application templates optionally matching a query", + response = CatalogItemSummary.class, + responseContainer = "List") public List<CatalogItemSummary> listApplications( @ApiParam(name = "regex", value = "Regular expression to search for") @QueryParam("regex") @DefaultValue("") String regex, @@ -171,9 +175,11 @@ public interface CatalogApi { @Deprecated @GET @Path("/entities/{entityId}") - @ApiOperation(value = "Fetch an entity's definition from the catalog", responseClass = "CatalogEntitySummary", multiValueResponse = true) - @ApiErrors(value = { - @ApiError(code = 404, reason = "Entity not found") + @ApiOperation(value = "Fetch an entity's definition from the catalog", + response = CatalogEntitySummary.class, + responseContainer = "List") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Entity not found") }) public CatalogEntitySummary getEntity( @ApiParam(name = "entityId", value = "The ID of the entity or template to retrieve", required = true) @@ -181,9 +187,11 @@ public interface CatalogApi { @GET @Path("/entities/{symbolicName}/{version}") - @ApiOperation(value = "Fetch a specific version of an entity's definition from the catalog", responseClass = "CatalogEntitySummary", multiValueResponse = true) - @ApiErrors(value = { - @ApiError(code = 404, reason = "Entity not found") + @ApiOperation(value = "Fetch a specific version of an entity's definition from the catalog", + response = CatalogEntitySummary.class, + responseContainer = "List") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Entity not found") }) public CatalogEntitySummary getEntity( @ApiParam(name = "symbolicName", value = "The symbolic name of the entity or template to retrieve", required = true) @@ -196,9 +204,11 @@ public interface CatalogApi { @Deprecated @GET @Path("/applications/{applicationId}") - @ApiOperation(value = "Fetch a specific version of an application's definition from the catalog", responseClass = "CatalogEntitySummary", multiValueResponse = true) - @ApiErrors(value = { - @ApiError(code = 404, reason = "Entity not found") + @ApiOperation(value = "Fetch a specific version of an application's definition from the catalog", + response = CatalogEntitySummary.class, + responseContainer = "List") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Entity not found") }) public CatalogEntitySummary getApplication( @ApiParam(name = "applicationId", value = "The ID of the application to retrieve", required = true) @@ -206,9 +216,11 @@ public interface CatalogApi { @GET @Path("/applications/{symbolicName}/{version}") - @ApiOperation(value = "Fetch a specific version of an application's definition from the catalog", responseClass = "CatalogEntitySummary", multiValueResponse = true) - @ApiErrors(value = { - @ApiError(code = 404, reason = "Entity not found") + @ApiOperation(value = "Fetch a specific version of an application's definition from the catalog", + response = CatalogEntitySummary.class, + responseContainer = "List") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Entity not found") }) public CatalogEntitySummary getApplication( @ApiParam(name = "symbolicName", value = "The symbolic name of the application to retrieve", required = true) @@ -219,7 +231,9 @@ public interface CatalogApi { @GET @Path("/policies") - @ApiOperation(value = "List available policies optionally matching a query", responseClass = "CatalogPolicySummary", multiValueResponse = true) + @ApiOperation(value = "List available policies optionally matching a query", + response = CatalogPolicySummary.class, + responseContainer = "List") public List<CatalogPolicySummary> listPolicies( @ApiParam(name = "regex", value = "Regular expression to search for") @QueryParam("regex") @DefaultValue("") String regex, @@ -232,9 +246,11 @@ public interface CatalogApi { @Deprecated @GET @Path("/policies/{policyId}") - @ApiOperation(value = "Fetch a policy's definition from the catalog", responseClass = "CatalogItemSummary", multiValueResponse = true) - @ApiErrors(value = { - @ApiError(code = 404, reason = "Entity not found") + @ApiOperation(value = "Fetch a policy's definition from the catalog", + response = CatalogItemSummary.class, + responseContainer = "List") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Entity not found") }) public CatalogItemSummary getPolicy( @ApiParam(name = "policyId", value = "The ID of the policy to retrieve", required = true) @@ -242,9 +258,11 @@ public interface CatalogApi { @GET @Path("/policies/{policyId}/{version}") - @ApiOperation(value = "Fetch a policy's definition from the catalog", responseClass = "CatalogItemSummary", multiValueResponse = true) - @ApiErrors(value = { - @ApiError(code = 404, reason = "Entity not found") + @ApiOperation(value = "Fetch a policy's definition from the catalog", + response = CatalogItemSummary.class, + responseContainer = "List") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Entity not found") }) public CatalogItemSummary getPolicy( @ApiParam(name = "policyId", value = "The ID of the policy to retrieve", required = true) @@ -254,7 +272,9 @@ public interface CatalogApi { @GET @Path("/locations") - @ApiOperation(value = "List available locations optionally matching a query", responseClass = "CatalogLocationSummary", multiValueResponse = true) + @ApiOperation(value = "List available locations optionally matching a query", + response = CatalogLocationSummary.class, + responseContainer = "List") public List<CatalogLocationSummary> listLocations( @ApiParam(name = "regex", value = "Regular expression to search for") @QueryParam("regex") @DefaultValue("") String regex, @@ -267,9 +287,11 @@ public interface CatalogApi { @Deprecated @GET @Path("/locations/{locationId}") - @ApiOperation(value = "Fetch a location's definition from the catalog", responseClass = "CatalogItemSummary", multiValueResponse = true) - @ApiErrors(value = { - @ApiError(code = 404, reason = "Entity not found") + @ApiOperation(value = "Fetch a location's definition from the catalog", + response = CatalogItemSummary.class, + responseContainer = "List") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Entity not found") }) public CatalogItemSummary getLocation( @ApiParam(name = "locationId", value = "The ID of the location to retrieve", required = true) @@ -277,9 +299,11 @@ public interface CatalogApi { @GET @Path("/locations/{locationId}/{version}") - @ApiOperation(value = "Fetch a location's definition from the catalog", responseClass = "CatalogItemSummary", multiValueResponse = true) - @ApiErrors(value = { - @ApiError(code = 404, reason = "Entity not found") + @ApiOperation(value = "Fetch a location's definition from the catalog", + response = CatalogItemSummary.class, + responseContainer = "List") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Entity not found") }) public CatalogItemSummary getLocation( @ApiParam(name = "locationId", value = "The ID of the location to retrieve", required = true) @@ -292,8 +316,8 @@ public interface CatalogApi { @GET @Path("/icon/{itemId}") @ApiOperation(value = "Return the icon for a given catalog entry (application/image or HTTP redirect)") - @ApiErrors(value = { - @ApiError(code = 404, reason = "Item not found") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Item not found") }) @Produces("application/image") public Response getIcon( @@ -303,8 +327,8 @@ public interface CatalogApi { @GET @Path("/icon/{itemId}/{version}") @ApiOperation(value = "Return the icon for a given catalog entry (application/image or HTTP redirect)") - @ApiErrors(value = { - @ApiError(code = 404, reason = "Item not found") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Item not found") }) @Produces("application/image") public Response getIcon( @@ -328,8 +352,8 @@ public interface CatalogApi { @POST @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM, MediaType.TEXT_PLAIN}) - @ApiErrors(value = { - @ApiError(code = 404, reason = "Undefined catalog item"), + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Undefined catalog item"), }) @Path("/entities/{itemId}/deprecated") public void setDeprecated( @@ -340,8 +364,8 @@ public interface CatalogApi { @POST @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM, MediaType.TEXT_PLAIN}) - @ApiErrors(value = { - @ApiError(code = 404, reason = "Undefined catalog item"), + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Undefined catalog item"), }) @Path("/entities/{itemId}/disabled") public void setDisabled( http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ab086feb/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/EffectorApi.java ---------------------------------------------------------------------- diff --git a/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/EffectorApi.java b/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/EffectorApi.java index 07c0ed1..fcd52d8 100644 --- a/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/EffectorApi.java +++ b/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/EffectorApi.java @@ -20,10 +20,10 @@ package org.apache.brooklyn.rest.api; import org.apache.brooklyn.swagger.annotations.Apidoc; import org.apache.brooklyn.rest.domain.EffectorSummary; -import com.wordnik.swagger.core.ApiError; -import com.wordnik.swagger.core.ApiErrors; -import com.wordnik.swagger.core.ApiOperation; -import com.wordnik.swagger.core.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; import javax.validation.Valid; import javax.ws.rs.*; @@ -40,10 +40,10 @@ public interface EffectorApi { @GET @ApiOperation(value = "Fetch the list of effectors", - responseClass = "org.apache.brooklyn.rest.domain.EffectorSummary", - multiValueResponse = true) - @ApiErrors(value = { - @ApiError(code = 404, reason = "Could not find application or entity") + response = org.apache.brooklyn.rest.domain.EffectorSummary.class, + responseContainer = "List") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Could not find application or entity") }) public List<EffectorSummary> list( @ApiParam(name = "application", value = "Application name", required = true) @@ -55,8 +55,8 @@ public interface EffectorApi { @Path("/{effector}") @ApiOperation(value = "Trigger an effector", notes="Returns the return value (status 200) if it completes, or an activity task ID (status 202) if it times out") - @ApiErrors(value = { - @ApiError(code = 404, reason = "Could not find application, entity or effector") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Could not find application, entity or effector") }) @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED}) public Response invoke( http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ab086feb/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/EntityApi.java ---------------------------------------------------------------------- diff --git a/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/EntityApi.java b/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/EntityApi.java index b614499..57eae42 100644 --- a/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/EntityApi.java +++ b/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/EntityApi.java @@ -23,10 +23,10 @@ import org.apache.brooklyn.rest.domain.EntitySummary; import org.apache.brooklyn.rest.domain.LocationSummary; import org.apache.brooklyn.rest.domain.TaskSummary; -import com.wordnik.swagger.core.ApiError; -import com.wordnik.swagger.core.ApiErrors; -import com.wordnik.swagger.core.ApiOperation; -import com.wordnik.swagger.core.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; @@ -43,10 +43,10 @@ public interface EntityApi { @GET @ApiOperation(value = "Fetch the list of entities for a given application", - responseClass = "org.apache.brooklyn.rest.domain.EntitySummary", - multiValueResponse = true) - @ApiErrors(value = { - @ApiError(code = 404, reason = "Application not found") + response = org.apache.brooklyn.rest.domain.EntitySummary.class, + responseContainer = "List") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Application not found") }) public List<EntitySummary> list( @ApiParam(value = "Application ID or name", required = true) @@ -55,9 +55,9 @@ public interface EntityApi { @GET @Path("/{entity}") @ApiOperation(value = "Fetch details about a specific application entity", - responseClass = "org.apache.brooklyn.rest.domain.EntitySummary") - @ApiErrors(value = { - @ApiError(code = 404, reason = "Application or entity missing") + response = org.apache.brooklyn.rest.domain.EntitySummary.class) + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Application or entity missing") }) public EntitySummary get( @ApiParam(value = "Application ID or name", required = true) @@ -68,7 +68,7 @@ public interface EntityApi { // TODO rename as "/children" ? @GET @ApiOperation(value = "Fetch details about a specific application entity's children", - responseClass = "org.apache.brooklyn.rest.domain.EntitySummary") + response = org.apache.brooklyn.rest.domain.EntitySummary.class) @Path("/{entity}/children") public List<EntitySummary> getChildren( @PathParam("application") final String application, @@ -83,7 +83,7 @@ public interface EntityApi { @POST @ApiOperation(value = "Add a child or children to this entity given a YAML spec", - responseClass = "org.apache.brooklyn.rest.domain.TaskSummary") + response = org.apache.brooklyn.rest.domain.TaskSummary.class) @Consumes({"application/x-yaml", // see http://stackoverflow.com/questions/332129/yaml-mime-type "text/yaml", "text/x-yaml", "application/yaml", MediaType.APPLICATION_JSON}) @@ -113,8 +113,8 @@ public interface EntityApi { @GET @Path("/{entity}/activities") @ApiOperation(value = "Fetch list of tasks for this entity") - @ApiErrors(value = { - @ApiError(code = 404, reason = "Could not find application or entity") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Could not find application or entity") }) public List<TaskSummary> listTasks( @ApiParam(value = "Application ID or name", required = true) @PathParam("application") String applicationId, @@ -122,9 +122,9 @@ public interface EntityApi { @GET @Path("/{entity}/activities/{task}") - @ApiOperation(value = "Fetch task details", responseClass = "org.apache.brooklyn.rest.domain.TaskSummary") - @ApiErrors(value = { - @ApiError(code = 404, reason = "Could not find application, entity or task") + @ApiOperation(value = "Fetch task details", response = org.apache.brooklyn.rest.domain.TaskSummary.class) + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Could not find application, entity or task") }) @Produces("text/json") public TaskSummary getTask( @@ -142,8 +142,8 @@ public interface EntityApi { @GET @Path("/{entity}/tags") @ApiOperation(value = "Fetch list of tags on this entity") - @ApiErrors(value = { - @ApiError(code = 404, reason = "Could not find application or entity") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Could not find application or entity") }) public List<Object> listTags( @ApiParam(value = "Application ID or name", required = true) @PathParam("application") String applicationId, @@ -153,8 +153,8 @@ public interface EntityApi { @ApiOperation( value = "Rename an entity" ) - @ApiErrors(value = { - @ApiError(code = 404, reason = "Undefined application or entity") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Undefined application or entity") }) @Path("/{entity}/name") public Response rename( @@ -165,10 +165,10 @@ public interface EntityApi { @POST @ApiOperation( value = "Expunge an entity", - responseClass = "org.apache.brooklyn.rest.domain.TaskSummary" + response = org.apache.brooklyn.rest.domain.TaskSummary.class ) - @ApiErrors(value = { - @ApiError(code = 404, reason = "Undefined application or entity") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Undefined application or entity") }) @Path("/{entity}/expunge") public Response expunge( @@ -179,9 +179,9 @@ public interface EntityApi { @GET @Path("/{entity}/descendants") @ApiOperation(value = "Fetch entity info for all (or filtered) descendants", - responseClass = "org.apache.brooklyn.rest.domain.EntitySummary") - @ApiErrors(value = { - @ApiError(code = 404, reason = "Application or entity missing") + response = org.apache.brooklyn.rest.domain.EntitySummary.class) + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Application or entity missing") }) public List<EntitySummary> getDescendants( @ApiParam(value = "Application ID or name", required = true) @@ -195,8 +195,8 @@ public interface EntityApi { @GET @Path("/{entity}/descendants/sensor/{sensor}") @ApiOperation(value = "Fetch values of a given sensor for all (or filtered) descendants") - @ApiErrors(value = { - @ApiError(code = 404, reason = "Application or entity missing") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Application or entity missing") }) public Map<String,Object> getDescendantsSensor( @ApiParam(value = "Application ID or name", required = true) @@ -212,8 +212,8 @@ public interface EntityApi { @GET @Path("/{entity}/locations") @ApiOperation(value = "List the locations set on the entity") - @ApiErrors(value = { - @ApiError(code = 404, reason = "Application or entity missing") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Application or entity missing") }) public List<LocationSummary> getLocations( @ApiParam(value = "Application ID or name", required = true) @@ -224,8 +224,8 @@ public interface EntityApi { @GET @Path("/{entity}/spec") @ApiOperation(value = "Get the YAML spec used to create the entity, if available") - @ApiErrors(value = { - @ApiError(code = 404, reason = "Application or entity missing") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Application or entity missing") }) public String getSpec( @ApiParam(value = "Application ID or name", required = true) http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ab086feb/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/EntityConfigApi.java ---------------------------------------------------------------------- diff --git a/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/EntityConfigApi.java b/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/EntityConfigApi.java index 2826023..a1672bc 100644 --- a/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/EntityConfigApi.java +++ b/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/EntityConfigApi.java @@ -34,10 +34,10 @@ import javax.ws.rs.core.MediaType; import org.apache.brooklyn.swagger.annotations.Apidoc; import org.apache.brooklyn.rest.domain.EntityConfigSummary; -import com.wordnik.swagger.core.ApiError; -import com.wordnik.swagger.core.ApiErrors; -import com.wordnik.swagger.core.ApiOperation; -import com.wordnik.swagger.core.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; @Path("/v1/applications/{application}/entities/{entity}/config") @Apidoc("Entity Config") @@ -47,10 +47,10 @@ public interface EntityConfigApi { @GET @ApiOperation(value = "Fetch the config keys for a specific application entity", - responseClass = "org.apache.brooklyn.rest.domain.ConfigSummary", - multiValueResponse = true) - @ApiErrors(value = { - @ApiError(code = 404, reason = "Could not find application or entity") + response = org.apache.brooklyn.rest.domain.ConfigSummary.class, + responseContainer = "List") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Could not find application or entity") }) public List<EntityConfigSummary> list( @ApiParam(value = "Application ID or name", required = true) @@ -74,9 +74,9 @@ public interface EntityConfigApi { //To call this endpoint set the Accept request field e.g curl -H "Accept: application/json" ... @GET @Path("/{config}") - @ApiOperation(value = "Fetch config value (json)", responseClass = "Object") - @ApiErrors(value = { - @ApiError(code = 404, reason = "Could not find application, entity or config key") + @ApiOperation(value = "Fetch config value (json)", response = Object.class) + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Could not find application, entity or config key") }) @Produces(MediaType.APPLICATION_JSON) public Object get( @@ -92,9 +92,9 @@ public interface EntityConfigApi { // if user requests plain value we skip some json post-processing @GET @Path("/{config}") - @ApiOperation(value = "Fetch config value (text/plain)", responseClass = "Object") - @ApiErrors(value = { - @ApiError(code = 404, reason = "Could not find application, entity or config key") + @ApiOperation(value = "Fetch config value (text/plain)", response = Object.class) + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Could not find application, entity or config key") }) @Produces(MediaType.TEXT_PLAIN) public String getPlain( @@ -109,8 +109,8 @@ public interface EntityConfigApi { @POST @ApiOperation(value = "Manually set multiple config values") - @ApiErrors(value = { - @ApiError(code = 404, reason = "Could not find application or entity") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Could not find application or entity") }) @SuppressWarnings("rawtypes") public void setFromMap( @@ -126,8 +126,8 @@ public interface EntityConfigApi { @POST @Path("/{config}") @ApiOperation(value = "Manually set a config value") - @ApiErrors(value = { - @ApiError(code = 404, reason = "Could not find application, entity or config key") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Could not find application, entity or config key") }) public void set( @ApiParam(value = "Application ID or name", required = true) http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ab086feb/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/LocationApi.java ---------------------------------------------------------------------- diff --git a/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/LocationApi.java b/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/LocationApi.java index adddebf..a6bbcbf 100644 --- a/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/LocationApi.java +++ b/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/LocationApi.java @@ -38,8 +38,8 @@ import org.apache.brooklyn.swagger.annotations.Apidoc; import org.apache.brooklyn.rest.domain.LocationSpec; import org.apache.brooklyn.rest.domain.LocationSummary; -import com.wordnik.swagger.core.ApiOperation; -import com.wordnik.swagger.core.ApiParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; @SuppressWarnings("deprecation") @Path("/v1/locations") @@ -53,8 +53,8 @@ public interface LocationApi { */ @GET @ApiOperation(value = "Fetch the list of location definitions", - responseClass = "org.apache.brooklyn.rest.domain.LocationSummary", - multiValueResponse = true) + response = org.apache.brooklyn.rest.domain.LocationSummary.class, + responseContainer = "List") @Deprecated public List<LocationSummary> list(); @@ -71,8 +71,8 @@ public interface LocationApi { @GET @Path("/{locationId}") @ApiOperation(value = "Fetch details about a location instance, or a location definition", - responseClass = "org.apache.brooklyn.rest.domain.LocationSummary", - multiValueResponse = true) + response = org.apache.brooklyn.rest.domain.LocationSummary.class, + responseContainer = "List") public LocationSummary get( @ApiParam(value = "Location id to fetch", required = true) @PathParam("locationId") String locationId, @@ -82,7 +82,7 @@ public interface LocationApi { /** @deprecated since 0.7.0 use {@link CatalogApi#create(String)} with a location definition */ @POST - @ApiOperation(value = "Create a new location definition", responseClass = "String") + @ApiOperation(value = "Create a new location definition", response = String.class) @Deprecated public Response create( @ApiParam(name = "locationSpec", value = "Location specification object", required = true) http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ab086feb/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/PolicyApi.java ---------------------------------------------------------------------- diff --git a/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/PolicyApi.java b/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/PolicyApi.java index 3b3f8c9..222976f 100644 --- a/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/PolicyApi.java +++ b/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/PolicyApi.java @@ -21,10 +21,10 @@ package org.apache.brooklyn.rest.api; import org.apache.brooklyn.swagger.annotations.Apidoc; import org.apache.brooklyn.rest.domain.PolicySummary; import org.apache.brooklyn.rest.domain.Status; -import com.wordnik.swagger.core.ApiError; -import com.wordnik.swagger.core.ApiErrors; -import com.wordnik.swagger.core.ApiOperation; -import com.wordnik.swagger.core.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; @@ -40,10 +40,10 @@ public interface PolicyApi { @GET @ApiOperation(value = "Fetch the policies attached to a specific application entity", - responseClass = "org.apache.brooklyn.rest.domain.PolicySummary", - multiValueResponse = true) - @ApiErrors(value = { - @ApiError(code = 404, reason = "Could not find application or entity") + response = org.apache.brooklyn.rest.domain.PolicySummary.class, + responseContainer = "List") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Could not find application or entity") }) public List<PolicySummary> list( @ApiParam(value = "Application ID or name", required = true) @@ -65,9 +65,9 @@ public interface PolicyApi { @POST @ApiOperation(value = "Add a policy", notes = "Returns a summary of the new policy") - @ApiErrors(value = { - @ApiError(code = 404, reason = "Could not find application or entity"), - @ApiError(code = 400, reason = "Type is not a class implementing Policy") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Could not find application or entity"), + @ApiResponse(code = 400, message = "Type is not a class implementing Policy") }) public PolicySummary addPolicy( @ApiParam(name = "application", value = "Application ID or name", required = true) @@ -87,8 +87,8 @@ public interface PolicyApi { @GET @Path("/{policy}") @ApiOperation(value = "Gets status of a policy (RUNNING / SUSPENDED)") - @ApiErrors(value = { - @ApiError(code = 404, reason = "Could not find application, entity or policy") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Could not find application, entity or policy") }) public Status getStatus( @ApiParam(name = "application", value = "Application ID or name", required = true) @@ -103,8 +103,8 @@ public interface PolicyApi { @POST @Path("/{policy}/start") @ApiOperation(value = "Start or resume a policy") - @ApiErrors(value = { - @ApiError(code = 404, reason = "Could not find application, entity or policy") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Could not find application, entity or policy") }) public Response start( @ApiParam(name = "application", value = "Application ID or name", required = true) @@ -119,8 +119,8 @@ public interface PolicyApi { @POST @Path("/{policy}/stop") @ApiOperation(value = "Suspends a policy") - @ApiErrors(value = { - @ApiError(code = 404, reason = "Could not find application, entity or policy") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Could not find application, entity or policy") }) public Response stop( @ApiParam(name = "application", value = "Application ID or name", required = true) @@ -136,8 +136,8 @@ public interface PolicyApi { @POST @Path("/{policy}/destroy") @ApiOperation(value = "Destroy a policy", notes="Removes a policy from being associated with the entity and destroys it (stopping first if running)") - @ApiErrors(value = { - @ApiError(code = 404, reason = "Could not find application, entity or policy") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Could not find application, entity or policy") }) public Response destroy( @ApiParam(name = "application", value = "Application ID or name", required = true) http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ab086feb/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/PolicyConfigApi.java ---------------------------------------------------------------------- diff --git a/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/PolicyConfigApi.java b/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/PolicyConfigApi.java index da5ca86..2421ca5 100644 --- a/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/PolicyConfigApi.java +++ b/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/PolicyConfigApi.java @@ -20,10 +20,10 @@ package org.apache.brooklyn.rest.api; import org.apache.brooklyn.swagger.annotations.Apidoc; import org.apache.brooklyn.rest.domain.PolicyConfigSummary; -import com.wordnik.swagger.core.ApiError; -import com.wordnik.swagger.core.ApiErrors; -import com.wordnik.swagger.core.ApiOperation; -import com.wordnik.swagger.core.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; @@ -39,10 +39,10 @@ public interface PolicyConfigApi { @GET @ApiOperation(value = "Fetch the config keys for a specific policy", - responseClass = "org.apache.brooklyn.rest.domain.ConfigSummary", - multiValueResponse = true) - @ApiErrors(value = { - @ApiError(code = 404, reason = "Could not find application or entity or policy") + response = org.apache.brooklyn.rest.domain.ConfigSummary.class, + responseContainer = "List") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Could not find application or entity or policy") }) public List<PolicyConfigSummary> list( @ApiParam(value = "Application ID or name", required = true) @@ -67,9 +67,9 @@ public interface PolicyConfigApi { @GET @Path("/{config}") - @ApiOperation(value = "Fetch config value", responseClass = "Object") - @ApiErrors(value = { - @ApiError(code = 404, reason = "Could not find application, entity, policy or config key") + @ApiOperation(value = "Fetch config value", response = Object.class) + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Could not find application, entity, policy or config key") }) public String get( @ApiParam(value = "Application ID or name", required = true) @@ -85,8 +85,8 @@ public interface PolicyConfigApi { @POST @Path("/{config}/set") @ApiOperation(value = "Sets the given config on this policy") - @ApiErrors(value = { - @ApiError(code = 404, reason = "Could not find application, entity, policy or config key") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Could not find application, entity, policy or config key") }) public Response set( @ApiParam(value = "Application ID or name", required = true) @@ -103,8 +103,8 @@ public interface PolicyConfigApi { @POST @Path("/{config}") @ApiOperation(value = "Sets the given config on this policy") - @ApiErrors(value = { - @ApiError(code = 404, reason = "Could not find application, entity, policy or config key") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Could not find application, entity, policy or config key") }) public Response set( @ApiParam(value = "Application ID or name", required = true) http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ab086feb/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/ScriptApi.java ---------------------------------------------------------------------- diff --git a/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/ScriptApi.java b/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/ScriptApi.java index bd0491b..6f809dd 100644 --- a/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/ScriptApi.java +++ b/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/ScriptApi.java @@ -20,8 +20,8 @@ package org.apache.brooklyn.rest.api; import org.apache.brooklyn.swagger.annotations.Apidoc; import org.apache.brooklyn.rest.domain.ScriptExecutionSummary; -import com.wordnik.swagger.core.ApiOperation; -import com.wordnik.swagger.core.ApiParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.Consumes; @@ -44,7 +44,7 @@ public interface ScriptApi { @Path("/groovy") @Consumes("application/text") @ApiOperation(value = "Execute a groovy script", - responseClass = "org.apache.brooklyn.rest.domain.SensorSummary") + response = org.apache.brooklyn.rest.domain.SensorSummary.class) public ScriptExecutionSummary groovy( @Context HttpServletRequest request, @ApiParam(name = "script", value = "Groovy script to execute", required = true) http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ab086feb/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/SensorApi.java ---------------------------------------------------------------------- diff --git a/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/SensorApi.java b/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/SensorApi.java index 69517dc..63bb119 100644 --- a/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/SensorApi.java +++ b/usage/rest-api/src/main/java/org/apache/brooklyn/rest/api/SensorApi.java @@ -35,10 +35,10 @@ import javax.ws.rs.core.MediaType; import org.apache.brooklyn.swagger.annotations.Apidoc; import org.apache.brooklyn.rest.domain.SensorSummary; -import com.wordnik.swagger.core.ApiError; -import com.wordnik.swagger.core.ApiErrors; -import com.wordnik.swagger.core.ApiOperation; -import com.wordnik.swagger.core.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; @Path("/v1/applications/{application}/entities/{entity}/sensors") @Apidoc("Entity Sensors") @@ -48,10 +48,10 @@ public interface SensorApi { @GET @ApiOperation(value = "Fetch the sensor list for a specific application entity", - responseClass = "org.apache.brooklyn.rest.domain.SensorSummary", - multiValueResponse = true) - @ApiErrors(value = { - @ApiError(code = 404, reason = "Could not find application or entity") + response = org.apache.brooklyn.rest.domain.SensorSummary.class, + responseContainer = "List") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Could not find application or entity") }) public List<SensorSummary> list( @ApiParam(value = "Application ID or name", required = true) @@ -72,9 +72,9 @@ public interface SensorApi { @GET @Path("/{sensor}") - @ApiOperation(value = "Fetch sensor value (json)", responseClass = "Object") - @ApiErrors(value = { - @ApiError(code = 404, reason = "Could not find application, entity or sensor") + @ApiOperation(value = "Fetch sensor value (json)", response = Object.class) + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Could not find application, entity or sensor") }) public Object get( @ApiParam(value = "Application ID or name", required = true) @@ -89,9 +89,9 @@ public interface SensorApi { // this method is used if user has requested plain (ie not converting to json) @GET @Path("/{sensor}") - @ApiOperation(value = "Fetch sensor value (text/plain)", responseClass = "String") - @ApiErrors(value = { - @ApiError(code = 404, reason = "Could not find application, entity or sensor") + @ApiOperation(value = "Fetch sensor value (text/plain)", response = String.class) + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Could not find application, entity or sensor") }) @Produces(MediaType.TEXT_PLAIN) public String getPlain( @@ -106,8 +106,8 @@ public interface SensorApi { @POST @ApiOperation(value = "Manually set multiple sensor values") - @ApiErrors(value = { - @ApiError(code = 404, reason = "Could not find application or entity") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Could not find application or entity") }) @SuppressWarnings("rawtypes") public void setFromMap( @@ -121,8 +121,8 @@ public interface SensorApi { @POST @Path("/{sensor}") @ApiOperation(value = "Manually set a sensor value") - @ApiErrors(value = { - @ApiError(code = 404, reason = "Could not find application, entity or sensor") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Could not find application, entity or sensor") }) public void set( @ApiParam(value = "Application ID or name", required = true) @@ -137,8 +137,8 @@ public interface SensorApi { @DELETE @Path("/{sensor}") @ApiOperation(value = "Manually clear a sensor value") - @ApiErrors(value = { - @ApiError(code = 404, reason = "Could not find application, entity or sensor") + @ApiResponses(value = { + @ApiResponse(code = 404, message = "Could not find application, entity or sensor") }) public void delete( @ApiParam(value = "Application ID or name", required = true)