Page MenuHomeVyOS Platform

Prevent op mode functions from returning bare literals in raw output
Closed, ResolvedPublic


Bare literals like "foo" or null are valid JSON documents, technically. However, all reasonable op mode outputs are either objects or lists. A bare literal is almost certainly caused by a bug or an oversight and is unlikely to be useful for a client.

Op mode functions that return bare literals should cause an internal error to help developers identify such oversights and help users report such issues to developers.


Difficulty level
Unknown (require assessment)
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible
Issue type
Internal change (not visible to end users)

Event Timeline

If the script returns nothing, the raw mode returns "". Is this expected behaviour? Should it not be {}?

@erkin this should not be an issue in practice, I believe: it is true that humps decamelize(None) returns "", however the PR here will reject non dict or list values. In practice, if an op-mode script has no data, it will raise an error, for example, DataUnavailable, or should return, say, {}.