Happy Business Starts Here

Zuora REST Swagger YAML Invalid

Highlighted

Zuora REST Swagger YAML Invalid

Hi, 

We have a tool that can import a swagger to learn about API's. We are having some trouble importing yours and it looks like there may be a few errors according to a validation tool.

Here are the errors the tool returns

Swagger schema validation failed.
Data does not match any schemas from 'anyOf' at #/definitions/ProxyActionqueryRequest/properties/conf/properties/batchSize/type
No enum match for: Integer at #/definitions/ProxyActionqueryRequest/properties/conf/properties/batchSize/type
Expected type array but found type string at #/definitions/ProxyActionqueryRequest/properties/conf/properties/batchSize/type

JSON_OBJECT_VALIDATION_FAILED

Error: Swagger schema validation failed.
Data does not match any schemas from 'anyOf' at #/definitions/ProxyActionqueryRequest/properties/conf/properties/batchSize/type
No enum match for: Integer at #/definitions/ProxyActionqueryRequest/properties/conf/properties/batchSize/type
Expected type array but found type string at #/definitions/ProxyActionqueryRequest/properties/conf/properties/batchSize/type

JSON_OBJECT_VALIDATION_FAILED
at http://bigstickcarpet.com/swagger-parser/www/js/bundle.min.js:9:1462
at http://bigstickcarpet.com/swagger-parser/www/js/bundle.min.js:9:13896
at <anonymous>

SyntaxError: Swagger schema validation failed.
Data does not match any schemas from 'anyOf' at #/definitions/ProxyActionqueryRequest/properties/conf/properties/batchSize/type
No enum match for: Integer at #/definitions/ProxyActionqueryRequest/properties/conf/properties/batchSize/type
Expected type array but found type string at #/definitions/ProxyActionqueryRequest/properties/conf/properties/batchSize/type

JSON_OBJECT_VALIDATION_FAILED
at Function.syntax (http://bigstickcarpet.com/swagger-parser/dist/swagger-parser.min.js:23:97630)
at validateSchema (http://bigstickcarpet.com/swagger-parser/dist/swagger-parser.min.js:9:4778)
at http://bigstickcarpet.com/swagger-parser/dist/swagger-parser.min.js:9:2973
at <anonymous>

z-schema validation error: JSON_OBJECT_VALIDATION_FAILED
at ZSchema.getLastError (http://bigstickcarpet.com/swagger-parser/dist/swagger-parser.min.js:25:193702)
at validateSchema (http://bigstickcarpet.com/swagger-parser/dist/swagger-parser.min.js:9:4682)
at http://bigstickcarpet.com/swagger-parser/dist/swagger-parser.min.js:9:2973
at <anonymous>

3 REPLIES 3
Highlighted
Zuora Documentation

Re: Zuora REST Swagger YAML Invalid

Thanks for pointing it out, Claude!

 

I downloaded the YAML file from the API reference and found two issues:

 

  1. There is a typo in the YAML file, where the type "Integer" should be "integer". This is the root which causes the errors you pointed out. To correct this typo, search the Swagger file for the string "type: Integer" and replace with "type: integer".
  2. There are these two endpoints in the Swagger file: /v1/revenue-schedules/invoice-item-adjustments/{invoice-item-adj-id} and /v1/revenue-schedules/invoice-item-adjustments/{invoice-item-adj-key}. However, according to the Swagger 2.0 spec, {invoice-item-adj-id} and {invoice-item-adj-key} are treated as the same parameter by Swagger and it is not allowed to have two "identical paths" declared in the same YAML file. After checking the definition of both params, I think they are basically the same. To fix this issue, I recommend you to:  a) Change the string /v1/revenue-schedules/invoice-item-adjustments/{invoice-item-adj-id} to /v1/revenue-schedules/invoice-item-adjustments/{invoice-item-adj-key} in the Swagger file. b) Replace the "- name: invoice-item-adj-id" to "- name: invoice-item-adj-key".  c) Remove the other duplicated endpoint /v1/revenue-schedules/invoice-item-adjustments/{invoice-item-adj-key} for the "Create revenue schedule for Invoice Item Adjustment (manual distribution)" operation.

Both these issues will be fixed in R222 Sandbox Release. You can either wait for our update and download again, or modify on your side.

 

Hope it helps. Feel free to reply me if you have further questions. Thanks!