Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typing questions #355

Open
Acurisu opened this issue Aug 7, 2024 · 1 comment
Open

Typing questions #355

Acurisu opened this issue Aug 7, 2024 · 1 comment
Labels
type:enhancement Enhancement request targeting an existing experience type:question An issue that's a question

Comments

@Acurisu
Copy link
Contributor

Acurisu commented Aug 7, 2024

def get_collection_of_primitive_values(self, primitive_type: Any) -> Optional[List[T]]: inside JsonParseNode takes primitive_type: Any, however we raise an error if primitive_type is not of type primitive_types = {bool, str, int, float, UUID, datetime, timedelta, date, time, bytes}. Why not just make primitive_type be a union type of these supported primitives? But then we could also remove T, since currently I don't quite see the use for it.
Alternatively we could leave T but then shouldn't we make primitive_type have type Type[T] or similar which allows for more restrictive typing on the user's end?

@Acurisu
Copy link
Contributor Author

Acurisu commented Aug 7, 2024

Also this function does not strictly follow the signature of the underlying abstractmethod which is def get_collection_of_primitive_values(self) -> List[T]:. Couldn't this be unexpected?

@Ndiritu Ndiritu added type:question An issue that's a question type:enhancement Enhancement request targeting an existing experience labels Aug 19, 2024
@baywet baywet transferred this issue from microsoft/kiota-serialization-json-python Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement Enhancement request targeting an existing experience type:question An issue that's a question
Projects
Status: Todo 📃
Development

No branches or pull requests

2 participants