8000 non-compiling code if an API method contains a parameter named 'result' · Issue #1778 · go-swagger/go-swagger · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
non-compiling code if an API method contains a parameter named 'result' #1778
Closed
@mtfelian

Description

@mtfelian

Problem statement

Compilation of generated code fails if an API method contains a parameter named 'result'.

Swagger specification

  /some/api/path:
    get:
      description: "Something"
      operationId: SomeOperation
      tags: ['sometag']
      produces:
      - application/json
      parameters:
      - {$ref: '#/parameters/page'}
      - {$ref: '#/parameters/pagesize'}
      - name: type
        in: query
        description: some description of type parameter
        type: array
        items:
          type: string
        collectionFormat: csv
      - name: result
        in: query
        description: some description of result parameter
        type: array
        items:
          type: boolean
        collectionFormat: csv

Steps to reproduce

Generate the spec and try to compile the code.

Environment

swagger version: 0.17.2
go version: 1.11.1
OS: Windows 10, Ubuntu 14

Additional

Problem lies in method Build() :

result.Path = golangswaggerpaths.Join(_basePath, _path)
...
result := swag.JoinByFormat(resultIR, "")

	if len(result) > 0 {
		qsv := result[0]
		if qsv != "" {
			qs.Set("result", qsv)
		}
	}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0