Spring Boot and REST and Open API 3
実装を使用しています。この例では、v1
グループにはリストの実装があります - すべてのデータはリストに取得され、v2
グループにはページネーションの実装があります - すべてのデータはページの形式になります。
コンシューマの場合、コンシュームするエンドポイント URL を変更したくありません。
リストを返すエンドポイント。
@GetMapping(value = "/contacts", headers = {"Accept-version=v1"})
public ResponseEntity<List<Contact>> findAll() {
List<Contact> contacts = contactService.findContactList();
return new ResponseEntity<>(contacts, HttpStatus.OK);
}
ページネーション付きのエンドポイント
@GetMapping(value = "/contacts", headers = {"Accept-version=v2"})
public ResponseEntity<List<Contact>> findAll(Pageable pageable) {
Page<Contact> contactPages = contactService.findContactPageable(pageable);
return new ResponseEntity<>(contactPages, HttpStatus.OK);
}
V1 エンドポイントを に表示しGroupedOpenApi
、v2 エンドポイントを に表示したいGroupedOpenApi2
。助言がありますか ?