Don't include read-only properties in Python examples. (#9252)

* Don't include read-only properties in Python examples.

When using a schema with read-only fields as API inputs, Python
generates examples for those: this excludes them.

* Fix tests
This commit is contained in:
Thomas Hervé
2021-04-14 20:43:28 +02:00
committed by GitHub
parent 9edf70e980
commit 60dcf8613f
11 changed files with 249 additions and 0 deletions

View File

@@ -20,6 +20,7 @@ except ImportError:
number_with_validations = sys.modules[
'petstore_api.model.number_with_validations']
from petstore_api.model.object_model_with_ref_props import ObjectModelWithRefProps
from petstore_api.model.readonly import Readonly
class TestObjectModelWithRefProps(unittest.TestCase):
@@ -38,6 +39,7 @@ class TestObjectModelWithRefProps(unittest.TestCase):
ObjectModelWithRefProps.openapi_types,
{
'my_number': (NumberWithValidations,),
'my_readonly': (Readonly,),
'my_string': (str,),
'my_boolean': (bool,),
}