Skip to content

Update OpenAPI schema#14

Merged
kantacky merged 4 commits intomainfrom
update-openapi-schema
Apr 21, 2026
Merged

Update OpenAPI schema#14
kantacky merged 4 commits intomainfrom
update-openapi-schema

Conversation

@dotto-api-schema-updater
Copy link
Copy Markdown
Contributor

This PR updates the OpenAPI schema from dotto-typespec.

Triggered by: fun-dotto/dotto-typespec@b43c097

@kantacky kantacky self-assigned this Apr 21, 2026
kantacky and others added 3 commits April 21, 2026 13:55
notifyAfter/notifyBefore への分割と通知一括送信エンドポイントの追加に追従する。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
StrictServerInterface を満たすため NotificationV1Dispatch を追加し、一旦 not implemented を返す。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
API 側の notifyAt が notifyAfter/notifyBefore に分割されたため、ビルド維持のため一旦 domain.NotifyAt を両フィールドへ射影し、リクエスト側は notifyAfter から取り込む。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@kantacky kantacky marked this pull request as ready for review April 21, 2026 04:57
@kantacky kantacky merged commit 9390a9d into main Apr 21, 2026
4 checks passed
@kantacky kantacky deleted the update-openapi-schema branch April 21, 2026 04:58
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR syncs this service’s OpenAPI contract (and generated server bindings) with updates from dotto-typespec, notably expanding the notification scheduling model and adding a new dispatch endpoint.

Changes:

  • Updated notification filtering descriptions and replaced notifyAt with notifyAfter/notifyBefore in schemas.
  • Added POST /v1/notifications/dispatch to the OpenAPI spec and regenerated server types/handlers.
  • Updated handler converter mappings to compile with the new generated models.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 6 comments.

File Description
openapi/openapi.yaml Updates notification schema fields and adds the /dispatch endpoint contract.
internal/handler/notification_dispatch.go Adds the new strict handler method stub for dispatch.
internal/handler/converter.go Adjusts domain↔API conversion for new notifyAfter/notifyBefore fields.
generated/api.gen.go Regenerates Go types and routes from the updated OpenAPI spec.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +90 to +91
NotifyAfter: n.NotifyAt,
NotifyBefore: n.NotifyAt,
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

notifyAfternotifyBefore をどちらも domain.Notification.NotifyAt にマッピングしているため、APIの「送信可能期間(ウィンドウ)」という新しい意味を表現できず、レスポンスが常に同一時刻になります。ドメイン/DB側で NotifyAfter / NotifyBefore を保持できるように拡張するか、少なくとも現状のモデル制約(単一時刻しか保持できない)に合わせてOpenAPI側を戻す/互換フィールドを残すなど、API仕様と実装を一致させてください。

Copilot uses AI. Check for mistakes.
Comment on lines 105 to 113
func toDomainNotification(id string, req api.NotificationRequest) domain.Notification {
return domain.Notification{
ID: id,
Title: req.Title,
Message: req.Message,
URL: req.Url,
NotifyAt: req.NotifyAt,
NotifyAt: req.NotifyAfter,
TargetUserIDs: req.TargetUserIds,
}
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NotificationRequest で必須になった notifyBeforetoDomainNotification で一切使われていないため、クライアントが指定した送信期限が保存されずデータ欠落になります。notifyAfter/notifyBefore の整合性(例: after <= before)を検証した上で、ドメインモデルへ両方を反映するか、現状単一時刻しか保持できないなら両者が同一であることを検証してエラーにする等の扱いを決めてください。

Copilot uses AI. Check for mistakes.
Comment thread openapi/openapi.yaml
Comment on lines +98 to +105
description: '通知予定期間の開始日時(通知ウィンドウがこの範囲と重なるものを抽出: notifyBefore >= notifyAtFrom)'
schema:
type: string
format: date-time
- name: notifyAtTo
in: query
required: false
description: 通知予定日時の終了日時 (notifyAt <= notifyAtTo)
description: '通知予定期間の終了日時(通知ウィンドウがこの範囲と重なるものを抽出: notifyAfter <= notifyAtTo)'
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

notifyAtFrom/notifyAtTo の説明が「通知ウィンドウの重なり(notifyBefore >= from, notifyAfter <= to)」になっていますが、現状の実装は notify_at >= from / notify_at <= to の単一時刻フィルタです(internal/repository/notification_list.go)。APIの実際の挙動と乖離するので、説明を現実のフィルタ条件に戻すか、実装側を説明通りの条件に更新してください。

Copilot uses AI. Check for mistakes.
Comment thread openapi/openapi.yaml
Comment on lines +191 to +198
type: object
properties:
notificationIds:
type: array
items:
type: string
required:
- notificationIds
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

notificationIds が空配列の場合に 400 を返す仕様ですが、スキーマに minItems: 1 が無いため OpenAPI バリデーションでは空配列を弾けません(結果として実装側での手動チェックが必須になります)。仕様通りにするなら notificationIdsminItems: 1 を追加してください。

Copilot uses AI. Check for mistakes.
Comment thread openapi/openapi.yaml
required:
- notifications
'400':
description: The server could not understand the request due to invalid syntax.
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

400 レスポンスの説明が「invalid syntax」になっていますが、このエンドポイントで想定している 400 は「notificationIds が空配列」のようなバリデーションエラーです。クライアントに誤解を与えるので、400 の説明を実際の条件に合わせるか、エラー本文スキーマ(例: message/code)を定義して明確にしてください。

Suggested change
description: The server could not understand the request due to invalid syntax.
description: リクエストのバリデーションエラー。たとえば `notificationIds` が空配列の場合に返される。
content:
application/json:
schema:
type: object
properties:
message:
type: string
description: バリデーションエラーの内容
code:
type: string
description: エラー種別を表すコード
required:
- message
- code
example:
message: notificationIds must not be empty
code: VALIDATION_ERROR

Copilot uses AI. Check for mistakes.
Comment on lines +5 to +11
"fmt"

api "github.com/fun-dotto/user-api/generated"
)

func (h *Handler) NotificationV1Dispatch(_ context.Context, _ api.NotificationV1DispatchRequestObject) (api.NotificationV1DispatchResponseObject, error) {
return nil, fmt.Errorf("not implemented")
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

このハンドラが未実装で常にエラーを返すため、strict handler の挙動により /v1/notifications/dispatch は常に HTTP 500 になります(OpenAPIでは 200/400 のみ定義)。少なくとも仕様に合わせて 400/200 の ResponseObject を返す実装を追加するか、実装が入るまでルート/スキーマを公開しないようにしてください。

Suggested change
"fmt"
api "github.com/fun-dotto/user-api/generated"
)
func (h *Handler) NotificationV1Dispatch(_ context.Context, _ api.NotificationV1DispatchRequestObject) (api.NotificationV1DispatchResponseObject, error) {
return nil, fmt.Errorf("not implemented")
api "github.com/fun-dotto/user-api/generated"
)
func (h *Handler) NotificationV1Dispatch(_ context.Context, _ api.NotificationV1DispatchRequestObject) (api.NotificationV1DispatchResponseObject, error) {
var resp api.NotificationV1Dispatch400JSONResponse
return resp, nil

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants