@@ -123,6 +123,27 @@ final class DereferencedContentTests: XCTestCase {
123123 )
124124 }
125125
126+ func test_inlineItemSchema( ) throws {
127+ let t1 = try OpenAPI . Content ( itemSchema: . string) . dereferenced ( in: . noComponents)
128+ XCTAssertEqual ( t1. itemSchema, . string( . init( ) , . init( ) ) )
129+ }
130+
131+ func test_referencedItemSchema( ) throws {
132+ let components = OpenAPI . Components (
133+ schemas: [ " schema1 " : . string]
134+ )
135+ let t1 = try OpenAPI . Content ( itemSchema: . reference( . component( named: " schema1 " ) ) ) . dereferenced ( in: components)
136+ XCTAssertEqual ( t1. itemSchema, . string( . init( vendorExtensions: [ " x-component-name " : " schema1 " ] ) , . init( ) ) )
137+ }
138+
139+ func test_missingItemSchema( ) {
140+ XCTAssertThrowsError (
141+ try OpenAPI . Content (
142+ itemSchema: . reference( . component( named: " missing " ) )
143+ ) . dereferenced ( in: . noComponents)
144+ )
145+ }
146+
126147 func test_inlineEncoding( ) throws {
127148 let t1 = try OpenAPI . Content ( schema: . string, encoding: [ " test " : . init( ) ] ) . dereferenced ( in: . noComponents)
128149 XCTAssertNotNil ( t1. encodingMap ? [ " test " ] )
@@ -153,6 +174,20 @@ final class DereferencedContentTests: XCTestCase {
153174 XCTAssertEqual ( t1. encodingMap ? [ " test " ] ? . style, OpenAPI . Content. Encoding. defaultStyle)
154175 }
155176
177+ func test_inlinePrefixEncoding( ) throws {
178+ let t1 = try OpenAPI . Content ( schema: . string, prefixEncoding: [ . init( ) ] ) . dereferenced ( in: . noComponents)
179+ XCTAssertNil ( t1. encodingMap ? [ " test " ] )
180+ XCTAssertEqual ( t1. prefixEncoding? . count, 1 )
181+ XCTAssertNil ( t1. itemEncoding)
182+ }
183+
184+ func test_inlineItemEncoding( ) throws {
185+ let t1 = try OpenAPI . Content ( schema: . string, itemEncoding: . init( ) ) . dereferenced ( in: . noComponents)
186+ XCTAssertNil ( t1. encodingMap ? [ " test " ] )
187+ XCTAssertEqual ( t1. prefixEncoding, [ ] )
188+ XCTAssertNotNil ( t1. itemEncoding)
189+ }
190+
156191 func test_missingHeaderInEncoding( ) {
157192 XCTAssertThrowsError (
158193 try OpenAPI . Content (
0 commit comments