Commit 6d6421f8 authored by mohammed.shibili's avatar mohammed.shibili

requirements

parent 04ead573
...@@ -5,8 +5,6 @@ import chardet ...@@ -5,8 +5,6 @@ import chardet
app = FastAPI() app = FastAPI()
app = FastAPI()
def find_and_replace_recursive(data: Any, replacements: Dict[str, str]) -> Any: def find_and_replace_recursive(data: Any, replacements: Dict[str, str]) -> Any:
if isinstance(data, dict): if isinstance(data, dict):
...@@ -39,8 +37,10 @@ async def replace_values(file: UploadFile = UploadFile(...)): ...@@ -39,8 +37,10 @@ async def replace_values(file: UploadFile = UploadFile(...)):
} }
updated_json = find_and_replace_recursive(json_data, replacements) updated_json = find_and_replace_recursive(json_data, replacements)
# add_component = {} add_component = []
# updated_json["components"].insert(0, add_component) if add_component:
components = add_component + updated_json["components"]
updated_json["components"] = components
return updated_json return updated_json
except json.JSONDecodeError: except json.JSONDecodeError:
raise HTTPException(status_code=400, detail="Invalid JSON format in the uploaded file.") raise HTTPException(status_code=400, detail="Invalid JSON format in the uploaded file.")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment