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

Kubernetes v1.json generates java client that won't compile. Any type mapping may be missing. #2347

Closed
ieb opened this issue Mar 9, 2016 · 4 comments

Comments

@ieb
Copy link
Contributor

ieb commented Mar 9, 2016

using the latest code from master and doing the following

java -jar swagger-codegen/modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -i testproject/src/main/resources/kubernetes/v1.json -l java -o kubernetes-client
cd kubernetes-client
mvn clean package

results in a few 100 compile errors of the form

[ERROR] /Users/ieb/Adobe/src/granite/kubernetes-client/src/main/java/io/swagger/client/model/V1ObjectMeta.java:[7,30] error: cannot find symbol

V1ObjectMeta.java:[7,30] is

import io.swagger.client.model.Any;

io.swagger.client.model.Any.java was not generated.

Is the type "any" missing from the Java client generator, or is there something else I need to do when generating the client ?

I could not find a duplicate open or closed bug and looking at the current code there does not appear to be a type mapping for "any".

@fehguy
Copy link
Contributor

fehguy commented Mar 9, 2016

Can you please point to the kubernetes json document that you're loading? Looks like it's local to your machine

@wing328
Copy link
Contributor

wing328 commented Mar 10, 2016

@ieb I believe you're using https://github.com/kubernetes/kubernetes/blob/master/api/swagger-spec/v1.json

That's a known issue with Kubernetes: kubernetes/kubernetes#4700.

To workaround the issue, please replace "any" with "object".

Ref: #997

@ieb
Copy link
Contributor Author

ieb commented Mar 10, 2016

@wing328 thank you.
Schema reference was correct. I was using v1.1.8 of Kubernetes.
Workaround (replace "any" with "object") works perfectly with swagger-codegen master and Kubernetes v1.1.8 on both the main api.json and the extensions_v1beta1..json

Thanks for finding the Kubernetes issue, I failed, searching for "Any" generates lots of results.

@ieb ieb closed this as completed Mar 10, 2016
@wing328
Copy link
Contributor

wing328 commented Mar 10, 2016

@ieb no problem. I also suggested in kubernetes/kubernetes#4700 to replace "any" with "object" so that others won't encounter the compilation error moving forward.

k8s-github-robot pushed a commit to kubernetes/kubernetes that referenced this issue Apr 15, 2016
Automatic merge from submit-queue

Updating go-restful to generate "type":"object" instead of "type":"any" in swagger-spec (breaks kubectl 1.1)

Updating go-restful to include emicklei/go-restful#270 (replacing type "any" by type "object". Ref swagger-api/swagger-codegen#2347 on why we want to do that)
Ref #4700 (comment)

First commit generated using:
```
godep restore
go get -u github.com/emicklei/go-restful
godep update github.com/emicklei/go-restful
```

Second commit generated by running 
```
./hack/update-swagger-spec.sh
```

Third commit generated by running:
```
./hack/update-api-reference-docs.sh
```

cc @kubernetes/sig-api-machinery @bgrant0607
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants