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

[BUG] - Startup script updates do not omit empty values #295

Closed
optik-aper opened this issue Jan 25, 2024 · 1 comment
Closed

[BUG] - Startup script updates do not omit empty values #295

optik-aper opened this issue Jan 25, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@optik-aper
Copy link
Member

optik-aper commented Jan 25, 2024

Describe the bug
Updates use the same struct as create and therefore do not allow nil values to be passed in or omitted when the JSON body is marshalled for the request.

To Reproduce
Steps to reproduce the behavior:

  • Create a script
  • Modify all but one value in the script
	scriptID := "b44d064c-e437-4360-adf7-570501c2577e"
	req := &govultr.StartupScriptReq{
		Name:   "new name2",
		Script: "ZWNobyAnaGVsbG8gd29ybGQnCg==",
	}

	if err := client.StartupScript.Update(ctx, scriptID, req); err != nil {
		fmt.Println(err)
		panic(err.Error())
	}
  • Note how Type is wiped out after this update since it is not provided
{
        "id": "b44d064c-e437-4360-adf7-570501c2577e",
        "date_created": "2024-01-25T23:08:23+00:00",
        "date_modified": "2024-01-25T23:20:37+00:00",
        "name": "new name2",
        "type": "",
        "script": "ZWNobyAnaGVsbG8gd29ybGQnCg=="
}

Expected behavior
Partial updates should be supported per the API documentation

@optik-aper optik-aper added the bug Something isn't working label Jan 25, 2024
@optik-aper optik-aper self-assigned this Jan 25, 2024
@optik-aper
Copy link
Member Author

Fixed in #299

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant