Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
prozorro-sale
Schematics
Commits
4c546a7e
Commit
4c546a7e
authored
Nov 10, 2020
by
Andrey Veltischev
Browse files
Merge branch 'vitalii/anyOf_comments' into 'master'
Added coments for allOf property See merge request
!39
parents
42b135b7
ad8622bb
Changes
1
Hide whitespace changes
Inline
Side-by-side
schematics/swagger_generator.py
View file @
4c546a7e
...
...
@@ -46,8 +46,10 @@ class SchemaTransformer:
schema_model
[
'anyOf'
]
=
{}
for
ref
in
model
[
'anyOf'
]:
if
isinstance
(
ref
,
dict
):
# ^ this condition is needed to avoid of re-expanding expanded schema
schema_model
[
'anyOf'
][
self
.
_split_model_name
(
ref
[
'$ref'
])]
=
self
.
expand_schema_model
(
schema
,
ref
)
else
:
# this case is needed for reuse expanded model schema
schema_model
[
'anyOf'
][
ref
]
=
self
.
expand_schema_model
(
schema
,
ref
)
else
:
schema_model
=
deepcopy
(
model
)
...
...
@@ -136,7 +138,7 @@ class BaseSchemaBuilder:
def
_build_poly_model
(
self
,
prop_data
):
models
=
[]
model_props
=
self
.
_map_params
(
prop_data
)
is_array
=
True
if
'type'
in
prop_data
and
prop_data
[
'type'
]
==
'array'
else
False
is_array
=
'type'
in
prop_data
and
prop_data
[
'type'
]
==
'array'
allOf_items
=
prop_data
[
'items'
][
'anyOf'
]
if
is_array
else
prop_data
[
'anyOf'
]
for
name
,
model
in
allOf_items
.
items
():
attr_model
=
getattr
(
self
.
module
,
name
.
split
(
'.'
)[
-
1
],
None
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment