[Django]-How to set required fields in PATCH API in Swagger UI

4👍

change your SPECTACULAR_SETTINGS

    SPECTACULAR_SETTINGS = {
        'TITLE': 'APP NAME',
        'VERSION': '1.0.0',
        'SCHEMA_PATH_PREFIX_TRIM': True,
        'PREPROCESSING_HOOKS': ["custom.url_remover.preprocessing_filter_spec"], 
        'COMPONENT_SPLIT_PATCH': False, 
    }

by default COMPONENT_SPLIT_PATCH is true in SPECTACULAR_SETTINGS so you can simply override('COMPONENT_SPLIT_PATCH': False) it to fix this problem

Leave a comment