Skip to content

Change in type custom resource type handling #89

Description

@mikemccabe

I recently updated, and my fields in my custom resource stopped working except for 'string'. Maybe I was doing it wrong before?

My schema had a toplevel UserId field of type integer

        "UserId": {
            "type": "integer"
        }

I get the following error running CFN test:

[ERROR] 2020-04-20T06:42:33.702Z        3a99cb01-89c4-1787-deb0-125e4dff798d    Invalid request
Traceback (most recent call last):
  File "/var/task/cloudformation_cli_python_lib/resource.py", line 140, in _parse_test_request
    ).to_modelled(self._model_cls)
  File "/var/task/cloudformation_cli_python_lib/utils.py", line 123, in to_modelled
    desiredResourceState=model_cls._deserialize(self.desiredResourceState),
  File "/var/task/nextdoor_sendgrid_subuser/models.py", line 56, in _deserialize
    recast_object(cls, json_data, dataclasses)
  File "/var/task/cloudformation_cli_python_lib/recast.py", line 29, in recast_object
    raise InvalidRequest(f"Unsupported type: {type(v)} for {k}")
cloudformation_cli_python_lib.exceptions.InvalidRequest: Unsupported type: <class 'int'> for UserId

Switching the schema to string, and casting the (json) UserId with str() when populating the model appears to resolve this. What's going on? We can make do with strings, but it's handy to have types. We ran into the same issue with bools.

Activity

  1. ammokhov commented on Sep 23, 2020

    @ammokhov
    Contributor

    closing as has been fixed by #94

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions