# SBE ref tag edge cases

**URL:** https://forum.fixtrading.org/t/sbe-ref-tag-edge-cases/17541
**Category:** General Q&A
**Tags:** simple-binary
**Created:** [March 1, 2024, 7:13pm UTC](https://forum.fixtrading.org/t/sbe-ref-tag-edge-cases/17541 "2024-03-01T19:13:57Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![zacksig](https://avatars.discourse-cdn.com/v4/letter/z/47e85d/32.png) [@zacksig](https://forum.fixtrading.org/u/zacksig)
#### Post date: [March 1, 2024, 7:13pm UTC](https://forum.fixtrading.org/t/sbe-ref-tag-edge-cases/17541/1 "2024-03-01T19:13:57Z")

</div>

Hi Folks,

We have some [SBE](https://www.fixtrading.org/standards/sbe-online/) questions. Are the following allowed per SBE standard?

1. Two composites referencing each other, so the referred type in one “Engine” is actually declared after the first usage. Since the `booster` field could be optional, the nestedness could stop at any arbitrary depth with the null value for “booster\_val\_field”

```auto
<composite name="Booster">
    <type name="booster_val_field" primitiveType="int64"/>
    <ref name="Engine">type="Engine"/>
    </composite>
    <composite name="Engine">
    <type name="engine_val_field" primitiveType="int64"/>
    <ref name="booster" type="Booster" presence="optional"/>
 </composite>

```

1. Assuming nested ref tag is allowed ( **please kindly point out if it’s not or unlikely in practice** ), a composite referencing itself. It could stop following the same null value logic as above.

```auto
 <composite name="Engine">
    <type name="value" primitiveType="int64"/>
    <ref name="booster" type=" Engine" presence="optional"/>
 </composite>

```

1. (not related to ref tag) Is it okay for a spec to have a composite/type that is completely unreferenced in any message? For example `<field name="modelYear" id="2" type="ModelYear"/>` is removed from the “Car” message, but remains declared inside “types”.

I sincerely appreciate your help!

---

<div class="post-metadata">

### Author: ![gtcpm](https://avatars.discourse-cdn.com/v4/letter/g/b2d939/32.png) [@gtcpm](https://forum.fixtrading.org/u/gtcpm)
#### Post date: [March 5, 2024, 1:11am UTC](https://forum.fixtrading.org/t/sbe-ref-tag-edge-cases/17541/2 "2024-03-05T01:11:42Z")

</div>

Corrected the formatting to display XML snippets (please always enclose in 3 backticks before and after the XML code).

Regards,  
FIX GTC Management.

---

<div class="post-metadata">

### Author: ![gtcpm](https://avatars.discourse-cdn.com/v4/letter/g/b2d939/32.png) [@gtcpm](https://forum.fixtrading.org/u/gtcpm)
#### Post date: [April 23, 2024, 1:11pm UTC](https://forum.fixtrading.org/t/sbe-ref-tag-edge-cases/17541/3 "2024-04-23T13:11:10Z")

</div>

Added to SBE discussions on GitHub: [https://github.com/FIXTradingCommunity/fix-simple-binary-encoding/discussions/163](https://github.com/FIXTradingCommunity/fix-simple-binary-encoding/discussions/163).
