datamodel-code-generator icon indicating copy to clipboard operation
datamodel-code-generator copied to clipboard

More flexible "Modular Schema" support (problems with versioned types)

Open ndevenish opened this issue 2 years ago • 0 comments

It looks like https://github.com/koxudaxi/datamodel-code-generator/pull/66 made schema type names automatically split into "modular" schemas based on . in the type name.

The SLURM scheduler API schema has schema names per-version like "v0.0.39_jobs_response"[^1]

This ends up in a v0/field_0.py Field36JobsResponse class name.

Describe the solution you'd like Some way to disable (or customise e.g. the splitting regex) the "modular schema" feature

Describe alternatives you've considered At the moment I'm preprocessing the openapi json with sed -Ee 's/v0.0.([[:digit:]]+)_/v00\1./'. This is a little fragile and so ideally this wouldn't be necessary.

Additional context I'm regenerating a schema implementation that someone else originally did, but didn't leave instructions for, so am working out what they did before, from scratch.

[^1]: Unfortunately, I don't know a place where the raw OpenAPI schema is publicly available without querying an active deployment

ndevenish avatar Sep 06 '23 10:09 ndevenish