datamodel-code-generator
datamodel-code-generator copied to clipboard
Generated python file names contain invalid caharacters
Describe the bug When generating data models from schemas in a directory (owned by another team in my case), the generated file names contain invalid characters, which doesn't allow python to import the module.
To Reproduce
example: INPUT
schemas:
- order-request.schema.json
- cancel-request.schema.json
example: OUTPUT
gen:
- order-request.schema.py
- cancel-request.schema.py
Used commandline:
$ datamodel-codegen --input "../schemas" --input-file-type jsonschema --output "./gen"
Expected behavior The file names to be valid python module names, ex: periods and dash characters to be replaced by underscores.
Version:
- OS: MacOs
- Python version: 3.8
- datamodel-code-generator version: 0.17.1
Additional context Workaround to import the module: https://stackoverflow.com/questions/8350853/how-to-import-module-when-module-name-has-a-dash-or-hyphen-in-it
@pulasthibandara Thank you for creating the issue. I will fix it.
Apologies, closed the wrong issue.