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

Superfluous underscore suffixes 'schema' field name

Open kingtistel opened this issue 1 year ago • 1 comments
trafficstars

Describe the bug From the json schema a property named 'schema' was created as a field named 'schema_'.

To Reproduce

Example schema: https://schema.getpostman.com/json/collection/v2.1.0/collection.json

Used commandline:

$ datamodel-codegen --url https://schema.getpostman.com/json/collection/v2.1.0/collection.json --output-model-type typing.TypedDict --output postman_td.py

and equally:

$ datamodel-codegen --url https://schema.getpostman.com/json/collection/v2.1.0/collection.json --output-model-type dataclasses.dataclass --output postman_dc.py

Expected behavior Expected that the 'Info' class would have a field named 'schema'. Instead it has a field named 'schema_'.

Version:

  • OS: macOS 14.3
  • Python version: 3.11.7
  • datamodel-code-generator version: 0.25.3

Additional context Add any other context about the problem here.

kingtistel avatar Feb 02 '24 14:02 kingtistel

Any resolution? Seeing the same issue

sayansisodiya avatar Mar 28 '25 00:03 sayansisodiya