Skip to content

fix: IsValid accepts empty strings for non-nullable string fields (20.0.3)#461

Merged
erwan-joly merged 1 commit intomasterfrom
fix/allow-empty-strings-in-required-check
Apr 24, 2026
Merged

fix: IsValid accepts empty strings for non-nullable string fields (20.0.3)#461
erwan-joly merged 1 commit intomasterfrom
fix/allow-empty-strings-in-required-check

Conversation

@erwan-joly
Copy link
Copy Markdown
Contributor

Summary

Symptom from live NosCore login traffic:
```
EROR -- Sending an invalid packet: header=NsTeST type=NosCore.Packets.ServerPackets.Login.NsTestPacket errors=[The NsTestPacket field is required.]
```

PacketBase.IsValid constructs `new RequiredAttribute()` which defaults to `AllowEmptyStrings = false`. That rejects `NsTestPacket.LeadingBlank = ""` — even though an empty token is exactly what the wire carries.

Switch to `new RequiredAttribute { AllowEmptyStrings = true }` so a non-nullable string property can legally hold `""`.

Test plan

  • `dotnet test` — 113/113 passing

🤖 Generated with Claude Code

….0.3)

PacketBase.IsValid constructed RequiredAttribute with default
AllowEmptyStrings=false, so a non-nullable string property with an
empty value (e.g. NsTestPacket.LeadingBlank = "" that models the
literal double-space token) failed validation with
"The <Type> field is required.". Empty tokens are legal on the wire;
allow them.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 24, 2026

Warning

Rate limit exceeded

@erwan-joly has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 5 minutes and 30 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 5 minutes and 30 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 520fac3e-b772-4318-9d76-e807bbdb4da9

📥 Commits

Reviewing files that changed from the base of the PR and between 41cf996 and 662254e.

📒 Files selected for processing (2)
  • src/NosCore.Packets/NosCore.Packets.csproj
  • src/NosCore.Packets/PacketBase.cs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/allow-empty-strings-in-required-check

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

@erwan-joly erwan-joly merged commit b759975 into master Apr 24, 2026
2 of 3 checks passed
@erwan-joly erwan-joly deleted the fix/allow-empty-strings-in-required-check branch April 24, 2026 15:36
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