diff --git a/src/maggma/api/API.py b/src/maggma/api/API.py index 9a7e0bdca..ca1812c26 100644 --- a/src/maggma/api/API.py +++ b/src/maggma/api/API.py @@ -23,6 +23,8 @@ def __init__( version: str = "v0.0.0", debug: bool = False, heartbeat_meta: Optional[Dict] = None, + description: str = None, + tags_meta: List[Dict] = None, ): """ Args: @@ -31,11 +33,15 @@ def __init__( version: the version for this API debug: turns debug on in FastAPI heartbeat_meta: dictionary of additional metadata to include in the heartbeat response + description: decription of the API to be used in the generated docs + tags_meta: descriptions of tags to be used in the generated docs """ self.title = title self.version = version self.debug = debug self.heartbeat_meta = heartbeat_meta + self.description = description + self.tags_meta = tags_meta if len(resources) == 0: raise RuntimeError("ERROR: There are no endpoints provided") @@ -60,6 +66,8 @@ def app(self): version=self.version, on_startup=[self.on_startup], debug=self.debug, + description=self.description, + openapi_tags=self.tags_meta, ) # Allow requests from other domains in debug mode. This allows diff --git a/src/maggma/api/query_operator/sparse_fields.py b/src/maggma/api/query_operator/sparse_fields.py index 7fb8e2324..a75188a46 100644 --- a/src/maggma/api/query_operator/sparse_fields.py +++ b/src/maggma/api/query_operator/sparse_fields.py @@ -30,7 +30,8 @@ def __init__( def query( fields: str = Query( None, - description=f"Fields to project from {str(model_name)} as a list of comma seperated strings", + description=f"Fields to project from {str(model_name)} as a list of comma seperated strings.\ + Fields include: {model_fields}", ), all_fields: bool = Query(False, description="Include all fields."), ) -> STORE_PARAMS: diff --git a/src/maggma/api/resource/read_resource.py b/src/maggma/api/resource/read_resource.py index dbc77d06f..eedf0d94b 100644 --- a/src/maggma/api/resource/read_resource.py +++ b/src/maggma/api/resource/read_resource.py @@ -147,7 +147,8 @@ async def get_by_key( self.router.get( f"{self.sub_path}{{{key_name}}}/", - response_description=f"Get an {model_name} by {key_name}", + summary=f"Get a {model_name} document by by {key_name}", + response_description=f"Get a {model_name} document by {key_name}", response_model=self.response_model, response_model_exclude_unset=True, tags=self.tags,