Closed pravosleva closed 3 years ago
Hello. How can I describe this case in yaml syntax? (The most interested color_choises field)
// express widdleware const toClient = [ { ok: false, code: 'imei_invalid', message: 'Неверный IMEI: Неверный формат IMEI', extra: null, }, { ok: true, imei: '868030034494621', phone: { vendor: 'Xiaomi', model: 'MI 6', memory: '', color: '', memory_choices: ['128 GB', '64 GB'], color_choices: { '128 GB': ['white', 'ceramic_black', 'blue', 'black'], '64 GB': ['black', 'blue', 'ceramic_black', 'white'], }, type: 'mobile_phone', }, id: 777, photo: 'models/samsung/galaxy-s20-ultra/color_cosmic_black_01.jpg', }, ] module.exports = async (req, res) => { const toBeOrNotToBe = getRandomInteger(0, 1) res.status(200).send(toClient[toBeOrNotToBe]) }
I tried this, but does not work:
# swagger.yaml # etc. paths: /imei: post: consumes: - application/json parameters: - in: body required: true schema: $ref: '#/definitions/IMEIVerifyRequestParams' summary: 'Returns specific OT data' description: 'Проверить IMEI' produces: - application/json responses: 200: description: 'OK' schema: info: 'Success response sample' type: object properties: ok: boolean imei: type: string phone: vendor: string model: string memory: string color: string memory_choices: array items: type: string color_choices: $ref: '#/definitions/ColorChoices' example: ok: true imei: '868030034494621' phone: vendor: Xiaomi model: 'MI 6' memory: '' color: '' memory_choices: - '128 GB' - '64 GB' color_choices: '128 GB': - white - ceramic_black - blue - black '64 GB': - white - ceramic_black - blue - black type: mobile_phone definitions: IMEIVerifyRequestParams: type: object properties: IMEI: required: true type: string description: 'Your device IMEI'
I would look at some json to yaml converter to help perhaps. Not something I am too versed in unfortunately
@scottie1984 thanx for good idea.
Hello. How can I describe this case in yaml syntax? (The most interested color_choises field)
I tried this, but does not work: