-
Notifications
You must be signed in to change notification settings - Fork 49
Fix #359 - Add support to DSL 1.0.0 #367
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
Merged
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
3355738
[Fix_#359] Migration to 0.10 DSL
fjtirado 1d080a8
[Fix_#359] Rebase
fjtirado 074f559
[Fix_#359] Handling anyOf
fjtirado 84fff10
[Fix_#359] Common class
fjtirado e80e149
[Fix #359] Deserialization
fjtirado a2f268b
[Fix #359] More deserialization
fjtirado 78a598e
[Fix #359] Naming
fjtirado e804006
[Fix #359] Enhacing deserialization
fjtirado fd4b7c4
[Fix #359] Ricardos comments
fjtirado File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,4 +28,5 @@ target/ | |
build/ | ||
|
||
### VS Code ### | ||
.vscode/ | ||
.vscode/ | ||
/.checkstyle |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
api/src/main/java/io/serverlessworkflow/api/ObjectMapperFactory.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright 2020-Present The Serverless Workflow Specification Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.serverlessworkflow.api; | ||
|
||
import com.fasterxml.jackson.databind.DeserializationFeature; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.databind.SerializationFeature; | ||
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; | ||
import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator.Feature; | ||
|
||
class ObjectMapperFactory { | ||
|
||
private static final ObjectMapper jsonMapper = configure(new ObjectMapper()); | ||
|
||
private static final ObjectMapper yamlMapper = | ||
configure(new ObjectMapper(new YAMLFactory().enable(Feature.MINIMIZE_QUOTES))); | ||
|
||
public static final ObjectMapper jsonMapper() { | ||
return jsonMapper; | ||
} | ||
|
||
public static final ObjectMapper yamlMapper() { | ||
return yamlMapper; | ||
} | ||
|
||
private static ObjectMapper configure(ObjectMapper mapper) { | ||
return mapper | ||
.configure(SerializationFeature.INDENT_OUTPUT, true) | ||
.configure(SerializationFeature.WRITE_EMPTY_JSON_ARRAYS, false) | ||
.configure(SerializationFeature.WRITE_NULL_MAP_VALUES, false) | ||
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); | ||
} | ||
|
||
private ObjectMapperFactory() {} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
api/src/main/java/io/serverlessworkflow/api/WorkflowReader.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright 2020-Present The Serverless Workflow Specification Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.serverlessworkflow.api; | ||
|
||
import io.serverlessworkflow.api.types.Workflow; | ||
import java.io.FileNotFoundException; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.io.Reader; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
|
||
public class WorkflowReader { | ||
|
||
public static Workflow readWorkflow(InputStream input, WorkflowFormat format) throws IOException { | ||
return format.mapper().readValue(input, Workflow.class); | ||
} | ||
|
||
public static Workflow readWorkflow(Reader input, WorkflowFormat format) throws IOException { | ||
return format.mapper().readValue(input, Workflow.class); | ||
} | ||
|
||
public static Workflow readWorkflow(Path path, WorkflowFormat format) throws IOException { | ||
return format.mapper().readValue(Files.readAllBytes(path), Workflow.class); | ||
} | ||
|
||
public static Workflow readWorkflowFromClasspath(String classpath) throws IOException { | ||
ricardozanini marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return readWorkflowFromClasspath( | ||
classpath, | ||
Thread.currentThread().getContextClassLoader(), | ||
WorkflowFormat.fromFileName(classpath)); | ||
} | ||
|
||
public static Workflow readWorkflowFromClasspath( | ||
String classpath, ClassLoader cl, WorkflowFormat format) throws IOException { | ||
try (InputStream in = cl.getResourceAsStream(classpath)) { | ||
if (in == null) { | ||
throw new FileNotFoundException(classpath); | ||
} | ||
return readWorkflow(in, format); | ||
} | ||
} | ||
|
||
private WorkflowReader() {} | ||
} |
49 changes: 49 additions & 0 deletions
49
api/src/main/java/io/serverlessworkflow/api/WorkflowWriter.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright 2020-Present The Serverless Workflow Specification Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.serverlessworkflow.api; | ||
|
||
import io.serverlessworkflow.api.types.Workflow; | ||
import java.io.IOException; | ||
import java.io.OutputStream; | ||
import java.io.Writer; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
|
||
public class WorkflowWriter { | ||
|
||
public static void writeWorkflow(OutputStream output, Workflow workflow, WorkflowFormat format) | ||
throws IOException { | ||
format.mapper().writeValue(output, workflow); | ||
} | ||
|
||
public static void writeWorkflow(Writer output, Workflow workflow, WorkflowFormat format) | ||
throws IOException { | ||
format.mapper().writeValue(output, workflow); | ||
} | ||
|
||
public static void writeWorkflow(Path output, Workflow workflow) throws IOException { | ||
writeWorkflow(output, workflow, WorkflowFormat.fromPath(output)); | ||
} | ||
|
||
public static void writeWorkflow(Path output, Workflow workflow, WorkflowFormat format) | ||
throws IOException { | ||
try (OutputStream out = Files.newOutputStream(output)) { | ||
writeWorkflow(out, workflow, format); | ||
} | ||
} | ||
|
||
private WorkflowWriter() {} | ||
} |
80 changes: 0 additions & 80 deletions
80
api/src/main/java/io/serverlessworkflow/api/deserializers/AuthDefinitionDeserializer.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.