question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Schema 1.1 SelectAction

See original GitHub issue

Platform

  • .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: image

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:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
andrewleadercommented, Oct 15, 2018

@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" }
    ]
  }
}
0reactions
andrewleadercommented, Jun 27, 2019

Our new 1.2 schema has a TON of improvements which likely fix all the issues mentioned in this thread, including…

  • selectAction property values should be correct now
  • case-insensitive enum values!!
  • validation within nested layers of containers/columns/etc works correctly
  • validation is STRICT, meaning any unknown enums or types will cause validation to fail (so that you know you did something wrong, or if you purposefully used a custom element/enum, you can knowingly ignore the error)

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Schema Explorer | Adaptive Cards
selectAction, ISelectAction, No, An Action that will be invoked when the card is tapped or selected. Action.ShowCard is not supported. 1.1.
Read more >
Container - Schema Explorer | Adaptive Cards
The card elements to render inside the Container . 1.0. selectAction, ISelectAction, No, An Action that will be invoked when the Container is...
Read more >
W3C XML Schema Definition Language (XSD) 1.1 Part 1
Abstract. This document specifies the XML Schema Definition Language, which offers facilities for describing the structure and constraining ...
Read more >
Using Adaptive Cards with the Microsoft Bot Framework
The schema defines everything that you can put in an Adaptive Card. Every host application that supports Adaptive Cards must be able to ......
Read more >
20 XML Schema Evolution
You perform copy-based XML schema evolution using PL/SQL procedure DBMS_XMLSCHEMA.copyEvolve . This backs up existing instance documents to temporary XMLType ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found