| ## fi-0058: Reference to compiler generated payload name {:#fi-0058} |
| |
| Anonymous method payloads have their names automatically generated by the FIDL |
| compiler, so that users of generated backend code may refer to the types they |
| represent as necessary. Referring to these types in *.fidl files themselves, |
| however, is forbidden: |
| |
| {% 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-0058.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %} |
| ``` |
| |
| If you wish to refer to the payload type directly, you should extract the |
| payload type into its own named type declaration instead: |
| |
| {% 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-0058.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %} |
| ``` |
| |
| All FIDL methods and events reserve the `[PROTOCOL_NAME][METHOD_NAME]Request` |
| name for their anonymous request payloads. Infallible two-way methods |
| additionally reserve `[PROTOCOL_NAME][METHOD_NAME]Response`. Fallible |
| two-methods reserve `[PROTOCOL_NAME][METHOD_NAME]TopResponse` instead. |
| |
| <!-- TODO(fxbug.dev/109789): Remove last sentence once TopResponse is gone. --> |