-
Notifications
You must be signed in to change notification settings - Fork 68
Description
Hi, I have this joi object:
Joi.object({ userGuid: Joi.string().uuid().required(), version: Joi.string() .regex(/^\d+(.\d+){3}$/) .required(), os: Joi.string() .valid('IOS', 'ANDROID', 'CHROMEOS', 'WINDOWS', 'MACOS') .required(), endUserId: Joi.string().required(), machineId: Joi.string().required(), }).meta({ className: 'postVersionInfo' })
and I generates this schema:
"postVersionInfo": { "type": "object", "properties": { "userGuid": { "type": "string", "format": "uuid" }, "version": { "type": "string", "pattern": "^\\d+(.\\d+){3}$" }, "os": { "type": "string", "enum": [ "IOS", "ANDROID", "CHROMEOS", "WINDOWS", "MACOS" ] }, "endUserId": { "type": "string" }, "machineId": { "type": "string" } }, "required": [ "userGuid", "version", "os", "endUserId", "machineId" ], "additionalProperties": false }
But in order to use in properly in swagger and to get info about each parameter, I need a joi-to-swagger to generate an array of parameters, like in this example: https://petstore.swagger.io/#/pet/uploadFile, where the parameters schema looks like:
[ { "name": "petId", "in": "path", "description": "ID of pet to update", "required": true, "type": "integer", "format": "int64" }, { "name": "additionalMetadata", "in": "formData", "description": "Additional data to pass to server", "required": false, "type": "string" }, { "name": "file", "in": "formData", "description": "file to upload", "required": false, "type": "file" } ]
How can I achieve this?
Thanks!