diff --git a/pydatalab/src/pydatalab/routes/v0_1/info.py b/pydatalab/src/pydatalab/routes/v0_1/info.py index 89376480d..4593e95ca 100644 --- a/pydatalab/src/pydatalab/routes/v0_1/info.py +++ b/pydatalab/src/pydatalab/routes/v0_1/info.py @@ -11,7 +11,7 @@ from pydatalab import __version__ from pydatalab.blocks import BLOCK_TYPES from pydatalab.config import CONFIG, FEATURE_FLAGS, FeatureFlags -from pydatalab.models import Person +from pydatalab.models import Collection, Equipment, Person, Sample, StartingMaterial from pydatalab.mongo import flask_mongo from ._version import __api_version__ @@ -76,8 +76,7 @@ def strip_maintainer_fields(cls, v): def _get_deployment_metadata_once() -> Dict: identifier_prefix = CONFIG.IDENTIFIER_PREFIX metadata = ( - CONFIG.DEPLOYMENT_METADATA.dict( - exclude_none=True) if CONFIG.DEPLOYMENT_METADATA else {} + CONFIG.DEPLOYMENT_METADATA.dict(exclude_none=True) if CONFIG.DEPLOYMENT_METADATA else {} ) metadata.update({"identifier_prefix": identifier_prefix}) return metadata @@ -95,8 +94,7 @@ def get_info(): jsonify( json.loads( JSONAPIResponse( - data=Data(id="/", type="info", - attributes=Info(**metadata)), + data=Data(id="/", type="info", attributes=Info(**metadata)), meta=Meta(query=request.query_string), links=Links(self=request.url), ).json() @@ -115,8 +113,7 @@ def get_stats(): cell_count = flask_mongo.db.items.count_documents({"type": "cells"}) return ( - jsonify({"counts": {"users": user_count, - "samples": sample_count, "cells": cell_count}}), + jsonify({"counts": {"users": user_count, "samples": sample_count, "cells": cell_count}}), 200, ) @@ -152,9 +149,9 @@ def list_block_types(): def list_supported_types_schemas(): """Returns a dictionary of supported item types and their schemas.""" schemas = { - "sample": Sample.schema(), - "collection": Collection.schema(), - "starting_material": StartingMaterial.schema(), + "samples": Sample.schema(), + "collections": Collection.schema(), + "starting_materials": StartingMaterial.schema(), "equipment": Equipment.schema(), } return jsonify(schemas) @@ -166,7 +163,7 @@ def get_sample_schema(): return jsonify(Sample.schema()) -@INFO.route("/info/types/collection", methods=["GET"]) +@INFO.route("/info/types/collections", methods=["GET"]) def get_collection_schema(): """Returns the JSON schema for the Collection type.""" return jsonify(Collection.schema())