Open johnttompkins opened 5 years ago
Relating to type is string / type keywords, here's the trace for when type is an array of simpleTypes:
[2019-12-09T03:35:45Z] DEBUG - Unhandled exception
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/rpdk/core/cli.py", line 98, in main
args.command(args)
File "/usr/local/lib/python3.7/site-packages/rpdk/core/generate.py", line 15, in generate
project.generate()
File "/usr/local/lib/python3.7/site-packages/rpdk/core/project.py", line 243, in generate
return self._plugin.generate(self)
File "/usr/local/lib/python3.7/site-packages/rpdk/go/codegen.py", line 151, in generate
contents = template.render(models=models)
File "/usr/local/lib/python3.7/site-packages/jinja2/asyncsupport.py", line 76, in render
return original_render(self, *args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/jinja2/environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "/usr/local/lib/python3.7/site-packages/jinja2/environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.7/site-packages/jinja2/_compat.py", line 37, in reraise
raise value.with_traceback(tb)
File "/usr/local/lib/python3.7/site-packages/rpdk/go/templates/types.go.tple", line 18, in top-level template code
{{ name|uppercase_first_letter }} {{ type|translate_type }} `json:"{{ name }},omitempty"`
File "/usr/local/lib/python3.7/site-packages/rpdk/go/resolver.py", line 16, in translate_type
return PRIMITIVE_TYPES[resolved_type.type]
TypeError: unhashable type: 'list'
We should investigate https://pypi.org/project/hypothesis-jsonschema/
update: test resource generation itself was unfortunately mostly abandoned for years (until some regex work in https://github.com/aws-cloudformation/cloudformation-cli/pull/930, https://github.com/aws-cloudformation/cloudformation-cli/issues/939) in favor of developers providing hardcoded property values
The current resource generator in #104 handles simpler cases of resource generation. The below items are necessary to bring the generator to a more operable state that can handle most if not all valid resource definition schemas.
Also, some research needs to be done to see if the flattener and resource generator can be combined in some way. They are both walking the schema in a similar way, so it would be nice to remove duplicate implementations of this to lessen the amount of code to be maintained.