Skip to content

Weaver registry diff: template.set_file_name("schema-diff.yaml") in jinja is ignored when no output dir is provided #762

@lmolkova

Description

@lmolkova

See open-telemetry/semantic-conventions#2307.

It has jinja template with

{{- template.set_file_name("schema-diff.yaml") }}
...

following the same pattern as we have in codegen.

If I run it without -o option:

weaver registry diff -r  ./current --baseline-registry ./baseline --diff-template ./path/to/templates --diff-format yaml

the result is printed to stdout.

If I add -o ./diff then the result is written to ./diff/schema-diff.yaml.

Suggestion:

  • if no output folder was configured, but jinja attempted to set file name, we can default to current folder or fail
  • Use the same output config between codegen templates and diff templates instead of inventing a new one - weaver registry generate does not have -o param and does something else. If we prefer -o, let's do it consistently for both options.
  • There is no need to provide default stdout experience for people coming with custom templates and custom config - assume file output as a default for them, they can always cat the file if they need stdout.

Related to #760 and #761

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Ease of Use

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions