•  
      request #35849 Focus the /api/frs_packages/{id}/frs_release to the collection
    Infos
    #35849
    Guilhem Bonnefille (CS) (gbonnefille)
    2024-01-18 17:55
    2024-01-15 10:58
    37451
    Details
    Focus the /api/frs_packages/{id}/frs_release to the collection

    The /api/frs_packages/{id}/frs_release returns a single "collection" struct containing a "files" attribute hosting the collection. Test with https://tuleap.net/api/frs_packages/1/frs_release.

    What is the reason of this structure?

    Returning directly the collection, as a JSON array, would simplify the processing of this result. Furthemore, most of the API endpoints returning a collection return directly the collection.

    API
    15.2
    Empty
    • [ ] enhancement
    • [ ] internal improvement
    Empty
    Stage
    Empty
    New
    Empty
    Attachments
    Empty
    References
    References list is empty

    Follow-ups

    User avatar

    It's possible to create a v2 however, as of today the route will not appear in the API explorer so it's not very helpful for end users.

    User avatar

    Alternatively, is it possible to create new endpoints in a V2 namespace? Of course, here, I can rename the endpoint, but for some other example it is not possible to rename the endpoint. Creating a new endpoint with the same name but in V2 namespace could help a lot.

    User avatar

    It's always possible to create new endpoints that brings this consistency.

    Current endpoints will not be changed.

    User avatar

    I understand the motivations but:

    • "in case of" is not really agile proof ;-)
    • the current behavior is not consistent with other collection related endpoints.

    If it is really impossible to evolve the API, what about creating a new endpoint returning the raw collection? Something like /api/frs_packages/{id}/releases? Not the plural and the remove of frs_ prefix like /api/frs_release/{id}/files.


    • Summary
      -Focus the /api/frs_packages/{id}/frs_release the the collection 
      +Focus the /api/frs_packages/{id}/frs_release to the collection 
    User avatar

    Back in time we thought that returning a object that contains the collection was a good idea because it's more "future proof" as we can add fields to the object while the array is there forever. This could be useful if we decide to return "something else".

    We cannot change this representation as it would be a breaking change on the API.