Skip to content

fix(image_variant): fix nested variant response deserialization - #7278

Open
Monark-Arkmon wants to merge 1 commit into
cloudflare:mainfrom
Monark-Arkmon:arka/fix-image-variant-nested-response
Open

fix(image_variant): fix nested variant response deserialization#7278
Monark-Arkmon wants to merge 1 commit into
cloudflare:mainfrom
Monark-Arkmon:arka/fix-image-variant-nested-response

Conversation

@Monark-Arkmon

Copy link
Copy Markdown
  • I understand that this repository is auto-generated and my pull request may not be merged

Changes being requested

HAND-PATCH: needs reseal
This fixes generated files (model.go, resource.go, schema.go) directly, because the root cause is inside Stainless's own generator, not in our OpenAPI spec or Stainless config. Confirmed via a real preview build (config fix tested, verified via actual generated artifact to have zero effect). See IMAGES-1782 / APIX-1226 for the full history of attempted upstream fixes.

The API returns image variant responses with data nested under result.variant, but Create/Read/Update/ImportState were deserializing against a flat envelope, so options.fit/metadata came back null after any Update unless masked by a no_refresh tag on the affected fields.

Switches to ImageVariantWriteResultEnvelope, which correctly parses the nested result.variant shape, and removes the now-redundant computed variant field from the resource schema/model.

Acceptance test run results

  • I have added or updated acceptance tests for my changes
  • I have run acceptance tests for my changes and included the results below

Steps to run acceptance tests

TF_ACC=1 CLOUDFLARE_API_TOKEN=<token> CLOUDFLARE_ACCOUNT_ID=<account_id> \
  go test ./internal/services/image_variant/... -run "TestAccCloudflareImageVariant" -v -timeout 5m

Test output

=== RUN   TestAccCloudflareImageVariantDataSource_Basic
--- PASS: TestAccCloudflareImageVariantDataSource_Basic (8.44s)
=== RUN   TestAccCloudflareImageVariant_Basic
--- PASS: TestAccCloudflareImageVariant_Basic (4.71s)
--- PASS: TestAccCloudflareImageVariant_Import (6.44s)
--- PASS: TestAccCloudflareImageVariant_Update (7.90s)
PASS

Additional context & links

Supersedes #6918 (same underlying fix, redone on top of current main, with acceptance tests actually run and passing against a real account).
Ref IMAGES-1782 / APIX-1226.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant