Skip to content

example-loading

Id
@azure-tools/typespec-client-generator-core/example-loading

Severity: warning

This diagnostic is issued when TCGC skips loading examples because the examples directory cannot be read, an example file cannot be parsed, or required operationId or title metadata is missing.

  • Area: Example and sample loading. Generation continues without the affected example files, so generated samples or example-based tests may be incomplete.
  • Not affected: SDK clients, models, and service protocol metadata are still generated from TypeSpec.

TCGC reports:

Skipped loading invalid example file: get.json. Error: Unexpected token

Fix the JSON syntax or contents of the example file so it can be parsed.

TCGC reports:

Skipping example loading from ./examples because there was an error reading the directory.

Create the configured examples directory, correct the examples-dir option, or omit the option when examples are not available.

TCGC reports:

Skipping example file get.json because it does not contain an operationId and/or title.

Add both operationId and title to the example JSON file.

This diagnostic should not be suppressed. Fix the example directory/files so they can be loaded, including valid JSON with operationId and title.