Skip to content

Comments

[docs] improve OpenAPI doc tags#38

Merged
capcom6 merged 1 commit intomasterfrom
docs/improve-openapi-docs
Feb 22, 2026
Merged

[docs] improve OpenAPI doc tags#38
capcom6 merged 1 commit intomasterfrom
docs/improve-openapi-docs

Conversation

@capcom6
Copy link
Member

@capcom6 capcom6 commented Feb 22, 2026

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Improved SIM number validation to ensure required values when provided.
    • Enhanced date-time field formatting in API responses for consistency.

@codecov
Copy link

codecov bot commented Feb 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
smsgateway/domain_messages.go 100.00% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai
Copy link

coderabbitai bot commented Feb 22, 2026

Walkthrough

Two validation and metadata updates: SimNumber field in Message now requires minimum 1 character when present (previously just maximum 3 characters), and TokenResponse.ExpiresAt field tag gains date-time format specification for serialization metadata.

Changes

Cohort / File(s) Summary
Message Validation
smsgateway/domain_messages.go
SimNumber field validation constraint updated to enforce minimum length of 1 character in addition to existing maximum of 3 characters.
DTO Metadata
smsgateway/dto_auth.go
TokenResponse.ExpiresAt field tag augmented with format:"date-time" specifier for serialization metadata.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title '[docs] improve OpenAPI doc tags' accurately reflects the changes made, which involve updating validation tags (SimNumber) and format specifiers (TokenResponse.ExpiresAt) that are used for OpenAPI documentation generation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
smsgateway/domain_messages.go (1)

84-84: min=1 is a runtime behavioral change: callers sending simNumber: 0 will now receive validation errors

The addition of min=1 to SimNumber's validate tag is semantically correct and will trigger validation failures at runtime when a non-nil *uint8 pointing to 0 is passed. This is a minor breaking change for callers who previously sent simNumber: 0.

Since this field is a pointer, omitnil expresses the intent more precisely than omitempty. Both skip validation when the pointer is nil, but omitnil is explicit and clearer to future readers that nil pointers are intentionally skipped (whereas omitempty is more ambiguous for pointer semantics).

♻️ Optional: use omitnil for pointer field clarity
-	SimNumber *uint8 `json:"simNumber,omitempty" validate:"omitempty,min=1,max=3" example:"1"`
+	SimNumber *uint8 `json:"simNumber,omitempty" validate:"omitnil,min=1,max=3"  example:"1"`
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@smsgateway/domain_messages.go` at line 84, The validate tag for SimNumber
currently uses `omitempty` which is ambiguous for a pointer and can cause
unintended validation when a non-nil *uint8 equals 0; update the struct tag on
SimNumber to use `omitnil` instead of `omitempty` (keeping the `min=1,max=3`
constraint) so nil pointers are explicitly skipped during validation and callers
sending nil continue to pass validation while non-nil values are validated
against min/max; locate the SimNumber field in domain_messages.go (symbol:
SimNumber *uint8) and replace `omitempty` with `omitnil` in its validate tag.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@smsgateway/domain_messages.go`:
- Line 84: The validate tag for SimNumber currently uses `omitempty` which is
ambiguous for a pointer and can cause unintended validation when a non-nil
*uint8 equals 0; update the struct tag on SimNumber to use `omitnil` instead of
`omitempty` (keeping the `min=1,max=3` constraint) so nil pointers are
explicitly skipped during validation and callers sending nil continue to pass
validation while non-nil values are validated against min/max; locate the
SimNumber field in domain_messages.go (symbol: SimNumber *uint8) and replace
`omitempty` with `omitnil` in its validate tag.

@capcom6 capcom6 merged commit 85fddb9 into master Feb 22, 2026
8 checks passed
@capcom6 capcom6 deleted the docs/improve-openapi-docs branch February 22, 2026 12:40
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.

1 participant