You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/10/11 17:51:02 UTC

[GitHub] [pulsar] lin-zhao commented on issue #17947: PIP-210: Admin API should be able to return messages in human-readable formats.

lin-zhao commented on issue #17947:
URL: https://github.com/apache/pulsar/issues/17947#issuecomment-1275063547

   > > > When we speak about "string" format, we are being too general. You can have a many different string formats after all: Base64, Yaml, JSON, etc. So I think it is a mistake to refer to this as string. Instead I'd recommend explicitly naming the format, and also including an extensible option mechanism like:
   > > > ```
   > > > --format=binary     # default for backwards compatibility
   > > > ```
   > > > 
   > > > 
   > > >     
   > > >       
   > > >     
   > > > 
   > > >       
   > > >     
   > > > 
   > > >     
   > > >   
   > > > ```
   > > > --format=json
   > > > ```
   > > 
   > > 
   > > The actual string format is determined by the schema. Some json, some plain text. They are determined at run time when the new mode is turned on. Perhaps `--format=binary/string`
   > 
   > The (Pulsar) `GenericRecord` has a `SchemaType` and initially, it might make sense to simply stringify all values. However, how should you stringify `JSON`? An escaped JSON string is frustrating to have to deal with from an end user perspective. I'd argue the actual unescaped json node should be returned in that case. I argue a similar point for number and boolean types as well.
   > 
   > I think `--format=json` would neatly encapsulate the varying types, provide a clear format that the end user can expect to receive and user-friendly formatting, already in a useful state for post-processing.
   > 
   > It would also allow `--format=string` as well if that is desirable.
   
   `--format=json` doesn't seem to apply for the API, since the format is determined by the schema at run time.
   
   On escaped string, my vote is not to escape the quotes and return a string that actually conform to JSON format.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org