Skip to content

Commit 9481e85

Browse files
Fixed CI and broken content md files (#691)
Co-authored-by: Mike Bifulco <mike@apisyouwonthate.com>
1 parent 8ffe77a commit 9481e85

11 files changed

Lines changed: 117 additions & 99 deletions

File tree

src/content.config.ts

Lines changed: 107 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -7,109 +7,127 @@ import { icons } from './components/Icon';
77

88
const iconNames = Object.keys(icons);
99

10-
const BannerSponsorSchema = z.object({
11-
name: z.string(),
12-
description: z.string(),
13-
ctaText: z.string().max(20), // 20 characters max
14-
ctaUrl: z.url(),
15-
});
10+
const BannerSponsorSchema = z
11+
.object({
12+
name: z.string(),
13+
description: z.string(),
14+
ctaText: z.string().max(20), // 20 characters max
15+
ctaUrl: z.url(),
16+
})
17+
.strict();
1618

1719
export type BannerSponsor = z.infer<typeof BannerSponsorSchema>;
1820

19-
const CategorySchema = z.object({
20-
name: z.string(),
21-
description: z.string(),
22-
icon: z
23-
.string()
24-
.optional()
25-
.nullable()
26-
.refine((value) => !value || (value && iconNames.includes(value)), {
27-
message: 'Invalid icon name. Must be one of: ' + iconNames.join(', '),
28-
}),
29-
});
21+
const CategorySchema = z
22+
.object({
23+
name: z.string(),
24+
description: z.string(),
25+
icon: z
26+
.string()
27+
.optional()
28+
.nullable()
29+
.refine((value) => !value || (value && iconNames.includes(value)), {
30+
message: 'Invalid icon name. Must be one of: ' + iconNames.join(', '),
31+
}),
32+
})
33+
.strict();
3034

3135
export type Category = z.infer<typeof CategorySchema>;
3236

33-
const BadgeSchema = z.object({
34-
id: z.string(),
35-
name: z.string(),
36-
description: z.string(),
37-
icon: z.string().optional(),
38-
variant: z.enum(['gold', 'silver', 'bronze', 'blue']).optional(),
39-
});
37+
const BadgeSchema = z
38+
.object({
39+
id: z.string(),
40+
name: z.string(),
41+
description: z.string(),
42+
icon: z.string().optional(),
43+
variant: z.enum(['gold', 'silver', 'bronze', 'blue']).optional(),
44+
})
45+
.strict();
4046

4147
export type Badge = z.infer<typeof BadgeSchema>;
4248

43-
const ToolSchema = z.object({
44-
name: z.string(),
45-
description: z.string(),
46-
categories: z.array(reference('categories')),
47-
languages: z.record(z.string(), z.boolean()).optional(),
48-
link: z.url().optional(),
49-
repo: z.url().optional(),
50-
oasVersions: z
51-
.object({
52-
v2: z.boolean().optional(),
53-
v3: z.boolean().optional(),
54-
v3_1: z.boolean().optional(),
55-
v3_2: z.boolean().optional(),
56-
})
57-
.optional(),
58-
oaiSpecs: z
59-
.object({
60-
oas: z.boolean().optional(),
61-
overlays: z.boolean().optional(),
62-
arazzo: z.boolean().optional(),
63-
})
64-
.optional(),
65-
featuredArticles: z
66-
.array(
67-
z.object({
68-
title: z.string(),
69-
url: z.url(),
70-
date: z.date(),
49+
const ToolSchema = z
50+
.object({
51+
name: z.string(),
52+
description: z.string(),
53+
categories: z.array(reference('categories')),
54+
languages: z.record(z.string(), z.boolean()).optional(),
55+
link: z.url().optional(),
56+
repo: z.url().optional(),
57+
oasVersions: z
58+
.object({
59+
v2: z.boolean().optional(),
60+
v3: z.boolean().optional(),
61+
v3_1: z.boolean().optional(),
62+
v3_2: z.boolean().optional(),
7163
})
72-
)
73-
.optional(),
74-
sponsorship: z
75-
.array(
76-
z.object({
77-
startDate: z.date(),
78-
endDate: z.date().optional(), // when sponsorship period ended
79-
url: z.url().optional(), // optionally override default link while sponsored
80-
testimonial: z.string().optional(), // optionally include a testimonial
64+
.strict()
65+
.optional(),
66+
oaiSpecs: z
67+
.object({
68+
oas: z.boolean().optional(),
69+
overlays: z.boolean().optional(),
70+
arazzo: z.boolean().optional(),
8171
})
82-
)
83-
.optional(),
84-
badges: z.array(reference('badges')).optional(),
85-
});
72+
.strict()
73+
.optional(),
74+
featuredArticles: z
75+
.array(
76+
z
77+
.object({
78+
title: z.string(),
79+
url: z.url(),
80+
date: z.date(),
81+
})
82+
.strict()
83+
)
84+
.optional(),
85+
sponsorship: z
86+
.array(
87+
z
88+
.object({
89+
startDate: z.date(),
90+
endDate: z.date().optional(), // when sponsorship period ended
91+
url: z.url().optional(), // optionally override default link while sponsored
92+
testimonial: z.string().optional(), // optionally include a testimonial
93+
})
94+
.strict()
95+
)
96+
.optional(),
97+
badges: z.array(reference('badges')).optional(),
98+
})
99+
.strict();
86100

87101
export type Tool = z.infer<typeof ToolSchema>;
88102

89-
const CollectionFiltersSchema = z.object({
90-
// Language filter - tool.languages[key] === true
91-
languages: z.array(z.string()).optional(),
92-
// Version filter - requires specific version support
93-
requireVersions: z.array(z.enum(['v2', 'v3', 'v3_1', 'v3_2'])).optional(),
94-
// Legacy filter - excludes v3.1+ support
95-
legacy: z.boolean().optional(),
96-
// Open source filter - must have repo URL
97-
requireRepo: z.boolean().optional(),
98-
// SaaS filter - tool.languages.saas === true
99-
saas: z.boolean().optional(),
100-
// Overlays filter - tool.oaiSpecs.overlays === true
101-
overlays: z.boolean().optional(),
102-
// Arazzo filter - tool.oaiSpecs.arazzo === true
103-
arazzo: z.boolean().optional(),
104-
// Badge filter - requires specific badges
105-
requireBadges: z.array(z.string()).optional(),
106-
});
107-
108-
const CollectionSchema = z.object({
109-
name: z.string(),
110-
description: z.string(),
111-
filters: CollectionFiltersSchema.optional(),
112-
});
103+
const CollectionFiltersSchema = z
104+
.object({
105+
// Language filter - tool.languages[key] === true
106+
languages: z.array(z.string()).optional(),
107+
// Version filter - requires specific version support
108+
requireVersions: z.array(z.enum(['v2', 'v3', 'v3_1', 'v3_2'])).optional(),
109+
// Legacy filter - excludes v3.1+ support
110+
legacy: z.boolean().optional(),
111+
// Open source filter - must have repo URL
112+
requireRepo: z.boolean().optional(),
113+
// SaaS filter - tool.languages.saas === true
114+
saas: z.boolean().optional(),
115+
// Overlays filter - tool.oaiSpecs.overlays === true
116+
overlays: z.boolean().optional(),
117+
// Arazzo filter - tool.oaiSpecs.arazzo === true
118+
arazzo: z.boolean().optional(),
119+
// Badge filter - requires specific badges
120+
requireBadges: z.array(z.string()).optional(),
121+
})
122+
.strict();
123+
124+
const CollectionSchema = z
125+
.object({
126+
name: z.string(),
127+
description: z.string(),
128+
filters: CollectionFiltersSchema.optional(),
129+
})
130+
.strict();
113131

114132
export type Collection = z.infer<typeof CollectionSchema>;
115133
export type CollectionFilters = z.infer<typeof CollectionFiltersSchema>;

src/content/tools/nswag.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ oasVersions:
1212
v3: true
1313
v3_1: false
1414
v3_2: false
15-
featureArticles:
15+
featuredArticles:
1616
- title: 'API Code-first: How to Generate OpenAPI from Code'
1717
url: 'https://apisyouwonthate.com/blog/code-first-how-to-generate-openapi-files-in-2024/'
1818
date: 2024-04-11

src/content/tools/redoc.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ oasVersions:
1212
v3: true
1313
v3_1: true
1414
v3_2: false
15-
oasSpecs:
15+
oaiSpecs:
1616
oas: true
1717

1818
featuredArticles:

src/content/tools/rswag.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ oasVersions:
1212
v3: true
1313
v3_1: true
1414
v3_2: false
15-
featureArticles:
15+
featuredArticles:
1616
- title: 'API Code-first: How to Generate OpenAPI from Code'
1717
url: 'https://apisyouwonthate.com/blog/code-first-how-to-generate-openapi-files-in-2024/'
1818
date: 2024-04-11

src/content/tools/scalar.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ languages:
88
vue: true
99
repo: https://github.com/scalar/scalar
1010

11-
oasSpecs:
11+
oaiSpecs:
1212
oas: true
1313

1414
oasVersions:

src/content/tools/stoplight-docs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ link: https://stoplight.io/api-documentation
77
languages:
88
saas: true
99

10-
oasSpecs:
10+
oaiSpecs:
1111
oas: true
1212

1313
oasVersions:

src/content/tools/swagger-core.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ oasVersions:
1313
v3: true
1414
v3_1: true
1515
v3_2: false
16-
featureArticles:
16+
featuredArticles:
1717
- title: 'API Code-first: How to Generate OpenAPI from Code'
1818
url: 'https://apisyouwonthate.com/blog/code-first-how-to-generate-openapi-files-in-2024/'
1919
date: 2024-04-11

src/content/tools/swagger-jsdoc.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ oasVersions:
1111
v3: true
1212
v3_1: true
1313
v3_2: false
14-
featureArticles:
14+
featuredArticles:
1515
- title: 'API Code-first: How to Generate OpenAPI from Code'
1616
url: 'https://apisyouwonthate.com/blog/code-first-how-to-generate-openapi-files-in-2024/'
1717
date: 2024-04-11

src/content/tools/swagger-php.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ oasVersions:
1111
v3: true
1212
v3_1: true
1313
v3_2: false
14-
featureArticles:
14+
featuredArticles:
1515
- title: 'API Code-first: How to Generate OpenAPI from Code'
1616
url: 'https://apisyouwonthate.com/blog/code-first-how-to-generate-openapi-files-in-2024/'
1717
date: 2024-04-11

src/content/tools/swashbuckle.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ oasVersions:
1111
v3: true
1212
v3_1: true
1313
v3_2: false
14-
featureArticles:
14+
featuredArticles:
1515
- title: 'API Code-first: How to Generate OpenAPI from Code'
1616
url: 'https://apisyouwonthate.com/blog/code-first-how-to-generate-openapi-files-in-2024/'
1717
date: 2024-04-11

0 commit comments

Comments
 (0)