Skip to content

#1840: API structure improvement: expose columns through a technical name/slug/alias#2428

Open
samin-z wants to merge 6 commits intomainfrom
feature/1840-expose-columns
Open

#1840: API structure improvement: expose columns through a technical name/slug/alias#2428
samin-z wants to merge 6 commits intomainfrom
feature/1840-expose-columns

Conversation

@samin-z
Copy link
Copy Markdown
Contributor

@samin-z samin-z commented Mar 30, 2026

Feature ticket: #1840

New response structure:

data: [
    {
        columnId: 70,
        value: 11
    },
    {
        columnId: 72,
        value: 3
    },
    {
        columnId: 76,
        value: [
            {
                id: user1,
                type: 0,
                displayName: user1
            }
        ]
    }
],
dataByAlias: {
    column_70: {
        columnId: 70,
        value: 11
    },
    column_72: {
        columnId: 72,
        value: 3
    },
    test_customer: {
        columnId: 76,
        value: [
            {
                id: user1,
                type: 0,
                displayName: user1
            }
        ]
    }
}

now we have new field added to columns called 'technical_name' which if user does not add it as default will be 'column_{id}', 'dataByAlias' added on top of 'data' not to break the current structure.
Screenshot 2026-03-30 at 15 13 32

@blizzz blizzz added enhancement New feature or request 3. to review Waiting for reviews labels Apr 2, 2026
@samin-z samin-z force-pushed the feature/1840-expose-columns branch from 8607112 to 5e0e8bc Compare April 7, 2026 09:19
@samin-z samin-z marked this pull request as ready for review April 10, 2026 15:30
@samin-z samin-z requested review from blizzz and enjeck as code owners April 10, 2026 15:30
Copy link
Copy Markdown
Contributor

@enjeck enjeck left a comment

Choose a reason for hiding this comment

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

some comments

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looking at #1840, in order for this to be useful for workflows, we must expose it via AbstractRowEvent.php -> toPublicRow() ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I believe we're now doing 2 writes? Both create() and importColumn() create a column first and only then assign the fallback column_ name. If the second write fails, the request throws after the insert has already succeeded, so we leave behind a persisted column without the technicalName. Maybe we should have a transaction then?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

there is no problem even if the update of technicalName fails a 'null' value for the column is valid. When 'technicalName' is null, the code in RowService handles it:
$alias = $aliasByColumnId[$columnId] ?? ('column_' . $columnId);
this causes the column to behave correctly with the 'column_{columnId}' fallback.
also when the user edits and saves the column, the 'null' will be updated with either their chosen value or the default 'column_{columnId}'.

Comment on lines +230 to +241
normalizeTechnicalName(technicalName) {
const normalized = technicalName?.trim()
return normalized === '' ? null : normalized
},
isTechnicalNameValid() {
const technicalName = this.normalizeTechnicalName(this.editColumn.technicalName)
if (technicalName === null) {
return false
}

return /^[a-z][a-z0-9_]*$/.test(technicalName)
},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

used here and in CreateColumn, could be moved to a shared file and reused

Comment thread src/modules/modals/EditColumn.vue Outdated
Comment on lines +236 to +238
if (technicalName === null) {
return false
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we return false for null technicalName when we edit but true for creating? Why?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

that wa my mistake as i was going through it and forgot to update

@samin-z samin-z requested a review from enjeck April 13, 2026 14:21
@benjaminfrueh benjaminfrueh self-requested a review April 21, 2026 08:00
@Koc
Copy link
Copy Markdown
Contributor

Koc commented Apr 28, 2026

hey @samin-z!

Thank you so much for taking care of this. I've just opened similar PR for Views #2547.

Few ideas that came to my mind when I worked on it:

  1. as this technical name is some kind of "advanced" feature used mostly by developers - then I moved it under special "spoiler" in order to not to burden the UI for regular users
image
  1. as changes to this field can broke API/integrations - then I added some notice on change
image

WDYT about adding same things to your PR?

@samin-z samin-z force-pushed the feature/1840-expose-columns branch from 009fc5d to 788e780 Compare April 29, 2026 14:42
@Koc Koc mentioned this pull request Apr 29, 2026
@jancborchardt jancborchardt moved this to 🏗️ At engineering in 🖍 Design team May 5, 2026
@samin-z
Copy link
Copy Markdown
Contributor Author

samin-z commented May 5, 2026

i compared playwright fails against main, failures are in known flaky datetime/login/navigation tests and are reproducible outside this branch, none of the failures point to technical_name or dataByAlias code paths.

@samin-z
Copy link
Copy Markdown
Contributor Author

samin-z commented May 5, 2026

@nimishavijay

now we have advanced setting to column edit/create

does this setup align with what design had in mind or exact design for "table view"?
Screenshot 2026-05-05 at 16 27 55

Screenshot 2026-05-05 at 16 28 05

Copy link
Copy Markdown
Contributor

@enjeck enjeck left a comment

Choose a reason for hiding this comment

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

some comments


return $this->filterRowResult($view ?? null, $updatedRow);
$updatedRow = $this->filterRowResult($view ?? null, $updatedRow);
$this->attachAliasPayload($updatedRow, $columns);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Did you test out the webbook event to see what the payload is? Cuz from the code, it seems like above we dispatch the event with new RowUpdatedEvent($updatedRow, $previousData) before even attaching dataByAlias? So webhook results doesn't get the dataByAlias value?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

you're right, fixed it in RowService by ensuring alias payload is attached before event dispatch.

* ownership: string,
* ownerDisplayName: string|null,
* createdBy: string,
* dataByAlias: array<string, array{columnId: int, value: mixed}>,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should this be optional

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i'de keep it as none optional, the row serializer always returns this key and it gets normalized to an array, so clients get a stable contract anyway.

Comment on lines +733 to +735
if ($column->getTechnicalName() === $technicalName) {
throw new BadRequestError('Technical name must be unique in the table.');
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think status 400 is better, not 500

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it is returning 400

@samin-z samin-z force-pushed the feature/1840-expose-columns branch from 7d347a8 to 87afb9e Compare May 8, 2026 14:15
samin-z added 6 commits May 8, 2026 16:54
Signed-off-by: samin-z <samin.zavarkesh@gmail.com>
Signed-off-by: samin-z <samin.zavarkesh@gmail.com>
Signed-off-by: samin-z <samin.zavarkesh@gmail.com>
Signed-off-by: samin-z <samin.zavarkesh@gmail.com>
Signed-off-by: samin-z <samin.zavarkesh@gmail.com>
Signed-off-by: samin-z <samin.zavarkesh@gmail.com>
@samin-z samin-z force-pushed the feature/1840-expose-columns branch from 87afb9e to 5eb1c41 Compare May 8, 2026 14:58
@samin-z samin-z requested a review from enjeck May 8, 2026 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants