{%
    set generated = {
        "Name":  name_slug,
        "Version": app_version,
    }
-%}
{%- if github -%}
    {%- set _ = generated.update({"CodeURL": "https://github.com/" + github + "/" + name_slug}) -%}
{%- endif -%}
{%- if full_name -%}
    {%- set _ = generated.update({"Author": full_name}) -%}
{%- endif -%}
{%- if email -%}
    {%- set _ = generated.update({"AuthorEmail": email}) -%}
{%- endif -%}
{{- {
        "Name": "Dataset generated by " + name_slug,
        "BIDSVersion":  bids_version,
        "DatasetType": "derivative",
        "GeneratedBy": [generated],
    } | to_json(indent=2)
}}
