Skip to content

Commit

Permalink
[HTTP/OAS] Add tags and summaries for saved object APIs (elastic#184184)
Browse files Browse the repository at this point in the history
Co-authored-by: Jean-Louis Leysens <[email protected]>
  • Loading branch information
lcawl and jloleysens authored Jul 8, 2024
1 parent b6fcfac commit dddcf2e
Show file tree
Hide file tree
Showing 16 changed files with 34 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ export const registerBulkCreateRoute = (
{
path: '/_bulk_create',
options: {
summary: `Create saved objects`,
tags: ['oas-tag:saved objects'],
access,
description: `Create saved objects`,
},
validate: {
query: schema.object({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ export const registerBulkDeleteRoute = (
{
path: '/_bulk_delete',
options: {
summary: `Delete saved objects`,
tags: ['oas-tag:saved objects'],
access,
description: `Remove saved objects`,
},
validate: {
body: schema.arrayOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ export const registerBulkGetRoute = (
{
path: '/_bulk_get',
options: {
summary: `Get saved objects`,
tags: ['oas-tag:saved objects'],
access,
description: `Get saved objects`,
},
validate: {
body: schema.arrayOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ export const registerBulkResolveRoute = (
{
path: '/_bulk_resolve',
options: {
summary: `Resolve saved objects`,
tags: ['oas-tag:saved objects'],
access,
description: `Resolve saved objects`,
},
validate: {
body: schema.arrayOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ export const registerBulkUpdateRoute = (
{
path: '/_bulk_update',
options: {
summary: `Update saved objects`,
tags: ['oas-tag:saved objects'],
access,
description: `Update saved objects`,
},
validate: {
body: schema.arrayOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ export const registerCreateRoute = (
{
path: '/{type}/{id?}',
options: {
summary: `Create a saved object`,
tags: ['oas-tag:saved objects'],
access,
description: `Create a saved object`,
},
validate: {
params: schema.object({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ export const registerDeleteRoute = (
{
path: '/{type}/{id}',
options: {
summary: `Delete a saved object`,
tags: ['oas-tag:saved objects'],
access,
description: `Delete a saved object`,
},
validate: {
params: schema.object({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,9 @@ export const registerExportRoute = (
{
path: '/_export',
options: {
summary: `Export saved objects`,
tags: ['oas-tag:saved objects'],
access: 'public',
description: `Export saved objects`,
},
validate: {
body: schema.object({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ export const registerFindRoute = (
{
path: '/_find',
options: {
summary: `Search for saved objects`,
tags: ['oas-tag:saved objects'],
access,
description: `Search for saved objects`,
},
validate: {
query: schema.object({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ export const registerGetRoute = (
{
path: '/{type}/{id}',
options: {
summary: `Get a saved object`,
tags: ['oas-tag:saved objects'],
access,
description: `Get a saved object`,
},
validate: {
params: schema.object({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ export const registerImportRoute = (
{
path: '/_import',
options: {
summary: `Import saved objects`,
tags: ['oas-tag:saved objects'],
access: 'public',
description: `Import saved objects`,
body: {
maxBytes: maxImportPayloadBytes,
output: 'stream',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ export const registerResolveRoute = (
{
path: '/resolve/{type}/{id}',
options: {
summary: `Resolve a saved object`,
tags: ['oas-tag:saved objects'],
access,
description: `Resolve a saved object`,
},
validate: {
params: schema.object({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ export const registerResolveImportErrorsRoute = (
{
path: '/_resolve_import_errors',
options: {
summary: `Resolve import errors`,
tags: ['oas-tag:saved objects'],
access: 'public',
description: `Resolve import errors`,
body: {
maxBytes: maxImportPayloadBytes,
output: 'stream',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ export const registerUpdateRoute = (
{
path: '/{type}/{id}',
options: {
summary: `Update a saved object`,
tags: ['oas-tag:saved objects'],
access,
description: `Update a saved object`,
},
validate: {
params: schema.object({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ describe('Key rotation routes', () => {
});

it('correctly defines route.', () => {
expect(routeConfig.options).toEqual({ tags: ['access:rotateEncryptionKey'] });
expect(routeConfig.options).toEqual({
tags: ['access:rotateEncryptionKey', 'oas-tag:saved objects'],
description: `Rotate a key for encrypted saved objects`,
});
expect(routeConfig.validate).toEqual({
body: undefined,
query: expect.any(Type),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ export function defineKeyRotationRoutes({
}),
},
options: {
tags: ['access:rotateEncryptionKey'],
tags: ['access:rotateEncryptionKey', 'oas-tag:saved objects'],
description: `Rotate a key for encrypted saved objects`,
},
},
async (context, request, response) => {
Expand Down

0 comments on commit dddcf2e

Please sign in to comment.