@@ -126,8 +126,7 @@ public void SerializeAsV3(IOpenApiWriter writer)
126126 Schemas ,
127127 ( w , key , component ) =>
128128 {
129- if ( component . Reference != null &&
130- component . Reference . Type == ReferenceType . Schema &&
129+ if ( component . Reference is { Type : ReferenceType . Schema } &&
131130 component . Reference . Id == key )
132131 {
133132 component . SerializeAsV3WithoutReference ( w ) ;
@@ -144,8 +143,7 @@ public void SerializeAsV3(IOpenApiWriter writer)
144143 Responses ,
145144 ( w , key , component ) =>
146145 {
147- if ( component . Reference != null &&
148- component . Reference . Type == ReferenceType . Response &&
146+ if ( component . Reference is { Type : ReferenceType . Response } &&
149147 component . Reference . Id == key )
150148 {
151149 component . SerializeAsV3WithoutReference ( w ) ;
@@ -162,8 +160,7 @@ public void SerializeAsV3(IOpenApiWriter writer)
162160 Parameters ,
163161 ( w , key , component ) =>
164162 {
165- if ( component . Reference != null &&
166- component . Reference . Type == ReferenceType . Parameter &&
163+ if ( component . Reference is { Type : ReferenceType . Parameter } &&
167164 component . Reference . Id == key )
168165 {
169166 component . SerializeAsV3WithoutReference ( w ) ;
@@ -180,8 +177,7 @@ public void SerializeAsV3(IOpenApiWriter writer)
180177 Examples ,
181178 ( w , key , component ) =>
182179 {
183- if ( component . Reference != null &&
184- component . Reference . Type == ReferenceType . Example &&
180+ if ( component . Reference is { Type : ReferenceType . Example } &&
185181 component . Reference . Id == key )
186182 {
187183 component . SerializeAsV3WithoutReference ( w ) ;
@@ -198,8 +194,7 @@ public void SerializeAsV3(IOpenApiWriter writer)
198194 RequestBodies ,
199195 ( w , key , component ) =>
200196 {
201- if ( component . Reference != null &&
202- component . Reference . Type == ReferenceType . RequestBody &&
197+ if ( component . Reference is { Type : ReferenceType . RequestBody } &&
203198 component . Reference . Id == key )
204199 {
205200 component . SerializeAsV3WithoutReference ( w ) ;
@@ -216,8 +211,7 @@ public void SerializeAsV3(IOpenApiWriter writer)
216211 Headers ,
217212 ( w , key , component ) =>
218213 {
219- if ( component . Reference != null &&
220- component . Reference . Type == ReferenceType . Header &&
214+ if ( component . Reference is { Type : ReferenceType . Header } &&
221215 component . Reference . Id == key )
222216 {
223217 component . SerializeAsV3WithoutReference ( w ) ;
@@ -234,8 +228,7 @@ public void SerializeAsV3(IOpenApiWriter writer)
234228 SecuritySchemes ,
235229 ( w , key , component ) =>
236230 {
237- if ( component . Reference != null &&
238- component . Reference . Type == ReferenceType . SecurityScheme &&
231+ if ( component . Reference is { Type : ReferenceType . SecurityScheme } &&
239232 component . Reference . Id == key )
240233 {
241234 component . SerializeAsV3WithoutReference ( w ) ;
@@ -252,8 +245,7 @@ public void SerializeAsV3(IOpenApiWriter writer)
252245 Links ,
253246 ( w , key , component ) =>
254247 {
255- if ( component . Reference != null &&
256- component . Reference . Type == ReferenceType . Link &&
248+ if ( component . Reference is { Type : ReferenceType . Link } &&
257249 component . Reference . Id == key )
258250 {
259251 component . SerializeAsV3WithoutReference ( w ) ;
@@ -270,8 +262,7 @@ public void SerializeAsV3(IOpenApiWriter writer)
270262 Callbacks ,
271263 ( w , key , component ) =>
272264 {
273- if ( component . Reference != null &&
274- component . Reference . Type == ReferenceType . Callback &&
265+ if ( component . Reference is { Type : ReferenceType . Callback } &&
275266 component . Reference . Id == key )
276267 {
277268 component . SerializeAsV3WithoutReference ( w ) ;
0 commit comments