Open Jgfrausing opened 3 years ago
I second this issue, and will add that fields that are not localized still get an additional nesting to explicitly say which locale it is.
While a getEntries()
query with default locale used locale: 'en'
might result in
{
title: 'Foo',
slug: 'Bar'
}
A query with locale: '*'
might look like this (assuming slug is localized and title is not)
{
title: {
en: 'Foo'
},
slug: {
en: 'Bar',
es: 'Bár'
}
}
This may be specific to my particular Contentful setup, but it would be nice if this package supported this! (I'm very appreciative this package exists in the first place, to be clear.)
A call to:
getEntries({content_type: 'example', locale: 'en'})
matches the following generated typesHowever, if requesting all languages with
getEntries({content_type: 'example', locale: '*'})
, the return type is instead (assuming title is not localised and slug is):where the types in slug corresponds to {locale: slug}
I suggest extending the codegen to create IExampleFieldsWithLocalisation. This way it is possible to extend getEntries to return different types based on the locale.
I suspect contentful has designed it like this to avoid returning the
sys
object multiple times.