parameters - Swagger 2.0: "unexpected missing property for name response" -
i'm trying write swagger spec http api queried /relationships?contact_id=12345
, returns json array of relationship objects looks [{"code": "abc", "org": "myorg"}, ...]
. have below:
swagger: '2.0' paths: /relationships: get: parameters: - name: contact_id in: query required: true type: integer responses: 200: schema: type: array items: - type: object properties: code: type: string org: type: string
but when attempting use (with java -jar swagger-codegen-cli.jar generate -i test.swagger -l python
), unexpected set of errors:
[main] error io.swagger.codegen.defaultcodegen - string sanitized null. default error_unknown [main] error io.swagger.codegen.defaultcodegen - unexpected missing property name response [main] warn io.swagger.codegen.defaultcodegen - skipping invalid property { "type" : "array" } [main] error io.swagger.codegen.defaultcodegen - unexpected missing property name response exception in thread "main" java.lang.runtimeexception: not process operation: tag: default operation: null resource: /relationships definitions: {} exception: null @ io.swagger.codegen.defaultgenerator.processoperation(defaultgenerator.java:720) @ io.swagger.codegen.defaultgenerator.processpaths(defaultgenerator.java:612) @ io.swagger.codegen.defaultgenerator.generate(defaultgenerator.java:339) @ io.swagger.codegen.cmd.generate.run(generate.java:223) @ io.swagger.codegen.swaggercodegen.main(swaggercodegen.java:36) caused by: java.lang.nullpointerexception @ io.swagger.codegen.defaultcodegen.fromresponse(defaultcodegen.java:1646) @ io.swagger.codegen.defaultcodegen.fromoperation(defaultcodegen.java:1440) @ io.swagger.codegen.defaultgenerator.processoperation(defaultgenerator.java:668) ... 4 more
what doing wrong here? don't know "unexpected missing property name response" means.
try this:
swagger: '2.0' info: version: 'v0' title: relationships description: relationships api paths: /relationships: get: parameters: - name: contact_id in: query required: true type: integer responses: 200: description: ok schema: type: array items: - type: object properties: code: type: string org: type: string
the info
block @ top required according http://swagger.io/specification. added description
field 200
response. unfortunately, have found swagger errors aren't helpful. :-(
Comments
Post a Comment