-
Notifications
You must be signed in to change notification settings - Fork 2
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
Refactor /set-field
endpoint
#119
Comments
@dcastro by optional FieldContents you mean
The combination visibility=null && fieldcontents=null is a bit strange, I think that is the main issue, which won't be resolved with your suggestion. Or probably I misunderstood something. |
Well, depends on how you look at it. The problem I described was that there was no use case for setting fieldcontents to null. With my proposed change, there would be a use case: if you set the fieldcontents to null and the visibility to not null, you would change the visibility of the field and leave its contents intact. But you're right, there would still be the issue that "the combination visibility=null && fieldcontents=null is a bit strange". It's the same thing with the CLI's So perhaps we should:
|
Sounds OK, I assume that CLI's |
Separate PRs sounds good (you can link them both to this issue) |
Problem: `set-field` route was used both for changing visibility and setting fields. This resulted in ambiguous behavior in case of missing contents and visibility options. Solution: require contents for setting field and allow changing visibility for convenience. Add `set-field-visibility` request which doesn't require field contents.
Problem: See issue #119. Solution: Split `set-field` command into a `set-field` with contents and `set-field-visibility`.
Problem: See issue #119. Solution: Split `set-field` command into a `set-field` with contents and `set-field-visibility`.
Problem: See issue #119. Solution: Split `set-field` command into a `set-field` with contents and `set-field-visibility`.
Problem: See issue #119. Solution: Split `set-field` command into a `set-field` with contents and `set-field-visibility`.
Clarification and motivation
The
set-field
endpoints are defined as:In other words, we have 3 distinct endpoints:
/set-field
with an optionalMaybe FieldContents
body/set-field/private
with no body/set-field/public
with no bodyThere are multiple issues with this interface:
/set-field
endpoint isMaybe FieldContents
, which suggests it's okay to call it withnull
in the body. But this doesn't make sense. If the?field
name already exists, then calling/set-field
withnull
in the body will do absolutely nothing. If the field does not yet exist,/set-field
will fail:POST /set-field
with the field contents in the bodyPOST /set-field/private
These issues can be solved by having a single endpoint that accepts an optional
?visibility=public/private
query parameter and an optionalFieldContents
.We should also be able to inline
handleSetFieldResult
as part of this issue.Acceptance criteria
We have a single
/set-field
endpointThe text was updated successfully, but these errors were encountered: