mikekonan / go-oas3

Open API v3 server code generator
MIT License
20 stars 9 forks source link

Redeclared headers struct #8

Closed sergeydobrodey closed 3 years ago

sergeydobrodey commented 3 years ago

In case when response has only headers, but no content, generator output contains redeclared structure

entrypoint/processing/v1/gen/routes_gen.go:2101:6: PutOperationsUUID200Headers redeclared in this block
        previous declaration at entrypoint/processing/v1/gen/routes_gen.go:2092:6
entrypoint/processing/v1/gen/routes_gen.go:2105:44: PutOperationsUUID200Headers.toMap redeclared in this block
        previous declaration at entrypoint/processing/v1/gen/routes_gen.go:2096:6
paths:
  '/operations/{uuid}':
    put:
      responses:
        '200':
          headers:
            x-jws-signature:
              schema:
                type: string
              description: response signature
          description: OK

BTW: generated header name is incorrect XJwsSignature, but should be x-jws-signature

type PutOperationsUUID200Headers struct {
    XJwsSignature string
}

func (headers PutOperationsUUID200Headers) toMap() map[string]string {

    return map[string]string{"XJwsSignature": cast.ToString(headers.XJwsSignature)}
}