Skip to content

Commit 89b128d

Browse files
committed
Update documentation for expanded YAML schema
1 parent 9f2bc71 commit 89b128d

2 files changed

Lines changed: 45 additions & 26 deletions

File tree

scijava-ops-ext-parser/README.md

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,31 +28,39 @@ The input YAML should be formatted as follows:
2828
```yaml
2929
namespace: "ns" # Optional. If present, your ops will all have "ns.MethodName" aliases.
3030
# (in addition to the per-method manually assigned aliases)
31-
version: "x" # Optional. If present, all ops will include this version metadata.
31+
version: "0" # Optional. If present, all ops will include this version metadata.
3232

33-
# Optional list of authors to apply to all Ops
33+
# Optional single or list of authors to apply to all Ops
3434
authors:
3535
- "author 1"
3636
- "author 2"
3737
- ...
3838

39-
# Optional. If "containers" is present, the value is a list of fully qualified
40-
# class names. Op methods that contain 2 or more of parameters with these types
41-
# will be marked as Computers, with the second occurrance being the "output"
42-
# param.
43-
containers:
44-
- "container.1.name"
45-
- "container.2.name"
46-
- ...
47-
48-
# You can include as many base classes as you wish. Each fully-qualified class
49-
# name should map to a map of method names to aliases. All methods in the base
50-
# class with that name will be indexed under the given alias. The alias should
51-
# be "SciJava" style - e.g. if your method performs a Gaussian filter, alias it
52-
# "filter.gauss"
39+
# The remaining entries define the actual Ops to include. Ops are specified by
40+
# fully-qualified class name. You can include as many base classes as you wish.
41+
# Each class name should map to a map of method names to metadata for Ops of
42+
# that method. You may include as many methods as desired from the base class.
43+
# All methods with that name in the base class will be processed as Ops.
5344
fully.qualified.className:
54-
method1Name: "method1.alias"
55-
method2Name: "method2.alias"
45+
methodName:
46+
# The alias should be "SciJava" style - e.g. if your method performs a
47+
# Gaussian filter, alias it "filter.gauss"
48+
alias: "method.alias"
49+
# Same as the global authors key. Method-specific authors supersede
50+
# (replace) the global entry for these Ops.
51+
authors: "author name"
52+
# The type specification is essential for non-Function methods. If your
53+
# methods include a pre-allocated buffer or an item that is modified as part
54+
# of execution, their type should be 'ComputerN' or 'InplaceN' respectively,
55+
# where 'N' is the one-based index of the parameter being modified.
56+
type: "Type"
57+
# Optional priority to apply to all Ops for this method, used during
58+
# Op matching in the case multiple Ops satisfy the parameter and name
59+
# for a given request.
60+
priority: "0.0"
61+
# Optional description to apply to all Ops for this method. This will appear
62+
# in help text queries for the Op.
63+
description: "method description"
5664
...
5765
...
5866
```

scijava-ops-ext-parser/src/main/java/org/scijava/ops/parser/OpParser.java

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,26 @@
4646
* Entry point for parsing external libraries to ops (via {@link #main}). <br/>
4747
* Expected YAML structure is:
4848
* <ul>
49-
* <li>namespace:string # Optional string for aliasing methods to
49+
* <li>namespace:String # Optional string for aliasing methods to
5050
* "namespace.methodName"</li>
51-
* <li>version:string # Optional version number for versioning input YAML</li>
52-
* <li>authors:List #Optional list of authors to apply to all ops</li>
53-
* <li>containers:List # Optional list fully-qualified data structure classes to
54-
* consider as potential containers</li>
55-
* <li>class:(method:alias) # One or more. Map of class name containing op
56-
* methods to a map of method names within that class, mapped to the "SciJava
57-
* Ops-style" name for that method</li>
51+
* <li>version:String # Optional version number for versioning input YAML</li>
52+
* <li>authors:String|List #Optional one or more authors to apply to all
53+
* ops</li>
54+
* <li>class:(Op map) # One or more. Map of class name containing op methods to
55+
* a map of method names within that class. Supported fields for each method
56+
* include:
57+
* <ul>
58+
* <li>priority:String # Optional priority for Ops of this method</li>
59+
* <li>description:String # Optional description for Ops of this method</li>
60+
* <li>authors:String|List # Optional, as global list, but per-method list takes
61+
* precedence</li>
62+
* <li>type:String # Optional SciJava Ops type shorthand (e.g. Computer2). If
63+
* omitted, Ops for this method are assumed to be functions.</li>
64+
* <li>alias:String|List # Optional, one or more names for the Ops to be aliased
65+
* under. This is in addition to the namespace aliasing. If omitted, defaults to
66+
* 'ext.Method'</li>
67+
* </ul>
68+
* </li>
5869
* </ul>
5970
*
6071
* @author Mark Hiner

0 commit comments

Comments
 (0)