-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Thank you for a very useful tool! I'm in the process of incorporating the scripts to our data model and felt there could be a couple more complex examples in the readme. I also read https://strapi.io/blog/migrate-from-contenful-to-strapi, but the examples given there were similarly simple.
Contentful fields with camelCased names
I had trouble getting these right. I think these need to be snake_cased in the model and representer? For example for a field productDescription in Contentful (and Strapi):
# model
module Contentful
class Product
include StrapiDocumentConnected
attr_accessor :product_rescription, :start_date
...# representer
nested :fields do
%w[product_description, start_date].each do |property_name|
nested property_name do
property property_name.underscore.to_sym, as: :fi_fi
end
end
nested :sys do
property :contentful_id, as: :id
end
endAnd also in the Strapi representer?
module Strapi
class ProductRepresenter < BaseRepresenter
property :product_description
property :start_date
end
endSingle links
The README could have for reference an example of a link that links to a single item, to show they use the singular name and property link in representer:
module Contentful
class Coverage
include StrapiDocumentConnected
link_object source: :label_i18n_key_link, target: :label_i18n_key # target snake cased here as well?
api_path '/api/coverages'
contentful_content_type 'coverage'
end
endAnd in the representer property instead of collection:
module Contentful
class CoverageRepresenter < Representable::Decorator
include Representable::JSON
nested :fields do
nested :label_i18n_key do
property :label_i18n_key_link, decorator: Contentful::EntryLinkRepresenter, class: Contentful::TranslationLink, as: :fi_fi
end
...List of strings in Contentful
I have no idea how these should work :D We have some fields in Contentful where the type is "Short text, list" and this seems to create a "component" in Strapi, but doesn't populate the content there. An example would be welcome, if these can be imported.