mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-04 04:04:14 +00:00
fix: update OpenAPI generator
This commit is contained in:
parent
914c8cb605
commit
f1c91f7161
2 changed files with 16 additions and 23 deletions
|
@ -9,7 +9,9 @@ import ipaddress
|
|||
import types
|
||||
import typing
|
||||
from dataclasses import make_dataclass
|
||||
from typing import Any, Dict, Set, Union
|
||||
from typing import Annotated, Any, Dict, get_args, get_origin, Set, Union
|
||||
|
||||
from fastapi import UploadFile
|
||||
|
||||
from llama_stack.apis.datatypes import Error
|
||||
from llama_stack.strong_typing.core import JsonType
|
||||
|
@ -30,9 +32,6 @@ from llama_stack.strong_typing.schema import (
|
|||
Schema,
|
||||
SchemaOptions,
|
||||
)
|
||||
from typing import get_origin, get_args
|
||||
from typing import Annotated
|
||||
from fastapi import UploadFile
|
||||
from llama_stack.strong_typing.serialization import json_dump_string, object_to_json
|
||||
|
||||
from .operations import (
|
||||
|
@ -636,10 +635,7 @@ class Generator:
|
|||
base_type = param_type
|
||||
if base_type is UploadFile:
|
||||
# File upload
|
||||
properties[name] = {
|
||||
"type": "string",
|
||||
"format": "binary"
|
||||
}
|
||||
properties[name] = {"type": "string", "format": "binary"}
|
||||
else:
|
||||
# Form field
|
||||
properties[name] = self.schema_builder.classdef_to_ref(base_type)
|
||||
|
@ -649,15 +645,11 @@ class Generator:
|
|||
multipart_schema = {
|
||||
"type": "object",
|
||||
"properties": properties,
|
||||
"required": required_fields
|
||||
"required": required_fields,
|
||||
}
|
||||
|
||||
requestBody = RequestBody(
|
||||
content={
|
||||
"multipart/form-data": {
|
||||
"schema": multipart_schema
|
||||
}
|
||||
},
|
||||
content={"multipart/form-data": {"schema": multipart_schema}},
|
||||
required=True,
|
||||
)
|
||||
# data passed in payload as JSON and mapped to request parameters
|
||||
|
@ -801,9 +793,10 @@ class Generator:
|
|||
)
|
||||
|
||||
return Operation(
|
||||
tags=[getattr(op.defining_class, "API_NAMESPACE", op.defining_class.__name__)],
|
||||
summary=None,
|
||||
# summary=doc_string.short_description,
|
||||
tags=[
|
||||
getattr(op.defining_class, "API_NAMESPACE", op.defining_class.__name__)
|
||||
],
|
||||
summary=doc_string.short_description,
|
||||
description=description,
|
||||
parameters=parameters,
|
||||
requestBody=requestBody,
|
||||
|
|
|
@ -29,4 +29,4 @@ fi
|
|||
|
||||
stack_dir=$(dirname $(dirname $THIS_DIR))
|
||||
PYTHONPATH=$PYTHONPATH:$stack_dir \
|
||||
python -m docs.openapi_generator.generate $(dirname $THIS_DIR)/_static
|
||||
python -m docs.openapi_generator.generate $(dirname $THIS_DIR)/static
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue