Open BHAUTIK04 opened 3 years ago
We have flask_restplus for our API, in one of the post requests we have a nested structure. When we validate input json with expect decorator it is raising the key error. API model is
user_expected_field = api.model('UserRequest', { "user_email": fields.String(example='user@abc.com', required=True), "user_name": fields.String(example="user", required=True), "user_gender": fields.String(example="Male", required=True), "user_address":fields.List(fields.Nested(api.model( "AddressModel", { "street1": field.String(required=True), "street2": field.String(required=True), "city": field.String(required=True), "state": field.String(required=True), "country": field.String(required=True), } ))) }, )
Error:
Traceback (most recent call last): File "/lib/python3.6/site-packages/jsonschema/validators.py", line 812, in resolve_fragment document = document[part] KeyError: 'AddressModel'
Any help will be highly appreciated.
We have flask_restplus for our API, in one of the post requests we have a nested structure. When we validate input json with expect decorator it is raising the key error. API model is
Error:
Any help will be highly appreciated.