Skip to content

Commit b97121c

Browse files
vinicius.lopesuasouz
vinicius.lopes
authored andcommitted
fix: Use extra single value enum where const is used due to lack of support from jsonschema2pojo
1 parent ed00379 commit b97121c

File tree

3 files changed

+43
-2
lines changed

3 files changed

+43
-2
lines changed

api/src/main/resources/schema/workflow.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ $defs:
202202
call:
203203
type: string
204204
const: asyncapi
205+
enum: [asyncapi]
205206
with:
206207
type: object
207208
title: AsyncApiArguments
@@ -247,6 +248,7 @@ $defs:
247248
call:
248249
type: string
249250
const: grpc
251+
enum: [grpc]
250252
with:
251253
type: object
252254
title: GRPCArguments
@@ -301,7 +303,8 @@ $defs:
301303
properties:
302304
call:
303305
type: string
304-
const: http
306+
const: http
307+
enum: [http]
305308
with:
306309
type: object
307310
title: HTTPArguments
@@ -350,6 +353,7 @@ $defs:
350353
call:
351354
type: string
352355
const: openapi
356+
enum: [openapi]
353357
with:
354358
type: object
355359
title: OpenAPIArguments
@@ -1351,4 +1355,4 @@ $defs:
13511355
type: string
13521356
title: RuntimeExpression
13531357
description: A runtime expression.
1354-
pattern: "^\\s*\\$\\{.+\\}\\s*$"
1358+
pattern: "^\\s*\\$\\{.+\\}\\s*$"

api/src/test/java/io/serverlessworkflow/api/ApiTest.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import static io.serverlessworkflow.api.WorkflowReader.readWorkflowFromClasspath;
1919
import static org.assertj.core.api.Assertions.assertThat;
2020

21+
import io.serverlessworkflow.api.types.CallFunction;
2122
import io.serverlessworkflow.api.types.CallHTTP;
2223
import io.serverlessworkflow.api.types.CallTask;
2324
import io.serverlessworkflow.api.types.Task;
@@ -27,6 +28,24 @@
2728

2829
public class ApiTest {
2930

31+
@Test
32+
void testCallFunctionAPIWithoutArguments() throws IOException {
33+
Workflow workflow = readWorkflowFromClasspath("features/callFunction.yaml");
34+
assertThat(workflow.getDo()).isNotEmpty();
35+
assertThat(workflow.getDo().get(0).getName()).isNotNull();
36+
assertThat(workflow.getDo().get(0).getTask()).isNotNull();
37+
Task task = workflow.getDo().get(0).getTask();
38+
CallTask callTask = task.getCallTask();
39+
assertThat(callTask).isNotNull();
40+
assertThat(callTask.get()).isInstanceOf(CallFunction.class);
41+
if (callTask.get() instanceof CallFunction) {
42+
CallFunction functionCall = callTask.getCallFunction();
43+
assertThat(functionCall).isNotNull();
44+
assertThat(callTask.getCallAsyncAPI()).isNull();
45+
assertThat(functionCall.getWith()).isNull();
46+
}
47+
}
48+
3049
@Test
3150
void testCallHTTPAPI() throws IOException {
3251
Workflow workflow = readWorkflowFromClasspath("features/callHttp.yaml");
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
document:
2+
dsl: 1.0.0-alpha1
3+
namespace: default
4+
name: http-call-with-response-output
5+
6+
use:
7+
functions:
8+
getPet:
9+
call: http
10+
with:
11+
method: get
12+
endpoint:
13+
uri: https://petstore.swagger.io/v2/pet/{petId}
14+
output: response
15+
16+
do:
17+
- getPetFunctionCall:
18+
call: getPet

0 commit comments

Comments
 (0)