| ## fi-0016: Missing ordinal before member {:#fi-0016} |
| |
| This error occurs when a fields in a union or table is missing an ordinal. |
| |
| {% include "docs/reference/fidl/language/error-catalog/label/_bad.md" %} |
| |
| ```fidl |
| {% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="tools/fidl/fidlc/tests/fidl/bad/fi-0016-a.noformat.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %} |
| ``` |
| |
| {% include "docs/reference/fidl/language/error-catalog/label/_bad.md" %} |
| |
| ```fidl |
| {% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="tools/fidl/fidlc/tests/fidl/bad/fi-0016-b.noformat.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %} |
| ``` |
| |
| To fix this error, explicitly specify the ordinals for the table or union: |
| |
| {% include "docs/reference/fidl/language/error-catalog/label/_good.md" %} |
| |
| ```fidl |
| {% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="tools/fidl/fidlc/tests/fidl/good/fi-0016.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %} |
| ``` |
| |
| Unlike structs, tables and unions are designed to allow backwards-compatible |
| changes to be made to their contents. In order to enable this, a consistent |
| value, the ordinal, is needed to identify table fields or union variants. To |
| avoid confusion and make it harder to accidentally change ordinals when changing |
| a table or union, ordinals must always be specified explicitly. |