Skip to content

Commit 0b01235

Browse files
committed
fix: zod schemas nullable Strapi Media props
1 parent e7a2efe commit 0b01235

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sensinum/astro-strapi-loader",
3-
"version": "1.0.4",
3+
"version": "1.0.5",
44
"description": "Astro loader for Strapi CMS",
55
"keywords": [
66
"astro",
@@ -46,7 +46,8 @@
4646
],
4747
"scripts": {
4848
"dev": "tsc --watch",
49-
"build": "tsc",
49+
"build": "yarn clean && tsc",
50+
"clean": "rm -rf dist",
5051
"test": "jest",
5152
"test:watch": "jest --watch",
5253
"test:coverage": "jest --coverage",
@@ -57,7 +58,8 @@
5758
"prepare": "husky install"
5859
},
5960
"dependencies": {
60-
"astro": "^5.0.0"
61+
"astro": "^5.0.0",
62+
"zod": "^3.24.2"
6163
},
6264
"devDependencies": {
6365
"@astrojs/ts-plugin": "^0.4.0",
@@ -75,7 +77,8 @@
7577
"typescript": "^5.0.0"
7678
},
7779
"peerDependencies": {
78-
"astro": "^5.0.0"
80+
"astro": "^5.0.0",
81+
"zod": "^3.24.2"
7982
},
8083
"engines": {
8184
"node": ">=18.17.0",

src/utils/schema.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ export class StrapiSchemaGenerator {
7171
case "media":
7272
return z.object({
7373
name: z.string(),
74-
alternativeText: z.string().optional(),
75-
caption: z.string().optional(),
74+
alternativeText: z.string().optional().nullable(),
75+
caption: z.string().optional().nullable(),
7676
width: z.number().optional(),
7777
height: z.number().optional(),
7878
formats: z.any().nullable(),
@@ -81,7 +81,7 @@ export class StrapiSchemaGenerator {
8181
mime: z.string(),
8282
size: z.number(),
8383
url: z.string(),
84-
previewUrl: z.string().optional(),
84+
previewUrl: z.string().optional().nullable(),
8585
provider: z.string(),
8686
createdAt: z.string(),
8787
updatedAt: z.string(),

0 commit comments

Comments
 (0)