概要
現在の api/openapi.yaml は openapi: 3.1.0 を宣言しているにもかかわらず、nullable フィールドに OAS 3.0 の記法(nullable: true)を使用している。
OAS 3.1 では nullable キーワードは非推奨であり、正式な記法は JSON Schema の type に null を含める方法である。
影響箇所
以下のフィールドが対象:
| スキーマ |
フィールド |
UserProfile |
departmentName |
MeResponse |
activeTenantId |
TenantUser |
departmentName |
Task |
description, assignee, completedAt |
TaskCreateRequest |
description, assigneeId |
TaskUpdateRequest |
description, assigneeId |
AuditLog |
userId, entityType, entityId, ipAddress |
修正方針
nullable: true を type: [<元の型>, 'null'] に置き換える。
例:
# Before (OAS 3.0 記法)
activeTenantId: { type: integer, format: int64, nullable: true }
# After (OAS 3.1 記法)
activeTenantId:
type: [integer, 'null']
format: int64
$ref を持つフィールド(assignee など)は oneOf を使う形式に変更する:
# Before
assignee: { $ref: "#/components/schemas/UserSummary", nullable: true }
# After
assignee:
oneOf:
- $ref: "#/components/schemas/UserSummary"
- type: 'null'
関連
概要
現在の
api/openapi.yamlはopenapi: 3.1.0を宣言しているにもかかわらず、nullable フィールドに OAS 3.0 の記法(nullable: true)を使用している。OAS 3.1 では
nullableキーワードは非推奨であり、正式な記法は JSON Schema のtypeにnullを含める方法である。影響箇所
以下のフィールドが対象:
UserProfiledepartmentNameMeResponseactiveTenantIdTenantUserdepartmentNameTaskdescription,assignee,completedAtTaskCreateRequestdescription,assigneeIdTaskUpdateRequestdescription,assigneeIdAuditLoguserId,entityType,entityId,ipAddress修正方針
nullable: trueをtype: [<元の型>, 'null']に置き換える。例:
$refを持つフィールド(assigneeなど)はoneOfを使う形式に変更する:関連