Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicated parentheses #1839

Closed
danikarik opened this issue Dec 20, 2018 · 2 comments · Fixed by #1840
Closed

Duplicated parentheses #1839

danikarik opened this issue Dec 20, 2018 · 2 comments · Fixed by #1840
Assignees
Labels
bug discriminator Related to polymorphic types model Related to swagger generate model command pending PR

Comments

@danikarik
Copy link

Problem statement

Generated code duplicates parentheses on method call. After generation I got errors like:

if swag.IsZero(m.Attachments()()) { // not required
    return nil
}

m.Attachments()() <---- duplicated

Swagger specification

spec

Steps to reproduce

swagger generate client \
    --additional-initialism=SMS \
    --additional-initialism=MMS \
    --additional-initialism=FAX \
    --name=clicksend \
    --spec=https://raw.githubusercontent.com/danikarik/clicksend-go/master/api/swagger.yaml

Environment

swagger version: 0.17.2
go version: 1.11.3
OS: MacOS Mojave

@fredbi fredbi added the bug label Dec 21, 2018
@fredbi fredbi self-assigned this Dec 21, 2018
@fredbi fredbi added model Related to swagger generate model command discriminator Related to polymorphic types labels Dec 21, 2018
@fredbi
Copy link
Contributor

fredbi commented Dec 21, 2018

This is indeed a bug I could reproduce. It occurs with polymorphic types.

fredbi added a commit to fredbi/go-swagger that referenced this issue Dec 21, 2018
…hic type

* fixes go-swagger#1839

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
@fredbi
Copy link
Contributor

fredbi commented Dec 21, 2018

Here is a fix you can fetch right away. This should be soon merged into next release.

fredbi added a commit to fredbi/go-swagger that referenced this issue Dec 21, 2018
…hic type

* fixes go-swagger#1839

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
fredbi added a commit to fredbi/go-swagger that referenced this issue Dec 21, 2018
…hic type

* fixes go-swagger#1839

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug discriminator Related to polymorphic types model Related to swagger generate model command pending PR
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants