-
Notifications
You must be signed in to change notification settings - Fork 13
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
Add document type design #378
base: develop
Are you sure you want to change the base?
Conversation
>>> document.as_shape(registry.get(document.discriminator)) | ||
``` | ||
|
||
##### Type Registries |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Design for these probably goes in the serialization document, but I wanted to have it here for now for the sake of making the review easier.
738e7b1
to
960137f
Compare
def discriminator(self) -> ShapeID: | ||
... | ||
|
||
def is_none(self) -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a need for an explicit value type to hold None? Could this just be None itself?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It lets you distinguish between null and unset
designs/documents.md
Outdated
def as_blob(self) -> bytes: | ||
... | ||
|
||
def as_boolean(self) -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's hard to imagine how a lot of this will be used- maybe it will become clearer as the document goes on, but what is the intended use for the methods like as_boolean or as_float?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They return the expected type. If the underlying data isn't compatible, an error is thrown. This can include things like converting a base64 string into bytes for a JSON document when as_bytes
is called.
This adds a full design document for document types.
960137f
to
35464a9
Compare
This adds a full design document for document types.
Note that this is a bit of a rough draft at the moment but I wanted to get it up sooner rather than later, and it nevertheless should convey all of the necessary information if not in an ideal order.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.