Skip to content

chore: [CP-403]Add Content Platform schema definitions - #2742

Closed
victorhmp wants to merge 22 commits into
mainfrom
feat/content-platform-schemas
Closed

victorhmp wants to merge 22 commits into
mainfrom
feat/content-platform-schemas

Conversation

@victorhmp

@victorhmp victorhmp commented Mar 24, 2025 •

Copy link
Copy Markdown
Member

What's the purpose of this pull request?

This PR adds the schema definitions for components and content types that will be used by Content Platform.

A big change introduced is regarding how we're allowing schema definitions for components to be broken into multiple json | jsonc files.

How it works?

As it is right now, without further changes to FastStore Core, this basically does nothing 😅, it's just a bunch of definitions (that's why I'm tagging this as a chore). Future PRs will add actual support for them.

How to test it?

No need.

References

The schemas added here all follow the meta schema definitions we're also using in Content Platform: https://github.com/vtex/content-platform/blob/main/resources/meta-schema.jsonc.

@victorhmp victorhmp self-assigned this Mar 24, 2025
@victorhmp victorhmp changed the title Feat/content platform schemas [CP-323] Feat/content platform schemas Mar 24, 2025
@codesandbox-ci

codesandbox-ci Bot commented Mar 24, 2025 •

Copy link
Copy Markdown

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@victorhmp victorhmp changed the title [CP-323] Feat/content platform schemas [CP-323] (chore)Add Content Platform schema definitions Mar 24, 2025
@victorhmp victorhmp changed the title [CP-323] (chore)Add Content Platform schema definitions (chore):[CP-323]Add Content Platform schema definitions Mar 24, 2025
@victorhmp
victorhmp requested a review from mateuspontes March 24, 2025 11:59
@victorhmp victorhmp changed the title (chore):[CP-323]Add Content Platform schema definitions chore:[CP-323]Add Content Platform schema definitions Mar 24, 2025

@mateuspontes mateuspontes left a comment

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 define the content-type without the anyOf? Or is something we're delegating to the frontend?

@victorhmp

victorhmp commented Mar 25, 2025 •

Copy link
Copy Markdown
Member Author

Did you define the content-type without the anyOf? Or is something we're delegating to the frontend?

I'm adding that into the sync process! Since I need to know the full list of components in order to create the "allow all" definition.

@victorhmp
victorhmp requested a review from mateuspontes March 25, 2025 11:37
@victorhmp victorhmp changed the title chore:[CP-323]Add Content Platform schema definitions chore: [CP-323]Add Content Platform schema definitions Mar 25, 2025
@victorhmp
victorhmp marked this pull request as ready for review March 25, 2025 17:28
@victorhmp
victorhmp requested a review from a team as a code owner March 25, 2025 17:28
@victorhmp
victorhmp requested review from hellofanny and lucasfp13 and removed request for a team March 25, 2025 17:28
@victorhmp
victorhmp force-pushed the feat/content-platform-schemas branch from be27463 to 4505d4d Compare April 23, 2025 20:11
@victorhmp victorhmp changed the title chore: [CP-323]Add Content Platform schema definitions chore: [CP-403]Add Content Platform schema definitions Apr 24, 2025

@mateuspontes mateuspontes left a comment

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.

Nice job! Let's wait for the FS team review

@lariciamota lariciamota left a comment

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.

question: Will we have something like a codemod to help clients migrate to CP? To automatically make their customizations follow this new schema standard

@victorhmp

Copy link
Copy Markdown
Member Author

question: Will we have something like a codemod to help clients migrate to CP? To automatically make their customizations follow this new schema standard

Yes, eventually! We're not sure how that's going to work yet, but we should provide an easy migration path in the future.

@victorhmp
victorhmp force-pushed the feat/content-platform-schemas branch from b749183 to dda6839 Compare June 18, 2025 13:40
@mateuspontes

Copy link
Copy Markdown
Contributor

Fixed the schema after reviews.
Now it should match the content-types from https://github.com/vtex/faststore/blob/main/packages/core/cms/faststore/content-types.json, and all the sections are imported on the Schema Registry: https://vtex.vtexcommercebeta.com.br/api/content-platform/schemas/vtex/schemas/faststore

curl --location 'https://vtex.vtexcommercebeta.com.br/api/content-platform/schemas/vtex/schemas/faststore/plp' \
--header 'Authorization: Bearer ****' \
--data ''

@mateuspontes
mateuspontes requested a review from lariciamota July 21, 2025 14:02

