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

Invalid JSON when serializing an entity with alerts #1314

Closed
jpeletier opened this issue Aug 19, 2024 · 1 comment
Closed

Invalid JSON when serializing an entity with alerts #1314

jpeletier opened this issue Aug 19, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@jpeletier
Copy link
Contributor

While working on #1215 I noticed invalid JSON generated (duplicate field name) if requesting alerts when serializing an entity.

Describe the bug

A repeated JSON field alerts appears when serializing an entity that has alerts, the first time to indicate there are alerts, the second time to provide an array of alerts:

{
 "name": "e1",
 "alerts": true, // <--- repeated field name
 "components": {
   "flecs.alerts.AlertsActive": {
     "info_count": 0,
     "warning_count": 0,
     "error_count": 2
   },
   "Position": null
 },
 "alerts": [ // <--- repeated field name
   {
     "alert": "position_without_mass.e1_alert_2",
     "message": "e1 has Position but not Mass",
     "severity": "Error"
   },
   {
     "alert": "position_without_velocity.e1_alert_1",
     "message": "e1 has Position but not Velocity",
     "severity": "Error"
   }
 ]
}

To Reproduce
Steps to reproduce the behavior:

See test SerializeEntityToJson_serialize_w_2_alerts in test/meta/src/SerializeEntityToJson.c

Expected behavior

the "alerts": true field perhaps should be renamed to "hasAlerts": true to avoid name collision.

Additional context
Add any other context about the problem here (operating system, hardware, ...).

@jpeletier jpeletier added the bug Something isn't working label Aug 19, 2024
@SanderMertens
Copy link
Owner

Fixed!

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

No branches or pull requests

2 participants