diff --git a/aiida_restapi/graphql/orm_factories.py b/aiida_restapi/graphql/orm_factories.py index 3a7d2f9..fade6fa 100644 --- a/aiida_restapi/graphql/orm_factories.py +++ b/aiida_restapi/graphql/orm_factories.py @@ -31,9 +31,10 @@ def get_pydantic_type_name(annotation: Any) -> Any: """ - In pydantic v1, one could do field.type_, + In pydantic v1, one could do `field.type_`, but in v2, one has to go though field.annotation """ + args = typing.get_args(annotation) if args: return args[0] diff --git a/aiida_restapi/graphql/sphinx_ext.py b/aiida_restapi/graphql/sphinx_ext.py index 329b1ea..88bea4c 100644 --- a/aiida_restapi/graphql/sphinx_ext.py +++ b/aiida_restapi/graphql/sphinx_ext.py @@ -3,7 +3,7 @@ # pylint: disable=import-outside-toplevel from typing import TYPE_CHECKING, List -from graphql.utils.schema_printer import print_schema +from graphql.utilities import print_schema from .main import SCHEMA @@ -21,7 +21,7 @@ class SchemaDirective(SphinxDirective): def run(self) -> List[Element]: """Run the directive.""" - text = print_schema(SCHEMA) + text = print_schema(SCHEMA.graphql_schema) # TODO for lexing tried: https://gitlab.com/marcogiusti/pygments-graphql/-/blob/master/src/pygments_graphql.py # but it failed code_node = literal_block(text, text) # , language="graphql") diff --git a/docs/source/conf.py b/docs/source/conf.py index 38ab465..80ebe50 100755 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -14,16 +14,8 @@ import sys import time -from aiida.manage.configuration import load_documentation_profile - import aiida_restapi -# -- AiiDA-related setup -------------------------------------------------- - -# Load the dummy profile even if we are running locally, this way the documentation will succeed even if the current -# default profile of the AiiDA installation does not use a Django backend. -load_documentation_profile() - extensions = [ 'myst_parser', 'sphinx_external_toc',