mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-15 01:02:38 +00:00
generate openapi
This commit is contained in:
parent
cdfd584a8f
commit
ec7c8f95de
6 changed files with 2854 additions and 1225 deletions
|
|
@ -4,7 +4,7 @@
|
|||
# This source code is licensed under the terms described in the LICENSE file in
|
||||
# the root directory of this source tree.
|
||||
|
||||
from typing import Dict, List, Literal, Union
|
||||
from typing import Literal, Union
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
from typing_extensions import Annotated
|
||||
|
|
@ -24,12 +24,10 @@ class BooleanType(BaseModel):
|
|||
|
||||
class ArrayType(BaseModel):
|
||||
type: Literal["array"] = "array"
|
||||
items: "ParamType"
|
||||
|
||||
|
||||
class ObjectType(BaseModel):
|
||||
type: Literal["object"] = "object"
|
||||
properties: Dict[str, "ParamType"] = Field(default_factory=dict)
|
||||
|
||||
|
||||
class JsonType(BaseModel):
|
||||
|
|
@ -38,7 +36,6 @@ class JsonType(BaseModel):
|
|||
|
||||
class UnionType(BaseModel):
|
||||
type: Literal["union"] = "union"
|
||||
options: List["ParamType"] = Field(default_factory=list)
|
||||
|
||||
|
||||
class CustomType(BaseModel):
|
||||
|
|
@ -77,7 +74,3 @@ ParamType = Annotated[
|
|||
],
|
||||
Field(discriminator="type"),
|
||||
]
|
||||
|
||||
ArrayType.model_rebuild()
|
||||
ObjectType.model_rebuild()
|
||||
UnionType.model_rebuild()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue