Skip to content

Commit

Permalink
fix: updated sdk to allow preview_tmpl to be nullable (#48)
Browse files Browse the repository at this point in the history
<!--

Describe in detail the changes you are proposing, and the rationale.

-->

<!--

Link all GitHub issues fixed by this PR, and add references to prior
related PRs.

-->

Fixes #47 

### NEW FEATURES | UPGRADE NOTES | ENHANCEMENTS | BUG FIXES |
EXPERIMENTS

<!--

Write a short description of your changes. Examples:

- Fixed a bug
- Added a new feature
- Updated documentation

--> 

-  Deleting preview_tmpl does not actually empty the field on apply
  • Loading branch information
demeyerthom authored Apr 19, 2024
1 parent 22a4d06 commit dc6f949
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 31 deletions.
3 changes: 3 additions & 0 deletions .changes/unreleased/Fixed-20240419-093400.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kind: Fixed
body: Updated sdk to allow preview_tmpl to be nullable
time: 2024-04-19T09:34:00.533488278+02:00
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ terraform-provider-storyblok*
*.backup
coverage.out
dist/
local-test
/local
/.idea
/.env
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/hashicorp/terraform-plugin-docs v0.16.0
github.com/hashicorp/terraform-plugin-framework v1.3.4
github.com/hashicorp/terraform-plugin-log v0.9.0
github.com/labd/storyblok-go-sdk v0.2.0
github.com/labd/storyblok-go-sdk v0.2.1
github.com/wk8/go-ordered-map/v2 v2.1.8
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
github.com/labd/storyblok-go-sdk v0.2.0 h1:BFyzZ/jDuvni5t6DFFpUfPY3V2xn7naymQF5rOcko1s=
github.com/labd/storyblok-go-sdk v0.2.0/go.mod h1:An/VvVu6a/oAn7bgPTTUVoqeXD2Ne8QCspqpbsa9BL0=
github.com/labd/storyblok-go-sdk v0.2.1 h1:HNgg2ox3Lpg3hPI4QFaQWbw7EJ6DWi5V1ErS2NZQKzQ=
github.com/labd/storyblok-go-sdk v0.2.1/go.mod h1:An/VvVu6a/oAn7bgPTTUVoqeXD2Ne8QCspqpbsa9BL0=
github.com/labstack/echo/v4 v4.11.1 h1:dEpLU2FLg4UVmvCGPuk/APjlH6GDpbEPti61srUUUs4=
github.com/labstack/echo/v4 v4.11.1/go.mod h1:YuYRTSM3CHs2ybfrL8Px48bO6BAnYIN4l8wSTMP6BDQ=
github.com/labstack/gommon v0.4.0 h1:y7cvthEAEbU0yHOf4axH8ZG2NH8knB9iNSoTO8dyIk8=
Expand Down
54 changes: 27 additions & 27 deletions internal/assets/component.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ interactions:
proto: HTTP/1.1
proto_major: 1
proto_minor: 1
content_length: 180
content_length: 229
transfer_encoding: []
trailer: {}
host: mapi.storyblok.com
remote_addr: ""
request_uri: ""
body: '{"component":{"is_nestable":false,"is_root":false,"name":"test-banner","schema":{"title":{"pos":1,"type":"text"},"intro":{"pos":2,"type":"text"},"image":{"pos":3,"type":"image"}}}}'
body: '{"component":{"is_nestable":false,"is_root":false,"name":"test-banner","preview_tmpl":"\u003cdiv\u003e\u003c/div\u003e","schema":{"title":{"pos":1,"type":"text"},"intro":{"pos":2,"type":"text"},"image":{"pos":3,"type":"image"}}}}'
form: {}
headers: {}
url: https://mapi.storyblok.com/v1/spaces/233252/components/
Expand All @@ -23,15 +23,15 @@ interactions:
proto_minor: 0
transfer_encoding: []
trailer: {}
content_length: 460
content_length: 569
uncompressed: false
body: '{"component":{"name":"test-banner","display_name":null,"created_at":"2023-08-29T14:15:36.723Z","updated_at":"2023-08-29T14:15:36.723Z","id":4493215,"schema":{"title":{"pos":1,"type":"text"},"intro":{"pos":2,"type":"text"},"image":{"pos":3,"type":"image"}},"image":null,"preview_field":null,"is_root":false,"preview_tmpl":null,"is_nestable":false,"all_presets":[],"preset_id":null,"real_name":"test-banner","component_group_uuid":null,"color":null,"icon":null}}'
body: '{"component":{"name":"test-banner","display_name":null,"created_at":"2024-04-19T07:48:23.688Z","updated_at":"2024-04-19T07:48:23.688Z","id":5678041,"schema":{"title":{"pos":1,"type":"text"},"intro":{"pos":2,"type":"text"},"image":{"pos":3,"type":"image"}},"image":null,"preview_field":null,"is_root":false,"preview_tmpl":"\u003cdiv\u003e\u003c/div\u003e","is_nestable":false,"all_presets":[],"preset_id":null,"real_name":"test-banner","component_group_uuid":null,"color":null,"icon":null,"internal_tags_list":[],"internal_tag_ids":[],"content_type_asset_preview":null}}'
headers:
Content-Type:
- application/json; charset=utf-8
status: 201 Created
code: 201
duration: 124.191708ms
duration: 148.817321ms
- id: 1
request:
proto: HTTP/1.1
Expand All @@ -46,23 +46,23 @@ interactions:
body: ""
form: {}
headers: {}
url: https://mapi.storyblok.com/v1/spaces/233252/components/4493215
url: https://mapi.storyblok.com/v1/spaces/233252/components/5678041
method: GET
response:
proto: HTTP/2.0
proto_major: 2
proto_minor: 0
transfer_encoding: []
trailer: {}
content_length: 460
content_length: 569
uncompressed: false
body: '{"component":{"name":"test-banner","display_name":null,"created_at":"2023-08-29T14:15:36.723Z","updated_at":"2023-08-29T14:15:36.723Z","id":4493215,"schema":{"title":{"pos":1,"type":"text"},"intro":{"pos":2,"type":"text"},"image":{"pos":3,"type":"image"}},"image":null,"preview_field":null,"is_root":false,"preview_tmpl":null,"is_nestable":false,"all_presets":[],"preset_id":null,"real_name":"test-banner","component_group_uuid":null,"color":null,"icon":null}}'
body: '{"component":{"name":"test-banner","display_name":null,"created_at":"2024-04-19T07:48:23.688Z","updated_at":"2024-04-19T07:48:23.688Z","id":5678041,"schema":{"title":{"pos":1,"type":"text"},"intro":{"pos":2,"type":"text"},"image":{"pos":3,"type":"image"}},"image":null,"preview_field":null,"is_root":false,"preview_tmpl":"\u003cdiv\u003e\u003c/div\u003e","is_nestable":false,"all_presets":[],"preset_id":null,"real_name":"test-banner","component_group_uuid":null,"color":null,"icon":null,"internal_tags_list":[],"internal_tag_ids":[],"content_type_asset_preview":null}}'
headers:
Content-Type:
- application/json; charset=utf-8
status: 200 OK
code: 200
duration: 53.005124ms
duration: 48.717671ms
- id: 2
request:
proto: HTTP/1.1
Expand All @@ -77,54 +77,54 @@ interactions:
body: ""
form: {}
headers: {}
url: https://mapi.storyblok.com/v1/spaces/233252/components/4493215
url: https://mapi.storyblok.com/v1/spaces/233252/components/5678041
method: GET
response:
proto: HTTP/2.0
proto_major: 2
proto_minor: 0
transfer_encoding: []
trailer: {}
content_length: 460
content_length: 569
uncompressed: false
body: '{"component":{"name":"test-banner","display_name":null,"created_at":"2023-08-29T14:15:36.723Z","updated_at":"2023-08-29T14:15:36.723Z","id":4493215,"schema":{"title":{"pos":1,"type":"text"},"intro":{"pos":2,"type":"text"},"image":{"pos":3,"type":"image"}},"image":null,"preview_field":null,"is_root":false,"preview_tmpl":null,"is_nestable":false,"all_presets":[],"preset_id":null,"real_name":"test-banner","component_group_uuid":null,"color":null,"icon":null}}'
body: '{"component":{"name":"test-banner","display_name":null,"created_at":"2024-04-19T07:48:23.688Z","updated_at":"2024-04-19T07:48:23.688Z","id":5678041,"schema":{"title":{"pos":1,"type":"text"},"intro":{"pos":2,"type":"text"},"image":{"pos":3,"type":"image"}},"image":null,"preview_field":null,"is_root":false,"preview_tmpl":"\u003cdiv\u003e\u003c/div\u003e","is_nestable":false,"all_presets":[],"preset_id":null,"real_name":"test-banner","component_group_uuid":null,"color":null,"icon":null,"internal_tags_list":[],"internal_tag_ids":[],"content_type_asset_preview":null}}'
headers:
Content-Type:
- application/json; charset=utf-8
status: 200 OK
code: 200
duration: 58.951484ms
duration: 49.537143ms
- id: 3
request:
proto: HTTP/1.1
proto_major: 1
proto_minor: 1
content_length: 151
content_length: 171
transfer_encoding: []
trailer: {}
host: mapi.storyblok.com
remote_addr: ""
request_uri: ""
body: '{"component":{"is_nestable":false,"is_root":false,"name":"new-test-banner","schema":{"intro":{"pos":1,"type":"text"},"title":{"pos":2,"type":"text"}}}}'
body: '{"component":{"is_nestable":false,"is_root":false,"name":"new-test-banner","preview_tmpl":null,"schema":{"intro":{"pos":1,"type":"text"},"title":{"pos":2,"type":"text"}}}}'
form: {}
headers: {}
url: https://mapi.storyblok.com/v1/spaces/233252/components/4493215
url: https://mapi.storyblok.com/v1/spaces/233252/components/5678041
method: PUT
response:
proto: HTTP/2.0
proto_major: 2
proto_minor: 0
transfer_encoding: []
trailer: {}
content_length: 435
content_length: 515
uncompressed: false
body: '{"component":{"name":"new-test-banner","display_name":null,"created_at":"2023-08-29T14:15:36.723Z","updated_at":"2023-08-29T14:15:37.307Z","id":4493215,"schema":{"intro":{"pos":1,"type":"text"},"title":{"pos":2,"type":"text"}},"image":null,"preview_field":null,"is_root":false,"preview_tmpl":null,"is_nestable":false,"all_presets":[],"preset_id":null,"real_name":"new-test-banner","component_group_uuid":null,"color":null,"icon":null}}'
body: '{"component":{"name":"new-test-banner","display_name":null,"created_at":"2024-04-19T07:48:23.688Z","updated_at":"2024-04-19T07:48:24.442Z","id":5678041,"schema":{"intro":{"pos":1,"type":"text"},"title":{"pos":2,"type":"text"}},"image":null,"preview_field":null,"is_root":false,"preview_tmpl":null,"is_nestable":false,"all_presets":[],"preset_id":null,"real_name":"new-test-banner","component_group_uuid":null,"color":null,"icon":null,"internal_tags_list":[],"internal_tag_ids":[],"content_type_asset_preview":null}}'
headers:
Content-Type:
- application/json; charset=utf-8
status: 200 OK
code: 200
duration: 82.907847ms
duration: 84.046017ms
- id: 4
request:
proto: HTTP/1.1
Expand All @@ -139,23 +139,23 @@ interactions:
body: ""
form: {}
headers: {}
url: https://mapi.storyblok.com/v1/spaces/233252/components/4493215
url: https://mapi.storyblok.com/v1/spaces/233252/components/5678041
method: GET
response:
proto: HTTP/2.0
proto_major: 2
proto_minor: 0
transfer_encoding: []
trailer: {}
content_length: 435
content_length: 515
uncompressed: false
body: '{"component":{"name":"new-test-banner","display_name":null,"created_at":"2023-08-29T14:15:36.723Z","updated_at":"2023-08-29T14:15:37.307Z","id":4493215,"schema":{"intro":{"pos":1,"type":"text"},"title":{"pos":2,"type":"text"}},"image":null,"preview_field":null,"is_root":false,"preview_tmpl":null,"is_nestable":false,"all_presets":[],"preset_id":null,"real_name":"new-test-banner","component_group_uuid":null,"color":null,"icon":null}}'
body: '{"component":{"name":"new-test-banner","display_name":null,"created_at":"2024-04-19T07:48:23.688Z","updated_at":"2024-04-19T07:48:24.442Z","id":5678041,"schema":{"intro":{"pos":1,"type":"text"},"title":{"pos":2,"type":"text"}},"image":null,"preview_field":null,"is_root":false,"preview_tmpl":null,"is_nestable":false,"all_presets":[],"preset_id":null,"real_name":"new-test-banner","component_group_uuid":null,"color":null,"icon":null,"internal_tags_list":[],"internal_tag_ids":[],"content_type_asset_preview":null}}'
headers:
Content-Type:
- application/json; charset=utf-8
status: 200 OK
code: 200
duration: 54.202081ms
duration: 80.854674ms
- id: 5
request:
proto: HTTP/1.1
Expand All @@ -170,20 +170,20 @@ interactions:
body: ""
form: {}
headers: {}
url: https://mapi.storyblok.com/v1/spaces/233252/components/4493215
url: https://mapi.storyblok.com/v1/spaces/233252/components/5678041
method: DELETE
response:
proto: HTTP/2.0
proto_major: 2
proto_minor: 0
transfer_encoding: []
trailer: {}
content_length: 435
content_length: 515
uncompressed: false
body: '{"component":{"name":"new-test-banner","display_name":null,"created_at":"2023-08-29T14:15:36.723Z","updated_at":"2023-08-29T14:15:37.307Z","id":4493215,"schema":{"intro":{"pos":1,"type":"text"},"title":{"pos":2,"type":"text"}},"image":null,"preview_field":null,"is_root":false,"preview_tmpl":null,"is_nestable":false,"all_presets":[],"preset_id":null,"real_name":"new-test-banner","component_group_uuid":null,"color":null,"icon":null}}'
body: '{"component":{"name":"new-test-banner","display_name":null,"created_at":"2024-04-19T07:48:23.688Z","updated_at":"2024-04-19T07:48:24.442Z","id":5678041,"schema":{"intro":{"pos":1,"type":"text"},"title":{"pos":2,"type":"text"}},"image":null,"preview_field":null,"is_root":false,"preview_tmpl":null,"is_nestable":false,"all_presets":[],"preset_id":null,"real_name":"new-test-banner","component_group_uuid":null,"color":null,"icon":null,"internal_tags_list":[],"internal_tag_ids":[],"content_type_asset_preview":null}}'
headers:
Content-Type:
- application/json; charset=utf-8
status: 200 OK
code: 200
duration: 82.652449ms
duration: 89.156546ms
1 change: 1 addition & 0 deletions internal/component_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func testComponentConfig(identifier string, spaceId int) string {
position = 3
}
}
preview_tmpl = "<div></div>"
}
`, map[string]any{
"identifier": identifier,
Expand Down

0 comments on commit dc6f949

Please sign in to comment.