mirror of
https://github.com/bentoml/OpenLLM.git
synced 2026-05-03 21:32:46 -04:00
chore(openapi): unify inject param (#645)
Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com>
This commit is contained in:
@@ -611,11 +611,17 @@ class MKSchema:
|
||||
|
||||
|
||||
def append_schemas(
|
||||
svc: bentoml.Service, generated_schema: dict[str, t.Any], tags_order: t.Literal['prepend', 'append'] = 'prepend'
|
||||
svc: bentoml.Service,
|
||||
generated_schema: dict[str, t.Any],
|
||||
tags_order: t.Literal['prepend', 'append'] = 'prepend',
|
||||
inject: bool = True,
|
||||
) -> bentoml.Service:
|
||||
# HACK: Dirty hack to append schemas to existing service. We def need to support mounting Starlette app OpenAPI spec.
|
||||
from bentoml._internal.service.openapi.specification import OpenAPISpecification
|
||||
|
||||
if not inject:
|
||||
return svc
|
||||
|
||||
svc_schema = svc.openapi_spec
|
||||
if isinstance(svc_schema, (OpenAPISpecification, MKSchema)):
|
||||
svc_schema = svc_schema.asdict()
|
||||
|
||||
Reference in New Issue
Block a user