Skip to content

Unable to declare ImageField as required #332

@johnthagen

Description

@johnthagen

Cross posted from Hipo/drf-extra-fields#66

My model:

class Image(models.Model):
      image=models.ImageField(upload_to='photos')
      name=models.CharField(max_length=40, unique=False)

My serializer:

class imagesSerializer(serializers.ModelSerializer):
      image = Base64ImageField(required=True)
      class Meta:
         model = Image
         fields = ('id','name','image')

My swagger view:
image

How can I make the ImageField as required in swagger POST request?

In the other thread we seem to have narrowed the problem down to drf-yasg, testing with drf-yasg==1.13.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions