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

datamodel-codegen isn't creating all models from jsonschema

Open VictorCarlquist opened this issue 3 years ago • 2 comments
trafficstars

The class Model "Docentes" isn't generated by datamodel-codegen

To Reproduce

Example schema:

PastBin JsonSchme

Used commandline:

datamodel-codegen  --input test.json --input-file-type  jsonschema --output model.py

Expected behavior

Convert the "Docentes" jsonschema to python class

Version:

  • OS: Ubuntu 20.04
  • Python version: 3.8.10
  • datamodel-code-generator version: 0.11.15

VictorCarlquist avatar Dec 09 '21 13:12 VictorCarlquist

@VictorCarlquist I'm sorry for my late reply. I just confirmed the problem. I will investigate the problem.

koxudaxi avatar Jan 11 '22 17:01 koxudaxi

Hi @VictorCarlquist I just checked your schema. Your schema has properties and oneOf attributes in the same object. I think we can't represent the way in the pydantic. If you want to pass the oneOf value to the pydantic model then we should use Extra.allow in the pydantic config.

koxudaxi avatar May 20 '22 18:05 koxudaxi