diff --git a/middleware/primary_resource_logic/locations_logic.py b/middleware/primary_resource_logic/locations_logic.py index e7048493..923420d4 100644 --- a/middleware/primary_resource_logic/locations_logic.py +++ b/middleware/primary_resource_logic/locations_logic.py @@ -10,17 +10,9 @@ message_response, multiple_results_response, ) -from middleware.dynamic_request_logic.get_many_logic import get_many -from middleware.dynamic_request_logic.get_related_resource_logic import ( - get_related_resource, - GetRelatedResourcesParameters, -) -from middleware.dynamic_request_logic.supporting_classes import MiddlewareParameters from middleware.enums import Relations from middleware.flask_response_manager import FlaskResponseManager -from middleware.primary_resource_logic.data_requests import ( - get_data_requests_subquery_params, -) + from middleware.schema_and_dto_logic.common_schemas_and_dtos import GetByIDBaseDTO diff --git a/middleware/schema_and_dto_logic/dynamic_logic/dynamic_schema_documentation_construction.py b/middleware/schema_and_dto_logic/dynamic_logic/dynamic_schema_documentation_construction.py index 9c08e09a..886bcffc 100644 --- a/middleware/schema_and_dto_logic/dynamic_logic/dynamic_schema_documentation_construction.py +++ b/middleware/schema_and_dto_logic/dynamic_logic/dynamic_schema_documentation_construction.py @@ -21,12 +21,13 @@ """ from abc import ABC, abstractmethod +from enum import Enum from typing import Optional, Type from flask_restx.reqparse import RequestParser from flask_restx import fields as restx_fields, Namespace, Model -from marshmallow import fields as marshmallow_fields +from marshmallow import fields as marshmallow_fields, missing from marshmallow.validate import OneOf from middleware.schema_and_dto_logic.mappings import ( @@ -108,6 +109,7 @@ def build_description(self): self.enum_case() self.validator_case() self.list_query_case() + self.default_case() def enum_case(self): if isinstance(self.field, marshmallow_fields.Enum): @@ -129,6 +131,14 @@ def list_query_case(self): return self.description += " \n(Comma-delimited list)" + def default_case(self): + default = self.field.load_default + if default != missing: + # If Enum, get value + if isinstance(default, Enum): + default = default.value + self.description += f" \nDefault: {default}" + class FieldInfo: