LCORE-1346: Updated OpenAPI spec#1545
Conversation
WalkthroughThe changes add OpenAPI specifications for a new Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Warning Review ran into problems🔥 ProblemsTimed out fetching pipeline failures after 30000ms 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/openapi.json`:
- Around line 13514-13588: The OpenAPI schema shows PromptUpdateRequest.version
generated with "exclusiveMinimum: 0.0" because the model used Field(gt=0) on an
integer; update the upstream Pydantic model so PromptUpdateRequest.version uses
Field(ge=1) (or otherwise set a minimum of 1) to produce "minimum: 1" for
integer types, or if modifying the generated schema directly replace
exclusiveMinimum: 0.0 with minimum: 1 for PromptUpdateRequest.version so integer
tooling renders a clean integer bound.
In `@docs/openapi.md`:
- Around line 6265-6275: The OpenAPI prompt schemas are missing explicit type
entries; update the source schema so PromptCreateRequest.variables,
PromptResourceResponse.is_default, PromptResourceResponse.prompt,
PromptResourceResponse.variables, PromptUpdateRequest.set_as_default, and
PromptUpdateRequest.variables each include an explicit "type" (e.g., type:
object/array/string/boolean as appropriate) in their schema definitions, then
regenerate the docs so the generated sections (including the other affected
blocks around PromptCreateRequest, PromptsListResponse.data,
PromptResourceResponse and PromptUpdateRequest referenced in the comment)
reflect the added type declarations.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 72225eb9-64e0-4a98-8feb-e296e6c78b4f
📒 Files selected for processing (2)
docs/openapi.jsondocs/openapi.md
📜 Review details
🔇 Additional comments (3)
docs/openapi.json (2)
1529-2317: LGTM — generated OpenAPI additions for/v1/promptslook consistent.The five new operations, error responses (401/403/404/500/503), and schema refs align with the existing conventions used by other endpoints in this spec. Since
docs/openapi.jsonis generated from the source code, any substantive correctness review should target the underlying Python handlers/models rather than this artifact.One minor observation:
GET /v1/promptsintentionally omits422(no validated inputs) whileDELETE /v1/prompts/{prompt_id}includes422even thoughprompt_idis just astringpath param — harmless inconsistency inherited from the generator, worth a quick sanity check in the handler signatures if you want the docs to be tight.
13309-13484: The OpenAPI spec forPromptResourceResponsecorrectly reflects the Pydantic model definitions. Therequiredfields in the schema match the model: onlyprompt_idandversionare mandatory, whileprompt,variables, andis_defaultare intentionally defined asOptional[str]andOptional[list[str]]with defaultNonein the source model. The presence of these fields in examples does not imply they are required in the schema. Similarly,PromptCreateRequestandPromptDeleteResponseare correctly specified.docs/openapi.md (1)
6277-6287: PromptDeleteResponse looks clear and well-structured.Field naming and semantics are easy to consume (
prompt_id,success,response).
| "PromptUpdateRequest": { | ||
| "properties": { | ||
| "prompt": { | ||
| "type": "string", | ||
| "minLength": 1, | ||
| "title": "Prompt", | ||
| "description": "Updated prompt text", | ||
| "examples": [ | ||
| "Summarize in bullet points: {{text}}" | ||
| ] | ||
| }, | ||
| "version": { | ||
| "type": "integer", | ||
| "exclusiveMinimum": 0.0, | ||
| "title": "Version", | ||
| "description": "Current version being updated", | ||
| "examples": [ | ||
| 1 | ||
| ] | ||
| }, | ||
| "set_as_default": { | ||
| "anyOf": [ | ||
| { | ||
| "type": "boolean" | ||
| }, | ||
| { | ||
| "type": "null" | ||
| } | ||
| ], | ||
| "title": "Set As Default", | ||
| "description": "Whether the new version becomes the default", | ||
| "examples": [ | ||
| true | ||
| ] | ||
| }, | ||
| "variables": { | ||
| "anyOf": [ | ||
| { | ||
| "items": { | ||
| "type": "string" | ||
| }, | ||
| "type": "array" | ||
| }, | ||
| { | ||
| "type": "null" | ||
| } | ||
| ], | ||
| "title": "Variables", | ||
| "description": "Updated allowed variable names", | ||
| "examples": [ | ||
| [ | ||
| "text" | ||
| ] | ||
| ] | ||
| } | ||
| }, | ||
| "additionalProperties": false, | ||
| "type": "object", | ||
| "required": [ | ||
| "prompt", | ||
| "version" | ||
| ], | ||
| "title": "PromptUpdateRequest", | ||
| "description": "Request body to update a stored prompt (creates a new version).", | ||
| "examples": [ | ||
| { | ||
| "prompt": "Summarize in bullet points: {{text}}", | ||
| "set_as_default": true, | ||
| "variables": [ | ||
| "text" | ||
| ], | ||
| "version": 1 | ||
| } | ||
| ] | ||
| }, |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
PromptUpdateRequest.version uses exclusiveMinimum: 0.0 on an integer type.
This is emitted by Pydantic v2 when a Field(gt=0) is used on an int. Functionally correct per JSON Schema, but some OpenAPI tooling (and Swagger UI versions) render a float bound awkwardly for integer fields. If you want a cleaner spec, prefer Field(ge=1) upstream so it renders as minimum: 1.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@docs/openapi.json` around lines 13514 - 13588, The OpenAPI schema shows
PromptUpdateRequest.version generated with "exclusiveMinimum: 0.0" because the
model used Field(gt=0) on an integer; update the upstream Pydantic model so
PromptUpdateRequest.version uses Field(ge=1) (or otherwise set a minimum of 1)
to produce "minimum: 1" for integer types, or if modifying the generated schema
directly replace exclusiveMinimum: 0.0 with minimum: 1 for
PromptUpdateRequest.version so integer tooling renders a clean integer bound.
| ## PromptCreateRequest | ||
|
|
||
|
|
||
| Request body to create a stored prompt template in Llama Stack. | ||
|
|
||
|
|
||
| | Field | Type | Description | | ||
| |-------|------|-------------| | ||
| | prompt | string | Prompt text with variable placeholders | | ||
| | variables | | Variable names allowed in the template | | ||
|
|
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
jq -r '
.components.schemas
| to_entries[]
| select(.key | test("^(PromptCreateRequest|PromptUpdateRequest|PromptResourceResponse|PromptDeleteResponse|PromptsListResponse)$"))
| .key as $schema
| .value.properties
| to_entries[]
| "\($schema).\(.key): type=\(.value.type // "MISSING"), ref=\(.value["$ref"] // "none"), items.type=\(.value.items.type // "none"), items.ref=\(.value.items["$ref"] // "none")"
' docs/openapi.jsonRepository: lightspeed-core/lightspeed-stack
Length of output: 1415
Define missing type declarations in prompt schema fields.
The OpenAPI schema is missing explicit type definitions for several prompt-related fields:
PromptCreateRequest.variables: type=MISSINGPromptResourceResponse.is_default,prompt,variables: type=MISSINGPromptUpdateRequest.set_as_default,variables: type=MISSING
Add explicit type declarations in the source OpenAPI schema for these fields and regenerate docs. Note: PromptsListResponse.data properly defines item schema via $ref to PromptResourceResponse.
Also applies to: 6290-6303, 6317-6329, 6331-6340
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@docs/openapi.md` around lines 6265 - 6275, The OpenAPI prompt schemas are
missing explicit type entries; update the source schema so
PromptCreateRequest.variables, PromptResourceResponse.is_default,
PromptResourceResponse.prompt, PromptResourceResponse.variables,
PromptUpdateRequest.set_as_default, and PromptUpdateRequest.variables each
include an explicit "type" (e.g., type: object/array/string/boolean as
appropriate) in their schema definitions, then regenerate the docs so the
generated sections (including the other affected blocks around
PromptCreateRequest, PromptsListResponse.data, PromptResourceResponse and
PromptUpdateRequest referenced in the comment) reflect the added type
declarations.
Description
LCORE-1346: Updated OpenAPI spec
Type of change
Tools used to create PR
Related Tickets & Documents
Summary by CodeRabbit