Skip to content
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

Require :dato/guid when creating a new entity #12

Open
sgrove opened this issue Aug 12, 2015 · 2 comments
Open

Require :dato/guid when creating a new entity #12

sgrove opened this issue Aug 12, 2015 · 2 comments

Comments

@sgrove
Copy link
Member

sgrove commented Aug 12, 2015

@dwwoelfel Is there a way to tell that a new entity is being created (both server-side and client-side), and either 1. require a :dato/guid k/v pair, or 2. auto-insert one? Would help with the "pit of success" story.

@dwwoelfel
Copy link
Member

The frontend does that by rejecting new entities without a :dato/guid. It could be configured to auto-insert one, but I think that might cause some data integrity problems. I think it's better to fail noisily than to silently insert unexpected data. We could write a helper for it, e.g. dato/create-new.

Server-side, we could also write a helper or maybe use a transactor function.

@sgrove
Copy link
Member Author

sgrove commented Aug 12, 2015

That's a good idea - I have an assert in broadcast-tx that checks that the
vals of the fid-map are not nil, so that's been helping me keep things
clean on the client. I reworked my data-gen ns after a major schema change,
and wasn't putting dato/guid on some stuff, and then seeing strange
behavior client-side. Perhaps the client should also fail noisily (in dev)
if it receives an entity from the server without a dato/guid?

On Wed, Aug 12, 2015 at 1:03 PM, Daniel Woelfel [email protected]
wrote:

The frontend does that by rejecting new entities without a :dato/guid. It
could be configured to auto-insert one, but I think that might cause some
data integrity problems. I think it's better to fail noisily than to
silently insert unexpected data. We could write a helper for it, e.g.
dato/create-new.

Server-side, we could also write a helper or maybe use a transactor
function.


Reply to this email directly or view it on GitHub
#12 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants