Skip to content

Choose a tag to compare

@github-actions github-actions released this 24 Jul 15:15
599d5db

Breaking Changes

Default Behavior Changes

  • New warning emitted by default for unresolved local $ref pointers - By default, an unresolved local $ref JSON pointer now emits a new DanglingRefWarning and generates a fallback Any model. Previously such refs resolved to a silent fallback, and some cases (e.g., out-of-range JSON pointer array indices) raised a hard error. Schemas that previously generated cleanly can now produce warnings, which breaks workflows that treat warnings as errors (e.g., python -W error). Use --strict-refs to fail on unresolved pointers instead, or --disable-warnings to silence them (#3639)

Error Handling Changes

  • $ref to a non-dict file now raises InvalidFileFormatError instead of TypeError - Resolving a $ref to a JSON/YAML file whose top-level value is not a mapping (e.g., a list) now raises datamodel_code_generator.InvalidFileFormatError (a subclass of Error/Exception) rather than the built-in TypeError. Programmatic callers that catch TypeError around generate() must catch InvalidFileFormatError (or Error) instead (#3639)
  • Malformed-input diagnostics reworded - Malformed inputs that previously surfaced an uncaught traceback now emit a concise message such as Invalid file format for <type> at <source>: ..., and the missing-file message changed from File not found to File not found: <path>. Tooling that matches on the exact previous strings needs updating (#3639)
  • Generation now aborts when output paths would overwrite inputs or collide - A new path-conflict validation runs before generation in both the generate() Python API and the CLI. Invocations that previously succeeded now raise an Error (CLI exits with an error code) in these cases: the output path resolves to an existing input file, the --emit-model-metadata path resolves to an existing input file, or the output and model-metadata paths resolve to the same file. Symlinks and hardlinks are resolved before the comparison. Workflows that intentionally wrote output over an input path, or that pointed the model-metadata artifact at the same path as the output, will now fail with one of:
Output path must not overwrite an input path: <path>
Model metadata path must not overwrite an input path: <path>
Output and model metadata paths must be different: <path>

(#3647)

What's Changed

Full Changelog: 0.70.0...0.71.0