Skip to content

Commit

Permalink
[Security Solution] Align operationId and file names in OpenAPI specs (
Browse files Browse the repository at this point in the history
…#189703)

**Relates to:** #183661 (internal)
**Relates to:** #183821 (internal)
**Relates to:** #183837 (internal)

## Summary

It addresses a discussion Rule Management team had on a tech time meeting whose outcome was usage of consistent  operationId, files and folder naming related to OpenAPI specs. For example use `Read` instead of `Get` since it gives better readability and matches with already used approach.

This PR aligns the naming and performs necessary renaming.
  • Loading branch information
maximpn authored Aug 5, 2024
1 parent 8d550b0 commit a4fc565
Show file tree
Hide file tree
Showing 66 changed files with 327 additions and 327 deletions.
6 changes: 3 additions & 3 deletions packages/kbn-securitysolution-exceptions-common/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ export * from './delete_exception_list_item/delete_exception_list_item.gen';
export * from './delete_exception_list/delete_exception_list.gen';
export * from './duplicate_exception_list/duplicate_exception_list.gen';
export * from './export_exception_list/export_exception_list.gen';
export * from './find_exception_list_item/find_exception_list_item.gen';
export * from './find_exception_list/find_exception_list.gen';
export * from './find_exception_list_items/find_exception_list_items.gen';
export * from './find_exception_lists/find_exception_lists.gen';
export * from './import_exceptions/import_exceptions.gen';
export * from './read_exception_list_item/read_exception_list_item.gen';
export * from './read_exception_list/read_exception_list.gen';
export * from './summary_exception_list/summary_exception_list.gen';
export * from './read_exception_list_summary/read_exception_list_summary.gen';
export * from './update_exception_list_item/update_exception_list_item.gen';
export * from './update_exception_list/update_exception_list.gen';
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*
* info:
* title: Get exception list API endpoint
* title: Read exception list API endpoint
* version: 2023-10-31
*/

Expand All @@ -24,8 +24,8 @@ import {
ExceptionList,
} from '../model/exception_list_common.gen';

export type GetExceptionListRequestQuery = z.infer<typeof GetExceptionListRequestQuery>;
export const GetExceptionListRequestQuery = z.object({
export type ReadExceptionListRequestQuery = z.infer<typeof ReadExceptionListRequestQuery>;
export const ReadExceptionListRequestQuery = z.object({
/**
* Either `id` or `list_id` must be specified
*/
Expand All @@ -36,7 +36,7 @@ export const GetExceptionListRequestQuery = z.object({
list_id: ExceptionListHumanId.optional(),
namespace_type: ExceptionNamespaceType.optional().default('single'),
});
export type GetExceptionListRequestQueryInput = z.input<typeof GetExceptionListRequestQuery>;
export type ReadExceptionListRequestQueryInput = z.input<typeof ReadExceptionListRequestQuery>;

export type GetExceptionListResponse = z.infer<typeof GetExceptionListResponse>;
export const GetExceptionListResponse = ExceptionList;
export type ReadExceptionListResponse = z.infer<typeof ReadExceptionListResponse>;
export const ReadExceptionListResponse = ExceptionList;
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
openapi: 3.0.0
info:
title: Get exception list API endpoint
title: Read exception list API endpoint
version: '2023-10-31'
paths:
/api/exception_lists:
get:
x-labels: [serverless, ess]
operationId: GetExceptionList
operationId: ReadExceptionList
x-codegen-enabled: true
summary: Retrieves an exception list using its `id` or `list_id` field
parameters:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*
* info:
* title: Get exception list item API endpoint
* title: Read exception list item API endpoint
* version: 2023-10-31
*/

Expand All @@ -24,8 +24,8 @@ import {
ExceptionListItem,
} from '../model/exception_list_common.gen';

export type GetExceptionListItemRequestQuery = z.infer<typeof GetExceptionListItemRequestQuery>;
export const GetExceptionListItemRequestQuery = z.object({
export type ReadExceptionListItemRequestQuery = z.infer<typeof ReadExceptionListItemRequestQuery>;
export const ReadExceptionListItemRequestQuery = z.object({
/**
* Either `id` or `item_id` must be specified
*/
Expand All @@ -36,9 +36,9 @@ export const GetExceptionListItemRequestQuery = z.object({
item_id: ExceptionListItemHumanId.optional(),
namespace_type: ExceptionNamespaceType.optional().default('single'),
});
export type GetExceptionListItemRequestQueryInput = z.input<
typeof GetExceptionListItemRequestQuery
export type ReadExceptionListItemRequestQueryInput = z.input<
typeof ReadExceptionListItemRequestQuery
>;

export type GetExceptionListItemResponse = z.infer<typeof GetExceptionListItemResponse>;
export const GetExceptionListItemResponse = ExceptionListItem;
export type ReadExceptionListItemResponse = z.infer<typeof ReadExceptionListItemResponse>;
export const ReadExceptionListItemResponse = ExceptionListItem;
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
openapi: 3.0.0
info:
title: Get exception list item API endpoint
title: Read exception list item API endpoint
version: '2023-10-31'
paths:
/api/exception_lists/items:
get:
x-labels: [serverless, ess]
operationId: GetExceptionListItem
operationId: ReadExceptionListItem
x-codegen-enabled: true
summary: Gets an exception list item
parameters:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*
* info:
* title: Get exception list summary API endpoint
* title: Read exception list summary API endpoint
* version: 2023-10-31
*/

Expand All @@ -23,10 +23,10 @@ import {
ExceptionNamespaceType,
} from '../model/exception_list_common.gen';

export type GetExceptionListSummaryRequestQuery = z.infer<
typeof GetExceptionListSummaryRequestQuery
export type ReadExceptionListSummaryRequestQuery = z.infer<
typeof ReadExceptionListSummaryRequestQuery
>;
export const GetExceptionListSummaryRequestQuery = z.object({
export const ReadExceptionListSummaryRequestQuery = z.object({
/**
* Exception list's identifier generated upon creation
*/
Expand All @@ -41,12 +41,12 @@ export const GetExceptionListSummaryRequestQuery = z.object({
*/
filter: z.string().optional(),
});
export type GetExceptionListSummaryRequestQueryInput = z.input<
typeof GetExceptionListSummaryRequestQuery
export type ReadExceptionListSummaryRequestQueryInput = z.input<
typeof ReadExceptionListSummaryRequestQuery
>;

export type GetExceptionListSummaryResponse = z.infer<typeof GetExceptionListSummaryResponse>;
export const GetExceptionListSummaryResponse = z.object({
export type ReadExceptionListSummaryResponse = z.infer<typeof ReadExceptionListSummaryResponse>;
export const ReadExceptionListSummaryResponse = z.object({
windows: z.number().int().min(0).optional(),
linux: z.number().int().min(0).optional(),
macos: z.number().int().min(0).optional(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
openapi: 3.0.0
info:
title: Get exception list summary API endpoint
title: Read exception list summary API endpoint
version: '2023-10-31'
paths:
/api/exception_lists/summary:
get:
x-labels: [serverless, ess]
operationId: GetExceptionListSummary
operationId: ReadExceptionListSummary
x-codegen-enabled: true
summary: Retrieves an exception list summary
parameters:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ paths:
tags:
- Security Solution Exceptions API
get:
operationId: GetExceptionList
operationId: ReadExceptionList
parameters:
- description: Either `id` or `list_id` must be specified
in: query
Expand Down Expand Up @@ -810,7 +810,7 @@ paths:
tags:
- Security Solution Exceptions API
get:
operationId: GetExceptionListItem
operationId: ReadExceptionListItem
parameters:
- description: Either `id` or `item_id` must be specified
in: query
Expand Down Expand Up @@ -1188,7 +1188,7 @@ paths:
- Security Solution Exceptions API
/api/exception_lists/summary:
get:
operationId: GetExceptionListSummary
operationId: ReadExceptionListSummary
parameters:
- description: Exception list's identifier generated upon creation
in: query
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ paths:
tags:
- Security Solution Exceptions API
get:
operationId: GetExceptionList
operationId: ReadExceptionList
parameters:
- description: Either `id` or `list_id` must be specified
in: query
Expand Down Expand Up @@ -810,7 +810,7 @@ paths:
tags:
- Security Solution Exceptions API
get:
operationId: GetExceptionListItem
operationId: ReadExceptionListItem
parameters:
- description: Either `id` or `item_id` must be specified
in: query
Expand Down Expand Up @@ -1188,7 +1188,7 @@ paths:
- Security Solution Exceptions API
/api/exception_lists/summary:
get:
operationId: GetExceptionListSummary
operationId: ReadExceptionListSummary
parameters:
- description: Exception list's identifier generated upon creation
in: query
Expand Down
8 changes: 4 additions & 4 deletions packages/kbn-securitysolution-lists-common/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ export * from './create_list/create_list.gen';
export * from './delete_list_index/delete_list_index.gen';
export * from './delete_list_item/delete_list_item.gen';
export * from './delete_list/delete_list.gen';
export * from './find_list_item/find_list_item.gen';
export * from './find_list/find_list.gen';
export * from './export_list_item/export_list_item.gen';
export * from './import_list_item/import_list_item.gen';
export * from './find_list_items/find_list_items.gen';
export * from './find_lists/find_lists.gen';
export * from './export_list_items/export_list_items.gen';
export * from './import_list_items/import_list_items.gen';
export * from './patch_list_item/patch_list_item.gen';
export * from './patch_list/patch_list.gen';
export * from './read_list_index/read_list_index.gen';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*
* info:
* title: Get list API endpoint
* title: Read list API endpoint
* version: 2023-10-31
*/

Expand All @@ -20,14 +20,14 @@ import { z } from 'zod';
import { ListId } from '../model/list_common.gen';
import { List } from '../model/list_schemas.gen';

export type GetListRequestQuery = z.infer<typeof GetListRequestQuery>;
export const GetListRequestQuery = z.object({
export type ReadListRequestQuery = z.infer<typeof ReadListRequestQuery>;
export const ReadListRequestQuery = z.object({
/**
* List's `id` value
*/
id: ListId,
});
export type GetListRequestQueryInput = z.input<typeof GetListRequestQuery>;
export type ReadListRequestQueryInput = z.input<typeof ReadListRequestQuery>;

export type GetListResponse = z.infer<typeof GetListResponse>;
export const GetListResponse = List;
export type ReadListResponse = z.infer<typeof ReadListResponse>;
export const ReadListResponse = List;
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
openapi: 3.0.0
info:
title: Get list API endpoint
title: Read list API endpoint
version: '2023-10-31'
paths:
/api/lists:
get:
x-labels: [serverless, ess]
operationId: GetList
operationId: ReadList
x-codegen-enabled: true
summary: Retrieves a list using its id field
parameters:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*
* info:
* title: Get list DS existence status API endpoint
* title: Read list DS existence status API endpoint
* version: 2023-10-31
*/

import { z } from 'zod';

export type GetListIndexResponse = z.infer<typeof GetListIndexResponse>;
export const GetListIndexResponse = z.object({
export type ReadListIndexResponse = z.infer<typeof ReadListIndexResponse>;
export const ReadListIndexResponse = z.object({
list_index: z.boolean(),
list_item_index: z.boolean(),
});
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
openapi: 3.0.0
info:
title: Get list DS existence status API endpoint
title: Read list DS existence status API endpoint
version: '2023-10-31'
paths:
/api/lists/index:
get:
x-labels: [serverless, ess]
operationId: GetListIndex
operationId: ReadListIndex
x-codegen-enabled: true
summary: Get list data stream existence status
responses:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*
* info:
* title: Get list item API endpoint
* title: Read list item API endpoint
* version: 2023-10-31
*/

Expand All @@ -20,8 +20,8 @@ import { z } from 'zod';
import { ListId } from '../model/list_common.gen';
import { ListItem } from '../model/list_schemas.gen';

export type GetListItemRequestQuery = z.infer<typeof GetListItemRequestQuery>;
export const GetListItemRequestQuery = z.object({
export type ReadListItemRequestQuery = z.infer<typeof ReadListItemRequestQuery>;
export const ReadListItemRequestQuery = z.object({
/**
* Required if `list_id` and `value` are not specified
*/
Expand All @@ -35,7 +35,7 @@ export const GetListItemRequestQuery = z.object({
*/
value: z.string().optional(),
});
export type GetListItemRequestQueryInput = z.input<typeof GetListItemRequestQuery>;
export type ReadListItemRequestQueryInput = z.input<typeof ReadListItemRequestQuery>;

export type GetListItemResponse = z.infer<typeof GetListItemResponse>;
export const GetListItemResponse = z.union([ListItem, z.array(ListItem)]);
export type ReadListItemResponse = z.infer<typeof ReadListItemResponse>;
export const ReadListItemResponse = z.union([ListItem, z.array(ListItem)]);
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
openapi: 3.0.0
info:
title: Get list item API endpoint
title: Read list item API endpoint
version: '2023-10-31'
paths:
/api/lists/items:
get:
x-labels: [serverless, ess]
operationId: GetListItem
operationId: ReadListItem
x-codegen-enabled: true
summary: Gets a list item
parameters:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*
* info:
* title: Get list privileges API endpoint
* title: Read list privileges API endpoint
* version: 2023-10-31
*/

Expand All @@ -35,8 +35,8 @@ export const ListItemPrivileges = z.object({
application: z.object({}).catchall(z.boolean()),
});

export type GetListPrivilegesResponse = z.infer<typeof GetListPrivilegesResponse>;
export const GetListPrivilegesResponse = z.object({
export type ReadListPrivilegesResponse = z.infer<typeof ReadListPrivilegesResponse>;
export const ReadListPrivilegesResponse = z.object({
lists: ListPrivileges,
listItems: ListItemPrivileges,
is_authenticated: z.boolean(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
openapi: 3.0.0
info:
title: Get list privileges API endpoint
title: Read list privileges API endpoint
version: '2023-10-31'
paths:
/api/lists/privileges:
get:
x-labels: [serverless, ess]
operationId: GetListPrivileges
operationId: ReadListPrivileges
x-codegen-enabled: true
summary: Gets list privileges
responses:
Expand Down
Loading

0 comments on commit a4fc565

Please sign in to comment.