LCORE-336: Regenerate OpenAPI schema#344
Conversation
WalkthroughThe OpenAPI specification for the GET Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant API Server
Client->>API Server: GET /v1/conversations/{conversation_id}
API Server-->>Client: Responds with { chat_history: [ { messages: [...], started_at, completed_at }, ... ] }
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Possibly related PRs
Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
docs/openapi.json(1 hunks)
🔇 Additional comments (1)
docs/openapi.json (1)
400-415: Validate regenerated OpenAPI spec in CITo avoid blocking CI later, install the validator locally and ensure its CLI is on
$PATHbefore running:#!/bin/bash # Install the OpenAPI spec validator into ~/.local/bin and add it to PATH pip install --user --quiet openapi-spec-validator==0.7.1 export PATH="$HOME/.local/bin:$PATH" # Validate the spec against OpenAPI 3.1 meta-schema openapi-spec-validator docs/openapi.jsonThis command will exit with a non-zero status if the spec (e.g. misplaced example keys) is invalid.
| "chat_history": [ | ||
| { | ||
| "messages": [ | ||
| { | ||
| "content": "Hi", | ||
| "type": "user" | ||
| }, | ||
| { | ||
| "content": "Hello!", | ||
| "type": "assistant" | ||
| } | ||
| ], | ||
| "started_at": "2024-01-01T00:00:00Z", | ||
| "completed_at": "2024-01-01T00:00:05Z" | ||
| } | ||
| ] |
There was a problem hiding this comment.
Misplaced example fields – current structure is not OpenAPI-compliant
conversation_id and chat_history are placed as siblings of content, but OpenAPI 3.x only allows the keys description, headers, content, and links inside a Response Object.
These two keys are therefore silently ignored by tooling (e.g., generators, validators) and break example rendering.
Refactor by moving the example under the proper media-type object:
- "conversation_id": "123e4567-e89b-12d3-a456-426614174000",
- "chat_history": [
- {
- "messages": [
- {"content": "Hi", "type": "user"},
- {"content": "Hello!", "type": "assistant"}
- ],
- "started_at": "2024-01-01T00:00:00Z",
- "completed_at":"2024-01-01T00:00:05Z"
- }
- ]
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ConversationResponse"
+ },
+ "example": {
+ "conversation_id": "123e4567-e89b-12d3-a456-426614174000",
+ "chat_history": [
+ {
+ "messages": [
+ {"content": "Hi", "type": "user"},
+ {"content": "Hello!", "type": "assistant"}
+ ],
+ "started_at": "2024-01-01T00:00:00Z",
+ "completed_at":"2024-01-01T00:00:05Z"
+ }
+ ]
+ }
+ }
+ }Without this change, openapi-generator, swagger-ui, and code-gen clients will not surface the example or may even reject the spec.
Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In docs/openapi.json around lines 400 to 415, the fields `conversation_id` and
`chat_history` are incorrectly placed as siblings to `content` inside a Response
Object, which violates OpenAPI 3.x specifications. To fix this, move these
example fields inside the `example` or `examples` property under the appropriate
media-type object within `content`. This ensures the example is correctly
recognized by OpenAPI tools and generators.
Description
LCORE-336: Regenerate OpenAPI schema
Type of change
Related Tickets & Documents
Summary by CodeRabbit