Avoid marking read_only fields as required (#133)

* Avoid marking read_only fields as required

Read only properties cannot be marked as required by a schema.
This commit is contained in:
werwty
2018-05-30 14:56:53 -04:00
committed by Cristi Vîjdea
parent a4a11ad1ab
commit 408b31fc4f
3 changed files with 6 additions and 4 deletions
+4 -2
View File
@@ -67,10 +67,12 @@ class InlineSerializerInspector(SerializerInspector):
}
prop_kwargs = filter_none(prop_kwargs)
properties[property_name] = self.probe_field_inspectors(
child_schema = self.probe_field_inspectors(
child, ChildSwaggerType, use_references, **prop_kwargs
)
if child.required:
properties[property_name] = child_schema
if child.required and not getattr(child_schema, 'read_only', False):
required.append(property_name)
result = SwaggerType(