Convert schema to component, keeping same name

Hi Sebastian,

I’m working on the design of a new app and have realized that some of my schemas should really be components. (I realize that I can use them as components, but I want them to be true components so that content people can’t create records in those schemas.)

I could clone them, but I really want to keep their current names. I thought perhaps I could use the CLI to export the schema, delete the live version, then (somehow) sync it back in as a component. But there doesn’t seem to be anything inside the schema’s json that identifies it as a component, and I can’t find a CLI command or option to identify it as a component when I sync.

Any tips on this would be greatly appreciated. I’d rather not have to recreate them manually as components.

Thanks!

Actually, nevermind. I figured it out just after posting, but thought I should provide my solution here in case it helps anyone else.

The steps to “convert” a schema to a component are:

  1. Use the CLI to export the schema json.
  2. Delete the schema.
  3. Create the component, using the same name.
  4. Use the CLI to sync the exported schema json. (It will add the fields to the component it finds with the same name.)