Skip to content

Improve the way bit Boilerplate deals with json (#12786) - #12787

Merged
yasmoradi merged 8 commits into
bitfoundation:developfrom
yasmoradi:review
Jul 30, 2026
Merged

Improve the way bit Boilerplate deals with json (#12786)#12787
yasmoradi merged 8 commits into
bitfoundation:developfrom
yasmoradi:review

Conversation

@yasmoradi

@yasmoradi yasmoradi commented Jul 30, 2026

Copy link
Copy Markdown
Member

closes #12786

Summary by CodeRabbit

  • New Features

    • Tenant creation and updates now reject reserved names and deployment-specific host labels.
    • Added localized messages for reserved tenant-name validation.
    • Gender selection now supports an unspecified value.
  • Bug Fixes

    • Improved claim equality, null handling, and string formatting.
    • Corrected response-cache metadata selection.
    • Removed password data from user details.
  • Documentation

    • Updated tenant security guidance, source-generator examples, and image-sizing documentation.
  • Refactor

    • Improved JSON naming and converter handling.
    • Removed an obsolete asynchronous collection helper.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 29982f60-208a-43ce-95a7-d384f70ccf59

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

The boilerplate updates add reserved tenant-name validation, revise JSON naming and converter configuration, make identity DTO contracts nullable and null-safe, adjust response-cache metadata selection, remove an async collection extension, and update documentation and localized resources.

Changes

Reserved tenant validation

Layer / File(s) Summary
Reserved-name validation
src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Features/Tenants/...
Adds reserved-name detection and applies it in tenant creation and name-change validation using deployment and trusted-origin hosts.
Tenant validation contract and messages
src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Features/Tenants/Dtos/TenantDto.cs, src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Resources/AppStrings*.resx
Documents server-side reserved-name rejection and adds ReservedTenantName translations.

JSON serialization configuration

Layer / File(s) Summary
Runtime and generated JSON options
src/Templates/Boilerplate/Bit.Boilerplate/src/Server/.../JsonSerializerOptionsExtensions.cs, src/Templates/Boilerplate/Bit.Boilerplate/src/Server/.../ServerJsonContext.cs, src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/.../AppJsonContext.cs, src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/.../IdentityJsonContext.cs
Removes dictionary-key camel-casing, retains camel-cased properties, and copies source-generated converters into runtime options.

Identity DTO contracts

Layer / File(s) Summary
Identity DTO and UI contracts
src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Features/Identity/..., src/Templates/Boilerplate/Bit.Boilerplate/src/Client/.../ProfileSection.razor
Makes gender nullable, updates ClaimDto equality and object overrides for null-safe comparisons, and removes UserDto.Password.

Supporting boilerplate updates

Layer / File(s) Summary
Utility behavior and documentation
src/Templates/Boilerplate/Bit.Boilerplate/src/Server/.../HttpContextExtensions.cs, src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Features/Attachments/AttachmentKind.cs, src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Infrastructure/Extensions/ICollectionExtensions.cs, src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Features/Readme.md
Selects the last response-cache metadata attribute, corrects image sizing guidance, removes ToListAsync, and revises source-generator examples.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant TenantController
  participant ReservedTenantNames
  participant ValidationResponse
  Client->>TenantController: submit tenant name
  TenantController->>ReservedTenantNames: check name and deployment hosts
  ReservedTenantNames-->>TenantController: reserved status
  TenantController->>ValidationResponse: return validation error for reserved name
Loading

Poem

I’m a rabbit with a tidy new stack,
Reserved names now bounce right back.
JSON keys hop, claims compare,
Nullable genders float through the air.
Docs and strings bloom everywhere!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning Multiple unrelated changes were added, including tenant, identity, docs, and resource updates outside JSON handling. Split the non-JSON changes into separate PRs or remove them so this PR focuses on JSON handling only.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and matches the PR's main JSON-handling theme.
Linked Issues check ✅ Passed The JSON-related code changes align with issue #12786's request to improve JSON handling.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Features/Tenants/ReservedTenantNames.cs`:
- Around line 41-43: Update the host-label comparison in ReservedTenantNames to
first require more than two dot-separated segments, matching TenantProvider’s
hostSegments.Length > 2 behavior; only derive and compare firstLabel for
eligible hosts, so two-label apex hosts such as example.com do not reserve
“example”.

In
`@src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Features/Identity/Dtos/ClaimDto.cs`:
- Around line 23-26: Add a strongly typed Equals(ClaimDto?) overload to ClaimDto
that compares ClaimType and ClaimValue, and update Equals(object?) to delegate
to this overload without recursion. Preserve null handling and the existing
equality contract.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4957dc9c-56c3-4151-97c1-dbaf126eaee3

📥 Commits

Reviewing files that changed from the base of the PR and between 9e6175d and ec48f6e.

📒 Files selected for processing (26)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Settings/ProfileSection.razor
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Features/Tenants/ReservedTenantNames.cs
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Features/Tenants/TenantController.cs
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Features/Tenants/TenantManagementController.cs
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Infrastructure/Extensions/JsonSerializerOptionsExtensions.cs
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Infrastructure/Services/ServerJsonContext.cs
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Shared/Infrastructure/Extensions/HttpContextExtensions.cs
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Features/Attachments/AttachmentKind.cs
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Features/Identity/Dtos/ClaimDto.cs
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Features/Identity/Dtos/EditUserRequestDto.cs
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Features/Identity/Dtos/IdentityJsonContext.cs
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Features/Identity/Dtos/UserDto.cs
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Features/Readme.md
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Features/Tenants/Dtos/TenantDto.cs
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Infrastructure/Dtos/AppJsonContext.cs
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Infrastructure/Extensions/ICollectionExtensions.cs
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Resources/AppStrings.ar.resx
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Resources/AppStrings.de.resx
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Resources/AppStrings.es.resx
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Resources/AppStrings.fa.resx
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Resources/AppStrings.fr.resx
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Resources/AppStrings.hi.resx
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Resources/AppStrings.nl.resx
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Resources/AppStrings.resx
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Resources/AppStrings.sv.resx
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Resources/AppStrings.zh.resx
💤 Files with no reviewable changes (5)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Features/Identity/Dtos/IdentityJsonContext.cs
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Infrastructure/Services/ServerJsonContext.cs
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Infrastructure/Dtos/AppJsonContext.cs
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Infrastructure/Extensions/ICollectionExtensions.cs
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Features/Identity/Dtos/UserDto.cs

@yasmoradi
yasmoradi merged commit 52e105e into bitfoundation:develop Jul 30, 2026
3 checks passed
@yasmoradi
yasmoradi deleted the review branch July 30, 2026 15:43
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.

Dealing with json files in bit Boilerplate must be improved

1 participant