[
{% for assoc in cls.associations_to %}{% if assoc.association_type.name in ['AGGREGATION', 'COMPOSITION', 'ASSOCIATION'] %}
	{
		"namespace": "{{ assoc.source.package.path[1:-1] | replace("/",".") | snakecase }}",
		"type": "record",
		"name": "{{ assoc.source.name | case_class }}",
		"fields": [{% if assoc.source.generalization %}{% for attr in assoc.source.generalization.attributes %}
			{ 
				"name": "{{ attr.name | case_attribute }}", 
				{% if attr.dest_type == "date" %}"type": ["string", "null", {"type": "int", "logicalType": "date"}], "default": "undefined"
				{% elif attr.dest_type == "datetime" %}"type": ["string", "null", {"type" : "long", "logicalType": "timestamp-millis"}], "default": "undefined"{% elif attr.classification %}"type":
					{
						"type": "enum",
						"name": "{{ attr.classification.name | case_class }}",
						"symbols": [{% for enum in attr.classification.values[:-1] %}
							"{{ enum | uppercase | replace(" ","_")}}",{% endfor %}
							"{{ attr.classification.values[-1] | uppercase | replace(" ","_") }}"
						]
					}{% else %}"type": {% if not attr.is_id %}[ {% if attr.dest_type != 'string' %}"string",{% endif %}"null", {% endif %}"{{attr.dest_type}}"{% if not attr.is_id %} ], "default": "undefined"{% endif %}{% endif %}
			},{% endfor %}{% endif %}{% for attr in assoc.source.attributes[:-1] %}
			{ 
				"name": "{{ attr.name | case_attribute }}", 
				{% if attr.dest_type == "date" %}"type": ["string", "null", {"type": "int", "logicalType": "date"}], "default": "undefined"
				{% elif attr.dest_type == "datetime" %}"type": ["string", "null", {"type" : "long", "logicalType": "timestamp-millis"}], "default": "undefined"{% elif attr.classification %}"type":
					{
						"type": "enum",
						"name": "{{ attr.classification.name | case_class }}",
						"symbols": [{% for enum in attr.classification.values[:-1] %}
							"{{ enum | uppercase | replace(" ","_") | replace("/","_") }}",{% endfor %}
							"{{ attr.classification.values[-1] | uppercase | replace(" ","_")}}"
						]
					}{% else %}"type": {% if not attr.is_id %}[ {% if attr.dest_type != 'string' %}"string", {% endif %}"null",{% endif %}"{{attr.dest_type}}"{% if not attr.is_id %} ], "default": "undefined"{% endif %}{% endif %} 
			},{% endfor %}
			{ 
				"name": "{{ assoc.source.attributes[-1].name | case_attribute }}", 
				{% if assoc.source.attributes[-1].dest_type == "date" %}"type": ["string", "null", {"type": "int", "logicalType": "date"}], "default": "undefined"
				{% elif assoc.source.attributes[-1].dest_type == "datetime" %}"type": ["string", "null", {"type" : "long", "logicalType": "timestamp-millis"}], "default": "undefined"{% elif assoc.source.attributes[-1].classification %}"type":
					{
						"type": "enum",
						"name": "{{ assoc.source.attributes[-1].classification.name | case_class }}",
						"symbols": [{% for enum in assoc.source.attributes[-1].classification.values[:-1] %}
							"{{ enum | uppercase | replace(" ","_") | replace("/","_") }}",{% endfor %}
							"{{ assoc.source.attributes[-1].classification.values[-1] | uppercase | replace(" ","_")}}"
						]
					}{% else %}"type": {% if not assoc.source.attributes[-1].is_id %}[ {% if assoc.source.attributes[-1].dest_type != 'string' %}"string", {% endif %}"null", {% endif %}"{{assoc.source.attributes[-1].dest_type}}"{% if not assoc.source.attributes[-1].is_id %} ], "default": "undefined"{% endif %}{% endif %}
			}{% for assoc in assoc.source.associations_from %}{% if assoc.association_type.name not in ['AGGREGATION', 'COMPOSITION'] %}
			,{ 
				"name": "{{ assoc.destination_name | case_attribute }}_id", 
				"type": ["string", "null"{% if assoc.destination_multiplicity[1] == '*' %}, 
					{ 
						"type": "array", 
						"items": "string" 
					}{% else %}], "default": "undefined"{% endif %} 
			}{% endif %}{% endfor %}
		]
	},{% endif %}{% endfor %}	
	{
		"namespace": "{{ cls.package.path[1:-1] | replace("/",".") | snakecase }}",
		"type": "record",
		"name": "{{ cls.name | case_class }}",
		"fields": [{% if cls.generalization %}{% for attr in cls.generalization.attributes %}
			{ 
				"name": "{{ attr.name | case_attribute }}",
				{% if attr.dest_type == "date" %}"type": ["string", "null", {"type": "int", "logicalType": "date"}], "default": "undefined"
				{% elif attr.dest_type == "datetime" %}"type": ["string", "null", {"type" : "long", "logicalType": "timestamp-millis"}], "default": "undefined"{% elif attr.classification %}"type":
					{
						"type": "enum",
						"name": "{{ attr.classification.name | case_class }}",
						"symbols": [{% for enum in attr.classification.values[:-1] %}
							"{{ enum | uppercase | replace(" ","_") | replace("/","_") }}",{% endfor %}
							"{{ attr.classification.values[-1] | uppercase | replace(" ","_") }}"
						]
					}{% else %}"type": [{% if attr.dest_type!="string" %}"string", {% endif %}"{{attr.dest_type}}"{% if not attr.is_id %}, "null" ], "default": "undefined"{% else %}]{% endif %}{% endif %} 
			},{% endfor %}{% endif %}{% for attr in cls.attributes[:-1] %}
			{ 
				"name": "{{ attr.name | case_attribute }}",
				{% if attr.dest_type == "date" %}"type": ["string", "null", {"type": "int", "logicalType": "date"}], "default": "undefined"
				{% elif attr.dest_type == "datetime" %}"type": ["string", "null", {"type" : "long", "logicalType": "timestamp-millis"}], "default": "undefined"{% elif attr.classification %}"type":
					{
						"type": "enum",
						"name": "{{ attr.classification.name | case_class }}",
						"symbols": [{% for enum in attr.classification.values[:-1] %}
							"{{ enum | uppercase | replace(" ","_") | replace("/","_")}}",{% endfor %}
							"{{ attr.classification.values[-1] | uppercase | replace(" ","_")}}"
						]
					}{% else %}"type": {% if not attr.is_id %}[ {% if attr.dest_type != 'string' %}"string", {% endif %}{% endif %}"{{attr.dest_type}}"{% if not attr.is_id %},"null" ], "default": "undefined"{% endif %}{% endif %} 
			},{% endfor %}
			{ 
				"name": "{{ cls.attributes[-1].name | case_attribute }}",
				{% if cls.attributes[-1].dest_type == "date" %}"type": ["string", "null", {"type": "int", "logicalType": "date"}], "default": "undefined"
				{% elif cls.attributes[-1].dest_type == "datetime" %}"type": ["string", "null", {"type" : "long", "logicalType": "timestamp-millis"}], "default": "undefined"{% elif cls.attributes[-1].classification %}"type":
					{
						"type": "enum",
						"name": "{{ cls.attributes[-1].classification.name | case_class }}",
						"symbols": [{% for enum in cls.attributes[-1].classification.values[:-1] %}
							"{{ enum | uppercase | replace(" ","_") | replace("/","_") }}",{% endfor %}
							"{{ cls.attributes[-1].classification.values[-1] | uppercase | replace(" ","_")}}"
						]
					}{% else %}"type": {% if not cls.attributes[-1].is_id %}[ {% if cls.attributes[-1].dest_type != 'string' %}"string", {% endif %}"null", {% endif %}"{{cls.attributes[-1].dest_type}}"{% if not cls.attributes[-1].is_id %} ], "default": "undefined"{% endif %}{% endif %}
			}{% for assoc in cls.associations_from %}
			,{ 
				"name": "{{ assoc.destination_name | case_attribute }}_id",
				"type": [{% if assoc.destination_multiplicity[1] == '*' %}{ "type": "array", "items": "string" }{% else %}"string"{% endif %}, "null"], "default": "undefined"
			}{% endfor %}{% for assoc in cls.associations_to %}{% if assoc.association_type.name in ['AGGREGATION', 'COMPOSITION'] %}
			,{ 
				"name": "{{ assoc.source.name | case_attribute }}", 
				"type": ["string", "null", {% if assoc.source_multiplicity[1] == '*' %}
					{ 
						"type": "array", 
						"items": "{{ assoc.source.name | case_class }}" 
					}{% else %}"{{ assoc.source.name | case_class }}"{% endif %}], "default": "undefined",
				"namespace": "{{ cls.package.path[1:-1] | replace("/",".") | snakecase }}"
			}{% endif %}{% endfor %}
		]
	}{% for special in cls.specialized_by %}{% if "root aggregate" not in special.stereotypes %},
	{
		"namespace": "{{ special.package.path[1:-1] | replace("/",".") | snakecase }}",
		"type": "record",
		"name": "{{ special.name | case_class }}",
		"fields": [
			{% for attr in special.attributes[:-1] %}{ 
				"name": "{{ attr.name | case_attribute }}",
				{% if attr.dest_type == "date" %}"type": ["string", "null", {"type": "int", "logicalType": "date"}], "default": "undefined"
				{% elif attr.dest_type == "datetime" %}"type": ["string", "null", {"type" : "long", "logicalType": "timestamp-millis"}], "default": "undefined"{% elif attr.classification %}"type":
					{
						"type": "enum",
						"name": "{{ attr.classification.name | case_class }}",
						"symbols": [{% for enum in attr.classification.values[:-1] %}
							"{{ enum | uppercase | replace(" ","_") | replace("/","_")}}",{% endfor %}
							"{{ attr.classification.values[-1] | uppercase | replace(" ","_")}}"
						]
					}{% else %}"type": {% if not attr.is_id %}[ {% if attr.dest_type != 'string' %}"string", {% endif %}{% endif %}"{{attr.dest_type}}"{% if not attr.is_id %},"null" ], "default": "undefined"{% endif %}{% endif %} 
			},{% endfor %}
			{ 
				"name": "{{ special.attributes[-1].name | case_attribute }}",
				{% if special.attributes[-1].dest_type == "date" %}"type": ["string", "null", {"type": "int", "logicalType": "date"}], "default": "undefined"
				{% elif special.attributes[-1].dest_type == "datetime" %}"type": ["string", "null", {"type" : "long", "logicalType": "timestamp-millis"}], "default": "undefined"{% elif cls.attributes[-1].classification %}"type":
					{
						"type": "enum",
						"name": "{{ special.attributes[-1].classification.name | case_class }}",
						"symbols": [{% for enum in special.attributes[-1].classification.values[:-1] %}
							"{{ enum | uppercase | replace(" ","_") | replace("/","_") }}",{% endfor %}
							"{{ special.attributes[-1].classification.values[-1] | uppercase | replace(" ","_")}}"
						]
					}{% else %}"type": {% if not special.attributes[-1].is_id %}[ {% if special.attributes[-1].dest_type != 'string' %}"string", {% endif %}"null", {% endif %}"{{special.attributes[-1].dest_type}}"{% if not special.attributes[-1].is_id %} ], "default": "undefined"{% endif %}{% endif %}
			}			
		]
	}{% endif %}{% endfor %}
]
