Skip to content
This repository was archived by the owner on Jun 21, 2022. It is now read-only.
This repository was archived by the owner on Jun 21, 2022. It is now read-only.

EnvVarSerializer validators unique together #145

@deoktr

Description

@deoktr

EnvVarSerializer validators unique together on buildoptions and variable.

There is a UniqueTogetherValidator that is not in use because it cause problemes because the buildoptions is set during the perform_create on the view and not on the validate of the serializer and thus causes a bug when creating an EnvVar from the API.

validators = [
    UniqueTogetherValidator(
        queryset=EnvVar.objects.all(),
        fields=["buildoptions", "variable"],
    )
]

The constraint is present at the model level (UniqueConstraint inside EnvVar model) and thus causes an error whenever someone tries to create a duplicate envvar for the same dapp, but this error is not reflected (without the UniqueTogetherValidator validator on the serializer) and send a 500 error wich is clearly not what we want.

Implementation idea

We could add a validation on create on the EnvVarViewSet ? This add the problems of relying on the views to make the serializer validation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    APIIssues about the APIImplementationHow to implement somethinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions