You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore(gatsby-source-contentful): move to pluginOptionsSchema (#27322)
* Move gatsby-source-contentful to pluginOptionsSchema
* Remove old validation options tests
* Better error message in case of failed external Contentful validation
* Restore old validation, wrap new one in env var
* use preinit and overwrite defaults
* remove console.log
* fix fetch
Co-authored-by: Abhi Aiyer <abhiaiyer91@gmail.com>
Co-authored-by: Ward Peeters <ward@coding-tech.com>
`Contentful delivery api key, when using the Preview API use your Preview API key`
81
+
)
82
+
.required()
83
+
.empty(),
84
+
spaceId: Joi.string()
85
+
.description(`Contentful spaceId`)
86
+
.required()
87
+
.empty(),
88
+
host: Joi.string()
89
+
.description(
90
+
`The base host for all the API requests, by default it's 'cdn.contentful.com', if you want to use the Preview API set it to 'preview.contentful.com'. You can use your own host for debugging/testing purposes as long as you respect the same Contentful JSON structure.`
91
+
)
92
+
.default(`cdn.contentful.com`)
93
+
.empty(),
94
+
environment: Joi.string()
95
+
.description(
96
+
`The environment to pull the content from, for more info on environments check out this [Guide](https://www.contentful.com/developers/docs/concepts/multiple-environments/).`
97
+
)
98
+
.default(`master`)
99
+
.empty(),
100
+
downloadLocal: Joi.boolean()
101
+
.description(
102
+
`Downloads and caches ContentfulAsset's to the local filesystem. Allows you to query a ContentfulAsset's localFile field, which is not linked to Contentful's CDN. Useful for reducing data usage.
103
+
You can pass in any other options available in the [contentful.js SDK](https://github.com/contentful/contentful.js#configuration).`
104
+
)
105
+
.default(false),
106
+
localeFilter: Joi.func()
107
+
.description(
108
+
`Possibility to limit how many locales/nodes are created in GraphQL. This can limit the memory usage by reducing the amount of nodes created. Useful if you have a large space in contentful and only want to get the data from one selected locale.
109
+
For example, to filter locales on only germany \`localeFilter: locale => locale.code === 'de-DE'\`
110
+
111
+
List of locales and their codes can be found in Contentful app -> Settings -> Locales`
112
+
)
113
+
.default(()=>true),
114
+
forceFullSync: Joi.boolean()
115
+
.description(
116
+
`Prevents the use of sync tokens when accessing the Contentful API.`
117
+
)
118
+
.default(false),
119
+
pageLimit: Joi.number()
120
+
.integer()
121
+
.description(
122
+
`Number of entries to retrieve from Contentful at a time. Due to some technical limitations, the response payload should not be greater than 7MB when pulling content from Contentful. If you encounter this issue you can set this param to a lower number than 100, e.g 50.`
123
+
)
124
+
.default(100),
125
+
proxy: Joi.object()
126
+
.keys({
127
+
host: Joi.string().required(),
128
+
port: Joi.number().required(),
129
+
auth: Joi.object().keys({
130
+
username: Joi.string(),
131
+
password: Joi.string(),
132
+
}),
133
+
})
134
+
.description(
135
+
`Axios proxy configuration. See the [axios request config documentation](https://github.com/mzabriskie/axios#request-config) for further information about the supported values.`
136
+
),
137
+
useNameForId: Joi.boolean()
138
+
.description(
139
+
`Use the content's \`name\` when generating the GraphQL schema e.g. a Content Type called \`[Component] Navigation bar\` will be named \`contentfulComponentNavigationBar\`.
140
+
When set to \`false\`, the content's internal ID will be used instead e.g. a Content Type with the ID \`navigationBar\` will be called \`contentfulNavigationBar\`.
141
+
142
+
Using the ID is a much more stable property to work with as it will change less often. However, in some scenarios, Content Types' IDs will be auto-generated (e.g. when creating a new Content Type without specifying an ID) which means the name in the GraphQL schema will be something like \`contentfulC6XwpTaSiiI2Ak2Ww0oi6qa\`. This won't change and will still function perfectly as a valid field name but it is obviously pretty ugly to work with.
143
+
144
+
If you are confident your Content Types will have natural-language IDs (e.g. \`blogPost\`), then you should set this option to \`false\`. If you are unable to ensure this, then you should leave this option set to \`true\` (the default).`
145
+
)
146
+
.default(true),
147
+
// default plugins passed by gatsby
148
+
plugins: Joi.array(),
149
+
richText: Joi.object()
150
+
.keys({
151
+
resolveFieldLocales: Joi.boolean()
152
+
.description(
153
+
`If you want to resolve the locales in fields of assets and entries that are referenced by rich text (e.g., via embedded entries or entry hyperlinks), set this to \`true\`. Otherwise, fields of referenced assets or entries will be objects keyed by locale.`
0 commit comments