Function
assignType
(item: dict, type: str, is_array: bool = False, map_binary_to_string: bool = False)
Source from the content-addressed store, hash-verified
| 24 | |
| 25 | |
| 26 | def assignType(item: dict, type: str, is_array: bool = False, map_binary_to_string: bool = False) -> None: |
| 27 | if is_array: |
| 28 | item["type"] = "array" |
| 29 | item["items"] = OrderedDict() |
| 30 | assignType(item["items"], type, False, map_binary_to_string) |
| 31 | return |
| 32 | |
| 33 | if type == "enum": |
| 34 | type = "string" |
| 35 | if map_binary_to_string and type == "binary": |
| 36 | type = "string" |
| 37 | if type in primitiveTypes: |
| 38 | item["type"] = type |
| 39 | else: |
| 40 | item["$ref"] = type |
| 41 | |
| 42 | |
| 43 | def createItem( |
Tested by
no test coverage detected