-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
CTF-next: use union for reference fields with validation #31395
CTF-next: use union for reference fields with validation #31395
Conversation
a435455
to
c3d64b4
Compare
95366fc
to
4656166
Compare
c3d64b4
to
2e685a4
Compare
Unfortunately field validations are not exposed for single reference fields. This blocks us from finishing this feature. I escalated this problem to the Contentful API team. Will keep u posted if I hear back. Here is a example response from CDA content-types: {
"id": "oneItemSingleType",
"name": "One Item: Single Type",
"type": "Link",
"localized": false,
"required": false,
"disabled": false,
"omitted": false,
"linkType": "Entry"
}
{
"id": "oneItemManyTypes",
"name": "One Item: Many Types",
"type": "Link",
"localized": false,
"required": false,
"disabled": false,
"omitted": false,
"linkType": "Entry"
}
{
"id": "oneItemAllTypes",
"name": "One Item: All Types",
"type": "Link",
"localized": false,
"required": false,
"disabled": false,
"omitted": false,
"linkType": "Entry"
}
{
"id": "multipleItemsSingleType",
"name": "Multiple Items: Single Type",
"type": "Array",
"localized": false,
"required": false,
"disabled": false,
"omitted": false,
"items": {
"type": "Link",
"validations": [
{
"linkContentType": [
"text"
]
}
],
"linkType": "Entry"
}
}
{
"id": "multipleItemsManyTypes",
"name": "Multiple Items: Many Types",
"type": "Array",
"localized": false,
"required": false,
"disabled": false,
"omitted": false,
"items": {
"type": "Link",
"validations": [
{
"linkContentType": [
"number",
"text"
]
}
],
"linkType": "Entry"
}
}
{
"id": "multipleItemsAllTypes",
"name": "Multiple Items: All Types",
"type": "Array",
"localized": false,
"required": false,
"disabled": false,
"omitted": false,
"items": {
"type": "Link",
"validations": [],
"linkType": "Entry"
}
} |
4656166
to
61f846c
Compare
61f846c
to
a5ddad2
Compare
849e5a3
to
05324da
Compare
a0d7001
to
15ab773
Compare
4f7e213
to
3a03727
Compare
15ab773
to
f2916cc
Compare
6f85503
to
d670466
Compare
We got a patch ready that exposes the field validation for single reference fields. I'll merge this PR into #30855 as soon we released the updated API to the public. |
380d85b
to
c342248
Compare
953c3e2
to
266ef16
Compare
266ef16
to
0468b64
Compare
WIP - first try to use union for reference field with validations fix multi reference fields shorten union names support multiple reference fields for a single content type fix: type name generation remove comment introduce validation for single reference fields
0468b64
to
bf317a5
Compare
Looks good now. Will add tests and merge into main PR :) |
Also: * test: add unit tests for schema customization * fix: rich text inline rendering * test: update e2e test schema dump
Also: * test: add unit tests for schema customization * fix: rich text inline rendering * test: update e2e test schema dump
Also: * test: add unit tests for schema customization * fix: rich text inline rendering * test: update e2e test schema dump
Also: * test: add unit tests for schema customization * fix: rich text inline rendering * test: update e2e test schema dump
Also: * test: add unit tests for schema customization * fix: rich text inline rendering * test: update e2e test schema dump
Also: * test: add unit tests for schema customization * fix: rich text inline rendering * test: update e2e test schema dump
Also: * test: add unit tests for schema customization * fix: rich text inline rendering * test: update e2e test schema dump
The current state allows you to query all content types in a reference field, even when the user/editor can not select it based on Contentful's field validations.
This change will adjust the schema to reflect the decisions made in the Contentful reference field validations.
Note: This is blocked from merging till Contentful CDA API delivers single reference field validations. A patch for the API is in progress :)