FIDL no longer supports reserved
table or union fields:
{% include “docs/reference/fidl/language/error-catalog/label/_bad.md” %}
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="tools/fidl/fidlc/tests/fidl/bad/fi-0209.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %}
The main purpose of reserved fields was to avoid accidental reuse of ordinals. With FIDL versioning, that is no longer an issue. You can annotate old fields @available(removed=N)
while keeping them (and their ordinals) in the source file:
{% include “docs/reference/fidl/language/error-catalog/label/_good.md” %}
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="tools/fidl/fidlc/tests/fidl/good/fi-0209-a.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %}
Another use of reserved
was to document the intended future use of an ordinal. In that case, consider defining the field at the unstable API level HEAD
:
{% include “docs/reference/fidl/language/error-catalog/label/_good.md” %}
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="tools/fidl/fidlc/tests/fidl/good/fi-0209-b.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %}
For any other uses of reserved
, consider leaving a comment instead:
{% include “docs/reference/fidl/language/error-catalog/label/_good.md” %}
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="tools/fidl/fidlc/tests/fidl/good/fi-0209-c.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %}