You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Resolving the typing inconsistency will need both generation and library changes as if we update the ParsableFactory to be a type variable as it is used and rename the current ParsableFactory we may end up breaking library functionalities calling methods like create_from_discriminator_value directly.
We probably need to either
create a new type variable based of the ParsableFactory class (or generate it inline) and generate it across the SDK to fix the type inconsistency and update the library parameter types to use this too.
update the library implementation of ParsableFactory to be consistent with other sdks and have the ParsableFactory be a function template. This would also involve updating the library implementations like get_object_value to no longer expect types and also probably be source breaking as well.
andrueastman
changed the title
ParsableFactory type is inconsistently used in generated code and the libraries.
Inconsistent typing used in generated code and the libraries.
Sep 13, 2024
Related to #331
Running typechecking validation using generated SDK by Kiota yields errors due to the inconsistencies .
1. Usage of the ParsableFactory
The functions below use the type as a parameter
However, on generation, the parameters passed are not instances of the factory but type(class) definitions.
The relevant implementations also happen to call the
create_from_discriminator_value
statically directly.https://github.com/microsoft/kiota-serialization-json-python/blob/160d8a6d54237f96205f9972acbf17da5d80b2cd/kiota_serialization_json/json_parse_node.py#L215C18-L215C25
Resolving the typing inconsistency will need both generation and library changes as if we update the
ParsableFactory
to be a type variable as it is used and rename the currentParsableFactory
we may end up breaking library functionalities calling methods likecreate_from_discriminator_value
directly.We probably need to either
ParsableFactory
class (or generate it inline) and generate it across the SDK to fix the type inconsistency and update the library parameter types to use this too.ParsableFactory
to be consistent with other sdks and have the ParsableFactory be a function template. This would also involve updating the library implementations likeget_object_value
to no longer expect types and also probably be source breaking as well.2. Return type of request executors should be optional in the case of returning streams/bytes
Taking a look at an example at
https://github.com/microsoftgraph/msgraph-sdk-python/blob/416fccc20bd90a8f8d71ef7cc7519d2f63f488f5/msgraph/generated/applications/item/logo/logo_request_builder.py#L49
The function ends up returning the result of
send_primitive_async
which is an optional not justbytes
The text was updated successfully, but these errors were encountered: