Skip to content

Commit

Permalink
initial support for CWL v1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-c committed Feb 1, 2023
1 parent 2435c91 commit 7f65643
Show file tree
Hide file tree
Showing 443 changed files with 36,906 additions and 0 deletions.
11 changes: 11 additions & 0 deletions adding_new_cwl_versions.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# discover the valid CWL files from the conformance tests:

cd ~/cwl-v1.1 # my local checkout of https://github.com/common-workflow-language/cwl-v1.1/
git ls-files -- tests | grep cwl$ | xargs -I{} bash -c 'cwltool --validate {} >/dev/null 2>/dev/null && echo {}' > valid_examples.txt
mkdir valid-examples; for file in $(cat valid_examples.txt); do cp ${file} valid-examples/valid_$(basename ${file}) ; done

# build the Java parser
schema-salad-tool --codegen java --codegen-package org.w3id.cwl.cwl1_1 --codegen-examples ~/cwl-v1.1/valid-examples ~/cwl-v1.1/CommonWorkflowLanguage.yml

mvn test
# copy missing files into ./src/test/resources/org/w3id/cwl/cwl1_1/utils
37 changes: 37 additions & 0 deletions src/main/java/org/w3id/cwl/cwl1_1/Any.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright Common Workflow Language project contributors
//
// 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 org.w3id.cwl.cwl1_1;

import org.w3id.cwl.cwl1_1.utils.ValidationException;

public enum Any {
ANY("Any");

private static String[] symbols = new String[] {"Any"};
private String docVal;

private Any(final String docVal) {
this.docVal = docVal;
}

public static Any fromDocumentVal(final String docVal) {
for(final Any val : Any.values()) {
if(val.docVal.equals(docVal)) {
return val;
}
}
throw new ValidationException(String.format("Expected one of %s", Any.symbols, docVal));
}
}
37 changes: 37 additions & 0 deletions src/main/java/org/w3id/cwl/cwl1_1/ArraySchema.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright Common Workflow Language project contributors
//
// 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 org.w3id.cwl.cwl1_1;

import org.w3id.cwl.cwl1_1.utils.Saveable;

/**
* Auto-generated interface for <I>https://w3id.org/cwl/salad#ArraySchema</I><BR>This interface is implemented by {@link ArraySchemaImpl}<BR>
*/
public interface ArraySchema extends Saveable {
/**
* Getter for property <I>https://w3id.org/cwl/salad#items</I><BR>
* <BLOCKQUOTE>
* Defines the type of the array elements. * </BLOCKQUOTE>
*/

Object getItems();
/**
* Getter for property <I>https://w3id.org/cwl/salad#type</I><BR>
* <BLOCKQUOTE>
* Must be `array` * </BLOCKQUOTE>
*/

enum_d062602be0b4b8fd33e69e29a841317b6ab665bc getType();
}
113 changes: 113 additions & 0 deletions src/main/java/org/w3id/cwl/cwl1_1/ArraySchemaImpl.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
// Copyright Common Workflow Language project contributors
//
// 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 org.w3id.cwl.cwl1_1;

import org.w3id.cwl.cwl1_1.utils.LoaderInstances;
import org.w3id.cwl.cwl1_1.utils.LoadingOptions;
import org.w3id.cwl.cwl1_1.utils.LoadingOptionsBuilder;
import org.w3id.cwl.cwl1_1.utils.SaveableImpl;
import org.w3id.cwl.cwl1_1.utils.ValidationException;

