You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@mesos.apache.org by Kevin Klues <kl...@gmail.com> on 2016/02/04 21:39:37 UTC

Review Request 43217: Added ability to return the /help endpoint as a JSON object.

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/43217/
-----------------------------------------------------------

Review request for mesos, Ben Mahler, Greg Mann, and Neil Conway.


Bugs: MESOS-3831
    https://issues.apache.org/jira/browse/MESOS-3831


Repository: mesos


Description
-------

Previously, the /help endpoint could only be returned as either pure
markdown or html.

This commit introduces a query parameter: format=json to allow the
help endpoint to return a JSON object containing the help information
for all other endpoints.


Diffs
-----

  3rdparty/libprocess/src/help.cpp 2f718b9e160113518fb4a0260db916cb2242dbae 

Diff: https://reviews.apache.org/r/43217/diff/


Testing
-------


Thanks,

Kevin Klues


Re: Review Request 43217: Added ability to return the /help endpoint as a JSON object.

Posted by Ben Mahler <be...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/43217/#review117961
-----------------------------------------------------------


Fix it, then Ship it!





3rdparty/libprocess/src/help.cpp (line 204)
<https://reviews.apache.org/r/43217/#comment179254>

    Period at the end here?



3rdparty/libprocess/src/help.cpp (lines 206 - 207)
<https://reviews.apache.org/r/43217/#comment179253>

    Looks like we can directly return:
    
    ```
    return http::OK(jsonify(*this));
    ```


- Ben Mahler


On Feb. 5, 2016, 3:23 a.m., Kevin Klues wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/43217/
> -----------------------------------------------------------
> 
> (Updated Feb. 5, 2016, 3:23 a.m.)
> 
> 
> Review request for mesos, Ben Mahler, Greg Mann, and Neil Conway.
> 
> 
> Bugs: MESOS-3831
>     https://issues.apache.org/jira/browse/MESOS-3831
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Previously, the /help endpoint could only be returned as either pure
> markdown or html.
> 
> This commit introduces a query parameter: format=json to allow the
> help endpoint to return a JSON object containing the help information
> for all other endpoints.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/src/help.cpp 2f718b9e160113518fb4a0260db916cb2242dbae 
> 
> Diff: https://reviews.apache.org/r/43217/diff/
> 
> 
> Testing
> -------
> 
> Unit test in a subsequent commit.
> 
> 
> Thanks,
> 
> Kevin Klues
> 
>


Re: Review Request 43217: Added ability to return the /help endpoint as a JSON object.

Posted by Kevin Klues <kl...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/43217/
-----------------------------------------------------------

(Updated Feb. 5, 2016, 3:23 a.m.)


Review request for mesos, Ben Mahler, Greg Mann, and Neil Conway.


Changes
-------

Addressed comments by bmahler.


Bugs: MESOS-3831
    https://issues.apache.org/jira/browse/MESOS-3831


Repository: mesos


Description
-------

Previously, the /help endpoint could only be returned as either pure
markdown or html.

This commit introduces a query parameter: format=json to allow the
help endpoint to return a JSON object containing the help information
for all other endpoints.


Diffs (updated)
-----

  3rdparty/libprocess/src/help.cpp 2f718b9e160113518fb4a0260db916cb2242dbae 

Diff: https://reviews.apache.org/r/43217/diff/


Testing (updated)
-------

Unit test in a subsequent commit.


Thanks,

Kevin Klues


Re: Review Request 43217: Added ability to return the /help endpoint as a JSON object.

Posted by Ben Mahler <be...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/43217/#review117934
-----------------------------------------------------------




3rdparty/libprocess/src/help.cpp (lines 187 - 188)
<https://reviews.apache.org/r/43217/#comment179232>

    You should be able to use the (Option<T>, T) equality operator to just do the following:
    
    ```
    if (request.url.query.get("format") == "json") {
    ```
    
    Although we probably have to do the following because of the string literal:
    
    ```
    if (request.url.query.get("format") == Some("json")) {
    ```



3rdparty/libprocess/src/help.cpp (lines 189 - 191)
<https://reviews.apache.org/r/43217/#comment179234>

    This should be setting the content type already:
    
    ```
    return http::OK(jsonify(*this));
    ```


- Ben Mahler


On Feb. 4, 2016, 8:39 p.m., Kevin Klues wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/43217/
> -----------------------------------------------------------
> 
> (Updated Feb. 4, 2016, 8:39 p.m.)
> 
> 
> Review request for mesos, Ben Mahler, Greg Mann, and Neil Conway.
> 
> 
> Bugs: MESOS-3831
>     https://issues.apache.org/jira/browse/MESOS-3831
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Previously, the /help endpoint could only be returned as either pure
> markdown or html.
> 
> This commit introduces a query parameter: format=json to allow the
> help endpoint to return a JSON object containing the help information
> for all other endpoints.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/src/help.cpp 2f718b9e160113518fb4a0260db916cb2242dbae 
> 
> Diff: https://reviews.apache.org/r/43217/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Kevin Klues
> 
>


Re: Review Request 43217: Added ability to return the /help endpoint as a JSON object.

Posted by Ben Mahler <be...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/43217/#review117938
-----------------------------------------------------------




3rdparty/libprocess/src/help.cpp (lines 185 - 192)
<https://reviews.apache.org/r/43217/#comment179235>

    Can you add a comment here for posterity, given that we discussed this quite a bit:
    
    ```
    // NOTE: We avoided relying on the 'Accept' header to
    // specify the format because if users are hitting the
    // endpoint from a browser it is difficult to change
    // the 'Accept' header.
    ```


- Ben Mahler


On Feb. 4, 2016, 8:39 p.m., Kevin Klues wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/43217/
> -----------------------------------------------------------
> 
> (Updated Feb. 4, 2016, 8:39 p.m.)
> 
> 
> Review request for mesos, Ben Mahler, Greg Mann, and Neil Conway.
> 
> 
> Bugs: MESOS-3831
>     https://issues.apache.org/jira/browse/MESOS-3831
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Previously, the /help endpoint could only be returned as either pure
> markdown or html.
> 
> This commit introduces a query parameter: format=json to allow the
> help endpoint to return a JSON object containing the help information
> for all other endpoints.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/src/help.cpp 2f718b9e160113518fb4a0260db916cb2242dbae 
> 
> Diff: https://reviews.apache.org/r/43217/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Kevin Klues
> 
>