Adds support for optional objects in lists & Add support for optional lists of (optional) objects
Generating the spark schema for array columns that contain optional objects used to result in errors.
The script would try to get the items for array types but if you have an array with optional object elements it would result in a NotImplementedError since the type and ref would be None. The ref would reside in anyOf which would contain $ref
class OptionalObjectsInArray(SparkBase):
c1: List[Optional[Nested2Model]]
OptionalObjectsInArray.spark_schema()
> `NotImplementedError`
Generating the spark schema for optional array columns that contain (optional) objects used to result in an Attribute error, since the array field would not have the attribute items it would have the attribute anyOf which would contain items
class OptionalArrayOfArraysWithOptionalObjectsInArray(SparkBase):
c1: Optional[List[OptionalObjectsInArray]]
OptionalArrayOfArraysWithOptionalObjectsInArray.spark_schema()
> `AttributeError: 'NoneType' object has no attribute 'get'`
Adds support for optional objects in lists & Add support for optional lists of (optional) objects
The script would try to get the items for array types but if you have an array with optional object elements it would result in a
NotImplementedError
since the type and ref would be None. The ref would reside inanyOf
which would contain$ref
items
it would have the attributeanyOf
which would containitems