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

Document that PUT doesn't support partial updates #3112

Closed
abonas opened this issue Dec 23, 2014 · 8 comments · Fixed by #5081
Closed

Document that PUT doesn't support partial updates #3112

abonas opened this issue Dec 23, 2014 · 8 comments · Fixed by #5081
Assignees
Labels
area/api Indicates an issue on api area. area/usability kind/documentation Categorizes issue or PR as related to documentation. priority/backlog Higher priority than priority/awaiting-more-evidence. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery.
Milestone

Comments

@abonas
Copy link
Contributor

abonas commented Dec 23, 2014

sending the following json to update a service:
"{"apiVersion":"v1beta1","port":6380,"containerPort":6379}"
fails with 422 and message: "service "" is invalid: name: required value ''"

It's not clear from the message what is exactly the problem.
is the "name" field missing? isn't it called "id" at the moment?
if yes, another issue (#3085) points on the fact that including the id fails the request with another error.

@abonas
Copy link
Contributor Author

abonas commented Dec 29, 2014

similar issue happens when creating a service:
input (based on the guestbook example) :

{"id":"redis-master","port":6379,"containerPort":"redis-server","selector":{"name":"redis","role":"master"}}

POST fails with :

{
  "kind": "Status",
  "creationTimestamp": null,
  "apiVersion": "v1beta1",
  "status": "Failure",
  "message": "service \"\" is invalid: [name: required value '', spec.port: invalid value '0']",
  "reason": "Invalid",
  "details": {
    "kind": "service",
    "causes": [
      {
        "reason": "FieldValueRequired",
        "message": "name: required value ''",
        "field": "name"
      },
      {
        "reason": "FieldValue "message": "service \"\" is invalid: [name: required value '', spec.port: invalid value '0']",
  "reason": "Invalid",
  "details": {
    "kind": "service",
    "causes": [
      {
        "reason": "FieldValueRequired",
        "message": "name: required value ''",
        "field": "name"
      },
      {
        "reason": "FieldValueInvalid",
        "message": "spec.port: invalid value '0'",
        "field": "spec.port"Invalid",
        "message": "spec.port: invalid value '0'",
        "field": "spec.port"
      }
    ]
  },
  "code": 422
}

@smarterclayton
Copy link
Contributor

Internal names are not converted to external during rendering of the status message. Name is the newer api version field name for what used to be called id

@smarterclayton smarterclayton added the kind/bug Categorizes issue or PR as related to a bug. label Dec 29, 2014
@abonas
Copy link
Contributor Author

abonas commented Dec 29, 2014

@smarterclayton but the input json contains "id", so why does it fail in the first place?

@smarterclayton
Copy link
Contributor

I'm referring to the first comment, where update failed because you omitted the ID of the service you were updating

@goltermann goltermann added the priority/backlog Higher priority than priority/awaiting-more-evidence. label Jan 7, 2015
@bgrant0607
Copy link
Member

Update requires the full resource to be specified. GET the resource, modify the fields you want to change, and do a PUT.

@bgrant0607 bgrant0607 added kind/documentation Categorizes issue or PR as related to documentation. area/usability area/api Indicates an issue on api area. and removed kind/bug Categorizes issue or PR as related to a bug. labels Jan 8, 2015
@bgrant0607 bgrant0607 changed the title REST api - 422 returned from PUT on 'service' with unclear message Improve documentation of updates Jan 8, 2015
@bgrant0607 bgrant0607 changed the title Improve documentation of updates Document that PUT doesn't support partial updates Jan 8, 2015
@bgrant0607
Copy link
Member

Using #3084 for the field name conversion problem.

@bgrant0607 bgrant0607 added the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Feb 5, 2015
@bgrant0607 bgrant0607 modified the milestones: v1.0, Doc Fixit Feb 6, 2015
@ghodss
Copy link
Contributor

ghodss commented Feb 20, 2015

As mentioned, PUT should not accept partial updates - PATCH should, and the issue for that is #4578.

This is documented in api-conventions.md: "Otherwise, PUT expects the whole object to be specified." Where else does it need to be documented?

@bgrant0607
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/api Indicates an issue on api area. area/usability kind/documentation Categorizes issue or PR as related to documentation. priority/backlog Higher priority than priority/awaiting-more-evidence. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants