-
Notifications
You must be signed in to change notification settings - Fork 25
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
to_dict
breaks when a type is aliased and alias=True
#338
Comments
Another test that breaks for test_to_dict: (
StructType(
fields=[
StringType(
name="primary_phone",
alias="build.recap.Phone",
bytes_=10,
),
UnionType(
name="secondary_phone",
types=[
NullType(),
ProxyType(
alias="build.recap.Phone",
registry=RecapTypeRegistry(),
),
],
default=None,
),
],
),
{
"type": "struct",
"fields": [
{
"type": "string",
"bytes": 10,
"name": "primary_phone",
"alias": "build.recap.Phone",
},
{
"type": "build.recap.Phone",
"name": "secondary_phone",
"optional": True,
},
],
},
True,
True,
), |
criccomini
added a commit
that referenced
this issue
Jul 29, 2023
The current Recap null-field handling is a bit cumbersome. I discussed with @gwukelic, @adrianisk, and @cpard. We decided to add support for an `optional` field to the CST. This will allow us to specify that a field is optional. See the conversation here: #335 Users can now specify an optional field as: ```yaml type: struct fields: - name: secondary_phone type: string32 optional: true ``` This will get treated the same as: ```yaml type: struct fields: - name: secondary_phone type: "union", types: ["null", "string32"], default: null ``` I will update the Recap spec accordingly, as well. Closes #335, #338 a
criccomini
added a commit
that referenced
this issue
Jul 29, 2023
The current Recap null-field handling is a bit cumbersome. I discussed with @gwukelic, @adrianisk, and @cpard. We decided to add support for an `optional` field to the CST. This will allow us to specify that a field is optional. See the conversation here: #335 Users can now specify an optional field as: ```yaml type: struct fields: - name: secondary_phone type: string32 optional: true ``` This will get treated the same as: ```yaml type: struct fields: - name: secondary_phone type: "union", types: ["null", "string32"], default: null ``` I will update the Recap spec accordingly, as well. Closes #335, #338
criccomini
added a commit
that referenced
this issue
Jul 30, 2023
The current Recap null-field handling is a bit cumbersome. I discussed with @gwukelic, @adrianisk, and @cpard. We decided to add support for an `optional` field to the CST. This will allow us to specify that a field is optional. See the conversation here: #335 Users can now specify an optional field as: ```yaml type: struct fields: - name: secondary_phone type: string32 optional: true ``` This will get treated the same as: ```yaml type: struct fields: - name: secondary_phone type: "union", types: ["null", "string32"], default: null ``` I will update the Recap spec accordingly, as well. Closes #335, #338
Closed by #340 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Adding this param to the
test_to_dict
test"Fails with:
I'm pretty sure it's because the UnionType is being added to the RecapTypeRegistry in from_dict (via alias_dict) while iteration is occurring.
The text was updated successfully, but these errors were encountered: