forked from phoenix-oss/llama-stack-mirror
Add version to REST API url (#478)
# What does this PR do? Adds a `/alpha/` prefix to all the REST API urls. Also makes them all use hyphens instead of underscores as is more standard practice. (This is based on feedback from our partners.) ## Test Plan The Stack itself does not need updating. However, client SDKs and documentation will need to be updated.
This commit is contained in:
parent
05e93bd2f7
commit
0dc7f5fa89
18 changed files with 32842 additions and 6032 deletions
|
@ -202,7 +202,9 @@ class ContentBuilder:
|
|||
) -> MediaType:
|
||||
schema = self.schema_builder.classdef_to_ref(item_type)
|
||||
if self.schema_transformer:
|
||||
schema_transformer: Callable[[SchemaOrRef], SchemaOrRef] = self.schema_transformer # type: ignore
|
||||
schema_transformer: Callable[[SchemaOrRef], SchemaOrRef] = (
|
||||
self.schema_transformer
|
||||
) # type: ignore
|
||||
schema = schema_transformer(schema)
|
||||
|
||||
if not examples:
|
||||
|
@ -630,6 +632,7 @@ class Generator:
|
|||
raise NotImplementedError(f"unknown HTTP method: {op.http_method}")
|
||||
|
||||
route = op.get_route()
|
||||
print(f"route: {route}")
|
||||
if route in paths:
|
||||
paths[route].update(pathItem)
|
||||
else:
|
||||
|
|
|
@ -12,6 +12,8 @@ import uuid
|
|||
from dataclasses import dataclass
|
||||
from typing import Any, Callable, Dict, Iterable, Iterator, List, Optional, Tuple, Union
|
||||
|
||||
from llama_stack.distribution.stack import LLAMA_STACK_API_VERSION
|
||||
|
||||
from termcolor import colored
|
||||
|
||||
from ..strong_typing.inspection import (
|
||||
|
@ -111,9 +113,12 @@ class EndpointOperation:
|
|||
|
||||
def get_route(self) -> str:
|
||||
if self.route is not None:
|
||||
return self.route
|
||||
assert (
|
||||
"_" not in self.route
|
||||
), f"route should not contain underscores: {self.route}"
|
||||
return "/".join(["", LLAMA_STACK_API_VERSION, self.route.lstrip("/")])
|
||||
|
||||
route_parts = ["", self.name]
|
||||
route_parts = ["", LLAMA_STACK_API_VERSION, self.name]
|
||||
for param_name, _ in self.path_params:
|
||||
route_parts.append("{" + param_name + "}")
|
||||
return "/".join(route_parts)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue