PRS003 - Unsupported Input Type¶
Description¶
The input provided to the validator is not a supported type. The validator accepts file paths, JSON strings, or dictionary objects.
Severity¶
Error
When This Occurs¶
- Passing an unsupported Python object type to
validate() - Using a custom object that cannot be serialized to JSON
Example¶
from dppvalidator import ValidationEngine
engine = ValidationEngine()
# These will cause PRS003:
result = engine.validate(12345) # int not supported
result = engine.validate(["list", "of"]) # list not supported
result = engine.validate(None) # None not supported
Supported Input Types¶
| Type | Example |
|---|---|
str (file path) |
"document.json" |
str (JSON) |
'{"@context": [...]}' |
dict |
{"@context": [...]} |
Path |
Path("document.json") |
Resolution¶
- Use a supported input type:
# From file path
result = engine.validate("document.json")
# From dict
result = engine.validate({"@context": ["https://..."], "type": "..."})
# From JSON string
result = engine.validate('{"@context": ["https://..."]}')
- Convert custom objects to dict: