A protocol cannot compose another protocol that is more open than itself:
{% include “docs/reference/fidl/language/error-catalog/label/_bad.md” %}
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="tools/fidl/fidlc/tests/fidl/bad/fi-0114.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %}
You can fix this by increasing the openness of the composing protocol, i.e. changing it from closed
to ajar
or from ajar
to open
:
{% include “docs/reference/fidl/language/error-catalog/label/_good.md” %}
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="tools/fidl/fidlc/tests/fidl/good/fi-0114-a.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %}
Alternatively, you can reduce the openness of the composed protocol, i.e. change it from open
to ajar
or from ajar
to closed
:
{% include “docs/reference/fidl/language/error-catalog/label/_good.md” %}
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="tools/fidl/fidlc/tests/fidl/good/fi-0114-b.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %}
This rule exists because the openness of a protocol restricts what kind of methods it is allowed to contain. For example, an ajar protocol cannot contain flexible two-way methods, but an open protocol can, so it's not safe for an ajar protocol to compose an open protocol.
See RFC-0138: Handling unknown interactions for more information about protocol modifiers.