/**
* Auto-generated class implementation for <I>https://w3id.org/cwl/salad#ArraySchema</I><BR>
*/
public class ArraySchemaImpl extends SaveableImpl implements ArraySchema {
private LoadingOptions loadingOptions_ = new LoadingOptionsBuilder().build();
private java.util.Map<String, Object> extensionFields_ =
new java.util.HashMap<String, Object>();

private Object items;

/**
* Getter for property <I>https://w3id.org/cwl/salad#items</I><BR>
* <BLOCKQUOTE>
* Defines the type of the array elements. * </BLOCKQUOTE>
*/

public Object getItems() {
return this.items;
}

private enum_d062602be0b4b8fd33e69e29a841317b6ab665bc type;

/**
* Getter for property <I>https://w3id.org/cwl/salad#type</I><BR>
* <BLOCKQUOTE>
* Must be `array` * </BLOCKQUOTE>
*/

public enum_d062602be0b4b8fd33e69e29a841317b6ab665bc getType() {
return this.type;
}

/**
* Used by {@link org.w3id.cwl.cwl1_1.utils.RootLoader} to construct instances of ArraySchemaImpl.
*
* @param __doc_ Document fragment to load this record object from (presumably a
{@link java.util.Map}).
* @param __baseUri_ Base URI to generate child document IDs against.
* @param __loadingOptions Context for loading URIs and populating objects.
* @param __docRoot_ ID at this position in the document (if available) (maybe?)
* @throws ValidationException If the document fragment is not a {@link java.util.Map}
* or validation of fields fails.
*/
public ArraySchemaImpl(
final Object __doc_,
final String __baseUri_,
LoadingOptions __loadingOptions,
final String __docRoot_) {
super(__doc_, __baseUri_, __loadingOptions, __docRoot_);
// Prefix plumbing variables with '__' to reduce likelihood of collision with
// generated names.
String __baseUri = __baseUri_;
String __docRoot = __docRoot_;
if (!(__doc_ instanceof java.util.Map)) {
throw new ValidationException("ArraySchemaImpl called on non-map");
}
final java.util.Map<String, Object> __doc = (java.util.Map<String, Object>) __doc_;
final java.util.List<ValidationException> __errors =
new java.util.ArrayList<ValidationException>();
if (__loadingOptions != null) {
this.loadingOptions_ = __loadingOptions;
}
Object items;
try {
items =
LoaderInstances
.typedsl_union_of_PrimitiveType_or_RecordSchema_or_EnumSchema_or_ArraySchema_or_StringInstance_or_array_of_union_of_PrimitiveType_or_RecordSchema_or_EnumSchema_or_ArraySchema_or_StringInstance_2
.loadField(__doc.get("items"), __baseUri, __loadingOptions);
} catch (ValidationException e) {
items = null; // won't be used but prevents compiler from complaining.
final String __message = "the `items` field is not valid because:";
__errors.add(new ValidationException(__message, e));
}
enum_d062602be0b4b8fd33e69e29a841317b6ab665bc type;
try {
type =
LoaderInstances
.typedsl_enum_d062602be0b4b8fd33e69e29a841317b6ab665bc_2
.loadField(__doc.get("type"), __baseUri, __loadingOptions);
} catch (ValidationException e) {
type = null; // won't be used but prevents compiler from complaining.
final String __message = "the `type` field is not valid because:";
__errors.add(new ValidationException(__message, e));
}
if (!__errors.isEmpty()) {
throw new ValidationException("Trying 'RecordField'", __errors);
}
this.items = (Object) items;
this.type = (enum_d062602be0b4b8fd33e69e29a841317b6ab665bc) type;
}
}
45 changes: 45 additions & 0 deletions src/main/java/org/w3id/cwl/cwl1_1/CWLType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright Common Workflow Language project contributors
//
// 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 org.w3id.cwl.cwl1_1;

import org.w3id.cwl.cwl1_1.utils.ValidationException;

public enum CWLType {
NULL("null"),
BOOLEAN("boolean"),
INT("int"),
LONG("long"),
FLOAT("float"),
DOUBLE("double"),
STRING("string"),
FILE("File"),
DIRECTORY("Directory");

private static String[] symbols = new String[] {"null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"};
private String docVal;

private CWLType(final String docVal) {
this.docVal = docVal;
}

public static CWLType fromDocumentVal(final String docVal) {
for(final CWLType val : CWLType.values()) {
if(val.docVal.equals(docVal)) {
return val;
}
}
throw new ValidationException(String.format("Expected one of %s", CWLType.symbols, docVal));
}
}
50 changes: 50 additions & 0 deletions src/main/java/org/w3id/cwl/cwl1_1/CWLVersion.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Copyright Common Workflow Language project contributors
//
// 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 org.w3id.cwl.cwl1_1;

