Setting a field type as long or short text, or as the title field with the Migration CLI

Hello,

I’m trying to evaluate if we can start using the Migration CLI for a project that’s starting soon. I’m using it to create some existing content types to see if I can replicate them.

When I use the UI to create content type, I can set the type as long or short text. I have no idea how Contentful retains that information across imports and exports though because I can’t find that information when I export the space.

Is there a way to set the type to short text with the CLI? What about making the editor display as Markdown or single line?

Finally, can I programatically set the title field, or is it always the first field I create?

If there are any major things that the CLI can’t yet do that the UI can, I’d like to be aware of them as well.

Thanks very much!

Hi there!

The properties that are used to communicate with the API are sometimes named a bit differently from the labels they are given in the UI, so it may not be immediately clear what corresponds to what.

  • Whether a field has long or short text is set in the type property of a field. Short text is type Symbol and long text is type Text. You can find these properties in the space export file as well.

  • Setting a field’s type to Text or Symbol determines the way it’s displayed in the editor (simple input field vs. markdown)

  • A content type’s title field is set through the displayField property on the content type. When creating the content type, you can choose which field you’d like to be the displayField

  • In terms of functionality regarding content types, the migration CLI should cover most of what you can do in the UI. One thing that you cannot do with the Migration CLI, however, is picking how you would like list fields to appear in the editor.

Does this answer your questions? Good luck with your project!

3 Likes

Hi Julia,

Thanks very much for that answer. I’m sure if I had read more carefully the docs would have said that but I’m pretty sure I skimmed over “symbol”. I’m glad to know about the list field limitation, but I don’t think that’s a problem for us.

Regards,
Dustin

@dustin.aleksiuk maybe it’s worth mentioning, that it’s not limited to how list fields look (but that’s a common example), but around everything that involves “Editor Interfaces”, which define how fields should appear to the editors.

@stephan.schneider

Are you saying that I can change those values using the migration CLI? I looked at your link but I don’t see how to map the API docs to the CLI.

@dustin.aleksiuk no, that was to clarify that it’s not possible to do anything related to Editor Interfaces (yet), sorry for the confusion :slightly_frowning_face:

1 Like