Skip to content

Commit

Permalink
feat: add endpoint to do syntax check only #3277 (#3299)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgomer2001 authored Dec 13, 2022
1 parent 8d743f2 commit 3b23636
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,26 @@ public Response createFlow(@Valid Flow flow)
return Response.status(Response.Status.CREATED).entity(minimize(flow, false)).build();
}

@POST
@Consumes(MediaType.TEXT_PLAIN)
@ProtectedApi(scopes = { ApiAccessConstants.AGAMA_READ_ACCESS }, groupScopes = {
ApiAccessConstants.AGAMA_WRITE_ACCESS }, superScopes = { ApiAccessConstants.SUPER_ADMIN_READ_ACCESS })
@Path("/syntax-check/" + ApiConstants.QNAME_PATH)
public Response doSyntaxCheck(@PathParam(ApiConstants.QNAME) String qname, String source) {

Exception e = null;
try {
Transpiler.runSyntaxCheck(qname, source);
e = new TranspilerException("");
} catch (SyntaxException | TranspilerException te) {
logger.info("Syntax check failed");
e = te;
}
e.setStackTrace(new StackTraceElement[0]);
return Response.ok().entity(e).build();

}

@Operation(summary = "Create a new agama flow from source", description = "Create a new agama flow from source.", operationId = "post-agama-flow-from-source", tags = {
"Agama - Configuration" }, security = @SecurityRequirement(name = "oauth2", scopes = {
ApiAccessConstants.AGAMA_WRITE_ACCESS }))
Expand Down

0 comments on commit 3b23636

Please sign in to comment.