-
Notifications
You must be signed in to change notification settings - Fork 355
Open
Description
Bug Report
Describe the bug
When updating a DigitalOcean App via Apps.Update, the API responds with:
Error 400. error validating app spec field "ingress.rules.rule.match.authority":
App Ingress authority routing only supports exact matching.
This happens even when the caller explicitly sets authority.exact = "", which is a valid value according to the DigitalOcean App Platform API and is accepted when sent as raw JSON.
The root cause is the following model definition in godo:
// AppIngressSpecRuleStringMatch The string match configuration.
type AppIngressSpecRuleStringMatch struct {
// Prefix-based match. For example, `/api` will match `/api`, `/api/`, and any nested paths such as `/api/v1/endpoint`.
Prefix string `json:"prefix,omitempty"`
Exact string `json:"exact,omitempty"`
}Because Exact is a string with the omitempty tag, setting it to "" causes the field to be omitted during JSON marshaling, resulting in:
"authority": {}Instead of the required:
"authority": {
"exact": ""
}This makes it impossible to send a valid App Spec using the typed godo structs when an empty exact authority match is required.
Affected Resource(s)
- Apps (
Apps.Update)
Actual Behavior
- Calling
Apps.UpdatewithAuthority.Exact = ""results in theexactfield being omitted from the request payload. - The DigitalOcean API rejects the request with a 400 validation error.
- There is no way to force
"exact": ""using the currentgodomodel definitions.
Expected Behavior
- Setting
Authority.Exact = ""should result in"exact": ""being included in the marshaled JSON. - It should be possible to express all valid DigitalOcean App Platform configurations using the provided
godostructs, without requiring raw JSON or manual requests.
Steps to Reproduce
- Create or fetch an existing App with an ingress rule.
- Set the ingress rule authority match to use an empty exact match:
rule.Match.Authority.Exact = ""
- Call:
client.Apps.Update(ctx, appID, updateReq)
- Observe the API response:
Error 400. error validating app spec field "ingress.rules.rule.match.authority": App Ingress authority routing only supports exact matching.
Suggested Fix
Change the Exact field to allow explicit empty values, for example by:
- Removing
omitemptyfrom theExactfield tag, or - Changing the type to
*stringand omittingomitempty, allowing callers to explicitly set an empty string.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels