View.UnmarshalJSON requires archived, but the Views API omits it → every view read fails
Affected package / versions
github.com/launchdarkly/api-client-go — confirmed in v22.0.0 and v23.0.0
(the latest release of each major line). The View model is identical on the
relevant points in both, so this is not fixed by upgrading v22 → v23.
Summary
The generated View model marks archived as a required property in its
UnmarshalJSON, but the Views (beta) API responses do not include archived
(they include deleted). As a result, deserializing any view GET/LIST response
fails, and every consumer that reads a view back from the API breaks.
Endpoints affected (ViewsBetaApi)
GET /api/v2/projects/{projectKey}/views/{viewKey} (GetView)
GET /api/v2/projects/{projectKey}/views (GetViews)
Both deserialize into the View model.
Root cause (in this SDK)
model_view.go (line numbers: v22.0.0 / v23.0.0):
// field is non-pointer / non-omitempty -> treated as required
Archived bool `json:"archived"` // line 49 (v22) / 52 (v23)
Deleted bool `json:"deleted"` // line 53 (v22) / 56 (v23)
func (o *View) UnmarshalJSON(data []byte) (err error) {
requiredProperties := []string{
"id", "accountId", "projectId", "projectKey", "key", "name",
"description", "generateSdkKeys", "version", "tags",
"createdAt", "updatedAt",
"archived", // line 1015 (v22) / 1056 (v23) <-- not returned by the API
"deleted", // line 1016 (v22) / 1057 (v23)
}
...
for _, requiredProperty := range requiredProperties {
if _, exists := allProperties[requiredProperty]; !exists {
return fmt.Errorf("no value given for required property %v", requiredProperty)
}
}
...
}
This is unchanged between v22.0.0 and v23.0.0. When the API response omits
archived, UnmarshalJSON returns:
no value given for required property archived
so GetView(...).Execute() fails before returning a *View.
Expected vs actual
- Expected: a view returned by the API deserializes successfully;
archived
defaults to false when absent.
- Actual: deserialization errors out with
no value given for required property archived.
Impact
Any read-back of a view fails. Concretely this breaks the Terraform provider
(terraform-provider-launchdarkly, viewRead → getView →
ViewsBetaApi.GetView(...).Execute()) and, transitively, the Pulumi provider
that bridges it — pulumi refresh fails on every existing view.
Suggested fix
Either (or both):
- SDK spec: mark
archived as optional/nullable in the OpenAPI spec for the
View schema so it is not enforced as required (make the field *bool with
omitempty, and drop "archived" from requiredProperties). Consider the same
for any other view field the API does not consistently return.
- API: have the Views API include
archived in view responses, matching the
documented schema.
Fix (1) is the actionable one for SDK consumers, since it restores forward/backward
compatibility regardless of which optional fields a given endpoint returns.
Reproduction
Call ViewsBetaApi.GetView (or GetViews) against a project that has views, with
a stock v22.0.0 or v23.0.0 client. The .Execute() call returns the
no value given for required property archived error because the response payload
contains deleted but not archived. Upgrading v22 → v23 does not change this.
View.UnmarshalJSONrequiresarchived, but the Views API omits it → every view read failsAffected package / versions
github.com/launchdarkly/api-client-go— confirmed in v22.0.0 and v23.0.0(the latest release of each major line). The
Viewmodel is identical on therelevant points in both, so this is not fixed by upgrading v22 → v23.
Summary
The generated
Viewmodel marksarchivedas a required property in itsUnmarshalJSON, but the Views (beta) API responses do not includearchived(they include
deleted). As a result, deserializing any view GET/LIST responsefails, and every consumer that reads a view back from the API breaks.
Endpoints affected (ViewsBetaApi)
GET /api/v2/projects/{projectKey}/views/{viewKey}(GetView)GET /api/v2/projects/{projectKey}/views(GetViews)Both deserialize into the
Viewmodel.Root cause (in this SDK)
model_view.go(line numbers: v22.0.0 / v23.0.0):This is unchanged between v22.0.0 and v23.0.0. When the API response omits
archived,UnmarshalJSONreturns:so
GetView(...).Execute()fails before returning a*View.Expected vs actual
archiveddefaults to
falsewhen absent.no value given for required property archived.Impact
Any read-back of a view fails. Concretely this breaks the Terraform provider
(
terraform-provider-launchdarkly,viewRead→getView→ViewsBetaApi.GetView(...).Execute()) and, transitively, the Pulumi providerthat bridges it —
pulumi refreshfails on every existing view.Suggested fix
Either (or both):
archivedas optional/nullable in the OpenAPI spec for theViewschema so it is not enforced as required (make the field*boolwithomitempty, and drop"archived"fromrequiredProperties). Consider the samefor any other view field the API does not consistently return.
archivedin view responses, matching thedocumented schema.
Fix (1) is the actionable one for SDK consumers, since it restores forward/backward
compatibility regardless of which optional fields a given endpoint returns.
Reproduction
Call
ViewsBetaApi.GetView(orGetViews) against a project that has views, witha stock
v22.0.0orv23.0.0client. The.Execute()call returns theno value given for required property archivederror because the response payloadcontains
deletedbut notarchived. Upgrading v22 → v23 does not change this.