Author, sending cards to WebChat emulator and DirectLine
NuGet 1.0.3
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.
Ironically, the new designer allows "ShowCard" actions on select:

@matthidinger seems like we should update the JSON schema for selectAction to the following as Benjathing suggested
"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" }
]
}
}
I also noticed a couple of other things with the schema today. I love the new designer, but even disregarding the issue I noted above, the JSON constructed from it still doesn't pass the schema.
It appears to be for two reasons:


Per this issue decision was made that enum values would be case insensitive, and the JS renderer (which the designer uses) got updated to not be case sensitive.
Problem is, JSON, which is very tied to JavaScript, is case sensitive by nature, and so is an enum defined in a JSON schema. We have a little bit of a conundrum here, where the renderers are case-insensitive but the schema prescribes a case for all enum values. Is there a way to define a case-insensitive enum in a JSON schema? If not, what should we do?
Apparently case-insensitive enums were proposed, but it doesn't look like they went anywhere (seemingly because dealing with case sensitivity cross-locale is tricky).
It's terrifying, but my current workaround is:
"color": {
"description": "Controls the color of `TextBlock` elements.",
"type": "string",
//"enum": [
// "default",
// "dark",
// "light",
// "accent",
// "good",
// "warning",
// "attention"
//]
"oneOf": [
{ "pattern": "^[Dd][Ee][Ff][Aa][Uu][Ll][Tt]$" },
{ "pattern": "^[Dd][Aa][Rr][Kk]$" },
{ "pattern": "^[Ll][Ii][Gg][Hh][Tt]$" },
{ "pattern": "^[Aa][Cc][Cc][Ee][Nn][Tt]$" },
{ "pattern": "^[Gg][Oo][Oo][Dd]$" },
{ "pattern": "^[Ww][Aa][Rr][Nn][Ii][Nn][Gg]$" },
{ "pattern": "^[Aa][Tt][Tt][Ee][Nn][Tt][Ii][Oo][Nn]$" }
]
}
Unfortunately, you can't use flags in json-schema patterns either,
EDIT:
similarly, I replaced the single value enums for the object types with patterns too:
"type": {
"type": "string",
"description": "Must be `\"Action.ShowCard\"`.",
//"enum": [
// "Action.ShowCard"
//]
"pattern": "^[Aa][Cc][Tt][Ii][Oo][Nn]\\.[Ss][Hh][Oo][Ww][Cc][Aa][Rr][Dd]$"
}
@matthidinger to followup
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
Most helpful comment
@matthidinger seems like we should update the JSON schema for selectAction to the following as Benjathing suggested