anz-bank / sysl-go

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

Return sequence of ServiceDoc in the downstream creates wrong Go code. #175

Closed springwiz closed 4 years ago

springwiz commented 4 years ago

An endpoint returning a sequence of type defined in the downstream sysl generates wrong go code.

/service-docs:
        GET:
            | Return whole service docs 
            return ok <: sequence of ServiceDoc
            return error <: status

    !type ServiceDoc:
        swagger <: string:
            @json_tag = "swagger"
        openapi <: string:
            @json_tag = "openapi"

    !type Status:
        statusField <: string

generates the following code in the service.go:

// GetServiceDocsList ...
func (s *Client) GetServiceDocsList(ctx context.Context, req *GetServiceDocsListRequest) (*ServiceDoc, error) {
    required := []string{}
    var okResponse ServiceDoc
    ........
    OkServiceDocResponse, ok := result.Response.(*ServiceDoc)
        .........
    return OkServiceDocResponse, nil
    }

A similar issue was fixed in the sysl transforms, this has been found in arrai transforms.