-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add Sample Api #12
Add Sample Api #12
Conversation
b1e5f16
to
a5ac530
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
技術的な質問だけー
|
||
/** paging data for current page */ | ||
@NotNull | ||
public final List<@Valid BEAN> rows; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
純粋な技術の質問。LastaFluteのexampleだと、@Validは変数自体に付けてるけど、Genericの方に付けても挙動って同じってことなのかな?
LastaFluteのexample:
@Valid
public final List<BEAN> rows;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jflute
試してみたところ、以下のどちらも同じ結果でした。
@Valid
public final List<BEAN> rows;
public final List<@Valid BEAN> rows;
ので、Lastaに合わせるように修正しました。
f9c2071
あと、Contollerのメソッドの戻り値にも @Validを付けないと、
レスポンスがバリデーションされなかったので、そちらも合わせて追加しました。
public @Valid SearchPagingResult<ProductRowResult> search(@BeanParam @Valid ProductSearchBody form) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
なるほど、LastaのExampleに合わせるで嬉しい、ありがとうー!
Genericにアノテーション付けられるって知らない人も多いだろうから、
挙動が同じであれば、変数自体に付けるほうが馴染みやすいかなとも思う。
一方で、レスポンスのBeanにもバリデーションできるんだ!?
こうできると便利って思ってるの自分だけかもしれない...とか思ってたので、
Quarkusも採用しているのは嬉しいね。
ただ、@Validを付けないとチェックされないってことで強制力は低めではあるんだの。
(Lastaはデフォルトで強制チェックなので)
* @author miyasama | ||
*/ | ||
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) | ||
public class ProductRowResult { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
publicフィールドスタイルなのは、Quarkusのスタンダードなのかな?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jflute
Quarkusの公式サイトの実装例とかを見ている感じだと、publicフィールドスタイルです。
Quarkusを使っている現場のスタンダードなのかは不明ですが、
うちのチームだとpublicフィールドスタイルにしています。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
publicフィールドスタイルはSeasar文化みたいな認識の人もよくいるんだけど、
んなこたないよってことだね笑、よかったよかった(^^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
あぷるーゔ、thanks
Create Login Api and MyPage Api
概要
サンプルとして、商品の検索APIと、ID指定の1件取得APIを追加しました。
詳細
以下の2つのサンプル相当のものを実装しました。
o LidoProductListAction.java
https://github.com/lastaflute/lastaflute-example-harbor/blob/master/src/main/java/org/docksidestage/app/web/lido/product/LidoProductListAction.java
o LidoProductDetailAction.java
https://github.com/lastaflute/lastaflute-example-harbor/blob/master/src/main/java/org/docksidestage/app/web/lido/product/LidoProductDetailAction.java
動作確認方法
以下のREADMEに記載の方法で、起動とSwaggerUIからの確認ができます。
https://github.com/dbflute-example/dbflute-example-on-quarkus/blob/master/README.md?plain=1#L38-L40