Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property key with $ sometimes does not work #268

Open
kinhoon opened this issue Jun 4, 2021 · 1 comment
Open

Property key with $ sometimes does not work #268

kinhoon opened this issue Jun 4, 2021 · 1 comment

Comments

@kinhoon
Copy link

kinhoon commented Jun 4, 2021

I have a JSON schema with a property key "$csv" of type "string".
This property item if it is under an "object" type, or "object" type under another "object" type then it works.
But if it is under an "object" type under another "array" type then it does not work.

Below is the JSON schema.

{
"$schema": "http://json-schema.org/draft-04/schema",
"title": "myData JSON Schema",
"description": "JSON Schema for myData config JSON document.",
"type": "object",
"ui": { "widgetConfig": { "layout": "h" } },
"properties": {
"server": {
"type": "string",
"default": "127.0.0.1:1883",
"ui": {
"label": "Server",
"description": "IP address and port number of destination server."
}
},
"$csv": {
"type": "string",
"default": "mydata-ts.csv",
"ui": {
"label": "File Name $",
"description": "Key is $csv. This works."
}
},
"csv": {
"type": "string",
"default": "mydata-ts.csv",
"ui": {
"label": "File Name",
"description": "Key is csv."
}
},
"task": {
"type": "array",
"ui": {
"label": "Tasks",
"description": "The configuration."
},
"items": {
"type": "object",
"ui": {
"label": "Task Item",
"description": "The task items.",
"widgetConfig": { "layout": "h" } },
"properties": {
"enable": {
"type": "boolean",
"default": true,
"ui": {
"label": "Enable",
"description": "Enable or disable the Modbus Master.",
"widget": "select"
}
},
"$csv": {
"type": "string",
"default": "mydata-ts.csv",
"ui": {
"label": "File Name $",
"description": "Key is $csv. This does not work. Why?"
}
},
"csv": {
"type": "string",
"default": "mydata-ts.csv",
"ui": {
"label": "File Name",
"description": "Key is csv."
}
},
"file": {
"type": "object",
"ui": { "widgetConfig": { "layout": "h" } },
"properties": {
"server": {
"type": "string",
"default": "127.0.0.1:1883",
"ui": {
"label": "Server",
"description": "IP address and port number of destination server."
}
},
"$csv": {
"type": "string",
"default": "mydata-ts.csv",
"ui": {
"label": "File Name $",
"description": "Key is $csv. This works."
}
},
"csv": {
"type": "string",
"default": "mydata-ts.csv",
"ui": {
"label": "File Name",
"description": "Key is csv."
}
}
}
},
"data": {
"type": "array",
"ui": {
"label": "Files",
"description": "List of Configuration files."
},
"items": {
"type": "object",
"ui": {
"label": "File List",
"description": "List of CSV configuration files.",
"widgetConfig": { "layout": "h" }
},
"properties": {
"$csv": {
"type": "string",
"default": "mydata-ts.csv",
"ui": {
"label": "File Name $",
"description": "Key is $csv. This does not work. Why?"
}
},
"csv": {
"type": "string",
"default": "mydata-ts.csv",
"ui": {
"label": "File Name",
"description": "Key is csv."
}
}
}
}
}
}
}
}
}
}

Below is the output generated using ncform playground https://ncform.github.io/ncform/ncform-show/playground/index.html.
The working one is highlighted in green, while the one not working is highlighted in red. I would like the red one to work correctly. Thanks.

image

@daniel-dx
Copy link
Collaborator

当前只能建议尽量不要用 $ 等特殊符号作为 key 的一部分

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants