SEBA-271 Fix xproto field numbers not passed through
Change-Id: Ib5abee510e1a02f025d3011699d9f34d59e201c1
diff --git a/lib/xos-genx/xosgenx/targets/protoapi.xtarget b/lib/xos-genx/xosgenx/targets/protoapi.xtarget
index 183bacd..2311b98 100644
--- a/lib/xos-genx/xosgenx/targets/protoapi.xtarget
+++ b/lib/xos-genx/xosgenx/targets/protoapi.xtarget
@@ -20,23 +20,23 @@
option (contentTypeId) = "{{ xproto_unquote(xproto_first_non_empty([object.options.name, object.options.app_label, options.name, context.app_label])) }}.{{ object.name | lower }}";
{%- 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')%}
+ {%- for field in xproto_fields(object, proto.message_table) | sort(attribute='id')%}
{%- if field.options.type == "link" and field.options.link_type == "manytomany" %}
- repeated int32 {{ field.name }}_ids = {{ loop.index }} [(manyToManyForeignKey).modelName = "{{ field.options.model }}"];
+ repeated int32 {{ field.name }}_ids = {{ field.id }} [(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) }};
+ {{ xproto_api_type(field) }} {{ field.name }}{% if field.link -%}_id{% endif %} = {{ field.id }} {{ xproto_api_opts(field) }};
}
{%- endif -%}
{%- endfor -%}
- {%- for ref in xproto_base_rlinks(object, proto.message_table) + object.rlinks | sort(attribute='src_port') %}
+ {%- for ref in xproto_rlinks(object, proto.message_table) | sort(attribute='id') %}
{%- if '+' not in ref.src_port and '+' not in ref.dst_port %}
- repeated int32 {{ ref.src_port }}_ids = {{ loop.index + 100 }} [(reverseForeignKey).modelName = "{{ ref.peer.name }}"];
+ repeated int32 {{ ref.src_port }}_ids = {{ ref["id"] }} [(reverseForeignKey).modelName = "{{ ref.peer.name }}"];
{%- endif -%}
{%- endfor %}
- string class_names = 201;
- string self_content_type_id = 202;
+ string class_names = 2046;
+ string self_content_type_id = 2047;
}
message {{ xproto_pluralize(object) }} {