Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModelGenerator fails to generate model with primitive type wrapped in object #330

Closed
genme opened this issue May 25, 2023 · 0 comments · Fixed by #332
Closed

ModelGenerator fails to generate model with primitive type wrapped in object #330

genme opened this issue May 25, 2023 · 0 comments · Fixed by #332

Comments

@genme
Copy link

genme commented May 25, 2023

import json

from dataclasses_avroschema import ModelGenerator

schema = """
{
  "namespace": "Foo.Boo",
  "name": "Zoo",
  "type": "record",
  "fields": [
    {
      "name": "value_a",
      "type": [
        "null", {"type": "string"}
      ]
    },
    {
      "name": "value_b",
      "type": [
        "null",
        "string"
      ]
    }
  ]
}
"""

mg = ModelGenerator()
print(mg.render(schema=json.loads(schema)))

# from dataclasses_avroschema import AvroModel
# import dataclasses
# import typing
#
#
# @dataclasses.dataclass
# class Zoo(AvroModel):
#     value_a: typing.Optional[: str] <------------------------
#     value_b: typing.Optional[str]
#
#     class Meta:
#         namespace = "Foo.Boo"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant