-
Notifications
You must be signed in to change notification settings - Fork 10
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
Form Field type null #39
Comments
@niklase why not have a form that has as a member the names of fields to delete as a string array? Just curious. IMO a |
APIs with updates according to JSON Merge Patch when doing HTTP PATCH will handle null values as delete of that field. In my API I have extended the Ion form field with a form field member "mustBeNull" which can be true or false (with false as default) and it works well to express the body to patch with but is not very pretty. You are right this is a special scenario but I prefer using standards like JSON Merge Patch rather than invent my own protocol for patching JSON data. The reason I suggested a new type "null" is that it would fit into the spec without introducing any new form field member (like my "mustBeNull" extension) and if I look in the JSON spec (ECMA-404), the only "types" mentioned are string, number, object and array - and null is defined on exactly the same level (as is true and false). I think it is good if it is possible to define an Ion form which is compliant with JSON Merge Patch. To do this I have to be able to tell the client that a value is required to be set to null when submitting the form. I will stick with the API as I have it is for now but according to the draft spec it would be ok to add the type "null" even though it is not part of the spec and might not be recognized by the client. Is this correct? |
I would like to be able to specify form for deleting fields according to JSON Merge Patch (RFC7396) where field to be deleted when calling PATCH must have value null. A type (”type”:”null”) which only allows null as value would be a good way to express this. Or is there a better way to express a field which has to be null?
The text was updated successfully, but these errors were encountered: