You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hop subscribe has a --json option that purports to "Request message output as raw json," but does not actually do anything. This PR causes hop subscribe to serialize the message content as JSON when the option is activated.
This is particularly useful for AvroBlob, which is otherwise not terribly legible.
Checklist
All new functions and classes are documented and adhere to Google doc style (3.8.3-3.8.6 of this document)
Add/update sphinx documentation with any relevant changes.
Add/update pytest-style tests in /tests, ensuring sufficient code coverage.
make test runs without errors.
make lint doesn't give any warnings.
make format doesn't give any code formatting suggestions.
make doc runs without errors and generated docs render correctly.
Check that CI pipeline run on this PR passes all stages.
Review signoff by at least one developer.
NOTE: If this PR relates to a release, open and reference an issue with the Release checklist template.
Unfortunately, the reason this got broken is that it isn't trivial to make it work for all message models (and I forgot to remove the option from the CLI), for a few reasons: Not all message models have a content property (VOEvent, GCNTextNotice, and GCNCircular), and others can contain non-JSON-serializable types (mainly bytes, which affects both Blob and AvroBlob; the content: Union[JSONType, List[JSONType]] type annotation in the latter is alas, not correct, and I need to figure out how to correctly write down the superset of JSON types which actually applies).
This is doable with a little bit more coding, however, if one is willing to make some tradeoffs like base64 encoding bytes so that they can legally be expressed as (rather inefficient) JSON strings.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
hop subscribehas a--jsonoption that purports to "Request message output as raw json," but does not actually do anything. This PR causeshop subscribeto serialize the message content as JSON when the option is activated.This is particularly useful for AvroBlob, which is otherwise not terribly legible.
Checklist
/tests, ensuring sufficient code coverage.make testruns without errors.make lintdoesn't give any warnings.make formatdoesn't give any code formatting suggestions.make docruns without errors and generated docs render correctly.NOTE: If this PR relates to a release, open and reference an issue with the Release checklist template.