-
-
Notifications
You must be signed in to change notification settings - Fork 33
Closed
Description
Hi all! First of all thanks for providing this tool. It has helped my projects a lot.
I find an issue related to the schema used for the validation. There is an _schema.update(...) in https://github.com/p1c2u/openapi-schema-validator/blob/ab7222af0597ebc672f93cc7f7e089897aba1bec/openapi_schema_validator/validators.py#L68-L72 that is mutating the schema adding nullable: False property in all the fields that doesn't have it.
This schema mutation is generating some issues at the time of using the schema in other features like generating default values and in tests that are expecting the schema without changes.
I'll be happy to work on this and submit a PR.
Steps to reproduce
- Create a schema that doesn't have the
nullableproperty - Use
validate(...)function with the instance and the schema - Now the schema contains the nullable property
Expected Behaviour
- The schema shouldn't have changed
Code used as an example for showing the issue
from openapi_schema_validator import validate
schema = {
"type": "object",
'properties': {
'email': {
'type': 'string'
},
'enabled': {
'type': 'boolean',
}
},
'example': {'enabled': False, 'email': "[email protected]"}
}
validate({"email": "[email protected]"}, schema)# schema after the validation
{
'type': 'object',
'properties': {
'email': {
'type': 'string',
+ 'nullable': False
},
'enabled': {
'type': 'boolean',
}
},
'example': {
'enabled': False,
'email': "[email protected]"
},
+ 'nullable': False
}fefi95 and sthagen
Metadata
Metadata
Assignees
Labels
No labels