-
Notifications
You must be signed in to change notification settings - Fork 2
Migrate @objectql/types to use @objectstack/spec as protocol constitution #135
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
24be696
8c60f19
07b8bce
9ff88f2
5b07fd7
f9ddcf0
0c1156b
9f1b180
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 |
|---|---|---|
|
|
@@ -110,7 +110,10 @@ export function convertIntrospectedSchemaToObjects( | |
|
|
||
| if (foreignKey) { | ||
| // This is a lookup field | ||
| // Note: name must be set explicitly here since we're creating the config programmatically. | ||
| // When defined in YAML (ObjectConfig.fields Record), the name is auto-populated from the key. | ||
| fieldConfig = { | ||
| name: column.name, | ||
| type: 'lookup', | ||
| reference_to: foreignKey.referencedTable, | ||
| label: toTitleCase(column.name), | ||
|
|
@@ -120,7 +123,10 @@ export function convertIntrospectedSchemaToObjects( | |
| // Regular field | ||
| const fieldType = mapDatabaseTypeToFieldType(column.type); | ||
|
|
||
| // Note: name must be set explicitly here since we're creating the config programmatically. | ||
| // When defined in YAML (ObjectConfig.fields Record), the name is auto-populated from the key. | ||
| fieldConfig = { | ||
| name: column.name, | ||
|
||
| type: fieldType, | ||
| label: toTitleCase(column.name), | ||
| required: !column.nullable | ||
|
|
@@ -133,7 +139,7 @@ export function convertIntrospectedSchemaToObjects( | |
|
|
||
| // Add max length for text fields | ||
| if (column.maxLength && (fieldType === 'text' || fieldType === 'textarea')) { | ||
| fieldConfig.max_length = column.maxLength; | ||
| fieldConfig.maxLength = column.maxLength; | ||
| } | ||
|
|
||
| // Add default value | ||
|
|
||
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.
The
nameproperty is now explicitly set in both lookup and regular field configurations. This is redundant since the comment on line 114 in the original code states 'If defined within an object map, this is often automatically populated from the key.' Consider documenting why explicitnameassignment is now required, or if this is needed for protocol compliance.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.
Added clarifying comments explaining that explicit
nameassignment is required when creating FieldConfig programmatically (as in database introspection). The auto-population behavior applies only to YAML definitions where the Record key becomes the field name. See commit 9f1b180.