Skip to content

Commit

Permalink
Add @deprecated annotation to deprecated JAX-RS resources for Swagger (
Browse files Browse the repository at this point in the history
…treasure-data#1286)

* Add @deprecated annotation to deprecated JAX-RS resources for Swagger

Swagger API document displays endpoints with `@Deprecated` annotation
with grayed out.

* /api/workflow is also deprecated

* Added @ApiOperation("(deprecated)") to visualize at docs.digdag.io/api/
  • Loading branch information
frsyuki authored and yoyama committed Dec 24, 2019
1 parent 59b0906 commit 1b23035
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion digdag-cli/src/main/java/io/digdag/cli/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ public SystemExitException usage(String error)
err.println(" --disable-executor-loop disable workflow executor loop");
err.println(" --disable-scheduler disable scheduler");
err.println(" --disable-local-agent disable local task execution");
err.println(" --enable-swagger enable swagger api");
err.println(" --enable-swagger enable swagger api. Do not use in production because CORS");
err.println(" is also enabled on from any domains with all HTTP methods");
err.println(" -p, --param KEY=VALUE overwrites a parameter (use multiple times to set many parameters)");
err.println(" -H, --header KEY=VALUE a header to include in api HTTP responses");
err.println(" -P, --params-file PATH.yml reads parameters from a YAML file");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import io.digdag.core.session.SessionStoreManager;
import io.digdag.core.session.StoredSessionAttemptWithSession;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import javax.ws.rs.GET;
import javax.ws.rs.NotFoundException;
Expand Down Expand Up @@ -39,8 +40,10 @@ public AdminResource(
this.tm = tm;
}

@Deprecated
@GET
@Path("/api/admin/attempts/{id}/userinfo")
@ApiOperation("(deprecated)")
public Config getUserInfo(@PathParam("id") long id)
throws ResourceNotFoundException
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,11 @@ private static StoredProject ensureNotDeletedProject(StoredProject proj)
return proj;
}

// /<singular> style is deprecated. Use /api/projects with filter instead
@Deprecated
@GET
@Path("/api/project")
@ApiOperation("(deprecated)")
public RestProject getProject(@QueryParam("name") String name)
throws ResourceNotFoundException
{
Expand Down Expand Up @@ -314,8 +317,11 @@ public RestRevisionCollection getRevisions(
}, ResourceNotFoundException.class);
}

// /<singular> style is deprecated. Use /api/projects/{id}/workflows with filter instead
@Deprecated
@GET
@Path("/api/projects/{id}/workflow")
@ApiOperation("(deprecated)")
public RestWorkflowDefinition getWorkflow(@PathParam("id") int projId, @QueryParam("name") String name, @QueryParam("revision") String revName)
throws ResourceNotFoundException
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,11 @@ public WorkflowResource(
this.tm = tm;
}

// /<singular> style is deprecated. Use /api/workflows with filter instead
@Deprecated
@GET
@Path("/api/workflow")
@ApiOperation("(deprecated)")
public RestWorkflowDefinition getWorkflowDefinition(
@QueryParam("project") String projName,
@QueryParam("revision") String revName,
Expand Down

0 comments on commit 1b23035

Please sign in to comment.