AdaptiveCards icon indicating copy to clipboard operation
AdaptiveCards copied to clipboard

[Typescript][Update Schema to include 1.2] [Typescript Schema file is out of date]

Open Lanakire opened this issue 6 years ago • 11 comments

Platform

What platform is your issue or question related to? (Delete other platforms).

  • JavaScript

Author or host

Workday for Teams integration

Version of SDK

NPM Version 1.2.5

Details

I am working on the Workday for Teams application, and we are creating cards in typescript. We use the schema file in source/nodejs/adaptivecards/src/schema.ts for types, but the file hasn't been updated since last year, and doesn't seem to be current with schema version 1.2. This makes it so we can either drop type checking, which we would rather not do, or need to have this file updated with the current, live version of the schema.

Lanakire avatar Jan 30 '20 20:01 Lanakire

Thanks for reporting @Lanakire . @matthidinger / @andrewleader thoughts on this one? Is there a process thing we are missing? I thought this was auto-generated now no?

shalinijoshi19 avatar Jan 31 '20 12:01 shalinijoshi19

We have acknowledged this issue report. Please continue to follow the issue for updates/progress/questions. @matthidinger / @dclaux / @rebeccaanne / @paulcam206 FYI.

ghost avatar Jan 31 '20 12:01 ghost

@shalinijoshi19 the person who opened this issue is explicitly referring to the schema.ts file that is part of the JS library. I've always wanted to remove it and was not the one to add it in the first place.

Things are more complicated than just updating it to the 1.2 schema. The next version of the library (2.0) will support all versions of the Adaptive Card schema in the sense that its parsing logic can be constrained to a particular schema version and its serialization logic can emit payloads in specific AC schema versions.

If we're going to keep the schema interfaces in the JS library, simply updating them to 1.2 is going to be weird; what we really need is one set of interfaces for each AC schema version. But I don't think including 3 sets of interfaces in the library (and more in the future) is the right thing to do, as it's going to inflate the size of the library even though a very small number of developers will actually use them.

I think the right solution is to remove the schema interfaces from the library, and somehow publish one schema.ts file per AC schema version separately (for instance schema_1-2.ts, etc.). These files could simply live in GitHub, I don't think there is a need to package them, and developers would simply make their own copy. Incidentally, that would allow developers to tweak these interfaces for their own needs, or add a declaration that we might have forgotten without having to wait on us.

@Lanakire would what I propose above work for you?

dclaux avatar Jan 31 '20 17:01 dclaux

The the real use case for this isn't actually Javascript, it is Typescript. I know the schema elements are available elsewhere, but I guess the real ask would be for a set of Typescript types. I totally agree that they should be by version, as that will avoid a lot of confusion.

If I were to step back and ask this as a feature ask there are a couple things that would really help facilitate our development over here at Workday:

  1. Versioned Schema Types for all Adaptive Cards. So being able to import specifically the type file for 1.1, 1.2, and so on, but just the type definitions.
  2. Type checks for those types.

More accurately it might be good to do a specific Typescript distribution of the adaptive card library. If the plan for 2.0 and beyond is to keep all versions of the AdaptiveCard schema, it seems like keeping the minimum useful, the type definitions and the guards, seems to be the best balance between bloat and functionality.

Everything beyond the types is gravy, but really if you are developing with AdaptiveCards in Typescript, which I expect to continue happening more as Typescript gains popularity, having a library which at the least provides the expected types is critical.

Lanakire avatar Feb 24 '20 17:02 Lanakire

@Lanakire that is precisely what I was saying.

dclaux avatar Feb 24 '20 17:02 dclaux

Then that would be absolutely beautiful, and would help our development immensely, because right now we have a hodgepodge of that original schema.ts file and some custom ones we have added to update it to 1.2...it is not ideal 🤣

Though it would be helpful if it was an NPM-installable typescript library. Copying the file from one github to another seems problematic. It would be much safer to have it actually be a released Typescript-definition-having library.

Lanakire avatar Feb 24 '20 17:02 Lanakire

@Lanakire since you guys have apparently done the work of updating the schema.ts file, would you be willing to contribute that to the repo?

dclaux avatar Feb 24 '20 17:02 dclaux

Right now the change is mostly just types to cover the RichTextBlock and TextRun elements, then some some heavily commented usages of any return types. It really isn't a functional thing we could PR. Though once you decide where the structure for the typescript package is and what not, we can probably help bug bash the schema definition 👍

Lanakire avatar Feb 24 '20 18:02 Lanakire

Hi there! I'm part of the team @Lanakire mentioned and we are curious what the status of this is.

mackenziemcclaskey avatar Feb 01 '22 21:02 mackenziemcclaskey

Hi there! I'm part of the team @Lanakire mentioned and we are curious what the status of this is.

Hey @mackenziefernandez , unfortunately the team can't commit to this at the moment. We can't promise a time frame, but I will leave this issue on the radar just in case 🚀

JeanRoca avatar Mar 18 '22 00:03 JeanRoca

So what is the recommended way to get the specific schema types? JSON schema is not particularly helpful for TypeScript usage.

enzy avatar Mar 19 '24 09:03 enzy