Skip to content

Commit e0ecdf0

Browse files
authored
Merge pull request #416 from true-false-maybe/main
add more ContentType's
2 parents 259f7b1 + 8adbbed commit e0ecdf0

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

Sources/OpenAPIKitCore/Shared/ContentType.swift

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//
22
// ContentType.swift
3-
//
3+
//
44
//
55
// Created by Mathew Polzin on 12/29/19.
66
//
@@ -111,6 +111,10 @@ public extension Shared.ContentType {
111111
static let form: Self = .init(.form)
112112
/// Graphics Interchange Format
113113
static let gif: Self = .init(.gif)
114+
/// geojson as defined in GeoJSON standard (RFC 7946)
115+
///
116+
/// see: https://datatracker.ietf.org/doc/html/rfc7946#section-12
117+
static let geojson: Self = .init(.geojson)
114118
static let html: Self = .init(.html)
115119
static let javascript: Self = .init(.javascript)
116120
/// JPEG image
@@ -131,9 +135,17 @@ public extension Shared.ContentType {
131135
/// OpenType font
132136
static let otf: Self = .init(.otf)
133137
static let pdf: Self = .init(.pdf)
138+
/// PNG image
139+
static let png: Self = .init(.png)
140+
/// Protocol Buffers
141+
///
142+
/// See: https://protobuf.dev/
143+
static let protobuf: Self = .init(.protobuf)
134144
/// RAR archive
135145
static let rar: Self = .init(.rar)
136146
static let rtf: Self = .init(.rtf)
147+
/// Scalable Vector Graphic (SVG)
148+
static let svg: Self = .init(.svg)
137149
/// Tape Archive (TAR)
138150
static let tar: Self = .init(.tar)
139151
/// TIF image
@@ -142,6 +154,8 @@ public extension Shared.ContentType {
142154
static let ttf: Self = .init(.ttf)
143155
/// Plaintext
144156
static let txt: Self = .init(.txt)
157+
/// Web Picture format (WEBP)
158+
static let webp: Self = .init(.webp)
145159
/// Web Open Font Format
146160
static let woff: Self = .init(.woff)
147161
/// Web Open Font Format
@@ -182,6 +196,10 @@ extension Shared.ContentType {
182196
case docx
183197
/// URL-encoded form data. See also: `multipartForm`.
184198
case form
199+
/// geojson as defined in GeoJSON standard (RFC 7946)
200+
///
201+
/// see: https://datatracker.ietf.org/doc/html/rfc7946#section-12
202+
case geojson
185203
/// Graphics Interchange Format
186204
case gif
187205
case html
@@ -204,9 +222,17 @@ extension Shared.ContentType {
204222
/// OpenType font
205223
case otf
206224
case pdf
225+
/// PNG image
226+
case png
227+
/// Protocol Buffers
228+
///
229+
/// See: https://protobuf.dev/
230+
case protobuf
207231
/// RAR archive
208232
case rar
209233
case rtf
234+
/// Scalable Vector Graphic (SVG)
235+
case svg
210236
/// Tape Archive (TAR)
211237
case tar
212238
/// TIF image
@@ -215,6 +241,8 @@ extension Shared.ContentType {
215241
case ttf
216242
/// Plaintext
217243
case txt
244+
/// Web Picture format (WEBP)
245+
case webp
218246
/// Web Open Font Format
219247
case woff
220248
/// Web Open Font Format
@@ -250,6 +278,7 @@ extension Shared.ContentType.Builtin: RawRepresentable {
250278
case .doc: return "application/msword"
251279
case .docx: return "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
252280
case .form: return "application/x-www-form-urlencoded"
281+
case .geojson: return "application/geo+json"
253282
case .gif: return "image/gif"
254283
case .html: return "text/html"
255284
case .javascript: return "application/javascript"
@@ -263,12 +292,16 @@ extension Shared.ContentType.Builtin: RawRepresentable {
263292
case .multipartForm: return "multipart/form-data"
264293
case .otf: return "font/otf"
265294
case .pdf: return "application/pdf"
295+
case .png: return "image/png"
296+
case .protobuf: return "application/x-protobuf"
266297
case .rar: return "application/x-rar-compressed"
267298
case .rtf: return "application/rtf"
299+
case .svg: return "image/svg+xml"
268300
case .tar: return "application/x-tar"
269301
case .tif: return "image/tiff"
270302
case .ttf: return "font/ttf"
271303
case .txt: return "text/plain"
304+
case .webp: return "image/webp"
272305
case .woff: return "font/woff"
273306
case .woff2: return "font/woff2"
274307
case .xml: return "application/xml"
@@ -298,6 +331,7 @@ extension Shared.ContentType.Builtin: RawRepresentable {
298331
case "application/msword": self = .doc
299332
case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": self = .docx
300333
case "application/x-www-form-urlencoded": self = .form
334+
case "application/geo+json": self = .geojson
301335
case "image/gif": self = .gif
302336
case "text/html": self = .html
303337
case "application/javascript": self = .javascript
@@ -311,12 +345,16 @@ extension Shared.ContentType.Builtin: RawRepresentable {
311345
case "multipart/form-data": self = .multipartForm
312346
case "font/otf": self = .otf
313347
case "application/pdf": self = .pdf
348+
case "image/png": self = .png
349+
case "application/x-protobuf": self = .protobuf
314350
case "application/x-rar-compressed": self = .rar
315351
case "application/rtf": self = .rtf
352+
case "image/svg+xml": self = .svg
316353
case "application/x-tar": self = .tar
317354
case "image/tiff": self = .tif
318355
case "font/ttf": self = .ttf
319356
case "text/plain": self = .txt
357+
case "image/webp": self = .webp
320358
case "font/woff": self = .woff
321359
case "font/woff2": self = .woff2
322360
case "application/xml": self = .xml

0 commit comments

Comments
 (0)