pyopenapi / pyswagger

An OpenAPI (fka Swagger) client & converter in python, which is type-safe, dynamic, spec-compliant.
MIT License
385 stars 89 forks source link

model primitive enforce to include required fields in requests #170

Open ybekdemir opened 5 years ago

ybekdemir commented 5 years ago

We are using pyswagger to make internal service call through gateway. Gateway validates request body with the related model by using model primitive. The problem is apply_with method in the model primitive enforce us to include all required fields in our requests body. Especially for the update calls we don't want to include required fields which we don't want to update. I found this code under aply_with https://github.com/pyopenapi/pyswagger/blob/333c4ca08e758cd2194943d9904a3eda3fe43977/pyswagger/primitives/_model.py#L47

I just want to learn that what is the reason behind this ? Is this best practice?

Thanks.