Middle
Puoi scrivere un Swagger semplice per un metodo API che modifica il cognome dell'utente?
sobes.tech AI
Risposta dell'AI
Ниже пример простого Swagger (OpenAPI 3.0) описания API метода для изменения фамилии пользователя:
openapi: 3.0.0
info:
title: User API
version: 1.0.0
paths:
/users/{userId}/lastname:
put:
summary: Изменить фамилию пользователя
parameters:
- in: path
name: userId
schema:
type: integer
required: true
description: ID пользователя
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
lastName:
type: string
description: Новая фамилия пользователя
required:
- lastName
responses:
'200':
description: Фамилия успешно обновлена
content:
application/json:
schema:
type: object
properties:
userId:
type: integer
lastName:
type: string
'400':
description: Некорректный запрос
'404':
description: Пользователь не найден