@@ -14,21 +14,6 @@ extension OpenAPI.Content {
14
14
public struct Encoding : Equatable {
15
15
public typealias Style = OpenAPI . Parameter . SchemaContext . Style
16
16
17
- /// If an encoding object only contains 1 content type, it will be populated here.
18
- /// Two or more content types will result in a null value here but the `contentTypes`
19
- /// (plural) property will contain all content types specified.
20
- ///
21
- /// The singular `contentType` property is only provided for backwards compatibility and
22
- /// using the plural `contentTypes` property should be preferred.
23
- @available ( * , deprecated, message: " use contentTypes instead " )
24
- public var contentType : OpenAPI . ContentType ? {
25
- guard let contentType = contentTypes. first,
26
- contentTypes. count == 1 else {
27
- return nil
28
- }
29
- return contentType
30
- }
31
-
32
17
public let contentTypes : [ OpenAPI . ContentType ]
33
18
public let headers : OpenAPI . Header . Map ?
34
19
public let style : Style
@@ -38,13 +23,12 @@ extension OpenAPI.Content {
38
23
/// The singular `contentType` argument is only provided for backwards compatibility and
39
24
/// using the plural `contentTypes` argument should be preferred.
40
25
public init (
41
- contentType: OpenAPI . ContentType ? = nil ,
42
26
contentTypes: [ OpenAPI . ContentType ] = [ ] ,
43
27
headers: OpenAPI . Header . Map ? = nil ,
44
28
style: Style = Self . defaultStyle,
45
29
allowReserved: Bool = false
46
30
) {
47
- self . contentTypes = contentTypes + [ contentType ] . compactMap { $0 }
31
+ self . contentTypes = contentTypes
48
32
self . headers = headers
49
33
self . style = style
50
34
self . explode = style. defaultExplode
@@ -54,14 +38,13 @@ extension OpenAPI.Content {
54
38
/// The singular `contentType` argument is only provided for backwards compatibility and
55
39
/// using the plural `contentTypes` argument should be preferred.
56
40
public init (
57
- contentType: OpenAPI . ContentType ? = nil ,
58
41
contentTypes: [ OpenAPI . ContentType ] = [ ] ,
59
42
headers: OpenAPI . Header . Map ? = nil ,
60
43
style: Style = Self . defaultStyle,
61
44
explode: Bool ,
62
45
allowReserved: Bool = false
63
46
) {
64
- self . contentTypes = contentTypes + [ contentType ] . compactMap { $0 }
47
+ self . contentTypes = contentTypes
65
48
self . headers = headers
66
49
self . style = style
67
50
self . explode = explode
@@ -104,7 +87,7 @@ extension OpenAPI.Content.Encoding: Decodable {
104
87
let container = try decoder. container ( keyedBy: CodingKeys . self)
105
88
106
89
let contentTypesString = try container. decodeIfPresent ( String . self, forKey: . contentType)
107
- if let contentTypesString = contentTypesString {
90
+ if let contentTypesString {
108
91
contentTypes = contentTypesString
109
92
. split ( separator: " , " )
110
93
. compactMap { string in
0 commit comments