feat(import): complete OpenAPI onboarding and verify delivery
This commit is contained in:
1 parent
bb3e376767
commit
e93de7015a
244 files changed
+57020
-5139
No files matched your search
@@ -30,6 +30,10 @@ def reject_duplicates(pairs: list[tuple[str, Any]]) -> dict[str, Any]:
|
||||
return result
|
||||
|
||||
|
||||
def reject_constant(_value: str) -> Any:
|
||||
raise ValidationError('/', 'invalid JSON constant')
|
||||
|
||||
|
||||
def load_json(path: Path) -> Any:
|
||||
try:
|
||||
raw = path.read_bytes()
|
||||
@@ -38,7 +42,11 @@ def load_json(path: Path) -> Any:
|
||||
if len(raw) > MAX_INPUT_BYTES:
|
||||
raise ValidationError('/', 'input exceeds 64 KiB')
|
||||
try:
|
||||
return json.loads(raw.decode('utf-8'), object_pairs_hook=reject_duplicates)
|
||||
return json.loads(
|
||||
raw.decode('utf-8'),
|
||||
object_pairs_hook=reject_duplicates,
|
||||
parse_constant=reject_constant,
|
||||
)
|
||||
except (UnicodeDecodeError, json.JSONDecodeError, RecursionError) as error:
|
||||
raise ValidationError('/', 'invalid JSON') from error
|
||||
|
||||
|
||||
Reference in new issue
Block a user