Skip to content

Commit

Permalink
Bug/openapi support yaml (#596)
Browse files Browse the repository at this point in the history
  • Loading branch information
zzhangpurdue authored Oct 29, 2024
1 parent b4646bb commit e89c720
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions apps/agentfabric/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,18 +569,23 @@ def openapi_schema_parser(uuid_str):
params_str = request.get_data(as_text=True)
params = json.loads(params_str)
openapi_schema = params.get('openapi_schema')
host = openapi_schema.get('host', '')
basePath = openapi_schema.get('basePath', '')
if host and basePath:
return make_response(
jsonify({
'success': False,
'status': 429,
'message': 'The Swagger 2.0 format is not support, '
'please convert it to OpenAPI 3.0 format at https://petstore.swagger.io/',
'request_id': request_id_var.get('')
}), 429)
try:
if isinstance(openapi_schema, dict):
host = openapi_schema.get('host', '')
basePath = openapi_schema.get('basePath', '')
if host and basePath:
return make_response(
jsonify({
'success':
False,
'status':
429,
'message':
'The Swagger 2.0 format is not support, '
'please convert it to OpenAPI 3.0 format at https://petstore.swagger.io/',
'request_id':
request_id_var.get('')
}), 429)
if not isinstance(openapi_schema, dict):
openapi_schema = json.loads(openapi_schema)
except json.decoder.JSONDecodeError:
Expand Down

0 comments on commit e89c720

Please sign in to comment.