CORD-2357 manytomany support
Change-Id: I54debd4eab66df003dc5079890c3fc87ee0d3e80
diff --git a/lib/xos-genx/xosgenx/targets/protoapi.xtarget b/lib/xos-genx/xosgenx/targets/protoapi.xtarget
index f375dae..c580764 100644
--- a/lib/xos-genx/xosgenx/targets/protoapi.xtarget
+++ b/lib/xos-genx/xosgenx/targets/protoapi.xtarget
@@ -21,9 +21,13 @@
{%- endif %}
{%- set id_field = {'type':'int32', 'name':'id', 'options':{}} -%}
{%- for field in (xproto_base_fields(object, proto.message_table) + object.fields + [id_field]) | sort(attribute='name')%}
+ {%- if field.options.type == "link" and field.options.link_type == "manytomany" %}
+ repeated int32 {{ field.name }}_ids = {{ loop.index }} [(manyToManyForeignKey).modelName = "{{ field.options.model }}"];
+ {%- else %}
oneof {{ field.name }}_present {
{{ xproto_api_type(field) }} {{ field.name }}{% if field.link -%}_id{% endif %} = {{ loop.index }}{{ xproto_api_opts(field) }};
}
+ {%- endif -%}
{%- endfor -%}
{%- for ref in xproto_base_rlinks(object, proto.message_table) + object.rlinks | sort(attribute='src_port') %}