Schema 1.1 SelectAction
See original GitHub issuePlatform
- .NET HTML
- JavaScript
Author or host
Author, sending cards to WebChat emulator and DirectLine
Version of SDK
NuGet 1.0.3
Issue
As of this morning, the card JSON I had written in my database is no longer passing through JSON Schema validation. The cards sent are still version 1.0; they’re not using any of the new 1.1 features; however, the schema information I was using was pulling directly from the url https://adaptivecards.io/schemas/adaptive-card.json. I noticed that it has changed since last Friday with the new 1.1 features.
Playing around with the JSON and the schema in https://www.jsonschemavalidator.net/, I noticed that my cards have images with ‘selectAction’ properties. The old and new schemas are differing in these values.
The old schema just mentioned that Action.ShowCard is not supported in the description, but set the Action as any from Action:
"selectAction": {
"description": "An Action that will be invoked when the Image is tapped or selected. Action.ShowCard not supported",
"$ref": "#/definitions/Action"
}
The new schema explicitly specifies that this isn’t supported:
"selectAction": {
"description": "An Action that will be invoked when the `Image` is tapped or selected. `Action.ShowCard` is not supported.",
"type": "object",
"enum": [
"Action.Submit",
"Action.OpenUrl"
]
}
I’ve only just started playing with json schemas, so I’m not sure, but the enum there doesn’t actually specify what the selectAction can be. Isn’t that expecting a string with any of those values?
Indeed, I got the following issue from the validator:
I changed the relevant section to:
"selectAction": {
"description": "An Action that will be invoked when the `Image` is tapped or selected. `Action.ShowCard` is not supported.",
"type": "object",
"item": {
"anyOf":[
{ "$ref": "#/definitions/Action.Submit" },
{ "$ref": "#/definitions/Action.OpenUrl" }
]
}
}
and the problem went away.
Is this correct? If not, this block is in the schema 4 times, Image, ColumnSet, Column. and Container.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:8 (5 by maintainers)
Top GitHub Comments
@matthidinger seems like we should update the JSON schema for selectAction to the following as Benjathing suggested
Our new 1.2 schema has a TON of improvements which likely fix all the issues mentioned in this thread, including…
Get the new schema file here! https://adaptivecards.io/schemas/1.2.0/adaptive-card.json
We’re working on updating the samples to point to this new schema file