fix: preserve value types in extraFields (no string coercion)
CI / typecheck + build (turbo) (push) Canceled after 0s
CI / typecheck + build (turbo) (push) Canceled after 0s
- DocumentMeta.extraFields type -> Record<string, unknown> - API routes pass extraFields through without JSON.stringify coercion - CustomFieldBadges auto-styles by value type/content (number->purple, boolean->green/red, etc.) - DocForm help text: generic (no hardcoded field examples)
This commit is contained in:
@@ -128,7 +128,7 @@ export interface CreateDocInput {
|
||||
status?: DocStatus;
|
||||
author?: string;
|
||||
tags?: string[];
|
||||
extraFields?: Record<string, string>;
|
||||
extraFields?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface UpdateDocInput {
|
||||
@@ -138,7 +138,7 @@ export interface UpdateDocInput {
|
||||
status?: DocStatus;
|
||||
tags?: string[];
|
||||
author?: string;
|
||||
extraFields?: Record<string, string>;
|
||||
extraFields?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
/** Validate that a slug is safe (no path traversal, only [a-z0-9/_-]). */
|
||||
|
||||
@@ -16,7 +16,8 @@ export interface DocumentMeta {
|
||||
updatedAt: string; // ISO
|
||||
// Dynamic custom frontmatter fields (e.g. CTF: event, challenge, category,
|
||||
// difficulty, points). Content creators add arbitrary key-value pairs.
|
||||
extraFields?: Record<string, string>;
|
||||
// Values can be strings, numbers, booleans, arrays, or objects.
|
||||
extraFields?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface Document extends DocumentMeta {
|
||||
|
||||
Reference in New Issue
Block a user