Skip to content

Commit

Permalink
Fix map:create() is not allowed based on the doc, but works siddhi-io#53
Browse files Browse the repository at this point in the history
 and

No-arg functions are not properly validated #1401
  • Loading branch information
suhothayan committed Jul 14, 2019
1 parent d996def commit d99554a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,26 +50,36 @@
@Parameter(name = "key1",
description = "Key 1",
type = {DataType.OBJECT, DataType.INT, DataType.LONG, DataType.FLOAT, DataType.DOUBLE,
DataType.FLOAT, DataType.BOOL, DataType.STRING},
dynamic = true
DataType.FLOAT, DataType.BOOL, DataType.STRING},
dynamic = true,
optional = true,
defaultValue = "-"
),
@Parameter(name = "value1",
description = "Value 1",
type = {DataType.OBJECT, DataType.INT, DataType.LONG, DataType.FLOAT, DataType.DOUBLE,
DataType.FLOAT, DataType.BOOL, DataType.STRING},
dynamic = true
dynamic = true,
optional = true,
defaultValue = "-"
),
},
parameterOverloads = {
@ParameterOverload(),
@ParameterOverload(parameterNames = {"key1", "value1"}),
@ParameterOverload(parameterNames = {"key1", "value1", "..."}),
},
returnAttributes = @ReturnAttribute(description = "Returns the created map object," +
" by pairing adjacent key value pairs.", type = DataType.OBJECT),
examples = @Example(
syntax = "map:create(1, 'one', 2, 'two', 3, 'three')",
description = "This returns a map with keys `1`, `2`, `3` mapped with their corresponding values, " +
"`one`, `two`, `three`.")
examples = {
@Example(
syntax = "map:create(1, 'one', 2, 'two', 3, 'three')",
description = "This returns a map with keys `1`, `2`, `3` mapped with " +
"their corresponding values, `one`, `two`, `three`."),
@Example(
syntax = "map:create()",
description = "This returns an empty map.")
}
)
public class CreateFunctionExtension extends FunctionExecutor {
private Attribute.Type returnType = Attribute.Type.OBJECT;
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
</profiles>

<properties>
<siddhi.version>5.0.2</siddhi.version>
<siddhi.version>5.1.1</siddhi.version>
<siddhi.import.version.range>[5.0.0, 6.0.0)</siddhi.import.version.range>
<log4j.version>1.2.17.wso2v1</log4j.version>
<org.json.wso2.version>2.0.0.wso2v1</org.json.wso2.version>
Expand Down

0 comments on commit d99554a

Please sign in to comment.