Skip to content
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

[Security Assistant] Aligning API Schemas #188704

Merged
merged 9 commits into from
Jul 24, 2024
Merged

Conversation

spong
Copy link
Member

@spong spong commented Jul 18, 2024

Summary

This PR aims to address #183825 to ensure all our public API's have a corresponding OpenAPI spec and to ensure that they are documented as intended.

I've updated the kbn-elastic-assistant-common yarn openapi:bundle script to generate both ess and serverless artifacts (as per this issue, which are now created within the package (instead of target), and so are checked in to x-pack/packages/kbn-elastic-assistant-common/docs/openapi/.

This also includes:

  • Create OpenAPI specs for the endpoints listed above (see issue).
    • They had already existed
  • Check if there are any other public endpoints that you own that don't have OpenAPI specs and add them to the list above.
    • All endpoints (public/internal) had specs, but did need to update the path's to make sure they were consistent with what was registered.
  • Make sure the specs you add are valid OpenAPI documents.
  • Make sure the specs you add match the actual API contract defined in the code.
  • Mark the endpoints as available in ESS, or Serverless, or in both offerings.

Initial evaluation of routes listed as missing specs in #183825:

  • POST /api/elastic_assistant/current_user/conversations/{id}/messages
    Latest/Actual Route: /internal/elastic_assistant/current_user/conversations/{id}/messages
    Route Handler:

    export const appendConversationMessageRoute = (router: ElasticAssistantPluginRouter) => {

    Schema:
    /internal/elastic_assistant/conversations/{id}/messages:
    post:
    operationId: AppendConversationMessage
    x-codegen-enabled: true
    description: Append a message to the conversation
    summary: Append a message to the conversation
    tags:
    - Conversation API
    parameters:
    - name: id
    in: path
    required: true
    description: The conversation's `id` value.
    schema:
    $ref: '../common_attributes.schema.yaml#/components/schemas/NonEmptyString'
    requestBody:
    required: true
    content:
    application/json:
    schema:
    $ref: './common_attributes.schema.yaml#/components/schemas/ConversationMessageCreateProps'
    responses:
    200:
    description: Indicates a successful call.
    content:
    application/json:
    schema:
    $ref: './common_attributes.schema.yaml#/components/schemas/ConversationResponse'
    400:
    description: Generic Error
    content:
    application/json:
    schema:
    type: object
    properties:
    statusCode:
    type: number
    error:
    type: string
    message:
    type: string

  • POST /api/elastic_assistant/current_user/conversations
    Updated Route: /api/security_ai_assistant/current_user/conversations
    Route Handler:

    export const createConversationRoute = (router: ElasticAssistantPluginRouter): void => {

    Schema:
    /internal/elastic_assistant/conversations:
    post:
    operationId: CreateConversation
    x-codegen-enabled: true
    description: Create a conversation
    summary: Create a conversation
    tags:
    - Conversation API
    requestBody:
    required: true
    content:
    application/json:
    schema:
    $ref: './common_attributes.schema.yaml#/components/schemas/ConversationCreateProps'
    responses:
    200:
    description: Indicates a successful call.
    content:
    application/json:
    schema:
    $ref: './common_attributes.schema.yaml#/components/schemas/ConversationResponse'
    400:
    description: Generic Error
    content:
    application/json:
    schema:
    type: object
    properties:
    statusCode:
    type: number
    error:
    type: string
    message:
    type: string

  • GET /api/elastic_assistant/current_user/conversations/_find
    Updated Route: /api/security_ai_assistant/current_user/conversations/_find
    Route Handler:

    export const findUserConversationsRoute = (router: ElasticAssistantPluginRouter) => {

    Schema:
    /internal/elastic_assistant/conversations/current_user/_find:
    get:
    operationId: FindCurrentUserConversations
    x-codegen-enabled: true
    description: Finds current user conversations that match the given query.
    summary: Finds current user conversations that match the given query.
    tags:
    - Conversations API
    parameters:
    - name: 'fields'
    in: query
    required: false
    schema:
    type: array
    items:
    type: string
    - name: 'filter'
    in: query
    description: Search query
    required: false
    schema:
    type: string
    - name: 'sort_field'
    in: query
    description: Field to sort by
    required: false
    schema:
    $ref: '#/components/schemas/FindConversationsSortField'
    - name: 'sort_order'
    in: query
    description: Sort order
    required: false
    schema:
    $ref: '../common_attributes.schema.yaml#/components/schemas/SortOrder'
    - name: 'page'
    in: query
    description: Page number
    required: false
    schema:
    type: integer
    minimum: 1
    default: 1
    - name: 'per_page'
    in: query
    description: Conversations per page
    required: false
    schema:
    type: integer
    minimum: 0
    default: 20
    responses:
    200:
    description: Successful response
    content:
    application/json:
    schema:
    type: object
    properties:
    page:
    type: integer
    perPage:
    type: integer
    total:
    type: integer
    data:
    type: array
    items:
    $ref: './common_attributes.schema.yaml#/components/schemas/ConversationResponse'
    required:
    - page
    - perPage
    - total
    - data
    400:
    description: Generic Error
    content:
    application/json:
    schema:
    type: object
    properties:
    statusCode:
    type: number
    error:
    type: string
    message:
    type: string

  • DELETE /api/elastic_assistant/current_user/conversations/{id}
    Updated Route: /api/security_ai_assistant/current_user/conversations/{id}
    Route Handler:

    export const deleteConversationRoute = (router: ElasticAssistantPluginRouter) => {

    Schema:
    delete:
    operationId: DeleteConversation
    x-codegen-enabled: true
    description: Deletes a single conversation using the `id` field.
    summary: Deletes a single conversation using the `id` field.
    tags:
    - Conversation API
    parameters:
    - name: id
    in: path
    required: true
    description: The conversation's `id` value.
    schema:
    $ref: '../common_attributes.schema.yaml#/components/schemas/NonEmptyString'
    responses:
    200:
    description: Indicates a successful call.
    content:
    application/json:
    schema:
    $ref: './common_attributes.schema.yaml#/components/schemas/ConversationResponse'
    400:
    description: Generic Error
    content:
    application/json:
    schema:
    type: object
    properties:
    statusCode:
    type: number
    error:
    type: string
    message:
    type: string

  • GET /api/elastic_assistant/current_user/conversations/{id}
    Updated Route: /api/security_ai_assistant/current_user/conversations/{id}
    Route Handler:

    export const readConversationRoute = (router: ElasticAssistantPluginRouter) => {

    Schema:
    get:
    operationId: ReadConversation
    x-codegen-enabled: true
    description: Read a single conversation
    summary: Read a single conversation
    tags:
    - Conversations API
    parameters:
    - name: id
    in: path
    required: true
    description: The conversation's `id` value.
    schema:
    $ref: '../common_attributes.schema.yaml#/components/schemas/NonEmptyString'
    responses:
    200:
    description: Indicates a successful call.
    content:
    application/json:
    schema:
    $ref: './common_attributes.schema.yaml#/components/schemas/ConversationResponse'
    400:
    description: Generic Error
    content:
    application/json:
    schema:
    type: object
    properties:
    statusCode:
    type: number
    error:
    type: string
    message:
    type: string

  • PUT /api/elastic_assistant/current_user/conversations/{id}
    Updated Route: /api/security_ai_assistant/current_user/conversations/{id}
    Route Handler:

    export const updateConversationRoute = (router: ElasticAssistantPluginRouter) => {

    Schema:
    put:
    operationId: UpdateConversation
    x-codegen-enabled: true
    description: Update a single conversation
    summary: Update a conversation
    tags:
    - Conversation API
    parameters:
    - name: id
    in: path
    required: true
    description: The conversation's `id` value.
    schema:
    $ref: '../common_attributes.schema.yaml#/components/schemas/NonEmptyString'
    requestBody:
    required: true
    content:
    application/json:
    schema:
    $ref: './common_attributes.schema.yaml#/components/schemas/ConversationUpdateProps'
    responses:
    200:
    description: Indicates a successful call.
    content:
    application/json:
    schema:
    $ref: './common_attributes.schema.yaml#/components/schemas/ConversationResponse'
    400:
    description: Generic Error
    content:
    application/json:
    schema:
    type: object
    properties:
    statusCode:
    type: number
    error:
    type: string
    message:
    type: string

To continue with remaining public routes....

@spong spong added release_note:skip Skip the PR/issue when compiling release notes Feature:Security Assistant Security Assistant Team:Security Generative AI Security Generative AI v8.15.0 v8.16.0 labels Jul 18, 2024
@spong spong self-assigned this Jul 18, 2024
@spong spong marked this pull request as ready for review July 22, 2024 20:35
@spong spong requested a review from a team as a code owner July 22, 2024 20:35
@spong spong requested a review from maximpn July 22, 2024 20:35
Copy link
Contributor

@maximpn maximpn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spong thank you for addressing OpenAPI tasks 👍

I looked through the diff and don't have any concerns regarding OpenAPI specs from general point of view. Though I didn't check that the specs match the implementation. But since generated artefacts are used in the implementation chances the implementation and specs don't match are quite low.

After this PR is merged the PR to enable bundling at pipeline will boil down to .buildkite/scripts/steps/openapi_bundling/security_solution_openapi_bundling.sh changes.

Copy link
Contributor

@YulNaumenko YulNaumenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/elastic-assistant-common 337 332 -5
Unknown metric groups

API count

id before after diff
@kbn/elastic-assistant-common 363 358 -5

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @spong

@spong spong merged commit a51b775 into elastic:main Jul 24, 2024
38 checks passed
@spong spong deleted the api-alignment branch July 24, 2024 14:03
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jul 24, 2024
## Summary

This PR aims to address elastic#183825
to ensure all our public API's have a corresponding OpenAPI spec and to
ensure that they are documented as intended.

I've updated the kbn-elastic-assistant-common `yarn openapi:bundle`
script to generate both `ess` and `serverless` artifacts (as per [this
issue](elastic/security-team#9516), which are
now created within the package (instead of `target`), and so are checked
in to `x-pack/packages/kbn-elastic-assistant-common/docs/openapi/`.

This also includes:

- [X] Create OpenAPI specs for the endpoints listed above (see
[issue](elastic#183825)).
  - They had already existed
- [X] Check if there are any other public endpoints that you own that
don't have OpenAPI specs and add them to the list above.
- All endpoints (public/internal) had specs, but did need to update the
`path`'s to make sure they were consistent with what was registered.
- [X] Make sure the specs you add are valid OpenAPI documents.
- [X] Make sure the specs you add match the actual API contract defined
in the code.
- [X] Mark the endpoints as available in ESS, or Serverless, or in both
offerings.

---
Initial evaluation of routes listed as missing specs in
elastic#183825:

- [X] `POST
/api/elastic_assistant/current_user/conversations/{id}/messages`
Latest/Actual Route:
`/internal/elastic_assistant/current_user/conversations/{id}/messages`
Route Handler:
https://github.com/elastic/kibana/blob/bae84d4569870dcecfd0cef346d2e0d38ac92160/x-pack/plugins/elastic_assistant/server/routes/user_conversations/append_conversation_messages_route.ts#L22
Schema:
https://github.com/elastic/kibana/blob/bae84d4569870dcecfd0cef346d2e0d38ac92160/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/crud_conversation_route.schema.yaml#L151-L191

- [X]  `POST /api/elastic_assistant/current_user/conversations`
Updated Route: `/api/security_ai_assistant/current_user/conversations`
Route Handler:
https://github.com/elastic/kibana/blob/1d4e9b9b53b5b6dcdc88c08ae5d9858daa483fe0/x-pack/plugins/elastic_assistant/server/routes/user_conversations/create_route.ts#L21
Schema:
https://github.com/elastic/kibana/blob/bae84d4569870dcecfd0cef346d2e0d38ac92160/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/crud_conversation_route.schema.yaml#L6-L39

- [X]  GET /api/elastic_assistant/current_user/conversations/_find
Updated Route:
`/api/security_ai_assistant/current_user/conversations/_find`
Route Handler:
https://github.com/elastic/kibana/blob/1d4e9b9b53b5b6dcdc88c08ae5d9858daa483fe0/x-pack/plugins/elastic_assistant/server/routes/user_conversations/find_route.ts#L26
Schema:
https://github.com/elastic/kibana/blob/1b872fbf9dc90d3c82a569a9faef9e360fc41171/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/find_conversations_route.schema.yaml#L94-L180

- [X]  DELETE /api/elastic_assistant/current_user/conversations/{id}
Updated Route:
`/api/security_ai_assistant/current_user/conversations/{id}`
Route Handler:
https://github.com/elastic/kibana/blob/1d5cf48a9700ee769f64256c23278fcfd8cecc5d/x-pack/plugins/elastic_assistant/server/routes/user_conversations/delete_route.ts#L19
Schema:
https://github.com/elastic/kibana/blob/bae84d4569870dcecfd0cef346d2e0d38ac92160/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/crud_conversation_route.schema.yaml#L116-L149

- [X] GET /api/elastic_assistant/current_user/conversations/{id}
Updated Route:
`/api/security_ai_assistant/current_user/conversations/{id}`
Route Handler:
https://github.com/elastic/kibana/blob/1d5cf48a9700ee769f64256c23278fcfd8cecc5d/x-pack/plugins/elastic_assistant/server/routes/user_conversations/read_route.ts#L21
Schema:
https://github.com/elastic/kibana/blob/bae84d4569870dcecfd0cef346d2e0d38ac92160/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/crud_conversation_route.schema.yaml#L42-L75

- [X]  PUT /api/elastic_assistant/current_user/conversations/{id}
Updated Route:
`/api/security_ai_assistant/current_user/conversations/{id}`
Route Handler:
https://github.com/elastic/kibana/blob/1d5cf48a9700ee769f64256c23278fcfd8cecc5d/x-pack/plugins/elastic_assistant/server/routes/user_conversations/update_route.ts#L24
Schema:
https://github.com/elastic/kibana/blob/bae84d4569870dcecfd0cef346d2e0d38ac92160/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/crud_conversation_route.schema.yaml#L76-L115

To continue with remaining public routes....

---------

Co-authored-by: kibanamachine <[email protected]>
(cherry picked from commit a51b775)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.15

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Jul 24, 2024
# Backport

This will backport the following commits from `main` to `8.15`:
- [[Security Assistant] Aligning API Schemas
(#188704)](#188704)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Garrett
Spong","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-07-24T14:03:46Z","message":"[Security
Assistant] Aligning API Schemas (#188704)\n\n## Summary\r\n\r\nThis PR
aims to address https://github.com/elastic/kibana/issues/183825\r\nto
ensure all our public API's have a corresponding OpenAPI spec and
to\r\nensure that they are documented as intended.\r\n\r\nI've updated
the kbn-elastic-assistant-common `yarn openapi:bundle`\r\nscript to
generate both `ess` and `serverless` artifacts (as per
[this\r\nissue](elastic/security-team#9516),
which are\r\nnow created within the package (instead of `target`), and
so are checked\r\nin to
`x-pack/packages/kbn-elastic-assistant-common/docs/openapi/`.\r\n\r\n\r\nThis
also includes:\r\n\r\n- [X] Create OpenAPI specs for the endpoints
listed above
(see\r\n[issue](https://github.com/elastic/kibana/issues/183825)).\r\n -
They had already existed \r\n- [X] Check if there are any other public
endpoints that you own that\r\ndon't have OpenAPI specs and add them to
the list above.\r\n- All endpoints (public/internal) had specs, but did
need to update the\r\n`path`'s to make sure they were consistent with
what was registered.\r\n- [X] Make sure the specs you add are valid
OpenAPI documents.\r\n- [X] Make sure the specs you add match the actual
API contract defined\r\nin the code.\r\n- [X] Mark the endpoints as
available in ESS, or Serverless, or in
both\r\nofferings.\r\n\r\n---\r\nInitial evaluation of routes listed as
missing specs
in\r\nhttps://github.com//issues/183825:\r\n\r\n- [X]
`POST\r\n/api/elastic_assistant/current_user/conversations/{id}/messages`\r\nLatest/Actual
Route:\r\n`/internal/elastic_assistant/current_user/conversations/{id}/messages`\r\nRoute
Handler:\r\nhttps://github.com/elastic/kibana/blob/bae84d4569870dcecfd0cef346d2e0d38ac92160/x-pack/plugins/elastic_assistant/server/routes/user_conversations/append_conversation_messages_route.ts#L22\r\nSchema:\r\nhttps://github.com/elastic/kibana/blob/bae84d4569870dcecfd0cef346d2e0d38ac92160/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/crud_conversation_route.schema.yaml#L151-L191\r\n\r\n\r\n-
[X] `POST /api/elastic_assistant/current_user/conversations`\r\nUpdated
Route: `/api/security_ai_assistant/current_user/conversations`\r\nRoute
Handler:\r\nhttps://github.com/elastic/kibana/blob/1d4e9b9b53b5b6dcdc88c08ae5d9858daa483fe0/x-pack/plugins/elastic_assistant/server/routes/user_conversations/create_route.ts#L21\r\nSchema:\r\nhttps://github.com/elastic/kibana/blob/bae84d4569870dcecfd0cef346d2e0d38ac92160/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/crud_conversation_route.schema.yaml#L6-L39\r\n\r\n-
[X] GET
/api/elastic_assistant/current_user/conversations/_find\r\nUpdated
Route:\r\n`/api/security_ai_assistant/current_user/conversations/_find`\r\nRoute
Handler:\r\nhttps://github.com/elastic/kibana/blob/1d4e9b9b53b5b6dcdc88c08ae5d9858daa483fe0/x-pack/plugins/elastic_assistant/server/routes/user_conversations/find_route.ts#L26\r\nSchema:\r\nhttps://github.com/elastic/kibana/blob/1b872fbf9dc90d3c82a569a9faef9e360fc41171/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/find_conversations_route.schema.yaml#L94-L180\r\n\r\n-
[X] DELETE
/api/elastic_assistant/current_user/conversations/{id}\r\nUpdated
Route:\r\n`/api/security_ai_assistant/current_user/conversations/{id}`\r\nRoute
Handler:\r\nhttps://github.com/elastic/kibana/blob/1d5cf48a9700ee769f64256c23278fcfd8cecc5d/x-pack/plugins/elastic_assistant/server/routes/user_conversations/delete_route.ts#L19\r\nSchema:\r\nhttps://github.com/elastic/kibana/blob/bae84d4569870dcecfd0cef346d2e0d38ac92160/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/crud_conversation_route.schema.yaml#L116-L149\r\n\r\n-
[X] GET
/api/elastic_assistant/current_user/conversations/{id}\r\nUpdated
Route:\r\n`/api/security_ai_assistant/current_user/conversations/{id}`\r\nRoute
Handler:\r\nhttps://github.com/elastic/kibana/blob/1d5cf48a9700ee769f64256c23278fcfd8cecc5d/x-pack/plugins/elastic_assistant/server/routes/user_conversations/read_route.ts#L21\r\nSchema:\r\nhttps://github.com/elastic/kibana/blob/bae84d4569870dcecfd0cef346d2e0d38ac92160/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/crud_conversation_route.schema.yaml#L42-L75\r\n\r\n-
[X] PUT
/api/elastic_assistant/current_user/conversations/{id}\r\nUpdated
Route:\r\n`/api/security_ai_assistant/current_user/conversations/{id}`\r\nRoute
Handler:\r\nhttps://github.com/elastic/kibana/blob/1d5cf48a9700ee769f64256c23278fcfd8cecc5d/x-pack/plugins/elastic_assistant/server/routes/user_conversations/update_route.ts#L24\r\nSchema:\r\nhttps://github.com/elastic/kibana/blob/bae84d4569870dcecfd0cef346d2e0d38ac92160/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/crud_conversation_route.schema.yaml#L76-L115\r\n\r\n\r\nTo
continue with remaining public
routes....\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<[email protected]>","sha":"a51b775391af09b6ba2ee9456489ef3351f8875a","branchLabelMapping":{"^v8.16.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Feature:Security
Assistant","Team:Security Generative
AI","v8.15.0","v8.16.0"],"title":"[Security Assistant] Aligning API
Schemas","number":188704,"url":"https://github.com/elastic/kibana/pull/188704","mergeCommit":{"message":"[Security
Assistant] Aligning API Schemas (#188704)\n\n## Summary\r\n\r\nThis PR
aims to address https://github.com/elastic/kibana/issues/183825\r\nto
ensure all our public API's have a corresponding OpenAPI spec and
to\r\nensure that they are documented as intended.\r\n\r\nI've updated
the kbn-elastic-assistant-common `yarn openapi:bundle`\r\nscript to
generate both `ess` and `serverless` artifacts (as per
[this\r\nissue](elastic/security-team#9516),
which are\r\nnow created within the package (instead of `target`), and
so are checked\r\nin to
`x-pack/packages/kbn-elastic-assistant-common/docs/openapi/`.\r\n\r\n\r\nThis
also includes:\r\n\r\n- [X] Create OpenAPI specs for the endpoints
listed above
(see\r\n[issue](https://github.com/elastic/kibana/issues/183825)).\r\n -
They had already existed \r\n- [X] Check if there are any other public
endpoints that you own that\r\ndon't have OpenAPI specs and add them to
the list above.\r\n- All endpoints (public/internal) had specs, but did
need to update the\r\n`path`'s to make sure they were consistent with
what was registered.\r\n- [X] Make sure the specs you add are valid
OpenAPI documents.\r\n- [X] Make sure the specs you add match the actual
API contract defined\r\nin the code.\r\n- [X] Mark the endpoints as
available in ESS, or Serverless, or in
both\r\nofferings.\r\n\r\n---\r\nInitial evaluation of routes listed as
missing specs
in\r\nhttps://github.com//issues/183825:\r\n\r\n- [X]
`POST\r\n/api/elastic_assistant/current_user/conversations/{id}/messages`\r\nLatest/Actual
Route:\r\n`/internal/elastic_assistant/current_user/conversations/{id}/messages`\r\nRoute
Handler:\r\nhttps://github.com/elastic/kibana/blob/bae84d4569870dcecfd0cef346d2e0d38ac92160/x-pack/plugins/elastic_assistant/server/routes/user_conversations/append_conversation_messages_route.ts#L22\r\nSchema:\r\nhttps://github.com/elastic/kibana/blob/bae84d4569870dcecfd0cef346d2e0d38ac92160/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/crud_conversation_route.schema.yaml#L151-L191\r\n\r\n\r\n-
[X] `POST /api/elastic_assistant/current_user/conversations`\r\nUpdated
Route: `/api/security_ai_assistant/current_user/conversations`\r\nRoute
Handler:\r\nhttps://github.com/elastic/kibana/blob/1d4e9b9b53b5b6dcdc88c08ae5d9858daa483fe0/x-pack/plugins/elastic_assistant/server/routes/user_conversations/create_route.ts#L21\r\nSchema:\r\nhttps://github.com/elastic/kibana/blob/bae84d4569870dcecfd0cef346d2e0d38ac92160/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/crud_conversation_route.schema.yaml#L6-L39\r\n\r\n-
[X] GET
/api/elastic_assistant/current_user/conversations/_find\r\nUpdated
Route:\r\n`/api/security_ai_assistant/current_user/conversations/_find`\r\nRoute
Handler:\r\nhttps://github.com/elastic/kibana/blob/1d4e9b9b53b5b6dcdc88c08ae5d9858daa483fe0/x-pack/plugins/elastic_assistant/server/routes/user_conversations/find_route.ts#L26\r\nSchema:\r\nhttps://github.com/elastic/kibana/blob/1b872fbf9dc90d3c82a569a9faef9e360fc41171/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/find_conversations_route.schema.yaml#L94-L180\r\n\r\n-
[X] DELETE
/api/elastic_assistant/current_user/conversations/{id}\r\nUpdated
Route:\r\n`/api/security_ai_assistant/current_user/conversations/{id}`\r\nRoute
Handler:\r\nhttps://github.com/elastic/kibana/blob/1d5cf48a9700ee769f64256c23278fcfd8cecc5d/x-pack/plugins/elastic_assistant/server/routes/user_conversations/delete_route.ts#L19\r\nSchema:\r\nhttps://github.com/elastic/kibana/blob/bae84d4569870dcecfd0cef346d2e0d38ac92160/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/crud_conversation_route.schema.yaml#L116-L149\r\n\r\n-
[X] GET
/api/elastic_assistant/current_user/conversations/{id}\r\nUpdated
Route:\r\n`/api/security_ai_assistant/current_user/conversations/{id}`\r\nRoute
Handler:\r\nhttps://github.com/elastic/kibana/blob/1d5cf48a9700ee769f64256c23278fcfd8cecc5d/x-pack/plugins/elastic_assistant/server/routes/user_conversations/read_route.ts#L21\r\nSchema:\r\nhttps://github.com/elastic/kibana/blob/bae84d4569870dcecfd0cef346d2e0d38ac92160/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/crud_conversation_route.schema.yaml#L42-L75\r\n\r\n-
[X] PUT
/api/elastic_assistant/current_user/conversations/{id}\r\nUpdated
Route:\r\n`/api/security_ai_assistant/current_user/conversations/{id}`\r\nRoute
Handler:\r\nhttps://github.com/elastic/kibana/blob/1d5cf48a9700ee769f64256c23278fcfd8cecc5d/x-pack/plugins/elastic_assistant/server/routes/user_conversations/update_route.ts#L24\r\nSchema:\r\nhttps://github.com/elastic/kibana/blob/bae84d4569870dcecfd0cef346d2e0d38ac92160/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/crud_conversation_route.schema.yaml#L76-L115\r\n\r\n\r\nTo
continue with remaining public
routes....\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<[email protected]>","sha":"a51b775391af09b6ba2ee9456489ef3351f8875a"}},"sourceBranch":"main","suggestedTargetBranches":["8.15"],"targetPullRequestStates":[{"branch":"8.15","label":"v8.15.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/188704","number":188704,"mergeCommit":{"message":"[Security
Assistant] Aligning API Schemas (#188704)\n\n## Summary\r\n\r\nThis PR
aims to address https://github.com/elastic/kibana/issues/183825\r\nto
ensure all our public API's have a corresponding OpenAPI spec and
to\r\nensure that they are documented as intended.\r\n\r\nI've updated
the kbn-elastic-assistant-common `yarn openapi:bundle`\r\nscript to
generate both `ess` and `serverless` artifacts (as per
[this\r\nissue](elastic/security-team#9516),
which are\r\nnow created within the package (instead of `target`), and
so are checked\r\nin to
`x-pack/packages/kbn-elastic-assistant-common/docs/openapi/`.\r\n\r\n\r\nThis
also includes:\r\n\r\n- [X] Create OpenAPI specs for the endpoints
listed above
(see\r\n[issue](https://github.com/elastic/kibana/issues/183825)).\r\n -
They had already existed \r\n- [X] Check if there are any other public
endpoints that you own that\r\ndon't have OpenAPI specs and add them to
the list above.\r\n- All endpoints (public/internal) had specs, but did
need to update the\r\n`path`'s to make sure they were consistent with
what was registered.\r\n- [X] Make sure the specs you add are valid
OpenAPI documents.\r\n- [X] Make sure the specs you add match the actual
API contract defined\r\nin the code.\r\n- [X] Mark the endpoints as
available in ESS, or Serverless, or in
both\r\nofferings.\r\n\r\n---\r\nInitial evaluation of routes listed as
missing specs
in\r\nhttps://github.com//issues/183825:\r\n\r\n- [X]
`POST\r\n/api/elastic_assistant/current_user/conversations/{id}/messages`\r\nLatest/Actual
Route:\r\n`/internal/elastic_assistant/current_user/conversations/{id}/messages`\r\nRoute
Handler:\r\nhttps://github.com/elastic/kibana/blob/bae84d4569870dcecfd0cef346d2e0d38ac92160/x-pack/plugins/elastic_assistant/server/routes/user_conversations/append_conversation_messages_route.ts#L22\r\nSchema:\r\nhttps://github.com/elastic/kibana/blob/bae84d4569870dcecfd0cef346d2e0d38ac92160/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/crud_conversation_route.schema.yaml#L151-L191\r\n\r\n\r\n-
[X] `POST /api/elastic_assistant/current_user/conversations`\r\nUpdated
Route: `/api/security_ai_assistant/current_user/conversations`\r\nRoute
Handler:\r\nhttps://github.com/elastic/kibana/blob/1d4e9b9b53b5b6dcdc88c08ae5d9858daa483fe0/x-pack/plugins/elastic_assistant/server/routes/user_conversations/create_route.ts#L21\r\nSchema:\r\nhttps://github.com/elastic/kibana/blob/bae84d4569870dcecfd0cef346d2e0d38ac92160/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/crud_conversation_route.schema.yaml#L6-L39\r\n\r\n-
[X] GET
/api/elastic_assistant/current_user/conversations/_find\r\nUpdated
Route:\r\n`/api/security_ai_assistant/current_user/conversations/_find`\r\nRoute
Handler:\r\nhttps://github.com/elastic/kibana/blob/1d4e9b9b53b5b6dcdc88c08ae5d9858daa483fe0/x-pack/plugins/elastic_assistant/server/routes/user_conversations/find_route.ts#L26\r\nSchema:\r\nhttps://github.com/elastic/kibana/blob/1b872fbf9dc90d3c82a569a9faef9e360fc41171/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/find_conversations_route.schema.yaml#L94-L180\r\n\r\n-
[X] DELETE
/api/elastic_assistant/current_user/conversations/{id}\r\nUpdated
Route:\r\n`/api/security_ai_assistant/current_user/conversations/{id}`\r\nRoute
Handler:\r\nhttps://github.com/elastic/kibana/blob/1d5cf48a9700ee769f64256c23278fcfd8cecc5d/x-pack/plugins/elastic_assistant/server/routes/user_conversations/delete_route.ts#L19\r\nSchema:\r\nhttps://github.com/elastic/kibana/blob/bae84d4569870dcecfd0cef346d2e0d38ac92160/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/crud_conversation_route.schema.yaml#L116-L149\r\n\r\n-
[X] GET
/api/elastic_assistant/current_user/conversations/{id}\r\nUpdated
Route:\r\n`/api/security_ai_assistant/current_user/conversations/{id}`\r\nRoute
Handler:\r\nhttps://github.com/elastic/kibana/blob/1d5cf48a9700ee769f64256c23278fcfd8cecc5d/x-pack/plugins/elastic_assistant/server/routes/user_conversations/read_route.ts#L21\r\nSchema:\r\nhttps://github.com/elastic/kibana/blob/bae84d4569870dcecfd0cef346d2e0d38ac92160/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/crud_conversation_route.schema.yaml#L42-L75\r\n\r\n-
[X] PUT
/api/elastic_assistant/current_user/conversations/{id}\r\nUpdated
Route:\r\n`/api/security_ai_assistant/current_user/conversations/{id}`\r\nRoute
Handler:\r\nhttps://github.com/elastic/kibana/blob/1d5cf48a9700ee769f64256c23278fcfd8cecc5d/x-pack/plugins/elastic_assistant/server/routes/user_conversations/update_route.ts#L24\r\nSchema:\r\nhttps://github.com/elastic/kibana/blob/bae84d4569870dcecfd0cef346d2e0d38ac92160/x-pack/packages/kbn-elastic-assistant-common/impl/schemas/conversations/crud_conversation_route.schema.yaml#L76-L115\r\n\r\n\r\nTo
continue with remaining public
routes....\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<[email protected]>","sha":"a51b775391af09b6ba2ee9456489ef3351f8875a"}}]}]
BACKPORT-->

Co-authored-by: Garrett Spong <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Security Assistant Security Assistant release_note:skip Skip the PR/issue when compiling release notes Team:Security Generative AI Security Generative AI v8.15.0 v8.16.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants