You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
When ingesting raw plutus data in some form, if the structure is complicated the error messages can be unclear about where in the data structure the error is being thrown.
For example, if there is an incorrect CONSTR_ID, you get an error message saying something like:
pycardano.exception.DeserializeException: Mismatch between constructors, expect: 0, got: 1 instead.
This doesn't tell me where the constructor error is occurring. Hopefully I don't have too many 1's in my data structure.
Describe the solution you'd like
Ideally when either serializing or deserializing, errors would have some form of data structure "stack trace" for lack of a better word. An example of how this has been handled well is in pydantic.
One potential (heavy lift) implementation of this would be to rewrite the underlying PlutusData classes to use pydantic. Maybe a less heavy lift would be to use the pydantic dataclasses, and honestly, it might be as simple as using pydantic dataclasses for the decorators rather than the vanilla base dataclasses.
The text was updated successfully, but these errors were encountered:
Yes, and I use it extensively for XML parsing. pydantic has it's own dataclass that is designed to be a drop in replacement for dataclasses.dataclass, but I don't know how robust it is as a drop in replacement. I originally ran into pydantic when building APIs, but I use it in nearly all my work. It's especially useful when building API clients to validate the response values. There are also a LOT of tools out there to autogenerate pydantic BaseModel/dataclass objects from schema (XML schema, openAPI, etc).
Is your feature request related to a problem? Please describe.
When ingesting raw plutus data in some form, if the structure is complicated the error messages can be unclear about where in the data structure the error is being thrown.
For example, if there is an incorrect
CONSTR_ID
, you get an error message saying something like:This doesn't tell me where the constructor error is occurring. Hopefully I don't have too many 1's in my data structure.
Describe the solution you'd like
Ideally when either serializing or deserializing, errors would have some form of data structure "stack trace" for lack of a better word. An example of how this has been handled well is in pydantic.
One potential (heavy lift) implementation of this would be to rewrite the underlying PlutusData classes to use pydantic. Maybe a less heavy lift would be to use the pydantic dataclasses, and honestly, it might be as simple as using pydantic dataclasses for the decorators rather than the vanilla base dataclasses.
The text was updated successfully, but these errors were encountered: