Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add endpoint to do agama syntax check only #3299

Merged
merged 1 commit into from
Dec 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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