-
Notifications
You must be signed in to change notification settings - Fork 43
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
Simplify PF attr obj shim #2232
base: vvm/add_pf_shim_tests1
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -152,15 +152,10 @@ func TestSchemaShimRepresentations(t *testing.T) { | |
"_": { | ||
"list_attribute": { | ||
"element": { | ||
"schema": { | ||
"element": { | ||
"resource": { | ||
"a1": { | ||
"type": 4 | ||
} | ||
} | ||
}, | ||
"type": 6 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. type=6 is TypeMap I think. This looks like the test was expecting what Elem() describes as "single-nested block encoding" - "In this case s.Type() == TypeMap and s.Elem() is a Resource value." IN the new encoding, this is encoded as TypeList with Elem()=Resource. Elem() doc comment describes that this is an encoding for List-nested block but with this change it also encodes a List attribute. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It the old encoding it is List(Elem(Map(Elem(Resource)))) In the new one it is List(Elem(Resource)) Given that pulumi doesn't care about attribute vs block, we might want to encode list nested blocks and list nested objects the same. Both represent an object in a list as far as pulumi is concerned. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also in the old encoding There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the sdkv2 list nested attributes are also represented the same as list nested blocks: #2242 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Are we 100% sure. I was trying to remember if that's the case, can't find anything just now searching now. There is normalizeBlockCollections but it's scoped to sdkv2 "under" the Shim abstraction. |
||
"resource": { | ||
"a1": { | ||
"type": 4 | ||
} | ||
} | ||
}, | ||
"optional": true, | ||
|
@@ -197,16 +192,11 @@ func TestSchemaShimRepresentations(t *testing.T) { | |
"_": { | ||
"list_nested_attribute": { | ||
"element": { | ||
"schema": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similarly a "single-nested-block-ish" encoding layer is stripped here. |
||
"element": { | ||
"resource": { | ||
"a1": { | ||
"optional": true, | ||
"type": 4 | ||
} | ||
} | ||
}, | ||
"type": 6 | ||
"resource": { | ||
"a1": { | ||
"optional": true, | ||
"type": 4 | ||
} | ||
} | ||
}, | ||
"optional": true, | ||
|
@@ -240,16 +230,11 @@ func TestSchemaShimRepresentations(t *testing.T) { | |
"_": { | ||
"map_nested_attribute": { | ||
"element": { | ||
"schema": { | ||
"element": { | ||
"resource": { | ||
"a1": { | ||
"optional": true, | ||
"type": 4 | ||
} | ||
} | ||
}, | ||
"type": 6 | ||
"resource": { | ||
"a1": { | ||
"optional": true, | ||
"type": 4 | ||
} | ||
} | ||
}, | ||
"type": 6 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assert on next line interestingly said it expects Resource, but the cast is casting to shim.Schema.