feat: jsdocs for generated types, by using admin.description (#9917)

This makes use of admin.description to generate JSDocs for field,
collection and global generated types.


![image](https://github.com/user-attachments/assets/980d825f-49a2-426d-933a-2ff3d205ea24)


![image](https://github.com/user-attachments/assets/d0b1f288-1ea1-4d80-8c05-003d59a4e41a)

For the future, we should add a dedicated property to override these
JSDocs.

You can view the effect of this PR on our test suite generated types
here:
05f552bbbc
This commit is contained in:
Alessio Gravili
2024-12-19 20:22:43 -07:00
committed by GitHub
parent 46e50c4572
commit b3308736c4
21 changed files with 323 additions and 47 deletions

View File

@@ -310,6 +310,9 @@ export interface LexicalMigrateField {
export interface LexicalLocalizedField {
id: string;
title: string;
/**
* Non-localized field with localized block subfields
*/
lexicalBlocksSubLocalized?: {
root: {
type: string;
@@ -325,6 +328,9 @@ export interface LexicalLocalizedField {
};
[k: string]: unknown;
} | null;
/**
* Localized field with localized block subfields
*/
lexicalBlocksLocalized?: {
root: {
type: string;
@@ -475,6 +481,9 @@ export interface ArrayField {
id?: string | null;
}[]
| null;
/**
* Row labels rendered as react components.
*/
rowLabelAsComponent?:
| {
title?: string | null;
@@ -589,6 +598,9 @@ export interface BlockField {
}
)[]
| null;
/**
* The purpose of this field is to test validateExistingBlockIsIdentical works with similar blocks with group fields
*/
blocksWithSimilarGroup?:
| (
| {
@@ -777,9 +789,18 @@ export interface TextField {
id: string;
text: string;
hiddenTextField?: string | null;
/**
* This field should be hidden
*/
adminHiddenTextField?: string | null;
/**
* This field should be disabled
*/
disabledTextField?: string | null;
localizedText?: string | null;
/**
* en description
*/
i18nText?: string | null;
defaultString?: string | null;
defaultEmptyString?: string | null;
@@ -900,8 +921,14 @@ export interface ConditionalLogic {
userConditional?: string | null;
parentGroup?: {
enableParentGroupFields?: boolean | null;
/**
* Ensures we can rely on nested fields within `data`.
*/
siblingField?: string | null;
};
/**
* Ensures we can rely on nested fields within `siblingsData`.
*/
reliesOnParentGroup?: string | null;
groupSelection?: ('group1' | 'group2') | null;
group1?: {
@@ -981,6 +1008,9 @@ export interface EmailField {
email: string;
localizedEmail?: string | null;
emailWithAutocomplete?: string | null;
/**
* en description
*/
i18nEmail?: string | null;
defaultEmail?: string | null;
defaultEmptyString?: string | null;
@@ -1010,6 +1040,9 @@ export interface RadioField {
*/
export interface GroupField {
id: string;
/**
* This is a group.
*/
group: {
text: string;
defaultParent?: string | null;
@@ -1402,6 +1435,9 @@ export interface RichTextField {
[k: string]: unknown;
};
lexicalCustomFields_html?: string | null;
/**
* This rich text field uses the lexical editor.
*/
lexical?: {
root: {
type: string;
@@ -1417,6 +1453,9 @@ export interface RichTextField {
};
[k: string]: unknown;
} | null;
/**
* This select field is rendered here to ensure its options dropdown renders above the rich text toolbar.
*/
selectHasMany?: ('one' | 'two' | 'three' | 'four' | 'five' | 'six')[] | null;
richText: {
[k: string]: unknown;
@@ -1505,6 +1544,9 @@ export interface TabsFields2 {
*/
export interface TabsField {
id: string;
/**
* This should not collapse despite there being many tabs pushing the main fields open.
*/
sidebarField?: string | null;
array: {
text: string;