PUT should have an api config option to amend an item on collection if the ID is present in payload i.e. PUT todos - {id:1,text="test"} to implement this add PUT options - locate by URI(mandatory or optional or disallow), payload include IDs (mandatory or optional or disallow)
locate by URI - configures what is allowed at the collection level - if mandatory then PUT todos would be disallowed, if optional then PUT todos and PUT todos/{id} would be allowed.
payload include ID - configures if a payload should include the locator id field - requests without the id would be rejected if mandatory (even if the locate by URI was mandatory), when optional then request would be allowed if they had all fields (excludng the id) and if allfields with id, when disallow requests would be rejected if they didn't have the id.
So in this scheme location is checked separately from payload.
This could lead to situations where id was disallows on uri and on body which would mean that PUT would not work - this should be flagged as a warning to the user - via some sort of validation function that returns a set of warnings and errors - the system should not allow api configurations with errors, but should allow api configurations with warnings, when there are no errors in te config.
PUT should have an api config option to amend an item on collection if the ID is present in payload i.e. PUT todos - {id:1,text="test"} to implement this add PUT options - locate by URI(mandatory or optional or disallow), payload include IDs (mandatory or optional or disallow)
locate by URI - configures what is allowed at the collection level - if mandatory then
PUT todoswould be disallowed, if optional thenPUT todosandPUT todos/{id}would be allowed.payload include ID - configures if a payload should include the locator id field - requests without the id would be rejected if mandatory (even if the locate by URI was mandatory), when optional then request would be allowed if they had all fields (excludng the id) and if allfields with id, when disallow requests would be rejected if they didn't have the id.
So in this scheme location is checked separately from payload.
This could lead to situations where id was disallows on uri and on body which would mean that PUT would not work - this should be flagged as a warning to the user - via some sort of validation function that returns a set of warnings and errors - the system should not allow api configurations with errors, but should allow api configurations with warnings, when there are no errors in te config.