Skip to content

Commit dcd5537

Browse files
authoredMar 18, 2024
fix: schema extraction object type name (#6014)
1 parent 2f16c94 commit dcd5537

File tree

2 files changed

+1
-36
lines changed

2 files changed

+1
-36
lines changed
 

‎packages/@sanity/schema/src/sanity/extractSchema.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ export function extractSchema(
219219
return {type: 'unknown'} satisfies UnknownTypeNode
220220
}
221221

222-
if (schemaType.type?.name !== 'document') {
222+
if (schemaType.type?.name !== 'document' && schemaType.name !== 'object') {
223223
attributes._type = {
224224
type: 'objectAttribute',
225225
value: {

‎packages/@sanity/schema/test/extractSchema/__snapshots__/extractSchema.test.ts.snap

-35
Original file line numberDiff line numberDiff line change
@@ -1334,13 +1334,6 @@ Array [
13341334
"type": "objectAttribute",
13351335
"value": Object {
13361336
"attributes": Object {
1337-
"_type": Object {
1338-
"type": "objectAttribute",
1339-
"value": Object {
1340-
"type": "string",
1341-
"value": "object",
1342-
},
1343-
},
13441337
"blocks": Object {
13451338
"optional": true,
13461339
"type": "objectAttribute",
@@ -1797,13 +1790,6 @@ Array [
17971790
"value": Object {
17981791
"of": Object {
17991792
"attributes": Object {
1800-
"_type": Object {
1801-
"type": "objectAttribute",
1802-
"value": Object {
1803-
"type": "string",
1804-
"value": "object",
1805-
},
1806-
},
18071793
"author": Object {
18081794
"optional": true,
18091795
"type": "objectAttribute",
@@ -1953,13 +1939,6 @@ Array [
19531939
"value": Object {
19541940
"of": Object {
19551941
"attributes": Object {
1956-
"_type": Object {
1957-
"type": "objectAttribute",
1958-
"value": Object {
1959-
"type": "string",
1960-
"value": "object",
1961-
},
1962-
},
19631942
"aNumber": Object {
19641943
"optional": true,
19651944
"type": "objectAttribute",
@@ -2555,13 +2534,6 @@ Array [
25552534
"value": Object {
25562535
"of": Object {
25572536
"attributes": Object {
2558-
"_type": Object {
2559-
"type": "objectAttribute",
2560-
"value": Object {
2561-
"type": "string",
2562-
"value": "object",
2563-
},
2564-
},
25652537
"aNumber": Object {
25662538
"optional": true,
25672539
"type": "objectAttribute",
@@ -2618,13 +2590,6 @@ Array [
26182590
"type": "objectAttribute",
26192591
"value": Object {
26202592
"attributes": Object {
2621-
"_type": Object {
2622-
"type": "objectAttribute",
2623-
"value": Object {
2624-
"type": "string",
2625-
"value": "object",
2626-
},
2627-
},
26282593
"blocks": Object {
26292594
"optional": true,
26302595
"type": "objectAttribute",

0 commit comments

Comments
 (0)
Please sign in to comment.