Skip to content

How to deal with out-of-schema logic #151

@nathanjmcdougall

Description

@nathanjmcdougall

Motivation
Some schemas generated by datamodel-codegen allow for non-schema fields to exist. For example, in Bitbucket pipelines, the definitions section is allowed to have any keys.

It's not fully obvious what impact this has on the code, but I suspect it might lead to a case where out-of-schema fields are dropped "for no reason". For example, in some cases our approach to modifications is to reconstruct the full file from scratch, but injecting our new element at a specific location. But if, in our traversal, we miss an out-of-schema component, it would just get dropped.

Summary of desired enhancement
Try and find a test case where this behaviour occurs for the two different schemas (pre-commit and bitbucket pipelines) and try to fix the issue if necessary. The fix might require some design considerations.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions