• 
      

    Add original URL and mimetype information for expanded resources.

    Review Request #10452 — Created March 19, 2019 and submitted

    Information

    Djblets
    release-2.0.x

    Reviewers

    When expanding objects in an API response, the caller loses out on some
    useful information, such as the original URL to the expanded resource
    and the mimetypes. This causes the caller some extra work if they need
    this information, either making assumptions about URLs/mimetypes or
    performing a second request to get these details.

    This change updates the payment to provide some useful information on
    the expanded information. Payloads that expand resources now have an
    _expanded field that has each expanded field name as a key and
    information as the value.

    If expanding a model (such as from a ForeignKey), this will contain
    an item_mimetype key mapping to the mimetype of the expanded resource.

    If expanding a QuerySet, this will also just contain item_mimetype
    (as there's not necessarily a corresponding list resource that the user
    could otherwise get access to).

    If expanding a child resource, this will contain item_mimetype,
    list_mimetype, and list_url, all of which can be useful for mapping
    the results back to native objects on the client.

    Unit tests pass in both Djblets and Review Board.

    Manually tested this with some resources, making sure I always got the
    results I expected.

    Summary ID
    Add original URL and mimetype information for expanded resources.
    When expanding objects in an API response, the caller loses out on some useful information, such as the original URL to the expanded resource and the mimetypes. This causes the caller some extra work if they need this information, either making assumptions about URLs/mimetypes or performing a second request to get these details. This change updates the payment to provide some useful information on the expanded information. Payloads that expand resources now have an `_expanded` field that has each expanded field name as a key and information as the value. If expanding a model (such as from a `ForeignKey`), this will contain an `item_mimetype` key mapping to the mimetype of the expanded resource. If expanding a `QuerySet`, this will also just contain `item_mimetype` (as there's not necessarily a corresponding list resource that the user could otherwise get access to). If expanding a child resource, this will contain `item_mimetype`, `list_mimetype`, and `list_url`, all of which can be useful for mapping the results back to native objects on the client.
    df2816a669167049f46595fd696896c7f21f448a
    david
    1. Ship It!
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-2.0.x (0cdc624)