feat: migrate Inspect API to FastAPI router (#4403)

# What does this PR do?

Migrate the Inspect API to the FastAPI router pattern.

Changes:
- Add inspect API to FastAPI router registry
- Add PUBLIC_ROUTE_KEY support for routes that don't require auth
- Update WebMethod creation to respect route's openapi_extra for
authentication requirements

Fixes: https://github.com/llamastack/llama-stack/issues/4346

<!-- Provide a short summary of what this PR does and why. Link to
relevant issues if applicable. -->

<!-- If resolving an issue, uncomment and update the line below -->
<!-- Closes #[issue-number] -->

## Test Plan

CI and various curls on /v1/inspect/routes, /v1/health, /v1/version

Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
Sébastien Han 2025-12-17 17:33:42 +01:00 committed by GitHub
parent cd5095a247
commit a7d509aaf9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 281 additions and 182 deletions

View file

@ -3196,6 +3196,7 @@ components:
properties:
status:
$ref: '#/components/schemas/HealthStatus'
description: The health status of the service
type: object
required:
- status
@ -3206,14 +3207,17 @@ components:
route:
type: string
title: Route
description: The API route path
method:
type: string
title: Method
description: The HTTP method for the route
provider_types:
items:
type: string
type: array
title: Provider Types
description: List of provider types implementing this route
type: object
required:
- route
@ -3228,6 +3232,7 @@ components:
$ref: '#/components/schemas/RouteInfo'
type: array
title: Data
description: List of available API routes
type: object
required:
- data
@ -7349,6 +7354,7 @@ components:
version:
type: string
title: Version
description: The version string of the service
type: object
required:
- version

View file

@ -2980,6 +2980,7 @@ components:
properties:
status:
$ref: '#/components/schemas/HealthStatus'
description: The health status of the service
type: object
required:
- status
@ -2990,14 +2991,17 @@ components:
route:
type: string
title: Route
description: The API route path
method:
type: string
title: Method
description: The HTTP method for the route
provider_types:
items:
type: string
type: array
title: Provider Types
description: List of provider types implementing this route
type: object
required:
- route
@ -3012,6 +3016,7 @@ components:
$ref: '#/components/schemas/RouteInfo'
type: array
title: Data
description: List of available API routes
type: object
required:
- data
@ -6610,6 +6615,7 @@ components:
version:
type: string
title: Version
description: The version string of the service
type: object
required:
- version

View file

@ -942,12 +942,10 @@ paths:
$ref: '#/components/responses/DefaultError'
tags:
- Inspect
summary: Health
description: |-
Get health status.
Get the current health status of the service.
summary: Get health status.
description: Get the current health status of the service.
operationId: health_v1_health_get
x-public: true
/v1/inspect/routes:
get:
responses:
@ -971,11 +969,8 @@ paths:
description: Default Response
tags:
- Inspect
summary: List Routes
description: |-
List routes.
List all available API routes with their methods and implementing providers.
summary: List routes.
description: List all available API routes with their methods and implementing providers.
operationId: list_routes_v1_inspect_routes_get
parameters:
- name: api_filter
@ -990,7 +985,9 @@ paths:
- deprecated
type: string
- type: 'null'
description: Optional filter to control which routes are returned. Can be an API level ('v1', 'v1alpha', 'v1beta') to show non-deprecated routes at that level, or 'deprecated' to show deprecated routes across all levels. If not specified, returns all non-deprecated routes.
title: Api Filter
description: Optional filter to control which routes are returned. Can be an API level ('v1', 'v1alpha', 'v1beta') to show non-deprecated routes at that level, or 'deprecated' to show deprecated routes across all levels. If not specified, returns all non-deprecated routes.
/v1/models:
get:
responses:
@ -2701,12 +2698,10 @@ paths:
$ref: '#/components/responses/DefaultError'
tags:
- Inspect
summary: Version
description: |-
Get version.
Get the version of the service.
summary: Get version.
description: Get the version of the service.
operationId: version_v1_version_get
x-public: true
components:
schemas:
Error:
@ -5008,6 +5003,7 @@ components:
properties:
status:
$ref: '#/components/schemas/HealthStatus'
description: The health status of the service
type: object
required:
- status
@ -5018,14 +5014,17 @@ components:
route:
type: string
title: Route
description: The API route path
method:
type: string
title: Method
description: The HTTP method for the route
provider_types:
items:
type: string
type: array
title: Provider Types
description: List of provider types implementing this route
type: object
required:
- route
@ -5040,6 +5039,7 @@ components:
$ref: '#/components/schemas/RouteInfo'
type: array
title: Data
description: List of available API routes
type: object
required:
- data
@ -9143,6 +9143,7 @@ components:
version:
type: string
title: Version
description: The version string of the service
type: object
required:
- version

View file

@ -944,12 +944,10 @@ paths:
$ref: '#/components/responses/DefaultError'
tags:
- Inspect
summary: Health
description: |-
Get health status.
Get the current health status of the service.
summary: Get health status.
description: Get the current health status of the service.
operationId: health_v1_health_get
x-public: true
/v1/inspect/routes:
get:
responses:
@ -973,11 +971,8 @@ paths:
description: Default Response
tags:
- Inspect
summary: List Routes
description: |-
List routes.
List all available API routes with their methods and implementing providers.
summary: List routes.
description: List all available API routes with their methods and implementing providers.
operationId: list_routes_v1_inspect_routes_get
parameters:
- name: api_filter
@ -992,7 +987,9 @@ paths:
- deprecated
type: string
- type: 'null'
description: Optional filter to control which routes are returned. Can be an API level ('v1', 'v1alpha', 'v1beta') to show non-deprecated routes at that level, or 'deprecated' to show deprecated routes across all levels. If not specified, returns all non-deprecated routes.
title: Api Filter
description: Optional filter to control which routes are returned. Can be an API level ('v1', 'v1alpha', 'v1beta') to show non-deprecated routes at that level, or 'deprecated' to show deprecated routes across all levels. If not specified, returns all non-deprecated routes.
/v1/models:
get:
responses:
@ -3161,12 +3158,10 @@ paths:
$ref: '#/components/responses/DefaultError'
tags:
- Inspect
summary: Version
description: |-
Get version.
Get the version of the service.
summary: Get version.
description: Get the version of the service.
operationId: version_v1_version_get
x-public: true
/v1beta/datasetio/append-rows/{dataset_id}:
post:
responses:
@ -6366,6 +6361,7 @@ components:
properties:
status:
$ref: '#/components/schemas/HealthStatus'
description: The health status of the service
type: object
required:
- status
@ -6376,14 +6372,17 @@ components:
route:
type: string
title: Route
description: The API route path
method:
type: string
title: Method
description: The HTTP method for the route
provider_types:
items:
type: string
type: array
title: Provider Types
description: List of provider types implementing this route
type: object
required:
- route
@ -6398,6 +6397,7 @@ components:
$ref: '#/components/schemas/RouteInfo'
type: array
title: Data
description: List of available API routes
type: object
required:
- data
@ -10519,6 +10519,7 @@ components:
version:
type: string
title: Version
description: The version string of the service
type: object
required:
- version