Export: Custom (Jinja)
Converts the data contract into any custom format using a Jinja template. Specify the template path with --template.
datacontract export custom --template template.txt datacontract.yaml
Template variables
You can use the ODCS object directly. data_contract is an OpenDataContractStandard instance; top-level fields include name, id, version, schema_ (the list of schemas), servers, team, etc.
title: {{ data_contract.name }}
schemas:
{%- for schema in data_contract.schema_ %}
- name: {{ schema.name }}
{%- endfor %}
$ datacontract export custom --template template.txt datacontract.yaml
title: Orders Latest
schemas:
- name: orders
Per-schema templates
Add --schema-name to render a single schema. The template then also receives:
schema_name(str)schema(theSchemaObjectfrom ODCS)
datacontract export custom datacontract.odcs.yaml --template template.sql --schema-name orders