import org.w3id.cwl.cwl1_1.utils.ValidationException;

public enum CWLVersion {
DRAFT_2("draft-2"),
DRAFT_3_DEV1("draft-3.dev1"),
DRAFT_3_DEV2("draft-3.dev2"),
DRAFT_3_DEV3("draft-3.dev3"),
DRAFT_3_DEV4("draft-3.dev4"),
DRAFT_3_DEV5("draft-3.dev5"),
DRAFT_3("draft-3"),
DRAFT_4_DEV1("draft-4.dev1"),
DRAFT_4_DEV2("draft-4.dev2"),
DRAFT_4_DEV3("draft-4.dev3"),
V1_0_DEV4("v1.0.dev4"),
V1_0("v1.0"),
V1_1_0_DEV1("v1.1.0-dev1"),
V1_1("v1.1");

private static String[] symbols = new String[] {"draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1"};
private String docVal;

private CWLVersion(final String docVal) {
this.docVal = docVal;
}

public static CWLVersion fromDocumentVal(final String docVal) {
for(final CWLVersion val : CWLVersion.values()) {
if(val.docVal.equals(docVal)) {
return val;
}
}
throw new ValidationException(String.format("Expected one of %s", CWLVersion.symbols, docVal));
}
}
65 changes: 65 additions & 0 deletions src/main/java/org/w3id/cwl/cwl1_1/CommandInputArraySchema.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// Copyright Common Workflow Language project contributors
//
// 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 org.w3id.cwl.cwl1_1;

import org.w3id.cwl.cwl1_1.utils.Saveable;

/**
* Auto-generated interface for <I>https://w3id.org/cwl/cwl#CommandInputArraySchema</I><BR>This interface is implemented by {@link CommandInputArraySchemaImpl}<BR>
*/
public interface CommandInputArraySchema extends InputArraySchema, CommandInputSchema, CommandLineBindable, Saveable {
/**
* Getter for property <I>https://w3id.org/cwl/cwl#IOSchema/name</I><BR>
* <BLOCKQUOTE>
* The identifier for this type * </BLOCKQUOTE>
*/

java.util.Optional<String> getName();
/**
* Getter for property <I>https://w3id.org/cwl/salad#items</I><BR>
* <BLOCKQUOTE>
* Defines the type of the array elements. * </BLOCKQUOTE>
*/

Object getItems();
/**
* Getter for property <I>https://w3id.org/cwl/salad#type</I><BR>
* <BLOCKQUOTE>
* Must be `array` * </BLOCKQUOTE>
*/

enum_d062602be0b4b8fd33e69e29a841317b6ab665bc getType();
/**
* Getter for property <I>https://w3id.org/cwl/cwl#Labeled/label</I><BR>
* <BLOCKQUOTE>
* A short, human-readable label of this object. * </BLOCKQUOTE>
*/

java.util.Optional<String> getLabel();
/**
* Getter for property <I>https://w3id.org/cwl/salad#Documented/doc</I><BR>
* <BLOCKQUOTE>
* A documentation string for this object, or an array of strings which should be concatenated. * </BLOCKQUOTE>
*/

Object getDoc();
/**
* Getter for property <I>https://w3id.org/cwl/cwl#CommandLineBindable/inputBinding</I><BR>
* <BLOCKQUOTE>
* Describes how to turn this object into command line arguments. * </BLOCKQUOTE>
*/

java.util.Optional<CommandLineBinding> getInputBinding();
}
Loading

0 comments on commit 7f65643

Please sign in to comment.