@lariciamota lariciamota left a comment

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.

Hi!
I've missed other sections: Search bar and Region popover

@@ -0,0 +1,78 @@
{

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.

question: We've recently added a new tab in the Global Sections type called "Settings" so we can add some global settings there. Should it be added in this base file?

@@ -0,0 +1,12 @@
{
"login": {

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.

question: why doesn't it require the "$extends": ["#/$defs/base-page-template"],?

Comment on lines +7 to +12
"slug": {
"$componentKey": "Slug",
"$componentTitle": "Slug",
"widget": {
"ui:widget": "slug"
},

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.

question: what is this slug property? In the landingPage content type we have nowadays there are only the SEO properties

Comment on lines +16 to +23
"slug": {
"$componentKey": "Slug",
"$componentTitle": "Slug",
"widget": {
"ui:widget": "slug"
},
"default": "/",
"type": "string"

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.

question: this slug is the "path", right? Should we add a required property for the required properties as we currently have?

@@ -0,0 +1,13 @@
{
"404": {
"$extends": ["#/$defs/base-page-template"],

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.

question: what does the extends do? I ask because I thought the

"properties": {
      "sections": {
        "$ref": "#/$defs/$ALLOW_ALL_COMPONENTS"
      }
    }

wouldn't be needed here because the extends would already do that.

"base-page-template": {
      "type": "object",
      "properties": {
        "sections": {
          "$ref": "#/$defs/$ALLOW_ALL_COMPONENTS"
        }
      }
    },

@@ -0,0 +1,40 @@
{
"$componentKey": "ProductGallery",

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.

It's different from

"name": "ProductGallery",
, is it something else?

"$componentTitle": "Product Tiles",
"type": "object",
"$extends": ["#/$defs/base-component"],
"description": "Add custom shelves to your store",

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.

Suggested change
"description": "Add custom shelves to your store",
"description": "Add custom highlights to your store",

@@ -0,0 +1,55 @@
{
"$componentKey": "RegionBar",
"$componentTitle": "Region Select Bar",

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.

Suggested change
"$componentTitle": "Region Select Bar",
"$componentTitle": "Region Bar",

"$componentKey": "RegionBar",
"$componentTitle": "Region Select Bar",
"$extends": ["#/$defs/base-component"],
"description": "Region Select Bar configuration",

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.

Suggested change
"description": "Region Select Bar configuration",
"description": "Region Bar configuration",

"editLabel": {
"title": "Location edit label",
"type": "string",
"default": "Edit"

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.

Another deprecated property, we could remove it or change it like that:

Suggested change
"default": "Edit"
"default": "",
"description": "[Deprecated] This label should not be used anymore."

lariciamota pushed a commit that referenced this pull request Aug 1, 2025
…omponentKey (#2915)

## What's the purpose of this pull request?

This PR makes it so FastStore Core is capable of rendering components
based on data from the CMS, using `$componentKey`s to identity each
component. It also adds the `$componentKey`s to each component, based on
their new schemas (for Content Platform) added in [this
PR](#2742).

## How it works?

The implementation here is backwards compatible, so during the existing
rendering flow a new check was added to look for the `$componentKey`
property in a section's data. Also, for each component that renders a
section, the `$componentKey` property was added, then, when indexing all
available components, the new property will now be used if its present.
To keep backwards compatibility, the `$componentKey`s are matching the
names of the components.

## How to test it?

Since this change should be totally backwards compatible, if you're
testing this branch with any current store, fetching data from hCMS, you
should see no change in behaviour and everything should still render
normally. Running `@faststore/core` locally also should look normal.

You can also test this by using this branch alongside the new CP client
being used in #2807.
@mateuspontes

Copy link
Copy Markdown
Contributor

Closing it in favor of #3071

@victorhmp victorhmp closed this Oct 20, 2025
lariciamota pushed a commit that referenced this pull request Dec 16, 2025
## What's the purpose of this pull request?

This PR adds the schema definitions for components and content types
that will be used by CMS (Content Platform).

A big change introduced is regarding how we're allowing schema
definitions for components to be broken into multiple json | jsonc
files.
A second significant change is the `base.jsonc` file. It's a special
file used only by the Consumer. In this case, Faststore is a Consumer
and must maintain this base file. This **must** not be sent to the
clients.

This PR replaces the #2742 

## How it works?

This PR splits the sections.json and content-types.json file into many
components.

- packages/core/cms/faststore/components/.*jsonc
- packages/core/cms/faststore/content-types/.*jsonc

It also adds a base.jsonc exclusive for Faststore (it must not be shared
with the Developer).
- packages/core/cms/faststore/base.jsonc

The content CLI (CMS) can combine the files, generate an output, and
send it to the Schema Registry.
- packages/core/cms/faststore/schema.json (final schema output)

The Faststore is the base schema for all Merchants. 🚀 

## How to test it?

Install the Content plugin and check the available commands
```bash
vtex plugins install @vtex/cli-plugin-content
```

Migrate the **sections** from hCMS to the new CMS:
```bash
vtex content split-components -i cms/faststore/sections.json -o cms/faststore/components
```

Migrate the **content-types** from hCMS to the new CMS:
```bash
vtex content split-content-types -i packages/core/cms/faststore/content-types.json -s packages/core/cms/faststore/sections.json -o packages/core/cms/faststore/content-types
```

When you are ready, you can generate the final output:
**IMPORTANT**: The Faststore Core Team is the only one that needs to add
the `-l base.jsonc` to the output. Merchants will automatically use the
base from the Schema Registry.

```bash
vtex content generate-schema packages/core/cms/faststore/components packages/core/cms/faststore/content-types -l packages/core/cms/faststore/base.jsonc -o packages/core/cms/faststore/schema.json
```

Finally, send the output schema to the Schema Registry 🚀 
IMPORTANT: This command is equivalent to the hCMS cms-sync function.
```bash
vtex content upload-schema
```

## References

[Schema Registry for CMS (content
platform)](https://github.com/vtex/content-platform/tree/main/services/schema-registry-api)
[Content Plugin CLI](https://github.com/vtex/cli-plugin-content)
[Split command](vtex/cli-plugin-content#13)

**Documentation**

- [x] For documentation changes, ping `@Mariana-Caetano` to review and
update (Or submit a doc request)

---------

Co-authored-by: Lucas Feijó <[email protected]>
thiagopereira-vtex pushed a commit that referenced this pull request Jan 8, 2026
## What's the purpose of this pull request?

This PR adds the schema definitions for components and content types
that will be used by CMS (Content Platform).

A big change introduced is regarding how we're allowing schema
definitions for components to be broken into multiple json | jsonc
files.
A second significant change is the `base.jsonc` file. It's a special
file used only by the Consumer. In this case, Faststore is a Consumer
and must maintain this base file. This **must** not be sent to the
clients.

This PR replaces the #2742 

## How it works?

This PR splits the sections.json and content-types.json file into many
components.

- packages/core/cms/faststore/components/.*jsonc
- packages/core/cms/faststore/content-types/.*jsonc

It also adds a base.jsonc exclusive for Faststore (it must not be shared
with the Developer).
- packages/core/cms/faststore/base.jsonc

The content CLI (CMS) can combine the files, generate an output, and
send it to the Schema Registry.
- packages/core/cms/faststore/schema.json (final schema output)

The Faststore is the base schema for all Merchants. 🚀 

## How to test it?

Install the Content plugin and check the available commands
```bash
vtex plugins install @vtex/cli-plugin-content
```

Migrate the **sections** from hCMS to the new CMS:
```bash
vtex content split-components -i cms/faststore/sections.json -o cms/faststore/components
```

Migrate the **content-types** from hCMS to the new CMS:
```bash
vtex content split-content-types -i packages/core/cms/faststore/content-types.json -s packages/core/cms/faststore/sections.json -o packages/core/cms/faststore/content-types
```

When you are ready, you can generate the final output:
**IMPORTANT**: The Faststore Core Team is the only one that needs to add
the `-l base.jsonc` to the output. Merchants will automatically use the
base from the Schema Registry.

```bash
vtex content generate-schema packages/core/cms/faststore/components packages/core/cms/faststore/content-types -l packages/core/cms/faststore/base.jsonc -o packages/core/cms/faststore/schema.json
```

Finally, send the output schema to the Schema Registry 🚀 
IMPORTANT: This command is equivalent to the hCMS cms-sync function.
```bash
vtex content upload-schema
```

## References

[Schema Registry for CMS (content
platform)](https://github.com/vtex/content-platform/tree/main/services/schema-registry-api)
[Content Plugin CLI](https://github.com/vtex/cli-plugin-content)
[Split command](vtex/cli-plugin-content#13)

**Documentation**

- [x] For documentation changes, ping `@Mariana-Caetano` to review and
update (Or submit a doc request)

---------

Co-authored-by: Lucas Feijó <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants