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

Enum is not being generated from JSON Schema from URL

Open coldenol opened this issue 9 months ago • 1 comments

Describe the bug A clear and concise description of what the bug is.

I'm trying to generate models from the skyscanner public JSON schema from here: partnerportal.skyscanner.net where they have enums like this one: image

But instead of enum an empty base class is being created: image

To Reproduce

Example schema: partnerportal.skyscanner.net

Used commandline:

$ datamodel-codegen --url https://partnerportal.skyscanner.net/tr-docs/static/push.schema.flights.v6.json --input-file-type jsonschema --use-subclass-enum --field-include-all-keys --output model.py
$ datamodel-codegen --url https://partnerportal.skyscanner.net/tr-docs/static/push.schema.flights.v6.json --input-file-type jsonschema --output model.py

Expected behavior A clear and concise description of what you expected to happen.

The expected is the correct enum class like this: image

Version:

  • OS: MacOS Sonoma 14.4.1
  • Python version: 3.12
  • datamodel-code-generator version: 0.25.6

coldenol avatar May 15 '24 17:05 coldenol

Seems the following issue is about the same topic #1925

coldenol avatar May 15 '24 17:05 coldenol