Open skinkie opened 5 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 100.00%. Comparing base (
cce0a16
) to head (d4b3e5b
).:exclamation: Current head d4b3e5b differs from pull request most recent head 67d847f
Please upload reports for the commit 67d847f to get more accurate results.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
We need to properly support the Iterable
type annotation in model fields, and of course support this for both xml/json serialization @skinkie.
We need to properly support the
Iterable
type annotation in model fields, and of course support this for both xml/json serialization @skinkie.
But would this something you would support from an architecture point of view?
We need to properly support the
Iterable
type annotation in model fields, and of course support this for both xml/json serialization @skinkie.But would this something you would support from an architecture point of view?
Yes
@tefra How would you like to proceed? Materialise List or Tuple in the tests?
Testing it with my own code results in this error. So it is clearly not done yet.
xsdata.exceptions.XmlContextError: Error on DataObjectsRelStructure::choice: Xml Elements does not support typing `typing.Iterable[typing.Union[netex.general_version_frame_structure.CompositeFrame, netex.mobility_journey_frame.MobilityJourneyFrame, netex.mobility_service_frame.MobilityServiceFrame, netex.sales_transaction_frame.SalesTransactionFrame, netex.fare_frame.FareFrame, netex.driver_schedule_frame.DriverScheduleFrame, netex.vehicle_schedule_frame.VehicleScheduleFrame, netex.service_frame.ServiceFrame, netex.timetable_frame.TimetableFrame, netex.site_frame.SiteFrame, netex.infrastructure_frame.InfrastructureFrame, netex.general_version_frame_structure.GeneralFrame, netex.resource_frame.ResourceFrame, netex.service_calendar_frame.ServiceCalendarFrame]]`
Parsing breaks with Iterable.
if tokens_factory:
value = value if collections.is_array(value) else value.split()
return tokens_factory(
converter.deserialize(val, types, ns_map=ns_map, format=format)
for val in value
Parsing solved.
While it looked like 'working' again, I noticed that Iterable
again breaks the parsing.
Issues
1 New issue
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code
π Description
Considering you are writing a very big tree, you don't want to materialise that tree before it ends up in a file in a list first. Ideally the entire subtree should only be rendered just in time.
π What I've Done
I have allowed a Generator to be handled as a List.
π¬ Comments
There might be more places this needs to be changed. Since List[] is used everywhere, type hinting fails.
π« Checklist