Skip to content

Commit 074ea1f

Browse files
Merge pull request #273 from ricardozanini/sync-4.0.5
Sync branch 4.0.x with main to release 4.0.5
2 parents 3d7ef6e + d8cb9b7 commit 074ea1f

File tree

29 files changed

+971
-888
lines changed

29 files changed

+971
-888
lines changed

.github/dependabot.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "maven" # See documentation for possible values
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "weekly"
12+
assignees:
13+
- ricardozanini
14+
- tsurdilo

.github/project.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
release:
2+
current-version: 4.0.5
3+
next-version: 5.0.0-SNAPSHOT

.github/workflows/maven-deploy.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

.github/workflows/maven-verify.yml

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,28 @@
11
# This workflow will build a Java project with Maven
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
33

4-
name: Verify JAVA SDK
4+
name: sdk-java Verify
55

66
on:
77
push:
88
branches:
9-
- main
9+
- 4.0.*
1010
pull_request:
1111
branches:
12-
- main
12+
- 4.0.*
1313
jobs:
1414
build:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v2
18-
- name: Set up JDK 1.8
19-
uses: actions/setup-java@v1
20-
with:
21-
java-version: 1.8
22-
- name: Cache Maven packages
23-
uses: actions/cache@v2
24-
with:
25-
path: ~/.m2
26-
key: ${{ runner.os }}-m2-${{ hashFiles('pom.xml') }}
27-
restore-keys: ${{ runner.os }}-m2
28-
- name: Verify with Maven
29-
run: |
30-
mvn -B -f pom.xml clean install verify
17+
- uses: actions/checkout@v2
18+
19+
- name: Set up JDK 1.8
20+
uses: actions/setup-java@v3
21+
with:
22+
distribution: temurin
23+
java-version: 8
24+
cache: 'maven'
25+
26+
- name: Verify with Maven
27+
run: |
28+
mvn -B -f pom.xml clean install verify

.github/workflows/pre-release.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: sdk-java Pre Release
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '.github/project.yml'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
name: pre release
12+
13+
steps:
14+
- uses: radcortez/project-metadata-action@master
15+
name: retrieve project metadata
16+
id: metadata
17+
with:
18+
github-token: ${{secrets.GITHUB_TOKEN}}
19+
metadata-file-path: '.github/project.yml'
20+
21+
- name: Validate version
22+
if: contains(steps.metadata.outputs.current-version, 'SNAPSHOT')
23+
run: |
24+
echo '::error::Cannot release a SNAPSHOT version.'
25+
exit 1

.github/workflows/release.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: sdk-java Release
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
paths:
7+
- '.github/project.yml'
8+
9+
jobs:
10+
release:
11+
runs-on: ubuntu-latest
12+
name: release
13+
if: ${{github.event.pull_request.merged == true}}
14+
15+
steps:
16+
- uses: radcortez/project-metadata-action@main
17+
name: Retrieve project metadata
18+
id: metadata
19+
with:
20+
github-token: ${{secrets.GITHUB_TOKEN}}
21+
metadata-file-path: '.github/project.yml'
22+
23+
- uses: actions/checkout@v3
24+
25+
- name: Import GPG key
26+
id: import_gpg
27+
uses: crazy-max/ghaction-import-gpg@v5
28+
with:
29+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
30+
passphrase: ${{ secrets.GPG_PASSPHRASE }}
31+
32+
- name: Set up JDK 1.8
33+
uses: actions/setup-java@v3
34+
with:
35+
distribution: temurin
36+
java-version: 8
37+
cache: 'maven'
38+
server-id: ossrh
39+
server-username: MAVEN_USERNAME
40+
server-password: MAVEN_PASSWORD
41+
42+
- name: Configure Git author
43+
run: |
44+
git config --local user.email "[email protected]"
45+
git config --local user.name "GitHub Action"
46+
47+
- name: Maven release ${{steps.metadata.outputs.current-version}}
48+
run: |
49+
mvn -B release:prepare -Prelease -DreleaseVersion=${{steps.metadata.outputs.current-version}} -DdevelopmentVersion=${{steps.metadata.outputs.next-version}}
50+
mvn -B release:perform -Darguments=-DperformRelease -DperformRelease -Prelease
51+
env:
52+
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
53+
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
54+
55+
- name: Push changes to ${{github.base_ref}} branch
56+
run: |
57+
git push
58+
git push origin ${{steps.metadata.outputs.current-version}}

api/pom.xml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,31 +26,19 @@
2626
<dependency>
2727
<groupId>com.fasterxml.jackson.core</groupId>
2828
<artifactId>jackson-core</artifactId>
29-
<version>[2.13.0,)</version>
3029
</dependency>
3130
<dependency>
3231
<groupId>com.fasterxml.jackson.core</groupId>
3332
<artifactId>jackson-databind</artifactId>
34-
<version>[2.13.0,)</version>
3533
</dependency>
3634
<dependency>
3735
<groupId>com.fasterxml.jackson.dataformat</groupId>
3836
<artifactId>jackson-dataformat-yaml</artifactId>
39-
<version>[2.13.0,)</version>
4037
</dependency>
4138
<dependency>
4239
<groupId>javax.validation</groupId>
4340
<artifactId>validation-api</artifactId>
4441
</dependency>
45-
<dependency>
46-
<groupId>org.json</groupId>
47-
<artifactId>json</artifactId>
48-
</dependency>
49-
<dependency>
50-
<groupId>com.github.erosb</groupId>
51-
<artifactId>everit-json-schema</artifactId>
52-
</dependency>
53-
5442
<!-- test -->
5543
<dependency>
5644
<groupId>org.junit.jupiter</groupId>

api/src/main/java/io/serverlessworkflow/api/deserializers/AuthDeserializer.java

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,13 @@
2020
import com.fasterxml.jackson.databind.JsonNode;
2121
import com.fasterxml.jackson.databind.ObjectMapper;
2222
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
23-
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
2423
import io.serverlessworkflow.api.auth.AuthDefinition;
2524
import io.serverlessworkflow.api.interfaces.WorkflowPropertySource;
2625
import io.serverlessworkflow.api.utils.Utils;
2726
import io.serverlessworkflow.api.workflow.Auth;
2827
import java.io.IOException;
2928
import java.util.ArrayList;
3029
import java.util.List;
31-
import org.json.JSONObject;
3230
import org.slf4j.Logger;
3331
import org.slf4j.LoggerFactory;
3432

@@ -69,21 +67,8 @@ public Auth deserialize(JsonParser jp, DeserializationContext ctxt) throws IOExc
6967
} else {
7068
String authFileDef = node.asText();
7169
String authFileSrc = Utils.getResourceFileAsString(authFileDef);
72-
JsonNode authRefNode;
73-
ObjectMapper jsonWriter = new ObjectMapper();
7470
if (authFileSrc != null && authFileSrc.trim().length() > 0) {
75-
// if its a yaml def convert to json first
76-
if (!authFileSrc.trim().startsWith("{")) {
77-
// convert yaml to json to validate
78-
ObjectMapper yamlReader = new ObjectMapper(new YAMLFactory());
79-
Object obj = yamlReader.readValue(authFileSrc, Object.class);
80-
81-
authRefNode =
82-
jsonWriter.readTree(new JSONObject(jsonWriter.writeValueAsString(obj)).toString());
83-
} else {
84-
authRefNode = jsonWriter.readTree(new JSONObject(authFileSrc).toString());
85-
}
86-
71+
JsonNode authRefNode = Utils.getNode(authFileSrc);
8772
JsonNode refAuth = authRefNode.get("auth");
8873
if (refAuth != null) {
8974
for (final JsonNode nodeEle : refAuth) {

api/src/main/java/io/serverlessworkflow/api/deserializers/ConstantsDeserializer.java

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,11 @@
1818
import com.fasterxml.jackson.core.JsonParser;
1919
import com.fasterxml.jackson.databind.DeserializationContext;
2020
import com.fasterxml.jackson.databind.JsonNode;
21-
import com.fasterxml.jackson.databind.ObjectMapper;
2221
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
23-
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
2422
import io.serverlessworkflow.api.interfaces.WorkflowPropertySource;
2523
import io.serverlessworkflow.api.utils.Utils;
2624
import io.serverlessworkflow.api.workflow.Constants;
2725
import java.io.IOException;
28-
import org.json.JSONObject;
2926
import org.slf4j.Logger;
3027
import org.slf4j.LoggerFactory;
3128

@@ -63,21 +60,8 @@ public Constants deserialize(JsonParser jp, DeserializationContext ctxt) throws
6360
} else {
6461
String constantsFileDef = node.asText();
6562
String constantsFileSrc = Utils.getResourceFileAsString(constantsFileDef);
66-
JsonNode constantsRefNode;
67-
ObjectMapper jsonWriter = new ObjectMapper();
6863
if (constantsFileSrc != null && constantsFileSrc.trim().length() > 0) {
69-
// if its a yaml def convert to json first
70-
if (!constantsFileSrc.trim().startsWith("{")) {
71-
// convert yaml to json to validate
72-
ObjectMapper yamlReader = new ObjectMapper(new YAMLFactory());
73-
Object obj = yamlReader.readValue(constantsFileSrc, Object.class);
74-
75-
constantsRefNode =
76-
jsonWriter.readTree(new JSONObject(jsonWriter.writeValueAsString(obj)).toString());
77-
} else {
78-
constantsRefNode = jsonWriter.readTree(new JSONObject(constantsFileSrc).toString());
79-
}
80-
64+
JsonNode constantsRefNode = Utils.getNode(constantsFileSrc);
8165
JsonNode refConstants = constantsRefNode.get("constants");
8266
if (refConstants != null) {
8367
constantsDefinition = refConstants;

api/src/main/java/io/serverlessworkflow/api/deserializers/ErrorsDeserializer.java

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,13 @@
2020
import com.fasterxml.jackson.databind.JsonNode;
2121
import com.fasterxml.jackson.databind.ObjectMapper;
2222
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
23-
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
2423
import io.serverlessworkflow.api.error.ErrorDefinition;
2524
import io.serverlessworkflow.api.interfaces.WorkflowPropertySource;
2625
import io.serverlessworkflow.api.utils.Utils;
2726
import io.serverlessworkflow.api.workflow.Errors;
2827
import java.io.IOException;
2928
import java.util.ArrayList;
3029
import java.util.List;
31-
import org.json.JSONObject;
3230
import org.slf4j.Logger;
3331
import org.slf4j.LoggerFactory;
3432

@@ -69,21 +67,8 @@ public Errors deserialize(JsonParser jp, DeserializationContext ctxt) throws IOE
6967
} else {
7068
String errorsFileDef = node.asText();
7169
String errorsFileSrc = Utils.getResourceFileAsString(errorsFileDef);
72-
JsonNode errorsRefNode;
73-
ObjectMapper jsonWriter = new ObjectMapper();
7470
if (errorsFileSrc != null && errorsFileSrc.trim().length() > 0) {
75-
// if its a yaml def convert to json first
76-
if (!errorsFileSrc.trim().startsWith("{")) {
77-
// convert yaml to json to validate
78-
ObjectMapper yamlReader = new ObjectMapper(new YAMLFactory());
79-
Object obj = yamlReader.readValue(errorsFileSrc, Object.class);
80-
81-
errorsRefNode =
82-
jsonWriter.readTree(new JSONObject(jsonWriter.writeValueAsString(obj)).toString());
83-
} else {
84-
errorsRefNode = jsonWriter.readTree(new JSONObject(errorsFileSrc).toString());
85-
}
86-
71+
JsonNode errorsRefNode = Utils.getNode(errorsFileSrc);
8772
JsonNode refErrors = errorsRefNode.get("errors");
8873
if (refErrors != null) {
8974
for (final JsonNode nodeEle : refErrors) {

api/src/main/java/io/serverlessworkflow/api/deserializers/EventsDeserializer.java

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,13 @@
2020
import com.fasterxml.jackson.databind.JsonNode;
2121
import com.fasterxml.jackson.databind.ObjectMapper;
2222
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
23-
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
2423
import io.serverlessworkflow.api.events.EventDefinition;
2524
import io.serverlessworkflow.api.interfaces.WorkflowPropertySource;
2625
import io.serverlessworkflow.api.utils.Utils;
2726
import io.serverlessworkflow.api.workflow.Events;
2827
import java.io.IOException;
2928
import java.util.ArrayList;
3029
import java.util.List;
31-
import org.json.JSONObject;
3230
import org.slf4j.Logger;
3331
import org.slf4j.LoggerFactory;
3432

@@ -69,21 +67,9 @@ public Events deserialize(JsonParser jp, DeserializationContext ctxt) throws IOE
6967
} else {
7068
String eventsFileDef = node.asText();
7169
String eventsFileSrc = Utils.getResourceFileAsString(eventsFileDef);
72-
JsonNode eventsRefNode;
73-
ObjectMapper jsonWriter = new ObjectMapper();
7470
if (eventsFileSrc != null && eventsFileSrc.trim().length() > 0) {
7571
// if its a yaml def convert to json first
76-
if (!eventsFileSrc.trim().startsWith("{")) {
77-
// convert yaml to json to validate
78-
ObjectMapper yamlReader = new ObjectMapper(new YAMLFactory());
79-
Object obj = yamlReader.readValue(eventsFileSrc, Object.class);
80-
81-
eventsRefNode =
82-
jsonWriter.readTree(new JSONObject(jsonWriter.writeValueAsString(obj)).toString());
83-
} else {
84-
eventsRefNode = jsonWriter.readTree(new JSONObject(eventsFileSrc).toString());
85-
}
86-
72+
JsonNode eventsRefNode = Utils.getNode(eventsFileSrc);
8773
JsonNode refEvents = eventsRefNode.get("events");
8874
if (refEvents != null) {
8975
for (final JsonNode nodeEle : refEvents) {

0 commit comments

Comments
 (0)