def _compute_example(self, label):
        """
        From the "raw example," resolves references to examples of other data
        types to compute the final example.

        Returns an Example object. The `value` attribute contains a
        JSON-serializable representation of the example.
        """
        if label in self._raw_examples:

            example = self._raw_examples[label]

            def deref_example_ref(dt, val):
                dt, _ = unwrap_nullable(dt)
                if not dt._has_example(val.label):
                    raise InvalidSpec(
                        "Reference to example for '%s' with label '%s' "
                        "does not exist." % (dt.name, val.label),
                        val.lineno, val.path)
                return dt._compute_example(val.label).value

            def get_json_val(dt, val):
                if isinstance(val, AstExampleRef):
                    # Embed references to other examples directly.
                    return deref_example_ref(dt, val)
                elif isinstance(val, list):
                    return [get_json_val(dt.data_type, v) for v in val]
                else:
                    return val

            example_field = list(example.fields.values())[0]

            # Do a deep copy of the example because we're going to mutate it.
            ex_val = OrderedDict([('.tag', example_field.name)])

            for field in self.all_fields:
                if field.name == example_field.name:
                    break

            # TODO: are we always guaranteed at least one field?
            # pylint: disable=undefined-loop-variable
            data_type, _ = unwrap_nullable(field.data_type)
            inner_ex_val = get_json_val(data_type, example_field.value)
            if (isinstance(data_type, Struct) and
                    not data_type.has_enumerated_subtypes()):
                ex_val.update(inner_ex_val)
            else:
                if inner_ex_val is not None:
                    ex_val[field.name] = inner_ex_val

            return Example(example.label, example.text, ex_val, ast_node=example)

        else:
            # Try to fallback to a union member with tag matching the label
            # with a data type that is composite or void.
            for field in self.all_fields:
                if label == field.name:
                    break
            else:
                raise AssertionError('No example for label %r' % label)

            # TODO: are we always guaranteed at least one field?
            # pylint: disable=undefined-loop-variable
            assert is_void_type(field.data_type)
            return Example(
                field.name, field.doc, OrderedDict([('.tag', field.name)]))
From the "raw example," resolves references to examples of other data
        types to compute the final example.

        Returns an Example object. The `value` attribute contains a
        JSON-serializable representation of the example.