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

Failed to initialize variables in deeper inheritance level #15

Open
patrickelectric opened this issue Jan 18, 2022 · 0 comments · May be fixed by #16
Open

Failed to initialize variables in deeper inheritance level #15

patrickelectric opened this issue Jan 18, 2022 · 0 comments · May be fixed by #16

Comments

@patrickelectric
Copy link

class Class1(pykson.JsonObject):
    variable_1 = pykson.IntegerField(default_value=1)

class Class2(Class1):
    variable_2 = pykson.IntegerField(default_value=2)

class Class3(Class2):
    variable_3 = pykson.IntegerField(default_value=3)

class Class4(Class3):
    variable_4 = pykson.IntegerField(default_value=4)

class_4 = Class4()
print(Pykson().to_json(class_4))

The following code returns:
{"variable_4": 4, "variable_3": 3, "variable_2": null, "variable_1": null}

patrickelectric added a commit to patrickelectric/pykson that referenced this issue Jan 19, 2022
patrickelectric added a commit to patrickelectric/pykson that referenced this issue Jan 19, 2022
patrickelectric added a commit to patrickelectric/pykson that referenced this issue Jan 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant