Skip to content

Conversation

@tisnik
Copy link
Contributor

@tisnik tisnik commented Jul 20, 2025

Description

LCORE-304: Update OpenAPI schema

Type of change

  • Refactor
  • New feature
  • Bug fix
  • CVE fix
  • Optimization
  • Documentation Update
  • Configuration Update
  • Bump-up service version
  • Bump-up dependent library
  • Bump-up library or tool used for development (does not change the final image)
  • CI configuration change
  • Konflux configuration change
  • Unit tests improvement
  • Integration tests improvement
  • End to end tests improvement

Related Tickets & Documents

  • Related Issue #LCORE-304

Summary by CodeRabbit

  • New Features

    • Added new API endpoints to retrieve and delete conversations by their ID.
    • Introduced detailed responses for conversation retrieval and deletion, including conversation history and status messages.
  • Documentation

    • Updated API documentation to include the new conversation endpoints and response formats.
    • Extended query request documentation to reflect the new optional media type property.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 20, 2025

Walkthrough

A new API path /v1/conversations/{conversation_id} is added, supporting both GET and DELETE methods for retrieving and deleting conversations by ID. Two new response schemas are introduced, and the QueryRequest schema is extended with an optional media_type property. No existing endpoints or schemas are modified.

Changes

File(s) Change Summary
docs/openapi.json Added /v1/conversations/{conversation_id} GET and DELETE endpoints; introduced ConversationResponse and ConversationDeleteResponse schemas; extended QueryRequest schema with optional media_type.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant API

    Client->>API: GET /v1/conversations/{conversation_id}
    API-->>Client: 200 ConversationResponse / 404 / 503 / 422

    Client->>API: DELETE /v1/conversations/{conversation_id}
    API-->>Client: 200 ConversationDeleteResponse / 404 / 503 / 422
Loading

Possibly related PRs

Poem

A new path opens, conversations in tow,
Retrieve or delete, just say so!
With schemas fresh and fields anew,
Media types join the query crew.
The API grows, the docs align—
Oh, what a lovely, chatty design! 🐇✨


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
docs/openapi.json (1)

1280-1289: Docstring not updated for new media_type field

QueryRequest now contains media_type, but the schema description (lines 1294-1299) still enumerates only up to attachments. Add a short note so docs generated from the spec stay self-consistent.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 76dc1d2 and b28259b.

📒 Files selected for processing (1)
  • docs/openapi.json (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-pr
🔇 Additional comments (1)
docs/openapi.json (1)

797-810: ConversationResponse is missing session_data referenced by the GET example

Either add an optional session_data property here or drop it from the example to keep consumer models accurate.

Example augmentation:

     "chat_history": { ... }
+    ,"session_data": {
+        "type": "object",
+        "additionalProperties": true,
+        "title": "Session Data"
+    }

Comment on lines +390 to +405
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ConversationResponse"
}
}
},
"conversation_id": "123e4567-e89b-12d3-a456-426614174000",
"session_data": {
"session_id": "123e4567-e89b-12d3-a456-426614174000",
"turns": [],
"started_at": "2024-01-01T00:00:00Z"
}
},
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

GET /v1/conversations/{conversation_id} – invalid top-level fields and schema drift

Inside the 200 response you place conversation_id and session_data directly under the Response object. OpenAPI 3.x only allows the keys description, headers, content, and links (plus vendor extensions x-*) at this level.
Additionally, the payload example introduces session_data, which is absent from the referenced ConversationResponse schema – this will fail validation and break code-gen.

-                        "conversation_id": "123e4567-e89b-12d3-a456-426614174000",
-                        "session_data": {
-                            "session_id": "123e4567-e89b-12d3-a456-426614174000",
-                            "turns": [],
-                            "started_at": "2024-01-01T00:00:00Z"
-                        }
+                        "content": {
+                            "application/json": {
+                                "schema": { "$ref": "#/components/schemas/ConversationResponse" },
+                                "example": {
+                                    "conversation_id": "123e4567-e89b-12d3-a456-426614174000",
+                                    "chat_history": []
+                                }
+                            }
+                        }

Either extend ConversationResponse with session_data or keep the example in sync with the current schema.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In docs/openapi.json around lines 390 to 405, the 200 response object
incorrectly includes top-level fields conversation_id and session_data, which
are not allowed by OpenAPI 3.x. To fix this, remove these fields from the
response object and instead add session_data to the ConversationResponse schema
if it is part of the response payload. Ensure the example matches the updated
schema to maintain validation and code generation compatibility.

Comment on lines +451 to +463
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ConversationDeleteResponse"
}
}
},
"conversation_id": "123e4567-e89b-12d3-a456-426614174000",
"success": true,
"message": "Conversation deleted successfully"
},
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

DELETE /v1/conversations/{conversation_id} – field name & spec compliance issues

  1. The inline example uses message, yet the schema defines the property as response; clients generated from this spec will reject the returned JSON.
  2. conversation_id, success, and message/response are again placed at the wrong level in the Response object, violating the OpenAPI structure.
-                        "conversation_id": "123e4567-e89b-12d3-a456-426614174000",
-                        "success": true,
-                        "message": "Conversation deleted successfully"
+                        "content": {
+                            "application/json": {
+                                "schema": { "$ref": "#/components/schemas/ConversationDeleteResponse" },
+                                "example": {
+                                    "conversation_id": "123e4567-e89b-12d3-a456-426614174000",
+                                    "success": true,
+                                    "response": "Conversation deleted successfully"
+                                }
+                            }
+                        }

Also rename either the schema field or the example so they match (response vs message).

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In docs/openapi.json around lines 451 to 463, the response example for DELETE
/v1/conversations/{conversation_id} incorrectly places conversation_id, success,
and message fields outside the content schema object, violating OpenAPI
structure. Move these fields inside the schema definition or the example object
within "application/json". Also, ensure the field name in the example matches
the schema property by renaming either "message" to "response" or vice versa for
consistency.

Comment on lines +766 to +796
"ConversationDeleteResponse": {
"properties": {
"conversation_id": {
"type": "string",
"title": "Conversation Id"
},
"success": {
"type": "boolean",
"title": "Success"
},
"response": {
"type": "string",
"title": "Response"
}
},
"type": "object",
"required": [
"conversation_id",
"success",
"response"
],
"title": "ConversationDeleteResponse",
"description": "Model representing a response for deleting a conversation.\n\nAttributes:\n conversation_id: The conversation ID (UUID) that was deleted.\n success: Whether the deletion was successful.\n response: A message about the deletion result.\n\nExample:\n ```python\n delete_response = ConversationDeleteResponse(\n conversation_id=\"123e4567-e89b-12d3-a456-426614174000\",\n success=True,\n response=\"Conversation deleted successfully\"\n )\n ```",
"examples": [
{
"conversation_id": "123e4567-e89b-12d3-a456-426614174000",
"response": "Conversation deleted successfully",
"success": true
}
]
},
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

ConversationDeleteResponse schema–example mismatch

The schema exposes property response, but the path example (see DELETE 200 above) uses message. Pick one identifier and keep it consistent across schema and examples to avoid runtime deserialization errors.

🤖 Prompt for AI Agents
In docs/openapi.json between lines 766 and 796, the ConversationDeleteResponse
schema defines a property named "response" but the example in the DELETE 200
path uses "message" instead. To fix this, choose either "response" or "message"
as the property name and update both the schema and all examples to use the same
identifier consistently to prevent deserialization errors.

@tisnik tisnik merged commit a383053 into lightspeed-core:main Jul 20, 2025
17 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Aug 5, 2025
15 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant