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

Closed
Acurisu opened this issue Aug 7, 2024 · 3 comments · Fixed by #402
Closed

Typing questions #355

Acurisu opened this issue Aug 7, 2024 · 3 comments · Fixed by #402
Assignees
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
@andrueastman
Copy link
Member

We'll close this for now as this was resolved with #402. With the type information updated to use primitive_type: type[T] where T is a union of the primitive types. Typing signatures were also aligned fixed in #331

@github-project-automation github-project-automation bot moved this from Todo 📃 to Done ✔️ in Kiota Nov 11, 2024
@andrueastman andrueastman self-assigned this Nov 11, 2024
@Acurisu
Copy link
Contributor Author

Acurisu commented Nov 11, 2024

Thank you.

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
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants