Open ciozi137 opened 4 days ago
Remove support for "all" in channel#: it is not supported by the hardware e,g, AL;S/cr
; I don't see the point in having it to set all channels the same...just call setChannel
N times
refactor and move to issue description
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "array",
"items": {
"$ref": "#/definitions/channelProperties"
},
"minItems": 1,
"maxItems": 8
}
[
{
"channel": 1,
"gain": 10,
"input": "SE+",
"shunt": "500",
"couple": "AC",
"filter": "ON"
},
{
"channel": 2,
"gain": 100,
"input": "DIFF",
"shunt": "10000000",
"couple": "DC",
"filter": "OFF"
},
{
"channel": 3,
"gain": 1,
"input": "OFF",
"shunt": "OPEN",
"couple": "AC",
"filter": "ON"
}
]
@ciozi137
#/definitions/channelProperties
) inside channelPropertieschannelPropertiesSch.json#/definitions/channelProperties
i.e. (Database schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "array",
"items": {
"$ref": "channelPropertiesSch.json#/definitions/channelProperties"
},
"minItems": 1,
"maxItems": 8
}
@pgwijesinghe here is what I observe:
regarding the "database schema" I'm wondering if there is a way to reference channelProperties if they are both in the same file?
something like:
{
{"channelPropertiesSch"},
{"schema that references channelPropertiesSch"}
}
OK I think I see the gist of what I need. something like:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"channelPropertiesSch": {}
},
"setChannelSch": {
"$ref": "#/channelPropertiesSch"
},
"getChannelSch": {
"$ref": "#/channelPropertiesSch"
}
}
@ciozi137 I see. In that case, we can do something like this, right? (tested it here)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$ref": "#/databaseSch", //schema selection
"definitions": {
"channelPropertiesSch": {
"type": "object",
"properties": {
"channel": {
"type": "integer",
"minimum": 1,
"maximum": 8
},
"gain": {
"type": "integer",
"enum": [1, 10, 100, 1000]
},
"input": {
"type": "string",
"enum": ["OFF", "SE+", "SE-", "DIFF"]
},
"shunt": {
"type": "string",
"enum": ["OPEN", "50", "500", "5000", "50000", "10000000"]
},
"couple": {
"type": "string",
"enum": ["AC", "DC"]
},
"filter": {
"type": "string",
"enum": ["OFF", "ON"]
}
},
"required": ["channel", "gain", "input", "shunt", "couple", "filter"]
}
},
"setChannelSch": {
"$ref": "#/definitions/channelPropertiesSch"
},
"getChannelSch": {
"$ref": "#/definitions/channelPropertiesSch"
},
"databaseSch": {
"type": "array",
"items": {
"$ref": "#/definitions/channelPropertiesSch"
},
"minItems": 1,
"maxItems": 8
}
}
Ah yes very nice! I see what you did here "$ref": "#/database", //schema selection
. Now I think I'm getting the hang of the "entry point" for the schema.
Here is the complete schema:
https://github.com/levylabpitt/Krohn-Hite-7008/blob/Instrument.KH7008/jsonrpcSch.json
todo: redefine databaseSch
as a $defs
item e.g. channelArray
or allProperties
or allChannels
and reuse
What methods should be supported? Follow conventions laid out in https://github.com/levylabpitt/Instrument-Framework/issues/91
channelProperties
common schema:setChannel
request schema:
request example:
getChannel
request schema:
request example:
response schema:
response example:
setAllChannels
request schema
request example
getAllChannels
request schema
request example
response schema
response example: