Skip to content

LCORE-1346: Updated OpenAPI spec#1545

Merged
tisnik merged 1 commit into
lightspeed-core:mainfrom
tisnik:lcore-1346
Apr 20, 2026
Merged

LCORE-1346: Updated OpenAPI spec#1545
tisnik merged 1 commit into
lightspeed-core:mainfrom
tisnik:lcore-1346

Conversation

@tisnik
Copy link
Copy Markdown
Contributor

@tisnik tisnik commented Apr 20, 2026

Description

LCORE-1346: Updated OpenAPI spec

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
  • Benchmarks improvement

Tools used to create PR

  • Assisted-by: N/A
  • Generated by: N/A

Related Tickets & Documents

  • Related Issue #LCORE-1346

Summary by CodeRabbit

  • Documentation
    • Added comprehensive API documentation for a new stored prompts management feature, including endpoints for creating, retrieving, updating, listing, and deleting prompts with versioning support.
    • Documented new permission controls for managing and accessing stored prompts.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 20, 2026

Walkthrough

The changes add OpenAPI specifications for a new /v1/prompts endpoint family with CRUD operations on stored prompt templates. Five endpoints are documented along with request/response schemas and new manage_prompts and read_prompts permission actions.

Changes

Cohort / File(s) Summary
Prompts API Documentation
docs/openapi.json, docs/openapi.md
Added OpenAPI specifications for /v1/prompts endpoints (GET, POST, PUT, DELETE) and five related schemas (PromptCreateRequest, PromptUpdateRequest, PromptsListResponse, PromptResourceResponse, PromptDeleteResponse). Extended Action enum with manage_prompts and read_prompts permission actions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: updating OpenAPI specifications with new /v1/prompts endpoint definitions and schemas.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
✨ Simplify code
  • Create PR with simplified code

Warning

Review ran into problems

🔥 Problems

Timed 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
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: 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

📥 Commits

Reviewing files that changed from the base of the PR and between 5c52585 and a736508.

📒 Files selected for processing (2)
  • docs/openapi.json
  • docs/openapi.md
📜 Review details
🔇 Additional comments (3)
docs/openapi.json (2)

1529-2317: LGTM — generated OpenAPI additions for /v1/prompts look 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.json is 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/prompts intentionally omits 422 (no validated inputs) while DELETE /v1/prompts/{prompt_id} includes 422 even though prompt_id is just a string path 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 for PromptResourceResponse correctly reflects the Pydantic model definitions. The required fields in the schema match the model: only prompt_id and version are mandatory, while prompt, variables, and is_default are intentionally defined as Optional[str] and Optional[list[str]] with default None in the source model. The presence of these fields in examples does not imply they are required in the schema. Similarly, PromptCreateRequest and PromptDeleteResponse are 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).

Comment thread docs/openapi.json
Comment on lines +13514 to +13588
"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
}
]
},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 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.

Comment thread docs/openapi.md
Comment on lines +6265 to +6275
## 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 |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 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.json

Repository: 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=MISSING
  • PromptResourceResponse.is_default, prompt, variables: type=MISSING
  • PromptUpdateRequest.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.

@tisnik tisnik merged commit e2ecd1b into lightspeed-core:main Apr 20, 2026
27 of 30 checks passed
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