mattpolzin / OpenAPIKit

Codable Swift OpenAPI implementation.
MIT License
280 stars 35 forks source link

OpenAPIKit.OpenAPI.Operation's requestBody type diff #276

Closed Kyle-Ye closed 1 year ago

Kyle-Ye commented 1 year ago

I was trying to add both OpenAPI and OpenAPI30 support for swift-openapi-generator.

And I found the type between OpenAPIKit.OpenAPI.Operation's requestBody and OpenAPIKit30.OpenAPI.Operation's requestBody is different on v3.0.0-alpha.6.

One is Either<OpenAPI.Reference<OpenAPI.Request>, OpenAPI.Request>? and the other is Either<JSONReference<OpenAPI.Request>, OpenAPI.Request>?

Is this a intended behavior or a bug?

Introduced by #231

mattpolzin commented 1 year ago

Yes, that is intended if I am reading your question correctly.

OpenAPI 3.0 did not support overriding summaries and descriptions of referenced schemas but OpenAPI 3.1 does support that. The OpenAPI.Reference type allows this new overriding while still wrapping a normal JSON Reference. There are some places (namely within JSON Schema) where this summary and description overriding does not apply so JSON References are still used directly instead of OpenAPI references.