| 330 | ) |
| 331 | |
| 332 | def read(self): |
| 333 | results = [] |
| 334 | properties = self.spec.get("items", {}).get("properties", {}) |
| 335 | message = ( |
| 336 | '~~~ Would you like to add another item to "%s" array / list?' % self.name |
| 337 | ) |
| 338 | |
| 339 | is_continue = True |
| 340 | index = 0 |
| 341 | while is_continue: |
| 342 | prefix = "{name}[{index}].".format(name=self.name, index=index) |
| 343 | results.append( |
| 344 | InteractiveForm( |
| 345 | properties, prefix=prefix, reraise=True |
| 346 | ).initiate_dialog() |
| 347 | ) |
| 348 | |
| 349 | index += 1 |
| 350 | if Question(message, {"default": "y"}).read() != "y": |
| 351 | is_continue = False |
| 352 | |
| 353 | return results |
| 354 | |
| 355 | |
| 356 | class ArrayEnumReader(EnumReader): |