mirror of
https://github.com/TECHNOFAB11/kubenix.git
synced 2025-12-13 08:30:05 +01:00
prevent self-referential types in generated modules
This commit is contained in:
parent
8fec3d8f9e
commit
6dfa8e81c7
7 changed files with 44 additions and 38 deletions
|
|
@ -138,7 +138,10 @@ with lib; let
|
|||
type = requiredOrNot (mapType swagger.definitions.${refDefinition property});
|
||||
}
|
||||
else {
|
||||
type = requiredOrNot (submoduleOf definitions (refDefinition property));
|
||||
type =
|
||||
if (refDefinition property) == _name
|
||||
then types.unspecified # do not allow self-referential values
|
||||
else requiredOrNot (submoduleOf definitions (refDefinition property));
|
||||
}
|
||||
# if property has an array type
|
||||
else if property.type == "array"
|
||||
|
|
@ -165,7 +168,10 @@ with lib; let
|
|||
}
|
||||
# in other case it's a simple list
|
||||
else {
|
||||
type = requiredOrNot (types.listOf (submoduleOf definitions (refDefinition property.items)));
|
||||
type =
|
||||
if (refDefinition property.items) == _name
|
||||
then types.unspecified # do not allow self-referential values
|
||||
else requiredOrNot (types.listOf (submoduleOf definitions (refDefinition property.items)));
|
||||
}
|
||||
# in other case it only references a simple type
|
||||
else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue