# Buggy code
async def bake(
    self,
    custom_default_resolver: Optional[Callable] = None,
    custom_default_type_resolver: Optional[Callable] = None,
) -> None:
    """
    Bake the final schema (it should not change after this) used for
    execution.
    :param custom_default_resolver: callable that will replace the builtin
    default_resolver
    :param custom_default_type_resolver: callable that will replace the
    tartiflette `default_type_resolver` (will be called on abstract types
    to deduct the type of a result)
    :type custom_default_resolver: Optional[Callable]
    :type custom_default_type_resolver: Optional[Callable]
    """
    self.default_type_resolver = custom_default_type_resolver or default_type_resolver
    self._inject_introspection_fields()

    self._validate_extensions()  # Validate this before bake
    # TODO maybe a pre_bake/post_bake thing

    try:
        self._bake_extensions()
        await self._bake_types(custom_default_resolver)
    except Exception:  # pylint: disable=broad-except
        # Exceptions should be collected at validation time
        pass

    self._validate()

    # Bake introspection attributes
    self._operation_types = {
        "query": self.type_definitions.get(self.query_operation_name),
        "mutation": self.type_definitions.get(self.mutation_operation_name),
        "subscription": self.type_definitions.get(self.subscription_operation_name),
    }
    self.queryType = self._operation_types["query"]
    self.mutationType = self._operation_types["mutation"]
    self.subscriptionType = self._operation_types["subscription"]
    self.directives = list(self._directive_definitions.values())

    for type_name, type_definition in self.type_definitions.items():
        if not type_name.startswith("__"):
            self.types.append(type_definition)


# Traceback (KeyError)
Traceback (most recent call last):
File "/Users/morse/.pyenv/versions/3.7.2/lib/python3.7/site-packages/tartiflette/schema/schema.py", line 348, in get_field_by_name
return self.type_definitions[parent_name].find_field(field_name)
File "/Users/morse/.pyenv/versions/3.7.2/lib/python3.7/site-packages/tartiflette/types/object.py", line 125, in find_field
return self.implemented_fields[name]
KeyError: 'world'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/morse/.pyenv/versions/3.7.2/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/Users/morse/.pyenv/versions/3.7.2/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/Users/morse/Documents/GitHub/play-tartiflette/src/__main__.py", line 54, in <module>
run()
File "/Users/morse/Documents/GitHub/play-tartiflette/src/__main__.py", line 52, in run
web.run_app(app, port=8090,)
File "/Users/morse/.pyenv/versions/3.7.2/lib/python3.7/site-packages/aiohttp/web.py", line 415, in run_app
reuse_port=reuse_port))
File "/Users/morse/.pyenv/versions/3.7.2/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
return future.result()
File "/Users/morse/.pyenv/versions/3.7.2/lib/python3.7/site-packages/aiohttp/web.py", line 287, in _run_app
await runner.setup()
File "/Users/morse/.pyenv/versions/3.7.2/lib/python3.7/site-packages/aiohttp/web_runner.py", line 203, in setup
self._server = await self._make_server()
File "/Users/morse/.pyenv/versions/3.7.2/lib/python3.7/site-packages/aiohttp/web_runner.py", line 302, in _make_server
await self._app.startup()
File "/Users/morse/.pyenv/versions/3.7.2/lib/python3.7/site-packages/aiohttp/web_app.py", line 389, in startup
await self.on_startup.send(self)
File "/Users/morse/.pyenv/versions/3.7.2/lib/python3.7/site-packages/aiohttp/signals.py", line 34, in send
await receiver(*args, **kwargs)  # type: ignore
File "/Users/morse/.pyenv/versions/3.7.2/lib/python3.7/site-packages/tartiflette_aiohttp/__init__.py", line 97, in _cook_on_startup
sdl=sdl, schema_name=schema_name, modules=modules
File "/Users/morse/.pyenv/versions/3.7.2/lib/python3.7/site-packages/tartiflette/engine.py", line 250, in cook
schema_name, custom_default_resolver, custom_default_type_resolver
File "/Users/morse/.pyenv/versions/3.7.2/lib/python3.7/site-packages/tartiflette/schema/bakery.py", line 65, in bake
schema = SchemaBakery._preheat(schema_name)
File "/Users/morse/.pyenv/versions/3.7.2/lib/python3.7/site-packages/tartiflette/schema/bakery.py", line 39, in _preheat
obj.bake(schema)
File "/Users/morse/.pyenv/versions/3.7.2/lib/python3.7/site-packages/tartiflette/resolver/resolver.py", line 67, in bake
field = schema.get_field_by_name(self.name)
File "/Users/morse/.pyenv/versions/3.7.2/lib/python3.7/site-packages/tartiflette/schema/schema.py", line 351, in get_field_by_name
f"field `{name}` was not found in GraphQL schema."
tartiflette.types.exceptions.tartiflette.UnknownSchemaFieldResolver: field `Query.world` was not found in GraphQL schema.

# Fixed code
async def bake(
    self,
    custom_default_resolver: Optional[Callable] = None,
    custom_default_type_resolver: Optional[Callable] = None,
) -> None:
    """
    Bake the final schema (it should not change after this) used for
    execution.
    :param custom_default_resolver: callable that will replace the builtin
    default_resolver
    :param custom_default_type_resolver: callable that will replace the
    tartiflette `default_type_resolver` (will be called on abstract types
    to deduct the type of a result)
    :type custom_default_resolver: Optional[Callable]
    :type custom_default_type_resolver: Optional[Callable]
    """
    self.default_type_resolver = custom_default_type_resolver or default_type_resolver
    self._inject_introspection_fields()

    self._validate_extensions()  # Validate this before bake
    # TODO maybe a pre_bake/post_bake thing

    try:
        self._bake_extensions()
    except Exception:  # pylint: disable=broad-except
        # Exceptions should be collected at validation time
        pass

    SchemaRegistry.bake_registered_objects(self)

    try:
        await self._bake_types(custom_default_resolver)
    except Exception:  # pylint: disable=broad-except
        # Exceptions should be collected at validation time
        pass

    self._validate()

    # Bake introspection attributes
    self._operation_types = {
        "query": self.type_definitions.get(self.query_operation_name),
        "mutation": self.type_definitions.get(self.mutation_operation_name),
        "subscription": self.type_definitions.get(self.subscription_operation_name),
    }
    self.queryType = self._operation_types["query"]
    self.mutationType = self._operation_types["mutation"]
    self.subscriptionType = self._operation_types["subscription"]
    self.directives = list(self._directive_definitions.values())

    for type_name, type_definition in self.type_definitions.items():
        if not type_name.startswith("__"):
            self.types.append(type_definition)