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 unable to generate client for specification #2154

Open
infominer75 opened this issue Dec 27, 2019 · 4 comments
Open

swagger unable to generate client for specification #2154

infominer75 opened this issue Dec 27, 2019 · 4 comments

Comments

@infominer75
Copy link

infominer75 commented Dec 27, 2019

Swagger is unable to generate Http client for a swagger 3.0 specification.

I have downloaded the swagger pre-compiled binary. I am trying to generate the API client using the instructions present here:
https://goswagger.io/generate/client.html

The link for requirements details certain dependencies that must be got using go get. However, it is not clear if these are required during the generation process itself.

Requirements link : https://goswagger.io/generate/requirements.html

Swagger specification

Swagger specification can be found here:

https://raw.githubusercontent.com/goharbor/pluggable-scanner-spec/master/api/spec/scanner-adapter-openapi-v1.0.yaml

Steps to reproduce

The below code snippet provides the command executed and the corresponding output

swagger generate client -f https://raw.githubusercontent.com/goharbor/pluggable-scanner-spec/master/api/spec/scanner-adapter-openapi-v1.0.yaml
2019/12/27 11:31:27 validating spec https://raw.githubusercontent.com/goharbor/pluggable-scanner-spec/master/api/spec/scanner-adapter-openapi-v1.0.yaml
The swagger spec at "https://raw.githubusercontent.com/goharbor/pluggable-scanner-spec/master/api/spec/scanner-adapter-openapi-v1.0.yaml" is invalid against swagger specification . see errors :
- .components in body is a forbidden property
- .openapi in body is a forbidden property
- .servers in body is a forbidden property
- "paths./metadata.get.responses.200" must validate one and only one schema (oneOf). Found none valid
- paths./metadata.get.responses.200.content in body is a forbidden property
- "paths./metadata.get.responses.500" must validate one and only one schema (oneOf). Found none valid
- paths./metadata.get.responses.500.content in body is a forbidden property
- paths./scan.post.requestBody in body is a forbidden property
- "paths./scan.post.responses.400" must validate one and only one schema (oneOf). Found none valid
- paths./scan.post.responses.400.content in body is a forbidden property
- "paths./scan.post.responses.422" must validate one and only one schema (oneOf). Found none valid
- paths./scan.post.responses.422.content in body is a forbidden property
- "paths./scan.post.responses.500" must validate one and only one schema (oneOf). Found none valid
- paths./scan.post.responses.500.content in body is a forbidden property
- "paths./scan.post.responses.202" must validate one and only one schema (oneOf). Found none valid
- paths./scan.post.responses.202.content in body is a forbidden property
- "paths./scan/{scan_request_id}/report.get.parameters" must validate one and only one schema (oneOf). Found none valid
- paths./scan/{scan_request_id}/report.get.parameters.style in body is a forbidden property
- paths./scan/{scan_request_id}/report.get.parameters.explode in body is a forbidden property
- paths./scan/{scan_request_id}/report.get.parameters.in in body should be one of [body]
- paths./scan/{scan_request_id}/report.get.parameters.example in body is a forbidden property
- "paths./scan/{scan_request_id}/report.get.responses.500" must validate one and only one schema (oneOf). Found none valid
- paths./scan/{scan_request_id}/report.get.responses.500.content in body is a forbidden property
- "paths./scan/{scan_request_id}/report.get.responses.200" must validate one and only one schema (oneOf). Found none valid
- paths./scan/{scan_request_id}/report.get.responses.200.content in body is a forbidden property
- "paths./scan/{scan_request_id}/report.get.responses.302" must validate one and only one schema (oneOf). Found none valid
- paths./scan/{scan_request_id}/report.get.responses.302.headers.Refresh-After.schema in body is a forbidden property
- paths./scan/{scan_request_id}/report.get.responses.302.headers.Refresh-After.type in body is required
- .swagger in body is required

Environment

version: v0.21.0
commit: 7c0fc3ee340f9d99d85573bc54a57e303a639692
chaitra@ALPHA-CENTAURI:/tmp/swaggersample$ go version
go version go1.13.1 linux/amd64
chaitra@ALPHA-CENTAURI:/tmp/swaggersample$ 

OS:   Ubtuntu 18.04```
@fredbi
Copy link
Contributor

fredbi commented Dec 27, 2019

go-swagger currently only supports Openapi v2.0

@ghost
Copy link

ghost commented Jan 12, 2021

@fredbi love this tool - best of both worlds (api-first, live docs)

This is worth sharing

https://dev.to/derberg/convert-swagger-2-0-to-openapi-3-0-3joj

shows how to convert to OAS 3.0 using another tool. That worked like a charm for my project. ;-)

@yu-iskw
Copy link

yu-iskw commented Jan 19, 2023

I have a similar issue with OpenAPI 3.0.1. Does go-swagger still support only OpenAPI 2.0?

@casualjim
Copy link
Member

yes. we have no plans to support openapi 3.0

@go-swagger go-swagger locked and limited conversation to collaborators Jan 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants