Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initialize the context from JsonNode( kind: JObject ?) #19

Open
d-Pixie opened this issue Sep 8, 2021 · 1 comment
Open

Initialize the context from JsonNode( kind: JObject ?) #19

d-Pixie opened this issue Sep 8, 2021 · 1 comment

Comments

@d-Pixie
Copy link

d-Pixie commented Sep 8, 2021

Hi

My internal state is kept as a JsonNode structure with the root as a JObject JsonNode. I'm trying to do the minimal amount of magic on the way to transferring the state into nim-mustache and thought something like this should work:

var context = new_context(
  searchDirs = plugin.search_dirs(),
  values = my_context
)

Where my_context is my root object.

I have also tried several variations such as:

var context = new_context(
  searchDirs = plugin.search_dirs(),
  values = castValue(my_context)
)

or:

var context = new_context(
  searchDirs = plugin.search_dirs(),
  values = Table[string, Value](castValue(my_context))
)

but to no avail ...

I'm sure it is doable, but the compiler and I can't agree on how to annotate the type in question I guess 🙂 Could you tell me how to do it correctly @soasme ?

@pietroppeter
Copy link
Contributor

use values=my_context.toValues (added in #9, example of usage mustache specs)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants