strapi / rfcs

RFCs for Strapi future changes
68 stars 33 forks source link

[V5] Init Content API RFC #53

Open alexandrebodin opened 10 months ago

alexandrebodin commented 10 months ago

Introduce the Content API changes for v5

You can read it here

strapi-cla commented 10 months ago

CLA assistant check
All committers have signed the CLA.

roelbeerens commented 10 months ago

I'm not sure where to comment on the RFC, so I'll add my comments here:

The simplified API response is a welcome feature 🥰. I do however have my concerns about the usage of 'documentId'. It isn't clear to me this response will also be used for the GraphQL response, but last I checked, using something like Apollo with caching, requires an 'id' field. Maybe this is configurable, but next to that, I don't really see the benefits of using something other than 'id'.

Rest looks super solid!

ComfortablyCoding commented 10 months ago

As mentioned above I would also advocate for keeping id as id instead of renaming it to documentId. id is a term everyone is already familiar with and understand what it is for (uid of a record).

I would say we keep ID for the uid of every record and the some other field (entryId sounds good to me) for indicating the id for the base record.

alexandrebodin commented 10 months ago

Thank you all for your comments 🚀 We have an updated version coming next week that thanks to your notes 🔥

alexandrebodin commented 10 months ago

Hello there 👋 There RFC was just updated to clarify certain differences between internal & meta attributes & show the different options that we have. If you can share what you think of each of them for your own DX that would be great 💯

ComfortablyCoding commented 10 months ago

The updated version looks a lot better now!

Given the option return formats I prefer option 2, but with it being meta not internal

Reasoning

Looking forward!

Boegie19 commented 10 months ago

This gives me an other question. no matter what option you do. how would you for come name conflicts on the DB layer. Only way I see this working is by prefixing the user generated content.

Also lets say we go for option 3. would that mean none can start a string with a _ or $ since if you where to allow for that that would mean you can still have conflicts.

alexandrebodin commented 10 months ago

This gives me an other question. no matter what option you do. how would you for come name conflicts on the DB layer. Only way I see this working is by prefixing the user generated content.

Also lets say we go for option 3. would that mean none can start a string with a _ or $ since if you where to allow for that that would mean you can still have conflicts.

Depending on the option we go with for the DX here we will of course adapt the DB layer to use prefixes when necessary. It would of course mean we forbidden those prefixes to be used (which is already the case)

Boegie19 commented 10 months ago

Other question I see no where in the RFC how you would reference a specific entry in the document.

alexandrebodin commented 10 months ago

Other question I see no where in the RFC how you would reference a specific entry in the document.

the document is a virtual thing fetching a document will always return the content of a single entry. (Based on filters provided or default filters)

if you do (just an example) ?locale=en&state=draft you will get the draft entry for the english locale and by default you would get your default locale and the published version of your document.

Boegie19 commented 10 months ago

Other question I see no where in the RFC how you would reference a specific entry in the document.

the document is a virtual thing fetching a document will always return the content of a single entry. (Based on filters provided or default filters)

if you do (just an example) ?locale=en&state=draft you will get the draft entry for the english locale and by default you would get your default locale and the published version of your document.

I think you should also be able to request by id since how would you get a record where a new one has been posted over so it no longer is first in any combination of keys also there needs to be an endpoint that lists all enteries in a document.

alexandrebodin commented 9 months ago

Hello everyone.

Thank you all for your comments 💯

We will go ahead and update this RFC to reflect the option we are going to move forward with and merge it in the upcoming days.

After carefully considering the different Options, Option 1 is the most viable one for v5 and is the one we will be moving forward with.

Here are the main driving deciders

martinbeentjes commented 8 months ago

I have been using Strapi for a short while now, and the nesting of attributes has been somewhat a hassle. Luckily, with ChatGPT nowadays the generation of all data classes (I consume in Kotlin) made it easier.

For a smooth migration, I think the best option is to supply a request parameter that allows for choosing the format. That way, all consumers of content can prepare for a new version and then a v5.3.x for example can migrate the version to be the new one by default.


What I am missing, how would the localizations be added under $.localizations here, just as flattened as the root level? Or is that to be defined?