← Каталог
Документирование API с использованием Swagger/OpenAPI — Наследование и композиция схем
Фрагмент из «Документирование API с использованием Swagger/OpenAPI»: Наследование и композиция схем.
components:
schemas:
BaseResource:
type: object
properties:
id:
type: string
format: uuid
createdAt:
type: string
format: date-time
updatedAt:
type: string
format: date-time
Task:
allOf:
- $ref: '#/components/schemas/BaseResource'
- type: object
properties:
title:
type: string
status:
type: string
enum: [active, completed] components:
schemas:
BaseResource:
type: object
properties:
id:
type: string
format: uuid
createdAt:
type: string
format: date-time
updatedAt:
type: string
format: date-time
Task:
allOf:
- $ref: '#/components/schemas/BaseResource'
- type: object
properties:
title:
type: string
status:
type: string
enum: [active, completed]