swagger-codegen icon indicating copy to clipboard operation
swagger-codegen copied to clipboard

Fail to generate code with "no property for v1beta3.Binding, null"

Open madhuri-rai07 opened this issue 11 years ago • 9 comments

I used develop_2.0 swagger-codegen and master Kubernetes v1beta3.json swagger spec. Error which I get: http://paste.openstack.org/show/294675/

madhuri-rai07 avatar Jun 16 '15 02:06 madhuri-rai07

@madhuri-rai07 would be hard to troubleshoot without the json to repeat the issue. Do you mind sharing the json with us ?

wing328 avatar Jun 16 '15 03:06 wing328

https://github.com/GoogleCloudPlatform/kubernetes/blob/master/api/swagger-spec/v1beta3.json must be the spec that she is using.

nikhiljindal avatar Jun 16 '15 03:06 nikhiljindal

@nikhiljindal thanks. will take a look later today

wing328 avatar Jun 16 '15 03:06 wing328

@nikhiljindal It is the master branch spec.

madhuri-rai07 avatar Jun 16 '15 04:06 madhuri-rai07

Thanks for the URL to the json, I suspect the issue has to do with the swagger-parser and I could repeat the issue with the Petstore Swagger 1.2 spec

Here is the error for Petstore (1.2):

reading from https://raw.githubusercontent.com/swagger-api/swagger-parser/master/modules/swagger-compat-spec-parser/src/test/resources/specs/v1_2/singleFile.json

reading from https://raw.githubusercontent.com/swagger-api/swagger-parser/master/modules/swagger-compat-spec-parser/src/test/resources/specs/v1_2/singleFile.json
2366 [main] ERROR io.swagger.models.properties.PropertyBuilder - no property for Pet, null
2366 [main] ERROR io.swagger.models.properties.PropertyBuilder - no property for Pet, null
2367 [main] ERROR io.swagger.models.properties.PropertyBuilder - no property for null, null
2367 [main] ERROR io.swagger.models.properties.PropertyBuilder - no property for void, null
WARNING!  No property detected!  Falling back to string!
2367 [main] ERROR io.swagger.models.properties.PropertyBuilder - no property for null, null
WARNING!  No property detected!  Falling back to string!
2367 [main] ERROR io.swagger.models.properties.PropertyBuilder - no property for Pet, null
2368 [main] ERROR io.swagger.models.properties.PropertyBuilder - no property for void, null
WARNING!  No property detected!  Falling back to string!
2368 [main] ERROR io.swagger.models.properties.PropertyBuilder - no property for Pet, null
2368 [main] ERROR io.swagger.models.properties.PropertyBuilder - no property for void, null
WARNING!  No property detected!  Falling back to string!
2368 [main] ERROR io.swagger.models.properties.PropertyBuilder - no property for null, null
2368 [main] ERROR io.swagger.models.properties.PropertyBuilder - no property for null, null
2368 [main] ERROR io.swagger.models.properties.PropertyBuilder - no property for void, null
WARNING!  No property detected!  Falling back to string!
2370 [main] ERROR io.swagger.models.properties.PropertyBuilder - no property for null, null
2370 [main] ERROR io.swagger.models.properties.PropertyBuilder - no property for null, null
writing file /var/tmp/perl/test/lib/WWW/SwaggerClient/Object/Category.pm
writing file /var/tmp/perl/test/lib/WWW/SwaggerClient/Object/Pet.pm
writing file /var/tmp/perl/test/lib/WWW/SwaggerClient/Object/Tag.pm
writing file /var/tmp/perl/test/lib/WWW/SwaggerClient/DefaultApi.pm
writing file /var/tmp/perl/test/lib/WWW/SwaggerClient/ApiClient.pm
writing file /var/tmp/perl/test/lib/WWW/SwaggerClient/Configuration.pm
writing file /var/tmp/perl/test/lib/WWW/SwaggerClient/Object/BaseObject.pm

As you can see, it's throwing similar error, which suggests the method response type (type under operations in Swagger spec 1.2) is not converted to swagger spec 2.0 correctly.

I'll open an issue in swagger-parser to see if anyone is familiar with the error message above.

wing328 avatar Jun 16 '15 09:06 wing328

I can repeat the issue when parsing that spec JSON with SwaggerCompatConverter, and the issue will be gone if I change all "method": "TRACE" to "method": "GET" in the spec JSON (e.g. here).

So it's should be that the TRACE method is not supported in swagger, which is indeed not listed in swagger spec 1.2 or 2.0.

xhh avatar Jun 16 '15 11:06 xhh

The issue of unsupported HTTP method could be logged as error message and then skipped by using a valid default value (say GET), so that it won't fail the whole process. If this is acceptable, I'm willing to submit a PR.

xhh avatar Jun 16 '15 12:06 xhh

@xhh - changing something like TRACE to GET is probably not the right idea (especially since there could be a GET for that resource already). I'd suggest logging as warning and dropping the operation altogether (as it is just not supported).

webron avatar Jun 16 '15 12:06 webron

I believe this is no longer an issue. Please reopen if it's not the case.

wing328 avatar Dec 29 '15 17:12 wing328