Skip to content

Change fields as decorator documentation for endpoint definitions #128

@smholloway

Description

@smholloway

See: https://django-declarative-apis.readthedocs.io/en/latest/fields.html#field-as-decorators-on-a-function

The example for this shows:

@field(
     required=False,
     name='completion_status',
     type=bool,
     default=None,
     description='Status for a task in the todo list. The only valid status is "True"')
 def status(self, raw_value):
    if status.get(raw_value, None) != True:
         raise ValueError(f"{raw_value} is not a valid status")
    return True

But in this example, what exactly is status? I think this should just be if raw_value != True

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions