Repository navigation
Python error in generated models.py code #88
Copy link
Copy link
Closed
Description
Activity
Here's my resource definition.
{ "typeName": "Nextdoor::SendGrid::Domain", "description": "Wrapper for /whitelabel/domains, see https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html", "sourceUrl": "https://github.com/aws-cloudformation/aws-cloudformation-rpdk.git", "definitions": { "DnsEntry": { "type": "object", "properties": { "Name": { "description": "Name for needed dns entry, e.g. 'mail_cname', 'dkim1'", "type": "string" }, "Valid": { "description": "Has entry been validated?", "type": "string" }, "Type": { "description": "cname, etc", "type": "string", "pattern": "^(cname|mx|txt)$" }, "Host": { "description": "dns record host", "type": "string" }, "Data": { "description": "dns record content", "type": "string" } } } }, "properties": { "SubuserName": { "description": "Subuser Name", "type": "string", "pattern": "^test-mikemccabe-test$", "$comment": "^(is|rs|hs|ms)-[a-z]{2}-[a-z]{8}$" }, "Domain": { "description": "Domain", "type": "string", "pattern": "^[a-z]\\.[a-z]+$" }, "Subdomain": { "description": "Subdomain", "type": "string", "pattern": "^[a-z]+$" }, "Id": { "type": "string" }, "Valid": { "type": "string" }, "Dns": { "type": "array", "items": { "$ref": "#/definitions/DnsEntry" } } }, "required": [ "SubuserName", "Domain", "Subdomain" ], "readOnlyProperties": [ "/properties/Id", "/properties/Valid", "/properties/Dns" ], "primaryIdentifier": [ "/properties/Id" ], "handlers": { "create": { "permissions": [""] }, "read": { "permissions": [""] }, "delete": { "permissions": [""] }, "list": { "permissions": [""] } }, "additionalProperties": false }@mikemccabe Looks like this might have been duplicated in #96 and fixed in #98.
@ammokhov Looks like a duplicate. I think we can close this issue.
Reacted by Anton Mokhovikov
Metadata
Metadata
Assignees
Labels
No labels
Hi, I'm pretty sure this is a regression, as it started for me recently after I installed the latest version of this library.
The generated models.py for my resource includes this method:
The issue here is that the last reference to
Dnsrefers to a name that's not in scope (as I believe it's an instance variable?) leading to a NameErrorI was able to patch this and get my tests to pass by replacing
DnswithDnsEntry(None, None, None, None, None). (Just using None didn't work, as it led to an error on a missing _deserialize method.)Obviously this won't work for the long term, as models.py is generated.