@@ -200,11 +200,9 @@ export function withNullableJSONSchemaType(
200
200
}
201
201
202
202
function entityOrFieldToJsDocs ( {
203
- config,
204
203
entity,
205
204
i18n,
206
205
} : {
207
- config : SanitizedConfig
208
206
entity : FlattenedField | SanitizedCollectionConfig | SanitizedGlobalConfig
209
207
i18n ?: I18n
210
208
} ) : string | undefined {
@@ -213,11 +211,10 @@ function entityOrFieldToJsDocs({
213
211
if ( typeof entity ?. admin ?. description === 'string' ) {
214
212
description = entity ?. admin ?. description
215
213
} else if ( typeof entity ?. admin ?. description === 'object' ) {
216
- const defaultLocale = config ?. localization ? config ?. localization ?. defaultLocale : undefined
217
214
if ( entity ?. admin ?. description ?. en ) {
218
215
description = entity ?. admin ?. description ?. en
219
- } else if ( entity ?. admin ?. description ?. [ defaultLocale ] ) {
220
- description = entity ?. admin ?. description ?. [ defaultLocale ]
216
+ } else if ( entity ?. admin ?. description ?. [ i18n . language ] ) {
217
+ description = entity ?. admin ?. description ?. [ i18n . language ]
221
218
}
222
219
} else if ( typeof entity ?. admin ?. description === 'function' && i18n ) {
223
220
description = entity ?. admin ?. description ( i18n )
@@ -255,7 +252,7 @@ export function fieldsToJSONSchema(
255
252
requiredFieldNames . add ( field . name )
256
253
}
257
254
258
- const fieldDescription = entityOrFieldToJsDocs ( { config , entity : field , i18n } )
255
+ const fieldDescription = entityOrFieldToJsDocs ( { entity : field , i18n } )
259
256
const baseFieldSchema : JSONSchema4 = { }
260
257
if ( fieldDescription ) {
261
258
baseFieldSchema . description = fieldDescription
@@ -710,7 +707,7 @@ export function entityToJSONSchema(
710
707
) ,
711
708
}
712
709
713
- const entityDescription = entityOrFieldToJsDocs ( { config , entity, i18n } )
710
+ const entityDescription = entityOrFieldToJsDocs ( { entity, i18n } )
714
711
715
712
if ( entityDescription ) {
716
713
jsonSchema . description = entityDescription
0 commit comments