Skip to content

fix(themes): implement runtime validation for SVG theme presets#6123

Open
MasterJi27 wants to merge 2 commits into
JhaSourav07:mainfrom
MasterJi27:fix/theme-validation-5272
Open

fix(themes): implement runtime validation for SVG theme presets#6123
MasterJi27 wants to merge 2 commits into
JhaSourav07:mainfrom
MasterJi27:fix/theme-validation-5272

Conversation

@MasterJi27

Copy link
Copy Markdown
Contributor

Fixes #5272

Closes JhaSourav07#5272

- Define badgeThemeSchema using Zod to validate BadgeTheme type
- Add validateThemes() to validate the themes map
- Invoke validateThemes() during module runtime initialization
- Add unit tests for runtime theme validation
@vercel

vercel Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

@MasterJi27 is attempting to deploy a commit to the jhasourav07's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

Copy link
Copy Markdown
Contributor

📦 Next.js Bundle Size Report (Gzipped Sizes)

Asset PR Size Base Size Difference Status
static/chunks/9389-[hash].js 5.99 KB 5.86 KB +0.13 KB (+2.23%) 🔴 Regression

📊 Summary of Totals

Category PR Size Base Size Difference
Total JS 3694.79 KB 3694.34 KB +0.45 KB (+0.01%)
Total CSS 296.06 KB 296.06 KB 0 B

@Aamod-Dev Aamod-Dev added GSSoC 2026 mentor:Aamod007 level:intermediate Moderate complexity tasks quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. refactor bug Something isn't working labels Jun 21, 2026

@Aamod-Dev Aamod-Dev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Adding Zod runtime validation for theme presets in lib/svg/themes.ts is an excellent safeguard against misconfigured hex colors in newly added themes. This guarantees that all themes match the required format before they can break the SVG renderer. Approved!

@github-actions github-actions Bot added the type:bug Something isn't working as expected label Jun 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working gssoc:needs-rebase GSSoC 2026 level:intermediate Moderate complexity tasks mentor:Aamod007 quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. refactor type:bug Something isn't working as expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Implement runtime validation for SVG theme presets

3 participants