# Validate serializations

**URL:** <https://forum.djangoproject.com/t/validate-serializations/29955>\
**Category:** Using Django\
**Created:** [April 8, 2024, 1:43pm UTC](https://forum.djangoproject.com/t/validate-serializations/29955 "2024-04-08T13:43:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ManDo](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/mando/32/20465_2.png) [@ManDo](https://forum.djangoproject.com/u/ManDo)\
**Post date:** [April 8, 2024, 1:43pm UTC](https://forum.djangoproject.com/t/validate-serializations/29955/1 "2024-04-08T13:43:13Z")

</div>

Hi,

I am using Django to create an API, but I am encountering an issue with validation serializers. Here is my serializer class:

```auto
class InputSerializer(serializers.Serializer):
    keyword = serializers.CharField(required=True, allow_blank=False, allow_null=False)
    vi_name = serializers.CharField(required=False, allow_blank=False, allow_null=False)

```

The problem is the validation succeed when I send a request with {‘keyword’: ‘a’, ‘vi\_name’:‘’} (I mean ‘vi\_name’ is blank).

How to make the serializer validation fail when I send ‘vi\_name’ blank or null?  
Thank you!

---

<div class="post-metadata">

**Author:** ![leandrodesouzadev](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/leandrodesouzadev/32/8981_2.png) [@leandrodesouzadev](https://forum.djangoproject.com/u/leandrodesouzadev)\
**Post date:** [April 8, 2024, 3:43pm UTC](https://forum.djangoproject.com/t/validate-serializations/29955/2 "2024-04-08T15:43:36Z")

</div>

Well, accordingly to the schema you provided, it should already be failing the validation.  
Can you double check the input data that you’re receiving in your view?

Also note that both [allow\_null](https://www.django-rest-framework.org/api-guide/fields/#allow_null) and [allow\_blank](https://www.django-rest-framework.org/api-guide/fields/#charfield) already defaults to `False`
