3scale-archive / 3scale-cli

DEPRECATED Beta of 3scale CLI, manage your 3scale installation directly from terminal (community supported)
https://www.3scale.net
MIT License
9 stars 21 forks source link

422 error when trying to create a new service from swagger definition #38

Closed lucamaf closed 7 years ago

lucamaf commented 7 years ago

Launched the following command: 3scale-cli import swagger -f swagger-mock.yaml -p {method}_{path}

with the attached file swagger-mock.yaml.txt

and received the following error while processing it:

[3scale-cli] ERROR encountered on creating Mapping rule: undefined
/usr/lib/node_modules/node-3scale-cli/node_modules/q/q.js:155
                throw e;
                ^

Error: Server responded with status code 422 undefined
    at /usr/lib/node_modules/node-3scale-cli/lib/mappingrules.js:29:13
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
    at process._tickCallback (internal/process/next_tick.js:104:9)
From previous event:
    at createMappingRulePromise (/usr/lib/node_modules/node-3scale-cli/lib/swagger.js:123:113)
    at /usr/lib/node_modules/node-3scale-cli/node_modules/delay-promise/index.js:15:18
    at delay.then (/usr/lib/node_modules/node-3scale-cli/node_modules/delay-promise/index.js:8:33)
From previous event:
    at threescale_waterfall (/usr/lib/node_modules/node-3scale-cli/lib/swagger.js:88:4)
    at /usr/lib/node_modules/node-3scale-cli/lib/swagger.js:36:11
picsoung commented 7 years ago

hey @lucamaf there is a missing basePath property in the swagger spec. it's not mandatory to make the description valid, but our flow rely on it.

adding a simple basePath: '/' will do the job.