フロントエンドで OpenAPI generator を利用した日付型の扱いについて #3509
Unanswered
1nu1taichi
asked this question in
05: Q&A
Replies: 1 comment
-
|
原則として、HTTP通信の仕様により発生する問題は通信層で解決したい。
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
OpenAPI 定義で日付型(date, date-time)とした値について、OpenAPI Generator が生成するモデルはstring型となる。
そのためどこかのタイミングでDate⇔stringの変換を行う必要がある。
OpenAPI Generatorの仕様に則ると、表示する箇所やHTTP リクエストのタイミングで変換を行うのが良いと考えられるが、現状Dresscaでは生成されたmodelをそのまま持ち回っているため、ビューモデルを扱うパターンが欲しい。
別案として axios.interceptors.response で共通処理として変換する方法も考えられる。
ただし、この場合、 type-mappingの設定が必要となる
Beta Was this translation helpful? Give feedback.
All reactions