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

feat!: SupportedDevicesからデシアライズ機能を剥奪 #958

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

qryxip
Copy link
Member

@qryxip qryxip commented Jan 30, 2025

内容

#941 の続き。

#941 においてSupportedDevices#[non_exhaustive]にしたが、一つ困った問題が生じた。SupportedDevicesのフィールドは現状全部requiredな形になっている。そしてSupportedDevicesはシリアライズ(オブジェクト → JSONの変換)と共にデシリアライズ(JSON → オブジェクトの変換)もできるようになっているため、このままだとフィールドを追加するのに困る。特に近いうちにROCmを入れたい。

解決法としては次の二つが考えられた。

  1. cudadml、あるいはcpuも含めた全てのフィールドをoptionalにする
  2. これから追加するであろうrocmとかをoptionalにし、今あるものはrequiredのままにする
  3. デシアライズ(JSON → SupportedDevices)の禁止

このPRでは3.を選んだ。というのもそもそもSupportedDevicesのコンストラクトは不要であるべきだからである。

BREAKING-CHANGE: Rust, Python, Java APIにおいてJSON → SupportedDevicesの変換が禁止される。

関連 Issue

その他

@qryxip qryxip requested a review from Hiroshiba January 30, 2025 18:41
@qryxip qryxip force-pushed the pr/feat-disable-deserialize-impl-from-supporteddevices branch from 6a0544d to 0d65912 Compare January 30, 2025 18:46
Comment on lines +142 to +143
JSONからの変換も含め、VOICEVOX CORE以外が作ることはできない。作ろうとした場合
``TypeError`` となる。
Copy link
Member Author

Choose a reason for hiding this comment

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

Java APIのとちょっと文面を変えているのは、Java APIがGSONだけに言及すればいいのに対してPythonのdataclassでは通常のコンストラクタのことがあるから。

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.

1 participant