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

hide_as_child_json_when makes null mean two things & weird API asymmetry #11

Open
craigspaeth opened this issue Mar 11, 2013 · 0 comments

Comments

@craigspaeth
Copy link

Using hide_as_child_json_when means that the API returns null to mean two different things 1. If the relation doesn't exist, 2. Some arbitrary clause e.g. The relation isn't "public".

I think hide_as_child_json_when should return something other than null or not include that key in the JSON at all.

Here's a concrete example of why this is weird:

  • I GET all of an upcoming show's artworks. This returns null for partner in each of them because the gallery isn't public.
  • I click "feature artwork" which PUTs the JSON I just got with feature_eligible set to true.
  • This also PUTS partner: null which removes the relationship to the gallery... now the gallery thinks the artwork was deleted.

To work around this the client has to know or assume null can mean multiple things and compensate by manipulating the fetched JSON to not sync the partner field unless the user explicitly breaks that relationship.

It's not hard to work around, but I thought this was an odd design decision.

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

1 participant