BaryoDev / BaryoDev/barakoCMS

Field type file: reference a stored file and resolve its metadata on delivery

Open
#668 1 comment 0 reactions 0 assignees View on GitHub
core enhancement
Dominant language
C#
Stars
6
Forks
7
Avg merge
4h 42m
Merged PRs (30d)
307

Description

Found while planning barakocms.com as a barakoCMS-backed site.

To put an image on a content entry today you use a `url` field and paste a `/api/public/files/{id}` string into it. The field type is a string. Nothing checks the file exists, nothing notices when it is deleted, and the alt text has to be duplicated into a second field on the entry because delivery will not resolve it.

`FieldDefinition` already anticipates this: its comment says `blob` is planned and not accepted.

## What to change

A `file` field type that stores a file id and that delivery resolves into an object the way `include` already resolves references:

```json
"coverImage": { "url": "...", "alt": "...", "caption": "...", "width": 1920, "height": 1080 }
```

Depends on the Files module recording dimensions. Together these remove a per-image metadata call from every consumer and stop alt text living in two places.

Contributor guide

Open the contributing guide

Research direction

Start with FieldDefinition and the existing include reference resolution used during delivery, then inspect the Files module and its file metadata. The work is complete when a file field stores a file id and delivery returns the file URL, alt text, caption, and dimensions as one object instead of requiring a separate metadata call.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend-api-design
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.