Skip to content

fix: conversion to dictionary depending on pydantic version - #408

Merged
kemingy merged 1 commit into
0b01001001:mainfrom
nightblure:no-calling-for-deprecated-dict-method-on-v2
Apr 9, 2025
Merged

kemingy merged 1 commit into
0b01001001:mainfrom
nightblure:no-calling-for-deprecated-dict-method-on-v2

Conversation

@nightblure

@nightblure nightblure commented Apr 9, 2025 •

Copy link
Copy Markdown
Contributor

hi!

having pydantic v2 I wouldn't want to call the dict method for at least two reasons:

  1. its deprecated for v2
  2. I could have an overridden implementation of the dict method and after moving to v2 it would be logical to rename it to model_dump. Without this change I'll have to debug the spectree code before I understood that my method with the new name won't be called

p.s. noqa: SIM108 it's a matter of taste, I can change it to a ternary operator as the linter suggests, if you want that too

@nightblure nightblure changed the title add model_dump method calling when pydantic v2 conversion to dictionary depending on pydantic version Apr 9, 2025
@nightblure nightblure changed the title conversion to dictionary depending on pydantic version fix: conversion to dictionary depending on pydantic version Apr 9, 2025

@kemingy kemingy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! 🎉

@kemingy
kemingy merged commit ee2332e into 0b01001001:main Apr 9, 2025
@nightblure

Copy link
Copy Markdown
Contributor Author

Thanks for such a quick review!

@nightblure
nightblure deleted the no-calling-for-deprecated-dict-method-on-v2 branch April 9, 2025 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants