-
Notifications
You must be signed in to change notification settings - Fork 8
expose metadata hooks in react package #882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
MillanWangGadget
commented
Jul 30, 2025
- UPDATE
- Exposing the metadata getter hooks that are used in auto comps from the react package
- Sometimes it could be useful to get that metadata in other contexts like getting the enum options to control a filter configuration
Click to expand sample model metadata result {
"data": {
"gadgetMeta": {
"modelAndRelatedModels": [
{
"key": "5CBR6ZRswtx1",
"apiIdentifier": "autoTableTest",
"namespace": [],
"name": "Auto table test",
"fields": [
{
"name": "Id",
"apiIdentifier": "id",
"fieldType": "ID",
"requiredArgumentForInput": true,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetGenericFieldConfig",
"fieldType": "ID",
"validations": [
{
"__typename": "GadgetGenericFieldValidation",
"name": "Uniqueness",
"specID": "gadget/validation/unique"
},
{
"__typename": "GadgetGenericFieldValidation",
"name": "Required",
"specID": "gadget/validation/required"
}
]
}
},
{
"name": "Email",
"apiIdentifier": "email",
"fieldType": "Email",
"requiredArgumentForInput": false,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetGenericFieldConfig",
"fieldType": "Email",
"validations": []
}
},
{
"name": "Str",
"apiIdentifier": "str",
"fieldType": "String",
"requiredArgumentForInput": false,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetGenericFieldConfig",
"fieldType": "String",
"validations": []
}
},
{
"name": "Num",
"apiIdentifier": "num",
"fieldType": "Number",
"requiredArgumentForInput": false,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetNumberConfig",
"fieldType": "Number",
"validations": [],
"decimals": null
}
},
{
"name": "Bool",
"apiIdentifier": "bool",
"fieldType": "Boolean",
"requiredArgumentForInput": false,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetGenericFieldConfig",
"fieldType": "Boolean",
"validations": []
}
},
{
"name": "Enum",
"apiIdentifier": "enum",
"fieldType": "Enum",
"requiredArgumentForInput": false,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetEnumConfig",
"fieldType": "Enum",
"validations": [],
"allowMultiple": true,
"allowOther": true,
"options": [
{
"name": "hello",
"color": "#FCFCFC",
"__typename": "GadgetEnumOption"
},
{
"name": "world",
"color": "#606060",
"__typename": "GadgetEnumOption"
},
{
"name": "zhao shang hao",
"color": "#DF2222",
"__typename": "GadgetEnumOption"
},
{
"name": "marhaban",
"color": "#E26722",
"__typename": "GadgetEnumOption"
},
{
"name": "privyet",
"color": "#E2CD2E",
"__typename": "GadgetEnumOption"
},
{
"name": "hola",
"color": "#67CA48",
"__typename": "GadgetEnumOption"
},
{
"name": "bonjour",
"color": "#56BFCC",
"__typename": "GadgetEnumOption"
},
{
"name": "zdravo",
"color": "#3280D6",
"__typename": "GadgetEnumOption"
},
{
"name": "Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long ",
"color": "#723FD3",
"__typename": "GadgetEnumOption"
}
]
}
},
{
"name": "Dt",
"apiIdentifier": "dt",
"fieldType": "DateTime",
"requiredArgumentForInput": false,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetDateTimeConfig",
"fieldType": "DateTime",
"validations": [],
"includeTime": true
}
},
{
"name": "Url",
"apiIdentifier": "url",
"fieldType": "URL",
"requiredArgumentForInput": false,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetGenericFieldConfig",
"fieldType": "URL",
"validations": []
}
},
{
"name": "Rt",
"apiIdentifier": "rt",
"fieldType": "RichText",
"requiredArgumentForInput": false,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetGenericFieldConfig",
"fieldType": "RichText",
"validations": []
}
},
{
"name": "File",
"apiIdentifier": "file",
"fieldType": "File",
"requiredArgumentForInput": false,
"sortable": false,
"filterable": false,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetGenericFieldConfig",
"fieldType": "File",
"validations": []
}
},
{
"name": "Json",
"apiIdentifier": "json",
"fieldType": "JSON",
"requiredArgumentForInput": false,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetGenericFieldConfig",
"fieldType": "JSON",
"validations": []
}
},
{
"name": "Es",
"apiIdentifier": "es",
"fieldType": "EncryptedString",
"requiredArgumentForInput": false,
"sortable": false,
"filterable": false,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetGenericFieldConfig",
"fieldType": "EncryptedString",
"validations": []
}
},
{
"name": "Pwd",
"apiIdentifier": "pwd",
"fieldType": "Password",
"requiredArgumentForInput": false,
"sortable": false,
"filterable": false,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetGenericFieldConfig",
"fieldType": "Password",
"validations": [
{
"__typename": "GadgetGenericFieldValidation",
"name": "Strong password",
"specID": "gadget/validation/password"
}
]
}
},
{
"name": "Rl",
"apiIdentifier": "rl",
"fieldType": "RoleAssignments",
"requiredArgumentForInput": false,
"sortable": false,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetGenericFieldConfig",
"fieldType": "RoleAssignments",
"validations": []
}
},
{
"name": "Has one",
"apiIdentifier": "hasOne",
"fieldType": "HasOne",
"requiredArgumentForInput": false,
"sortable": false,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetHasOneConfig",
"fieldType": "HasOne",
"validations": [],
"relatedModel": {
"key": "BiA3DmG_1AlG",
"name": "Foo",
"apiIdentifier": "foo",
"namespace": [],
"__typename": "GadgetModel"
},
"inverseField": {
"apiIdentifier": "belongsToParent",
"__typename": "GadgetModelField"
}
}
},
{
"name": "Has many",
"apiIdentifier": "hasMany",
"fieldType": "HasMany",
"requiredArgumentForInput": false,
"sortable": false,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetHasManyConfig",
"fieldType": "HasMany",
"validations": [],
"isJoinModelHasManyField": false,
"relatedModel": {
"key": "BiA3DmG_1AlG",
"name": "Foo",
"apiIdentifier": "foo",
"namespace": [],
"__typename": "GadgetModel"
},
"inverseField": {
"apiIdentifier": "manyBelongsToParent",
"__typename": "GadgetModelField"
}
}
},
{
"name": "Computed",
"apiIdentifier": "computed",
"fieldType": "Computed",
"requiredArgumentForInput": false,
"sortable": false,
"filterable": false,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetGenericFieldConfig",
"fieldType": "Computed",
"validations": []
}
},
{
"name": "Vect",
"apiIdentifier": "vect",
"fieldType": "Vector",
"requiredArgumentForInput": false,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetGenericFieldConfig",
"fieldType": "Vector",
"validations": []
}
},
{
"name": "Created at",
"apiIdentifier": "createdAt",
"fieldType": "DateTime",
"requiredArgumentForInput": true,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetDateTimeConfig",
"fieldType": "DateTime",
"validations": [
{
"__typename": "GadgetGenericFieldValidation",
"name": "Required",
"specID": "gadget/validation/required"
}
],
"includeTime": true
}
},
{
"name": "Updated at",
"apiIdentifier": "updatedAt",
"fieldType": "DateTime",
"requiredArgumentForInput": true,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetDateTimeConfig",
"fieldType": "DateTime",
"validations": [
{
"__typename": "GadgetGenericFieldValidation",
"name": "Required",
"specID": "gadget/validation/required"
}
],
"includeTime": true
}
}
],
"defaultDisplayField": {
"name": "Email",
"apiIdentifier": "email",
"fieldType": "Email",
"__typename": "GadgetModelField"
},
"__typename": "GadgetModel"
},
{
"key": "BiA3DmG_1AlG",
"apiIdentifier": "foo",
"namespace": [],
"name": "Foo",
"fields": [
{
"name": "Id",
"apiIdentifier": "id",
"fieldType": "ID",
"requiredArgumentForInput": true,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetGenericFieldConfig",
"fieldType": "ID",
"validations": [
{
"__typename": "GadgetGenericFieldValidation",
"name": "Uniqueness",
"specID": "gadget/validation/unique"
},
{
"__typename": "GadgetGenericFieldValidation",
"name": "Required",
"specID": "gadget/validation/required"
}
]
}
},
{
"name": "Name",
"apiIdentifier": "name",
"fieldType": "String",
"requiredArgumentForInput": false,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetGenericFieldConfig",
"fieldType": "String",
"validations": []
}
},
{
"name": "Some number",
"apiIdentifier": "someNumber",
"fieldType": "Number",
"requiredArgumentForInput": false,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetNumberConfig",
"fieldType": "Number",
"validations": [],
"decimals": null
}
},
{
"name": "Some bool",
"apiIdentifier": "someBool",
"fieldType": "Boolean",
"requiredArgumentForInput": false,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetGenericFieldConfig",
"fieldType": "Boolean",
"validations": []
}
},
{
"name": "Belongs to parent",
"apiIdentifier": "belongsToParent",
"fieldType": "BelongsTo",
"requiredArgumentForInput": false,
"sortable": false,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetBelongsToConfig",
"fieldType": "BelongsTo",
"validations": [],
"relatedModel": {
"key": "5CBR6ZRswtx1",
"name": "Auto table test",
"apiIdentifier": "autoTableTest",
"namespace": [],
"__typename": "GadgetModel"
}
}
},
{
"name": "Many belongs to parent",
"apiIdentifier": "manyBelongsToParent",
"fieldType": "BelongsTo",
"requiredArgumentForInput": false,
"sortable": false,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetBelongsToConfig",
"fieldType": "BelongsTo",
"validations": [],
"relatedModel": {
"key": "5CBR6ZRswtx1",
"name": "Auto table test",
"apiIdentifier": "autoTableTest",
"namespace": [],
"__typename": "GadgetModel"
}
}
},
{
"name": "Created at",
"apiIdentifier": "createdAt",
"fieldType": "DateTime",
"requiredArgumentForInput": true,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetDateTimeConfig",
"fieldType": "DateTime",
"validations": [
{
"__typename": "GadgetGenericFieldValidation",
"name": "Required",
"specID": "gadget/validation/required"
}
],
"includeTime": true
}
},
{
"name": "Updated at",
"apiIdentifier": "updatedAt",
"fieldType": "DateTime",
"requiredArgumentForInput": true,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetDateTimeConfig",
"fieldType": "DateTime",
"validations": [
{
"__typename": "GadgetGenericFieldValidation",
"name": "Required",
"specID": "gadget/validation/required"
}
],
"includeTime": true
}
}
],
"defaultDisplayField": {
"name": "Name",
"apiIdentifier": "name",
"fieldType": "String",
"__typename": "GadgetModelField"
},
"__typename": "GadgetModel"
}
],
"__typename": "GadgetApplicationMeta"
}
},
"extensions": {
"logs": "https://ggt.link/logs/114412/ea6075d53bc7cb0a54bc070a497e8c4c",
"traceId": "ea6075d53bc7cb0a54bc070a497e8c4c"
}
} Click to expand sample model action metadata result {
"data": {
"gadgetMeta": {
"modelAndRelatedModels": [
{
"key": "KwFwuOQQ7WJd",
"name": "Stadium",
"namespace": [
"game"
],
"apiIdentifier": "stadium",
"defaultRecord": {
"tags": [],
"__typename": "GameStadium"
},
"fields": [
{
"name": "Id",
"apiIdentifier": "id",
"fieldType": "ID",
"requiredArgumentForInput": true,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetGenericFieldConfig",
"fieldType": "ID",
"validations": [
{
"__typename": "GadgetGenericFieldValidation",
"name": "Uniqueness",
"specID": "gadget/validation/unique"
},
{
"__typename": "GadgetGenericFieldValidation",
"name": "Required",
"specID": "gadget/validation/required"
}
]
}
},
{
"name": "Name",
"apiIdentifier": "name",
"fieldType": "String",
"requiredArgumentForInput": false,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetGenericFieldConfig",
"fieldType": "String",
"validations": []
}
},
{
"name": "Type",
"apiIdentifier": "type",
"fieldType": "Enum",
"requiredArgumentForInput": false,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetEnumConfig",
"fieldType": "Enum",
"validations": [],
"allowMultiple": false,
"allowOther": false,
"options": [
{
"name": "football",
"color": "#FCFCFC",
"__typename": "GadgetEnumOption"
},
{
"name": "basketball",
"color": "#606060",
"__typename": "GadgetEnumOption"
},
{
"name": "baseball",
"color": "#DF2222",
"__typename": "GadgetEnumOption"
}
]
}
},
{
"name": "City",
"apiIdentifier": "city",
"fieldType": "BelongsTo",
"requiredArgumentForInput": false,
"sortable": false,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetBelongsToConfig",
"fieldType": "BelongsTo",
"validations": [],
"relatedModel": {
"key": "mfUOUX8NClda",
"name": "City",
"apiIdentifier": "city",
"namespace": [
"game"
],
"__typename": "GadgetModel"
}
}
},
{
"name": "Tags",
"apiIdentifier": "tags",
"fieldType": "Enum",
"requiredArgumentForInput": false,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetEnumConfig",
"fieldType": "Enum",
"validations": [],
"allowMultiple": true,
"allowOther": true,
"options": [
{
"name": "a",
"color": "#FCFCFC",
"__typename": "GadgetEnumOption"
},
{
"name": "b",
"color": "#606060",
"__typename": "GadgetEnumOption"
}
]
}
},
{
"name": "Rounds",
"apiIdentifier": "rounds",
"fieldType": "HasMany",
"requiredArgumentForInput": false,
"sortable": false,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetHasManyConfig",
"fieldType": "HasMany",
"validations": [],
"isJoinModelHasManyField": false,
"relatedModel": {
"key": "v0yG4wBANpJV",
"name": "Round",
"apiIdentifier": "round",
"namespace": [
"game"
],
"__typename": "GadgetModel"
},
"inverseField": {
"apiIdentifier": "stadium",
"__typename": "GadgetModelField"
}
}
},
{
"name": "Photo",
"apiIdentifier": "photo",
"fieldType": "File",
"requiredArgumentForInput": false,
"sortable": false,
"filterable": false,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetGenericFieldConfig",
"fieldType": "File",
"validations": [
{
"__typename": "GadgetRangeFieldValidation",
"name": "File size range",
"specID": "gadget/validation/file-size-range",
"min": 1000,
"max": 1000000
},
{
"__typename": "GadgetOnlyImageFileFieldValidation",
"name": "Image file",
"specID": "gadget/validation/valid-image-file",
"allowAnimatedImages": false
}
]
}
},
{
"name": "Created at",
"apiIdentifier": "createdAt",
"fieldType": "DateTime",
"requiredArgumentForInput": true,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetDateTimeConfig",
"fieldType": "DateTime",
"validations": [
{
"__typename": "GadgetGenericFieldValidation",
"name": "Required",
"specID": "gadget/validation/required"
}
],
"includeTime": true
}
},
{
"name": "Updated at",
"apiIdentifier": "updatedAt",
"fieldType": "DateTime",
"requiredArgumentForInput": true,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetDateTimeConfig",
"fieldType": "DateTime",
"validations": [
{
"__typename": "GadgetGenericFieldValidation",
"name": "Required",
"specID": "gadget/validation/required"
}
],
"includeTime": true
}
}
],
"defaultDisplayField": {
"name": "Name",
"apiIdentifier": "name",
"fieldType": "String",
"__typename": "GadgetModelField"
},
"__typename": "GadgetModel"
},
{
"key": "mfUOUX8NClda",
"name": "City",
"namespace": [
"game"
],
"apiIdentifier": "city",
"defaultRecord": {
"__typename": "GameCity"
},
"fields": [
{
"name": "Id",
"apiIdentifier": "id",
"fieldType": "ID",
"requiredArgumentForInput": true,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetGenericFieldConfig",
"fieldType": "ID",
"validations": [
{
"__typename": "GadgetGenericFieldValidation",
"name": "Uniqueness",
"specID": "gadget/validation/unique"
},
{
"__typename": "GadgetGenericFieldValidation",
"name": "Required",
"specID": "gadget/validation/required"
}
]
}
},
{
"name": "Name",
"apiIdentifier": "name",
"fieldType": "String",
"requiredArgumentForInput": false,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetGenericFieldConfig",
"fieldType": "String",
"validations": []
}
},
{
"name": "Stadium",
"apiIdentifier": "stadium",
"fieldType": "HasOne",
"requiredArgumentForInput": false,
"sortable": false,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetHasOneConfig",
"fieldType": "HasOne",
"validations": [],
"relatedModel": {
"key": "KwFwuOQQ7WJd",
"name": "Stadium",
"apiIdentifier": "stadium",
"namespace": [
"game"
],
"__typename": "GadgetModel"
},
"inverseField": {
"apiIdentifier": "city",
"__typename": "GadgetModelField"
}
}
},
{
"name": "Tweeters",
"apiIdentifier": "tweeters",
"fieldType": "HasMany",
"requiredArgumentForInput": false,
"sortable": false,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetHasManyConfig",
"fieldType": "HasMany",
"validations": [],
"isJoinModelHasManyField": false,
"relatedModel": {
"key": "r3ZJoWWZ5mUk",
"name": "Tweeter",
"apiIdentifier": "tweeter",
"namespace": [],
"__typename": "GadgetModel"
},
"inverseField": {
"apiIdentifier": "city",
"__typename": "GadgetModelField"
}
}
},
{
"name": "Created at",
"apiIdentifier": "createdAt",
"fieldType": "DateTime",
"requiredArgumentForInput": true,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetDateTimeConfig",
"fieldType": "DateTime",
"validations": [
{
"__typename": "GadgetGenericFieldValidation",
"name": "Required",
"specID": "gadget/validation/required"
}
],
"includeTime": true
}
},
{
"name": "Updated at",
"apiIdentifier": "updatedAt",
"fieldType": "DateTime",
"requiredArgumentForInput": true,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetDateTimeConfig",
"fieldType": "DateTime",
"validations": [
{
"__typename": "GadgetGenericFieldValidation",
"name": "Required",
"specID": "gadget/validation/required"
}
],
"includeTime": true
}
}
],
"defaultDisplayField": {
"name": "Name",
"apiIdentifier": "name",
"fieldType": "String",
"__typename": "GadgetModelField"
},
"__typename": "GadgetModel"
},
{
"key": "lbE1pzH1vPb0",
"name": "Friendship",
"namespace": [],
"apiIdentifier": "friendship",
"defaultRecord": {
"__typename": "Friendship"
},
"fields": [
{
"name": "Id",
"apiIdentifier": "id",
"fieldType": "ID",
"requiredArgumentForInput": true,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetGenericFieldConfig",
"fieldType": "ID",
"validations": [
{
"__typename": "GadgetGenericFieldValidation",
"name": "Uniqueness",
"specID": "gadget/validation/unique"
},
{
"__typename": "GadgetGenericFieldValidation",
"name": "Required",
"specID": "gadget/validation/required"
}
]
}
},
{
"name": "Started",
"apiIdentifier": "started",
"fieldType": "DateTime",
"requiredArgumentForInput": false,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetDateTimeConfig",
"fieldType": "DateTime",
"validations": [],
"includeTime": false
}
},
{
"name": "Ended",
"apiIdentifier": "ended",
"fieldType": "DateTime",
"requiredArgumentForInput": false,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetDateTimeConfig",
"fieldType": "DateTime",
"validations": [],
"includeTime": false
}
},
{
"name": "Follower",
"apiIdentifier": "follower",
"fieldType": "BelongsTo",
"requiredArgumentForInput": false,
"sortable": false,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetBelongsToConfig",
"fieldType": "BelongsTo",
"validations": [],
"relatedModel": {
"key": "r3ZJoWWZ5mUk",
"name": "Tweeter",
"apiIdentifier": "tweeter",
"namespace": [],
"__typename": "GadgetModel"
}
}
},
{
"name": "Followee",
"apiIdentifier": "followee",
"fieldType": "BelongsTo",
"requiredArgumentForInput": false,
"sortable": false,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetBelongsToConfig",
"fieldType": "BelongsTo",
"validations": [],
"relatedModel": {
"key": "r3ZJoWWZ5mUk",
"name": "Tweeter",
"apiIdentifier": "tweeter",
"namespace": [],
"__typename": "GadgetModel"
}
}
},
{
"name": "Created at",
"apiIdentifier": "createdAt",
"fieldType": "DateTime",
"requiredArgumentForInput": true,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetDateTimeConfig",
"fieldType": "DateTime",
"validations": [
{
"__typename": "GadgetGenericFieldValidation",
"name": "Required",
"specID": "gadget/validation/required"
}
],
"includeTime": true
}
},
{
"name": "Updated at",
"apiIdentifier": "updatedAt",
"fieldType": "DateTime",
"requiredArgumentForInput": true,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetDateTimeConfig",
"fieldType": "DateTime",
"validations": [
{
"__typename": "GadgetGenericFieldValidation",
"name": "Required",
"specID": "gadget/validation/required"
}
],
"includeTime": true
}
}
],
"defaultDisplayField": {
"name": "Id",
"apiIdentifier": "id",
"fieldType": "ID",
"__typename": "GadgetModelField"
},
"__typename": "GadgetModel"
},
{
"key": "PInam_N1hwnl",
"name": "Player",
"namespace": [
"game"
],
"apiIdentifier": "player",
"defaultRecord": {
"__typename": "GamePlayer"
},
"fields": [
{
"name": "Id",
"apiIdentifier": "id",
"fieldType": "ID",
"requiredArgumentForInput": true,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetGenericFieldConfig",
"fieldType": "ID",
"validations": [
{
"__typename": "GadgetGenericFieldValidation",
"name": "Uniqueness",
"specID": "gadget/validation/unique"
},
{
"__typename": "GadgetGenericFieldValidation",
"name": "Required",
"specID": "gadget/validation/required"
}
]
}
},
{
"name": "Name",
"apiIdentifier": "name",
"fieldType": "String",
"requiredArgumentForInput": false,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetGenericFieldConfig",
"fieldType": "String",
"validations": []
}
},
{
"name": "Current round",
"apiIdentifier": "currentRound",
"fieldType": "BelongsTo",
"requiredArgumentForInput": false,
"sortable": false,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetBelongsToConfig",
"fieldType": "BelongsTo",
"validations": [],
"relatedModel": {
"key": "v0yG4wBANpJV",
"name": "Round",
"apiIdentifier": "round",
"namespace": [
"game"
],
"__typename": "GadgetModel"
}
}
},
{
"name": "Created at",
"apiIdentifier": "createdAt",
"fieldType": "DateTime",
"requiredArgumentForInput": true,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetDateTimeConfig",
"fieldType": "DateTime",
"validations": [
{
"__typename": "GadgetGenericFieldValidation",
"name": "Required",
"specID": "gadget/validation/required"
}
],
"includeTime": true
}
},
{
"name": "Updated at",
"apiIdentifier": "updatedAt",
"fieldType": "DateTime",
"requiredArgumentForInput": true,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetDateTimeConfig",
"fieldType": "DateTime",
"validations": [
{
"__typename": "GadgetGenericFieldValidation",
"name": "Required",
"specID": "gadget/validation/required"
}
],
"includeTime": true
}
}
],
"defaultDisplayField": {
"name": "Name",
"apiIdentifier": "name",
"fieldType": "String",
"__typename": "GadgetModelField"
},
"__typename": "GadgetModel"
},
{
"key": "v0yG4wBANpJV",
"name": "Round",
"namespace": [
"game"
],
"apiIdentifier": "round",
"defaultRecord": {
"__typename": "GameRound"
},
"fields": [
{
"name": "Id",
"apiIdentifier": "id",
"fieldType": "ID",
"requiredArgumentForInput": true,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetGenericFieldConfig",
"fieldType": "ID",
"validations": [
{
"__typename": "GadgetGenericFieldValidation",
"name": "Uniqueness",
"specID": "gadget/validation/unique"
},
{
"__typename": "GadgetGenericFieldValidation",
"name": "Required",
"specID": "gadget/validation/required"
}
]
}
},
{
"name": "Name",
"apiIdentifier": "name",
"fieldType": "String",
"requiredArgumentForInput": false,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetGenericFieldConfig",
"fieldType": "String",
"validations": []
}
},
{
"name": "Stadium",
"apiIdentifier": "stadium",
"fieldType": "BelongsTo",
"requiredArgumentForInput": true,
"sortable": false,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetBelongsToConfig",
"fieldType": "BelongsTo",
"validations": [
{
"__typename": "GadgetGenericFieldValidation",
"name": "Required",
"specID": "gadget/validation/required"
}
],
"relatedModel": {
"key": "KwFwuOQQ7WJd",
"name": "Stadium",
"apiIdentifier": "stadium",
"namespace": [
"game"
],
"__typename": "GadgetModel"
}
}
},
{
"name": "Players",
"apiIdentifier": "players",
"fieldType": "HasMany",
"requiredArgumentForInput": false,
"sortable": false,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetHasManyConfig",
"fieldType": "HasMany",
"validations": [],
"isJoinModelHasManyField": false,
"relatedModel": {
"key": "PInam_N1hwnl",
"name": "Player",
"apiIdentifier": "player",
"namespace": [
"game"
],
"__typename": "GadgetModel"
},
"inverseField": {
"apiIdentifier": "currentRound",
"__typename": "GadgetModelField"
}
}
},
{
"name": "Created at",
"apiIdentifier": "createdAt",
"fieldType": "DateTime",
"requiredArgumentForInput": true,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetDateTimeConfig",
"fieldType": "DateTime",
"validations": [
{
"__typename": "GadgetGenericFieldValidation",
"name": "Required",
"specID": "gadget/validation/required"
}
],
"includeTime": true
}
},
{
"name": "Updated at",
"apiIdentifier": "updatedAt",
"fieldType": "DateTime",
"requiredArgumentForInput": true,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetDateTimeConfig",
"fieldType": "DateTime",
"validations": [
{
"__typename": "GadgetGenericFieldValidation",
"name": "Required",
"specID": "gadget/validation/required"
}
],
"includeTime": true
}
}
],
"defaultDisplayField": {
"name": "Name",
"apiIdentifier": "name",
"fieldType": "String",
"__typename": "GadgetModelField"
},
"__typename": "GadgetModel"
},
{
"key": "r3ZJoWWZ5mUk",
"name": "Tweeter",
"namespace": [],
"apiIdentifier": "tweeter",
"defaultRecord": {
"__typename": "Tweeter"
},
"fields": [
{
"name": "Id",
"apiIdentifier": "id",
"fieldType": "ID",
"requiredArgumentForInput": true,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetGenericFieldConfig",
"fieldType": "ID",
"validations": [
{
"__typename": "GadgetGenericFieldValidation",
"name": "Uniqueness",
"specID": "gadget/validation/unique"
},
{
"__typename": "GadgetGenericFieldValidation",
"name": "Required",
"specID": "gadget/validation/required"
}
]
}
},
{
"name": "Name",
"apiIdentifier": "name",
"fieldType": "String",
"requiredArgumentForInput": false,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetGenericFieldConfig",
"fieldType": "String",
"validations": []
}
},
{
"name": "City",
"apiIdentifier": "city",
"fieldType": "BelongsTo",
"requiredArgumentForInput": false,
"sortable": false,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetBelongsToConfig",
"fieldType": "BelongsTo",
"validations": [],
"relatedModel": {
"key": "mfUOUX8NClda",
"name": "City",
"apiIdentifier": "city",
"namespace": [
"game"
],
"__typename": "GadgetModel"
}
}
},
{
"name": "Followers",
"apiIdentifier": "followers",
"fieldType": "HasManyThrough",
"requiredArgumentForInput": false,
"sortable": false,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetHasManyThroughConfig",
"fieldType": "HasManyThrough",
"validations": [],
"relatedModel": {
"key": "r3ZJoWWZ5mUk",
"name": "Tweeter",
"apiIdentifier": "tweeter",
"namespace": [],
"__typename": "GadgetModel"
},
"inverseField": {
"apiIdentifier": "followees",
"__typename": "GadgetModelField"
},
"joinModel": {
"key": "lbE1pzH1vPb0",
"apiIdentifier": "friendship",
"namespace": [],
"__typename": "GadgetModel"
},
"inverseJoinModelField": {
"apiIdentifier": "followee",
"__typename": "GadgetModelField"
},
"inverseRelatedModelField": {
"apiIdentifier": "follower",
"__typename": "GadgetModelField"
},
"joinModelHasManyFieldApiIdentifier": "followerFriendships"
}
},
{
"name": "Followees",
"apiIdentifier": "followees",
"fieldType": "HasManyThrough",
"requiredArgumentForInput": false,
"sortable": false,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetHasManyThroughConfig",
"fieldType": "HasManyThrough",
"validations": [],
"relatedModel": {
"key": "r3ZJoWWZ5mUk",
"name": "Tweeter",
"apiIdentifier": "tweeter",
"namespace": [],
"__typename": "GadgetModel"
},
"inverseField": {
"apiIdentifier": "followers",
"__typename": "GadgetModelField"
},
"joinModel": {
"key": "lbE1pzH1vPb0",
"apiIdentifier": "friendship",
"namespace": [],
"__typename": "GadgetModel"
},
"inverseJoinModelField": {
"apiIdentifier": "follower",
"__typename": "GadgetModelField"
},
"inverseRelatedModelField": {
"apiIdentifier": "followee",
"__typename": "GadgetModelField"
},
"joinModelHasManyFieldApiIdentifier": "followeeFriendships"
}
},
{
"name": "Created at",
"apiIdentifier": "createdAt",
"fieldType": "DateTime",
"requiredArgumentForInput": true,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetDateTimeConfig",
"fieldType": "DateTime",
"validations": [
{
"__typename": "GadgetGenericFieldValidation",
"name": "Required",
"specID": "gadget/validation/required"
}
],
"includeTime": true
}
},
{
"name": "Updated at",
"apiIdentifier": "updatedAt",
"fieldType": "DateTime",
"requiredArgumentForInput": true,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetDateTimeConfig",
"fieldType": "DateTime",
"validations": [
{
"__typename": "GadgetGenericFieldValidation",
"name": "Required",
"specID": "gadget/validation/required"
}
],
"includeTime": true
}
},
{
"name": "Follower friendships",
"apiIdentifier": "followerFriendships",
"fieldType": "HasMany",
"requiredArgumentForInput": false,
"sortable": false,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetHasManyConfig",
"fieldType": "HasMany",
"validations": [],
"isJoinModelHasManyField": true,
"relatedModel": {
"key": "lbE1pzH1vPb0",
"name": "Friendship",
"apiIdentifier": "friendship",
"namespace": [],
"__typename": "GadgetModel"
},
"inverseField": {
"apiIdentifier": "followee",
"__typename": "GadgetModelField"
}
}
},
{
"name": "Followee friendships",
"apiIdentifier": "followeeFriendships",
"fieldType": "HasMany",
"requiredArgumentForInput": false,
"sortable": false,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetHasManyConfig",
"fieldType": "HasMany",
"validations": [],
"isJoinModelHasManyField": true,
"relatedModel": {
"key": "lbE1pzH1vPb0",
"name": "Friendship",
"apiIdentifier": "friendship",
"namespace": [],
"__typename": "GadgetModel"
},
"inverseField": {
"apiIdentifier": "follower",
"__typename": "GadgetModelField"
}
}
}
],
"defaultDisplayField": {
"name": "Name",
"apiIdentifier": "name",
"fieldType": "String",
"__typename": "GadgetModelField"
},
"__typename": "GadgetModel"
}
],
"model": {
"key": "KwFwuOQQ7WJd",
"name": "Stadium",
"namespace": [
"game"
],
"apiIdentifier": "stadium",
"defaultRecord": {
"tags": [],
"__typename": "GameStadium"
},
"action": {
"name": "Create",
"apiIdentifier": "create",
"operatesWithRecordIdentity": false,
"isDeleteAction": false,
"isUpsertMetaAction": false,
"inputFields": [
{
"name": "Stadium",
"apiIdentifier": "stadium",
"fieldType": "Object",
"requiredArgumentForInput": false,
"configuration": {
"__typename": "GadgetObjectFieldConfig",
"fieldType": "Object",
"validations": [],
"name": null,
"fields": [
{
"name": "Name",
"apiIdentifier": "name",
"fieldType": "String",
"requiredArgumentForInput": false,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetGenericFieldConfig",
"fieldType": "String",
"validations": []
}
},
{
"name": "Rounds",
"apiIdentifier": "rounds",
"fieldType": "HasMany",
"requiredArgumentForInput": false,
"sortable": false,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetHasManyConfig",
"fieldType": "HasMany",
"validations": [],
"isJoinModelHasManyField": false,
"relatedModel": {
"key": "v0yG4wBANpJV",
"name": "Round",
"apiIdentifier": "round",
"namespace": [
"game"
],
"__typename": "GadgetModel"
},
"inverseField": {
"apiIdentifier": "stadium",
"__typename": "GadgetModelField"
}
}
},
{
"name": "City",
"apiIdentifier": "city",
"fieldType": "BelongsTo",
"requiredArgumentForInput": false,
"sortable": false,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetBelongsToConfig",
"fieldType": "BelongsTo",
"validations": [],
"relatedModel": {
"key": "mfUOUX8NClda",
"name": "City",
"apiIdentifier": "city",
"namespace": [
"game"
],
"__typename": "GadgetModel"
}
}
},
{
"name": "Photo",
"apiIdentifier": "photo",
"fieldType": "File",
"requiredArgumentForInput": false,
"sortable": false,
"filterable": false,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetGenericFieldConfig",
"fieldType": "File",
"validations": [
{
"__typename": "GadgetRangeFieldValidation",
"name": "File size range",
"specID": "gadget/validation/file-size-range",
"min": 1000,
"max": 1000000
},
{
"__typename": "GadgetOnlyImageFileFieldValidation",
"name": "Image file",
"specID": "gadget/validation/valid-image-file",
"allowAnimatedImages": false
}
]
}
},
{
"name": "Type",
"apiIdentifier": "type",
"fieldType": "Enum",
"requiredArgumentForInput": false,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetEnumConfig",
"fieldType": "Enum",
"validations": [],
"allowMultiple": false,
"allowOther": false,
"options": [
{
"name": "football",
"color": "#FCFCFC",
"__typename": "GadgetEnumOption"
},
{
"name": "basketball",
"color": "#606060",
"__typename": "GadgetEnumOption"
},
{
"name": "baseball",
"color": "#DF2222",
"__typename": "GadgetEnumOption"
}
]
}
},
{
"name": "Tags",
"apiIdentifier": "tags",
"fieldType": "Enum",
"requiredArgumentForInput": false,
"sortable": true,
"filterable": true,
"__typename": "GadgetModelField",
"configuration": {
"__typename": "GadgetEnumConfig",
"fieldType": "Enum",
"validations": [],
"allowMultiple": true,
"allowOther": true,
"options": [
{
"name": "a",
"color": "#FCFCFC",
"__typename": "GadgetEnumOption"
},
{
"name": "b",
"color": "#606060",
"__typename": "GadgetEnumOption"
}
]
}
}
]
},
"__typename": "GadgetObjectField"
}
],
"triggers": [
{
"specID": "gadget/trigger/graphql_api",
"__typename": "GadgetTrigger"
}
],
"__typename": "GadgetAction"
},
"__typename": "GadgetModel"
},
"__typename": "GadgetApplicationMeta"
}
},
"extensions": {
"logs": "https://ggt.link/logs/114412/857d813ff4eb91d3b17e538a97712036",
"traceId": "857d813ff4eb91d3b17e538a97712036"
}
} |
@@ -351,7 +351,6 @@ const treeifyModelMetadata = <T extends { key: string; fields: FieldMetadata[]; | |||
|
|||
/** | |||
* Retrieve a given Gadget model's metadata from the backend | |||
* @internal | |||
*/ | |||
export const useModelMetadata = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if the publicly exposed one should take a model manager so you can do
const {metadata} = useModelMetadata(api.todo)
I think both the incoming an outgoing apis need some thought before we expose them publicly I think that the output structure is too complex for public usage and we should think through the ergonomics before we expose it publicly |