Created by: jmini
Fix for #16 (closed)
This PR introduces CodegenProperty.mostInnerItems and CodegenParameter.mostInnerItems that gives always the most inner items type when arrays are contained in arrays.
OAS2 (extract):
definitions:
SomeObj:
type: object
properties:
order:
type: array
items:
type: array
items:
type: string
enum:
- val1
- val2
- val3
Example in Java:
The CodegenProperty created for order defines the type List<List<OrderEnum>>.
Before this PR, if you want to access the CodegenProperty corresponding to the enum you need to do items.items (because we have an array of array of enum). The problem is that you do not know how many time you need to loop. If you just have a simple array of enum it will be items
In the Java code you often see this pattern:
while (codegenProperty != null) {
codegenProperty = codegenProperty.items;
}
To find the most inner items CodegenProperty
This PR introduces mostInnerItems that you can call at top level (you should check isContainer) and that gives you the items you are looking for (the one corresponding to OrderEnum in the example)