Skip to content

Commit 0ecd331

Browse files
fix: Add enum for format parameter (#220)
# Description Add a list of allowable strings as an enum type for the format parameter. ## Issue Ticket Number Fixes #142 ## Type of change <!-- Please select all options that are applicable. --> - [ ] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Fix or improve the documentation - [ ] This change requires a documentation update # Checklist <!-- These must all be followed and checked. --> - [x] I have followed the contributing guidelines of this project as mentioned in [CONTRIBUTING.md](/CONTRIBUTING.md) - [x] I have created an [issue](https://github.com/colbyfayock/cloudinary-util/issues) ticket for this PR - [x] I have checked to ensure there aren't other open [Pull Requests](https://github.com/colbyfayock/cloudinary-util/pulls) for the same update/change? - [x] I have performed a self-review of my own code - [ ] I have run tests locally to ensure they all pass - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes needed to the documentation
1 parent 53887cd commit 0ecd331

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

packages/url-loader/src/types/asset.ts

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,36 @@ export const assetOptionsSchema = z.object({
4545
)
4646
.optional(),
4747
format: z
48-
.string()
48+
.enum([
49+
"auto",
50+
"auto:image",
51+
"auto:animated",
52+
"gif",
53+
"png",
54+
"jpg",
55+
"bmp",
56+
"ico",
57+
"pdf",
58+
"tiff",
59+
"eps",
60+
"jpc",
61+
"jp2",
62+
"psd",
63+
"webp",
64+
"zip",
65+
"svg",
66+
"webm",
67+
"wdp",
68+
"hpx",
69+
"djvu",
70+
"ai",
71+
"flif",
72+
"bpg",
73+
"miff",
74+
"tga",
75+
"heic",
76+
"default" // library specific feature to turn off automatic optimization
77+
])
4978
.default("auto")
5079
.describe(
5180
JSON.stringify({

0 commit comments

Comments
 (0)