In our TS codebase, we have a single validate method. The same is true of our Python codebase, but the input differs.
In the TS codebase, validate takes an object parsed from JSON.
In the Python codebase, validate takes a string presumed to be JSON. The reason for this is that internally Pydantic can parse and validate faster than going through a separate parse and validation phase.
Since it's already there, I
Renamed the validate method to validate_json_text.
Introduced a validate_object that works similarly to the TypeScript validate method.
In our TS codebase, we have a single
validate
method. The same is true of our Python codebase, but the input differs.In the TS codebase,
validate
takes an object parsed from JSON.In the Python codebase,
validate
takes a string presumed to be JSON. The reason for this is that internally Pydantic can parse and validate faster than going through a separate parse and validation phase.Since it's already there, I
validate
method tovalidate_json_text
.validate_object
that works similarly to the TypeScriptvalidate
method.