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

StaticDeviceAttribute Metadata Type #60

Closed
RedingJeff opened this issue Oct 18, 2021 · 1 comment · Fixed by #61
Closed

StaticDeviceAttribute Metadata Type #60

RedingJeff opened this issue Oct 18, 2021 · 1 comment · Fixed by #61
Assignees
Labels
bug Something isn't working

Comments

@RedingJeff
Copy link
Contributor

Describe the bug
Currently the StaticDevice metadata field allows the type Optional[Dict[str, Dict]]. But Fiware only allows a very specific Dict structure. Giving any other structure results in a success in Filip, but an uncatched background error in Fiware.

To Reproduce
Steps to reproduce the behavior:

  1. Create an ContextDevice containing a StaticDeviceAttribute with the metadata: {"meta": { "test": "1" }}
  2. Filip allows this assignment, you can now post the device without error
  3. But if you now look in Fiware, no device or corresponding ContextEntity appeared.

Expected behavior
FiLiP tells you, that the assignment of the metadata was not valid, and stops the execution

Fix
Change the type of the StaticDevice metadata field to a BaseModel modeling the allowed structure. The ContextMetadata and NamedContextMetadata modeld in context.py, can probably be reused for this task. The StaticDeviceAttribute metadata field would then have the same structure and logic as the ContextAttribute metadata field.

@RedingJeff RedingJeff added the bug Something isn't working label Oct 18, 2021
@RedingJeff RedingJeff self-assigned this Oct 18, 2021
@github-actions
Copy link

Branch 60-StaticDeviceAttribute-Metadata-Type created!

@RedingJeff RedingJeff linked a pull request Oct 18, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant