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

Models are not generated from OpenAPI 3.0.1

Open ysemennikov opened this issue 1 year ago • 0 comments

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:

  • OS: macOS 14.4 (23E214)
  • Python version: 3.12
  • datamodel-code-generator version: 0.25.7

ysemennikov avatar Jun 16 '24 23:06 ysemennikov