-
Notifications
You must be signed in to change notification settings - Fork 3
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 SliceableRepository #6
Conversation
@@ -11,4 +11,5 @@ dependencies { | |||
|
|||
testCompile "com.fasterxml.jackson.core:jackson-databind" | |||
testCompile "com.jayway.jsonpath:json-path-assert:2.2.0" | |||
testCompile "org.skyscreamer:jsonassert:1.5.0" |
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.
JSON 文字列の比較で使用
です。 | ||
|
||
ソート順は、ユニークになるように指定してください。 | ||
例えば、`ORDER BY create_at ASC` にした場合、create_at が同じ値のレコードのソート順は不定です。 |
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.
ページングで全部の値が取得できることが保証できない、まで書いちゃってよいかと(ソートにこだわらなければユニークでなくてもよいようにとられそう)
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.
言い切りました。
0f6f479
* SliceableHandlerMethodArgumentResolver | ||
* Slice のリクエストを受け取る場合 | ||
|
||
インスタンスを add してください。 |
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 class WebMvcConfiguration implements WebMvcConfigurer {
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
argumentResolvers.add(new ChunkableHandlerMethodArgumentResolver());
argumentResolvers.add(new SliceableHandlerMethodArgumentResolver());
}
}
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.
書きました
0f6f479
@Setter(AccessLevel.PACKAGE) | ||
@XmlElement(name = "embedded") | ||
@JsonProperty("_embedded") | ||
@JsonInclude(JsonInclude.Include.NON_NULL) |
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.
これNullのケースないような気がしますがどうでしょうか(コンストラクタ的にも仕様的にも)
https://github.com/classmethod/cmapi-five-rings/blob/24ebeff38f9f8a6ab257b23c30ab44a1f5e0f7f0/content/section2/pagination-offset.md
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.
setter で設定できるからコンパイル的には...と思ったのですが、setter もデフォルトコンストラクタも撲滅で解決。
0f6f479
a03800d
to
0f6f479
Compare
282f4de
to
47dcbd6
Compare
@inabajunmr SliceableHandlerMethodArgumentResolver でチェックしても良かったのですが、エラーハンドリングが柔軟にできなさそうだったので(Controller に入る前に throw する)、spring-data-mirage 側で Sliceable#validate を呼び出す想定です。 |
この観点のバリデーションエラーについては固定で400で良い気がしますが、SliceableHandlerMethodArgumentResolverだと困るのってどういうのを想定してますか?(もしくは実装がしづらい?) mirageでやるようにするとControllerのハンドリング漏れで500返るとかそういうイベント起きそうだなあと |
c376134
to
1d55963
Compare
直接 spring-data-mirage を呼んだ時のことを想定したのですが、SliceableHandlerMethodArgumentResolver でもチェックはしておいて良いとも思ったのでチェック処理追加してみました。 |
1d55963
to
bd4bda3
Compare
bd4bda3
to
21810a4
Compare
fa67641
to
56b0195
Compare
概要
#2
内容
Service / Repository 向け
(実際に SQL を意識するのは spring-data-mirage 側の PR を参照)
Controller 向け
@ChunkableDefault
相当)