Skip to content

Fail generation when a required template cannot render #695

Open

Description

@clemensv

Observed while validating #694 at ca72b9a plus local producer-template changes.

xrcg generate can log a template rendering exception, omit the corresponding generated file, and still return exit code 0.

Reproducer:

  1. Use a catalog with one CloudEvents message and an Avro payload schema.
  2. Generate --language ts --style producerhttp.
  3. The existing src/types/_index.ts.jinja calls the unavailable stack() function.

The generator logs:

Template Rendering Error in src/types/_index.ts.jinja
jinja2.exceptions.UndefinedError: 'stack' is undefined

Yet assert xrcg.cli() == 0 succeeds. The generation regression that searches other generated sources for a schema URI also passes despite the missing file.

Expected: any failed required template causes a nonzero CLI exit code and an explicit failure result. Incomplete output must not be reported as a successful generation.

The stale TypeScript HTTP type-export template is being corrected in #696 as part of compiling its constructor-override API. This issue concerns propagation of rendering failures, independently of that template.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions