Adding custom per-recipient fields in a context


#1

Hello,

I’m trying to create a template with cert-tools with additional per-recipient fields in it.
I know that those fields need to be included in a JSON-LD context, but I’m not sure how to reference them with a jsonpath.

Let’s say I want to add the field foo in the context, I bet I need something this:
additional_per_recipient_fields = {"fields": [{"path": "@context.foo","value": "*|FOO|*","csv_column": "foo"}]}
but the create-certificate-template tool doesn’t like that syntax.

I tried to find to read the documentation of JSON-LD to understand how the jsonpath could work with contexts but I didn’t find anything relevant.

Any help?


#2

If you want to add a brand new field, you’d need to add it to additional_global_fields as well, so that JSON-LD is aware of it. See the way that DisplayHtml works there.

If foo had already existed as part of the JSON, you would be fine (though I think it wants "path": ".foo" without the @context).


#3

oh, that makes sense.

Now it works, thank you