Closed lianqiw closed 8 years ago
Hi Lianqi,
Currently the software is defined to support command/config arguments that are primitive types or arrays of primitive types. Matrices are also supported, as are arrays of matrices. The reason is that the keys and values need to be converted to JSON format and should be understandable by different programming languages.
I'm not sure I understand what you are trying to do with the "anyOf" keyword. That would implement something like a C "union", which each parameter would have one of the listed types. Or was your intent to define something like a class that contains the three fields (index, friedParameter, windVelocity)?
Would it be possible to define three different parameters instead (each one can be a primitive type or an array of primitive types or matrices, etc.)? You should be able to give them names like "dm.index", "dm.friedParameter", "dm.windVelocity", if you want to make it clear that they belong together.
Allan
Note that we also support arrays of primitives and matrices of primitives as item types so we can have an array of arrays of primitives and an array of matrices of primitives...
On Sep 28, 2016 12:36 PM, "abrighton" notifications@github.com wrote:
Hi Lianqi,
Currently the software is defined to support command/config arguments that are primitive types or arrays of primitive types. The reason is that the keys and values need to be converted to JSON format and should be understandable by different programming languages.
I'm not sure I understand what you are trying to do with the "anyOf" keyword. That would implement something like a C "union", which each parameter would have one of the listed types. Or was your intent to define something like a class that contains the three fields (index, friedParameter, windVelocity)?
The anyof was taken from an online example. Without it, the validator reports an error. All I need is an array of classes that have the same format. This is valid json object, serialization shouldn't be a problem, right?
Would it be possible to define three different parameters instead (each one can be a primitive type or an array of primitive types)? You should be able to give them names like "dm.index", "dm.friedParameter", dm.windVelocity", if you want to make it clear that they belong together.
This is certainly a viable work around, although it will become more cumbersome to add or remove elements from all related parameters.
Lianqi
Allan
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
Hi Lianqi,
I think the solution here is to define separate parameters.
Also, we are planning on removing support for "anyOf" in the JSON schema for commands, so it should not be used there.
A class type object would be valid JSON, but the Scala and Java APIs we are using are based on primitive types. The JSON parsing is done automatically and that would be difficult to do if the value type was some unknown class type.
Allan
So same constraint applies to events as well, right? Events can only have fields that are primitive types or array of such.
Yes (or matrix, array of matrix of primitive types, etc.).
I will close the issue now.
For certain commands, I will like to pass an array of objects for some arguments to configure multiple entities of the same type. In this case, the generated API/ICD document shows type as "array of ?". Is it possible to list the properties of such object in a following table? Below is an example: