-
Notifications
You must be signed in to change notification settings - Fork 388
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: refactor to use compiled schema
- Loading branch information
Showing
19 changed files
with
3,628 additions
and
1,873 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
3,708 changes: 2,533 additions & 1,175 deletions
3,708
packages/@sanity/schema/test/extractSchema/__snapshots__/extractSchema.test.ts.snap
Large diffs are not rendered by default.
Oops, something went wrong.
432 changes: 331 additions & 101 deletions
432
packages/@sanity/schema/test/extractSchema/extractSchema.test.ts
Large diffs are not rendered by default.
Oops, something went wrong.
26 changes: 26 additions & 0 deletions
26
packages/@sanity/schema/test/extractSchema/fixtures/assetSourceData.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
export default { | ||
name: 'sanity.assetSourceData', | ||
title: 'Asset Source Data', | ||
type: 'object', | ||
fields: [ | ||
{ | ||
name: 'name', | ||
title: 'Source name', | ||
description: 'A canonical name for the source this asset is originating from', | ||
type: 'string', | ||
}, | ||
{ | ||
name: 'id', | ||
title: 'Asset Source ID', | ||
description: | ||
'The unique ID for the asset within the originating source so you can programatically find back to it', | ||
type: 'string', | ||
}, | ||
{ | ||
name: 'url', | ||
title: 'Asset information URL', | ||
description: 'A URL to find more information about this asset in the originating source', | ||
type: 'string', | ||
}, | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 103 additions & 0 deletions
103
packages/@sanity/schema/test/extractSchema/fixtures/fileAsset.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
export default { | ||
name: 'sanity.fileAsset', | ||
title: 'File', | ||
type: 'document', | ||
fieldsets: [ | ||
{ | ||
name: 'system', | ||
title: 'System fields', | ||
description: 'These fields are managed by the system and not editable', | ||
}, | ||
], | ||
fields: [ | ||
{ | ||
name: 'originalFilename', | ||
type: 'string', | ||
title: 'Original file name', | ||
readOnly: true, | ||
}, | ||
{ | ||
name: 'label', | ||
type: 'string', | ||
title: 'Label', | ||
}, | ||
{ | ||
name: 'title', | ||
type: 'string', | ||
title: 'Title', | ||
}, | ||
{ | ||
name: 'description', | ||
type: 'string', | ||
title: 'Description', | ||
}, | ||
{ | ||
name: 'altText', | ||
type: 'string', | ||
title: 'Alternative text', | ||
}, | ||
{ | ||
name: 'sha1hash', | ||
type: 'string', | ||
title: 'SHA1 hash', | ||
readOnly: true, | ||
fieldset: 'system', | ||
}, | ||
{ | ||
name: 'extension', | ||
type: 'string', | ||
title: 'File extension', | ||
readOnly: true, | ||
fieldset: 'system', | ||
}, | ||
{ | ||
name: 'mimeType', | ||
type: 'string', | ||
title: 'Mime type', | ||
readOnly: true, | ||
fieldset: 'system', | ||
}, | ||
{ | ||
name: 'size', | ||
type: 'number', | ||
title: 'File size in bytes', | ||
readOnly: true, | ||
fieldset: 'system', | ||
}, | ||
{ | ||
name: 'assetId', | ||
type: 'string', | ||
title: 'Asset ID', | ||
readOnly: true, | ||
fieldset: 'system', | ||
}, | ||
{ | ||
name: 'uploadId', | ||
type: 'string', | ||
readOnly: true, | ||
hidden: true, | ||
fieldset: 'system', | ||
}, | ||
{ | ||
name: 'path', | ||
type: 'string', | ||
title: 'Path', | ||
readOnly: true, | ||
fieldset: 'system', | ||
}, | ||
{ | ||
name: 'url', | ||
type: 'string', | ||
title: 'Url', | ||
readOnly: true, | ||
fieldset: 'system', | ||
}, | ||
{ | ||
name: 'source', | ||
type: 'sanity.assetSourceData', | ||
title: 'Source', | ||
readOnly: true, | ||
fieldset: 'system', | ||
}, | ||
], | ||
} |
22 changes: 22 additions & 0 deletions
22
packages/@sanity/schema/test/extractSchema/fixtures/geopoint.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
export default { | ||
title: 'Geographical Point', | ||
name: 'geopoint', | ||
type: 'object', | ||
fields: [ | ||
{ | ||
name: 'lat', | ||
type: 'number', | ||
title: 'Latitude', | ||
}, | ||
{ | ||
name: 'lng', | ||
type: 'number', | ||
title: 'Longitude', | ||
}, | ||
{ | ||
name: 'alt', | ||
type: 'number', | ||
title: 'Altitude', | ||
}, | ||
], | ||
} |
108 changes: 108 additions & 0 deletions
108
packages/@sanity/schema/test/extractSchema/fixtures/imageAsset.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
export default { | ||
name: 'sanity.imageAsset', | ||
title: 'Image', | ||
type: 'document', | ||
fieldsets: [ | ||
{ | ||
name: 'system', | ||
title: 'System fields', | ||
description: 'These fields are managed by the system and not editable', | ||
}, | ||
], | ||
fields: [ | ||
{ | ||
name: 'originalFilename', | ||
type: 'string', | ||
title: 'Original file name', | ||
readOnly: true, | ||
}, | ||
{ | ||
name: 'label', | ||
type: 'string', | ||
title: 'Label', | ||
}, | ||
{ | ||
name: 'title', | ||
type: 'string', | ||
title: 'Title', | ||
}, | ||
{ | ||
name: 'description', | ||
type: 'string', | ||
title: 'Description', | ||
}, | ||
{ | ||
name: 'altText', | ||
type: 'string', | ||
title: 'Alternative text', | ||
}, | ||
{ | ||
name: 'sha1hash', | ||
type: 'string', | ||
title: 'SHA1 hash', | ||
readOnly: true, | ||
fieldset: 'system', | ||
}, | ||
{ | ||
name: 'extension', | ||
type: 'string', | ||
readOnly: true, | ||
title: 'File extension', | ||
fieldset: 'system', | ||
}, | ||
{ | ||
name: 'mimeType', | ||
type: 'string', | ||
readOnly: true, | ||
title: 'Mime type', | ||
fieldset: 'system', | ||
}, | ||
{ | ||
name: 'size', | ||
type: 'number', | ||
title: 'File size in bytes', | ||
readOnly: true, | ||
fieldset: 'system', | ||
}, | ||
{ | ||
name: 'assetId', | ||
type: 'string', | ||
title: 'Asset ID', | ||
readOnly: true, | ||
fieldset: 'system', | ||
}, | ||
{ | ||
name: 'uploadId', | ||
type: 'string', | ||
readOnly: true, | ||
hidden: true, | ||
fieldset: 'system', | ||
}, | ||
{ | ||
name: 'path', | ||
type: 'string', | ||
title: 'Path', | ||
readOnly: true, | ||
fieldset: 'system', | ||
}, | ||
{ | ||
name: 'url', | ||
type: 'string', | ||
title: 'Url', | ||
readOnly: true, | ||
fieldset: 'system', | ||
}, | ||
{ | ||
name: 'metadata', | ||
type: 'sanity.imageMetadata', | ||
title: 'Metadata', | ||
}, | ||
{ | ||
name: 'source', | ||
type: 'sanity.assetSourceData', | ||
title: 'Source', | ||
readOnly: true, | ||
fieldset: 'system', | ||
}, | ||
], | ||
} |
23 changes: 23 additions & 0 deletions
23
packages/@sanity/schema/test/extractSchema/fixtures/imageCrop.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
export default { | ||
name: 'sanity.imageCrop', | ||
title: 'Image crop', | ||
type: 'object', | ||
fields: [ | ||
{ | ||
name: 'top', | ||
type: 'number', | ||
}, | ||
{ | ||
name: 'bottom', | ||
type: 'number', | ||
}, | ||
{ | ||
name: 'left', | ||
type: 'number', | ||
}, | ||
{ | ||
name: 'right', | ||
type: 'number', | ||
}, | ||
], | ||
} |
10 changes: 10 additions & 0 deletions
10
packages/@sanity/schema/test/extractSchema/fixtures/imageDimensions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export default { | ||
name: 'sanity.imageDimensions', | ||
type: 'object', | ||
title: 'Image dimensions', | ||
fields: [ | ||
{name: 'height', type: 'number', title: 'Height', readOnly: true}, | ||
{name: 'width', type: 'number', title: 'Width', readOnly: true}, | ||
{name: 'aspectRatio', type: 'number', title: 'Aspect ratio', readOnly: true}, | ||
], | ||
} |
Oops, something went wrong.