@@ -200,11 +200,9 @@ export function withNullableJSONSchemaType(
200200}
201201
202202function entityOrFieldToJsDocs ( {
203- config,
204203 entity,
205204 i18n,
206205} : {
207- config : SanitizedConfig
208206 entity : FlattenedField | SanitizedCollectionConfig | SanitizedGlobalConfig
209207 i18n ?: I18n
210208} ) : string | undefined {
@@ -213,11 +211,10 @@ function entityOrFieldToJsDocs({
213211 if ( typeof entity ?. admin ?. description === 'string' ) {
214212 description = entity ?. admin ?. description
215213 } else if ( typeof entity ?. admin ?. description === 'object' ) {
216- const defaultLocale = config ?. localization ? config ?. localization ?. defaultLocale : undefined
217214 if ( entity ?. admin ?. description ?. en ) {
218215 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 ]
221218 }
222219 } else if ( typeof entity ?. admin ?. description === 'function' && i18n ) {
223220 description = entity ?. admin ?. description ( i18n )
@@ -255,7 +252,7 @@ export function fieldsToJSONSchema(
255252 requiredFieldNames . add ( field . name )
256253 }
257254
258- const fieldDescription = entityOrFieldToJsDocs ( { config , entity : field , i18n } )
255+ const fieldDescription = entityOrFieldToJsDocs ( { entity : field , i18n } )
259256 const baseFieldSchema : JSONSchema4 = { }
260257 if ( fieldDescription ) {
261258 baseFieldSchema . description = fieldDescription
@@ -710,7 +707,7 @@ export function entityToJSONSchema(
710707 ) ,
711708 }
712709
713- const entityDescription = entityOrFieldToJsDocs ( { config , entity, i18n } )
710+ const entityDescription = entityOrFieldToJsDocs ( { entity, i18n } )
714711
715712 if ( entityDescription ) {
716713 jsonSchema . description = entityDescription
0 commit comments