in python/rpdk/python/codegen.py [0:0]
def generate(self, project):
LOG.debug("Generate started")
self._init_from_project(project)
models = resolve_models(project.schema)
if project.configuration_schema:
configuration_schema_path = (
project.root / project.configuration_schema_filename
)
project.write_configuration_schema(configuration_schema_path)
configuration_models = resolve_models(
project.configuration_schema, "TypeConfigurationModel"
)
else:
configuration_models = {"TypeConfigurationModel": {}}
models.update(configuration_models)
path = self.package_root / self.package_name / "models.py"
LOG.debug("Writing file: %s", path)
template = self.env.get_template("models.py")
contents = template.render(support_lib_pkg=SUPPORT_LIB_PKG, models=models)
project.overwrite(path, contents)
LOG.debug("Generate complete")