Skip to content

Commit

Permalink
fix: upload json non string (#111)
Browse files Browse the repository at this point in the history
Co-authored-by: leoguillaume <[email protected]>
  • Loading branch information
leoguillaume and leoguillaumegouv authored Dec 19, 2024
1 parent 92ee926 commit c7f7809
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/helpers/data/parsers/_jsonparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def parse(self, file: UploadFile) -> List[ParserOutput]:
try:
file = JsonFile(documents=file)
except Exception as e:
raise InvalidJSONFormatException()
raise InvalidJSONFormatException(detail=f"Invalid JSON file format: {e}")

output = list()
created_at = round(time.time())
Expand Down
4 changes: 2 additions & 2 deletions app/schemas/files.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from typing import List, Literal, Optional
import json
from typing import Dict, List, Literal, Optional
from uuid import UUID

from pydantic import BaseModel, Field, field_validator, model_validator
Expand Down Expand Up @@ -43,7 +43,7 @@ def convert_to_string(cls, collection):
class Json(BaseModel):
title: str
text: str
metadata: dict = {}
metadata: Dict[str, str] = {}


class JsonFile(BaseModel):
Expand Down

0 comments on commit c7f7809

Please sign in to comment.