anz-bank / sysl-go

Communication library used by SYSL-generated code written in Go.
Apache License 2.0
10 stars 14 forks source link

<critical> path var in endpoint does not get added to the client interface name, causes duplicate func names #110

Closed ghost closed 4 years ago

ghost commented 4 years ago

sysl:

/orders/states:
        GET ?q=string?:
            | No description.
            return error
            return ok
/orders/{id<:int64}/states:
        GET ?q=string?&limit=int32?&offset=int32?:
            | No description.
            return error
            return ok <: OrderStateDto

Both of these endpoints generates a func named GetOrdersStatesList(ctx context.Context, req *GetOrdersStatesListRequest), and both have the same named req type (which is also generated twice, once for each with different fields).

I think the required fix is that the second endpoint should take the path var names into account when naming, so something like GetOrdersIdStatesList(...) (which yeah, looks ugly but will have to do)

anzdaddy commented 4 years ago

Any solution to this needs to be opt-in. The example API is badly designed, and we shouldn't make every single API wear the cost of this.

ghost commented 4 years ago

Agreed, happy to add an attribute to the endpoint to work around this