-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BinData can't be instantiated #9
Comments
Simply making that proposed change (moving the content to a |
yeah I recall some of the constrained strings (with additional properties) being hard to model... but I didn't appreciate that it couldn't even be instantiated! That'll never do! :) |
Zero!
|
fwiw, I'm more than happy to use whatever "ugliness" is necessary for now to just get the output model working. So if using the current |
In the schema BinData is an extension of string, but modeling this in python as a subclass of str with extra constructor args is not feasible. Instead this change moves the string content to a `value` attribute which aligns with how our to_dict converter presents element text content. Fixes tlambert03#9
In the schema BinData is an extension of string, but modeling this in python as a subclass of str with extra constructor args is not feasible. Instead this change moves the string content to a `value` attribute which aligns with how our to_dict converter presents element text content. Fixes tlambert03#9
I don't think dataclasses can usefully subclass a non-dataclass or really any non-cooperative class. For example our
BinData
ultimately subclassesstr
and I discovered there's no way to actually instantiate one due to errors from either thestr
constructor or the pydantic validator. How would the core string value actually get passed in here, anyway? The other subclasses ofConstrainedStr
seem OK since they aren't also dataclasses. Maybe BinData should be a top-level class with an attributevalue: base64Binary
rather than inheriting.The text was updated successfully, but these errors were encountered: