Open zhao004 opened 5 months ago
可能是编码问题,中文默认系统编码是gbk,而你的json可能是utf-8。你可以尝试以gbk保存后再试。 It might be a problem with file encoding. The datamodel-codegen loads your json file with the system default encoding (GBK in simplified chinese env) and it failed. Try save it with GBK encoding and run the code-gen command again.
I had the same problem with my json files (and docs from mongo) - I dunno why but somewhere in the code yaml file reader is used and it throws errors when encouters specific unicode. Made a gist with script I use to clean json from those characters and generate pydantic class.
Describe the bug When generating pydantic with jsonData, an error occurred: "Invalid file format"
To Reproduce
Example schema:
Used commandline:
Expected behavior Invalid file format
Version:
Additional context