koxudaxi / datamodel-code-generator

Pydantic model and dataclasses.dataclass generator for easy conversion of JSON, OpenAPI, JSON Schema, and YAML data sources.
https://koxudaxi.github.io/datamodel-code-generator/
MIT License
2.44k stars 281 forks source link

Models are not generated from OpenAPI 3.0.1 #2004

Open ysemennikov opened 2 weeks ago

ysemennikov commented 2 weeks ago

Describe the bug I try to generate models from the OpenAPI JSON spec, but only 2 models are being generated (there are much more in the spec).

Generated file:

# generated by datamodel-codegen:
#   filename:  https://auth.devifex.com/api/swagger.json
#   timestamp: 2024-06-16T23:38:53+00:00

from __future__ import annotations

from pydantic import BaseModel, Field, RootModel

class Translation(RootModel[str]):
    root: str

class TranslationObject(BaseModel):
    field_translation_key_: Translation | None = Field(None, alias='[translationKey]')

To Reproduce

Example schema: https://auth.devifex.com/api/swagger.json

Used commandline:

$ datamodel-codegen --input openapi.json \
  --output-model-type pydantic_v2.BaseModel \
  --strict-nullable --snake-case-field --capitalize-enum-members \
  --use-union-operator --use-standard-collections \
  --url https://auth.devifex.com/api/swagger.json

Expected behavior

All models specified in the JSON file must be generated.

Version: