-
Notifications
You must be signed in to change notification settings - Fork 1
feat: show example values and improve section spacing #60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -486,7 +486,7 @@ function BodyFieldRow({ field, value, onChange }: { | |||||
| return ( | ||||||
| <div className={styles.arrayField}> | ||||||
| <div className={styles.fieldRow}> | ||||||
| <span className={styles.fieldLabel}>{field.name}</span> | ||||||
| <span className={styles.fieldLabel}>{field.name} {field.required && <Badge variant="danger" size="micro">required</Badge>}</span> | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
|
||||||
| <IconButton size={2} onClick={() => onChange([...items, ''])} aria-label="Add item"> | ||||||
| <PlusIcon /> | ||||||
| </IconButton> | ||||||
|
|
@@ -537,7 +537,7 @@ function BodyFieldRow({ field, value, onChange }: { | |||||
|
|
||||||
| return ( | ||||||
| <div className={styles.fieldRow}> | ||||||
| <span className={styles.fieldLabel}>{field.name}</span> | ||||||
| <span className={styles.fieldLabel}>{field.name} {field.required && <Badge variant="danger" size="micro">required</Badge>}</span> | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above - wrapping in
Suggested change
|
||||||
| <div className={styles.fieldInput}> | ||||||
| <InputField | ||||||
| size="small" | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,7 @@ export interface SchemaField { | |
| required: boolean | ||
| description?: string | ||
| default?: unknown | ||
| example?: unknown | ||
| enum?: unknown[] | ||
| children?: SchemaField[] | ||
| } | ||
|
|
@@ -90,6 +91,7 @@ export function flattenSchema( | |
| required: required.includes(name), | ||
| description: rawProp.description ?? prop.description, | ||
| default: prop.default, | ||
| example: prop.example, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice addition. One gap though: |
||
| enum: prop.enum, | ||
| children: children?.length ? children : undefined, | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JSON.stringifywraps string examples in quotes, so a string example likeactiverenders asExample: "active"with escaped double-quotes. For primitive types it'd look cleaner to show the raw value and only stringify objects/arrays.