nfdi4plants / ARCtrl

Library for management of Annotated Research Contexts (ARCs) using an in-memory representation and runtime-agnostic contract systems.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[NET] ARCtrl.Template.Web.getTemplates fails

Freymaurer opened this issue · comments

This is the code i am running:

#r "nuget: ARCtrl, 2.0.0-alpha.6.swate"

let templateUrl = @"https://github.com/nfdi4plants/Swate-templates/releases/download/latest/templates_v2.0.0.json"

ARCtrl.Template.Web.getTemplates (Some templateUrl)
|> Async.RunSynchronously
|> fun (x: Map<string,ARCtrl.Template>) -> x.Values |> Seq.item (x.Count-1)

It fails, but the error message is so big, the console is not able to display the upper end (i scroll all the way up and it still shows json string):

image

Warning

Not sure why or when, but it now returns Map<name, template> which is strange?

Working on it. Problem seems to be that the decoder expects a json object but the encoder codes to an array.

Maybe kill this map logic? i would have also expected an array

Seems like we did actually write Objects (Dictionaries) in ARCtrl v1.x.x:

Here as an example the Templates.json File from the Swate-Templates release
image

As you can see, instead of an array, we have a dictionary where the key is the path to the template.

Maybe the idea was, that we wanted to improve loadtime but first offering a list of names, then parsing and reading the specific file. But this was postponed. So maybe just return an array and write an array

Also we now don't have the path information at all.