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

swagger generation with --with-context result in compiles error #1684

Closed
etsangsplk opened this issue Sep 6, 2018 · 3 comments · Fixed by #1806
Closed

swagger generation with --with-context result in compiles error #1684

etsangsplk opened this issue Sep 6, 2018 · 3 comments · Fixed by #1806

Comments

@etsangsplk
Copy link
Contributor

etsangsplk commented Sep 6, 2018

Problem statement

RE generate the code for example custom-server with context results in compilation error.
There is missing returned http.Request for generated code and missing Authorizer method.

Compilation Error:

github.com/go-swagger/go-swagger/examples/tutorials/custom-server/gen/restapi/operations

examples/tutorials/custom-server/gen/restapi/operations/get_greeting.go:43:12: assignment mismatch: 2 variables but 3 values
examples/tutorials/custom-server/gen/restapi/operations/greeter_api.go:190:46: cannot use o (type *GreeterAPI) as type middleware.RoutableAPI in argument to middleware.NewRoutableContext:
*GreeterAPI does not implement middleware.RoutableAPI (missing Authorizer method)
Please remove the sections that don't apply

Even after manually fixing that, following error
examples/tutorials/custom-server/cmd/greeter/main.go:39:60: cannot convert func literal (type func(operations.GetGreetingParams) middleware.Responder) to type operations.GetGreetingHandlerFunc

Swagger specification

Just using the custom-server in example
https://github.com/go-swagger/go-swagger/blob/master/examples/tutorials/custom-server/swagger/swagger.yml

Steps to reproduce

server:
rm -rf gen && swagger generate server --exclude-main -A greeter -t gen -f ./swagger/swagger.yml --with-context
client:
swagger generate client -A greeter -t gen -f ./swagger/swagger.yml

Environment

swagger version: dev
go version: go1.10.2 darwin/amd64
OS:
macOS

@huikang
Copy link
Contributor

huikang commented Sep 12, 2018

Looks like some mismatch from vendor packages

@etsangsplk
Copy link
Contributor Author

@ huikang dep ensure was run and vendor dir was deleted

@casualjim
Copy link
Member

--with-context has no actual effect we should remove the option

fredbi added a commit to fredbi/go-swagger that referenced this issue Nov 18, 2018
The command line flags remains active (older CLI scripts still work),
but the flag is ignored.

Templates are cleaned up from this unsupported variant, including stratoscale.

* fixes go-swagger#1684

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
fredbi added a commit to fredbi/go-swagger that referenced this issue Nov 18, 2018
The command line flags remains active (older CLI scripts still work),
but the flag is ignored.

Templates are cleaned up from this unsupported variant, including stratoscale.

* fixes go-swagger#1684

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
fredbi added a commit to fredbi/go-swagger that referenced this issue Nov 19, 2018
The command line flags remains active (older CLI scripts still work),
but the flag is ignored.

Templates are cleaned up from this unsupported variant, including stratoscale.

* fixes go-swagger#1684

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
fredbi added a commit to fredbi/go-swagger that referenced this issue Nov 19, 2018
The command line flags remains active (older CLI scripts still work),
but the flag is ignored.

Templates are cleaned up from this unsupported variant, including stratoscale.

* fixes go-swagger#1684

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
@fredbi fredbi self-assigned this Nov 20, 2018
fredbi added a commit to fredbi/go-swagger that referenced this issue Nov 22, 2018
The command line flags remains active (older CLI scripts still work),
but the flag is ignored.

Templates are cleaned up from this unsupported variant, including stratoscale.

* fixes go-swagger#1684

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
fredbi added a commit to fredbi/go-swagger that referenced this issue Nov 28, 2018
The command line flags remains active (older CLI scripts still work),
but the flag is ignored.

Templates are cleaned up from this unsupported variant, including stratoscale.

* fixes go-swagger#1684

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
fredbi added a commit to fredbi/go-swagger that referenced this issue Nov 28, 2018
The command line flags remains active (older CLI scripts still work),
but the flag is ignored.

Templates are cleaned up from this unsupported variant, including stratoscale.

* fixes go-swagger#1684

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
fredbi added a commit that referenced this issue Nov 28, 2018
The command line flags remains active (older CLI scripts still work),
but the flag is ignored.

Templates are cleaned up from this unsupported variant, including stratoscale.

* fixes #1684

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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants