Skip to content

Commit 37b1c2e

Browse files
committed
better labels for documen schema builder
1 parent c4cba4c commit 37b1c2e

File tree

2 files changed

+28
-23
lines changed

2 files changed

+28
-23
lines changed

src/ui/src/components/json-schema-builder/constraints/StringConstraints.jsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const StringConstraints = ({ attribute, onUpdate }) => {
88

99
return (
1010
<>
11-
<Header variant="h4">String Constraints</Header>
11+
<Header variant="h4">String Constraints (JSON Schema)</Header>
1212

1313
<FormField label="Pattern (regex)" description="Regular expression pattern to validate the extracted string format">
1414
<Input
@@ -18,7 +18,11 @@ const StringConstraints = ({ attribute, onUpdate }) => {
1818
/>
1919
</FormField>
2020

21-
<FormField label="Format" description="Standard format to validate against (e.g., date, email, uri)">
21+
<FormField
22+
label="Format (JSON Schema)"
23+
description="JSON Schema built-in format validation. Values must match the specified format exactly."
24+
constraintText="Select a format to enforce validation on extracted values"
25+
>
2226
<Select
2327
selectedOption={FORMAT_OPTIONS.find((opt) => opt.value === (attribute.format || '')) || FORMAT_OPTIONS[0]}
2428
onChange={({ detail }) => onUpdate({ format: detail.selectedOption.value || undefined })}

src/ui/src/constants/schemaConstants.js

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -242,29 +242,30 @@ export const ATTRIBUTE_TYPE_OPTIONS = [
242242
];
243243

244244
// ============================================================================
245-
// JSON Schema Format Options
245+
// JSON Schema Format Options (with examples for UI display)
246+
// See: https://json-schema.org/understanding-json-schema/reference/string#built-in-formats
246247
// ============================================================================
247248
export const FORMAT_OPTIONS = [
248-
{ label: 'None', value: '' },
249-
{ label: 'Date', value: 'date' },
250-
{ label: 'Time', value: 'time' },
251-
{ label: 'Date-Time', value: 'date-time' },
252-
{ label: 'Duration', value: 'duration' },
253-
{ label: 'Email', value: 'email' },
254-
{ label: 'IDN Email', value: 'idn-email' },
255-
{ label: 'Hostname', value: 'hostname' },
256-
{ label: 'IDN Hostname', value: 'idn-hostname' },
257-
{ label: 'IPv4', value: 'ipv4' },
258-
{ label: 'IPv6', value: 'ipv6' },
259-
{ label: 'URI', value: 'uri' },
260-
{ label: 'URI Reference', value: 'uri-reference' },
261-
{ label: 'IRI', value: 'iri' },
262-
{ label: 'IRI Reference', value: 'iri-reference' },
263-
{ label: 'URI Template', value: 'uri-template' },
264-
{ label: 'JSON Pointer', value: 'json-pointer' },
265-
{ label: 'Relative JSON Pointer', value: 'relative-json-pointer' },
266-
{ label: 'Regex', value: 'regex' },
267-
{ label: 'UUID', value: 'uuid' },
249+
{ label: 'None', value: '', description: 'No format validation' },
250+
{ label: 'Date (e.g., 2024-12-25)', value: 'date', description: 'ISO 8601 date: YYYY-MM-DD' },
251+
{ label: 'Time (e.g., 14:30:00)', value: 'time', description: 'ISO 8601 time: HH:MM:SS' },
252+
{ label: 'Date-Time (e.g., 2024-12-25T14:30:00Z)', value: 'date-time', description: 'ISO 8601 date-time' },
253+
{ label: 'Duration (e.g., P3Y6M4D)', value: 'duration', description: 'ISO 8601 duration' },
254+
{ label: 'Email (e.g., user@example.com)', value: 'email', description: 'RFC 5321 email address' },
255+
{ label: 'IDN Email (e.g., user@example.com)', value: 'idn-email', description: 'Internationalized email' },
256+
{ label: 'Hostname (e.g., example.com)', value: 'hostname', description: 'RFC 1123 hostname' },
257+
{ label: 'IDN Hostname (e.g., example.com)', value: 'idn-hostname', description: 'Internationalized hostname' },
258+
{ label: 'IPv4 (e.g., 192.168.1.1)', value: 'ipv4', description: 'IPv4 address' },
259+
{ label: 'IPv6 (e.g., 2001:db8::1)', value: 'ipv6', description: 'IPv6 address' },
260+
{ label: 'URI (e.g., https://example.com/path)', value: 'uri', description: 'RFC 3986 URI' },
261+
{ label: 'URI Reference (e.g., /path/to/resource)', value: 'uri-reference', description: 'URI or relative reference' },
262+
{ label: 'IRI (e.g., https://example.com/path)', value: 'iri', description: 'Internationalized URI' },
263+
{ label: 'IRI Reference', value: 'iri-reference', description: 'IRI or relative reference' },
264+
{ label: 'URI Template (e.g., /users/{id})', value: 'uri-template', description: 'RFC 6570 URI template' },
265+
{ label: 'JSON Pointer (e.g., /foo/bar)', value: 'json-pointer', description: 'RFC 6901 JSON pointer' },
266+
{ label: 'Relative JSON Pointer (e.g., 1/foo)', value: 'relative-json-pointer', description: 'Relative JSON pointer' },
267+
{ label: 'Regex (e.g., ^[a-z]+$)', value: 'regex', description: 'ECMA-262 regular expression' },
268+
{ label: 'UUID (e.g., 550e8400-e29b-41d4-a716-446655440000)', value: 'uuid', description: 'RFC 4122 UUID' },
268269
];
269270

270271
// ============================================================================

0 commit comments

Comments
 (0)