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

Added cloud models and appropriate JSON fields to fix #252 #253

Merged
merged 2 commits into from
Nov 7, 2024

Conversation

tsm1th
Copy link
Contributor

@tsm1th tsm1th commented Nov 7, 2024

Fixes bug where json fields would not be collected from the response for new cloud models. Closes #252.

Issue arises from this block of code. If class does not have the _json_field attribute set to True, then it's skipped.

for k, v in values.items():
if isinstance(v, dict):
lookup = getattr(self.__class__, k, None)
if k in ["custom_fields", "local_context_data"] or hasattr(lookup, "_json_field"):
self._add_cache((k, v.copy()))
setattr(self, k, v)
continue
if lookup:

@joewesch
Copy link
Contributor

joewesch commented Nov 7, 2024

Any tests you can add that would have failed before the change (TDD)?

@tsm1th
Copy link
Contributor Author

tsm1th commented Nov 7, 2024

@joewesch - Added test and confirmed they failed prior to these changes.

@joewesch joewesch merged commit e277210 into nautobot:develop Nov 7, 2024
27 checks passed
@tsm1th tsm1th deleted the u/tsm1th-fix-cloud-models branch November 26, 2024 09:49
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 this pull request may close these issues.

Cloud models are not returning json fields
2 participants