rs / rest-layer

REST Layer, Go (golang) REST API framework
http://rest-layer.io
MIT License
1.26k stars 114 forks source link

Fix PUT,PATCH on read-only fields #235

Closed Dragomir-Ivanov closed 5 years ago

Dragomir-Ivanov commented 5 years ago

Fields stored in non-scalar form by Storer will differ from incoming JSON scalar form. Input scalars need to be converted to non-scalar form before comparison, so decision to be made if the field has changed. Closes #232

Dragomir-Ivanov commented 5 years ago

I don't recall any breaking changes, except that updating read-only non-scalar fields with the same value will not bail out. Same as updating scalar fields.

smyrman commented 5 years ago

The breaking change is the change of the schema.Prepare interface and implementation. We must consider any change to the public API a breaking change, no matter if it's commonly used by applications or not.

E.g. we call Prepare directly several places, where we have code working directly against the resource layer without going through rest.

Dragomir-Ivanov commented 5 years ago

Ah, I see now. Didn't considered someone to use Prepare outside rest. I will add it to README.

smyrman commented 5 years ago

Ah, I see now. Didn't considered someone to use Prepare outside rest. I will add it to README.

It's OK to wait untilll we have discussed/agreed on the interface change though 😉 Let's wait for @rs feedback.

smyrman commented 5 years ago

This also means there will be no breaking changes.

Dragomir-Ivanov commented 5 years ago

On it.

Dragomir-Ivanov commented 5 years ago

@smyrman I have resolved all conversations and rebased the PR.

smyrman commented 5 years ago

Going ahead with the merge then.