@@ -54,6 +54,13 @@ public struct YamsParser: ParserProtocol {
5454 let decoder = YAMLDecoder ( )
5555 let openapiData = input. contents
5656
57+ let decodingOptions = [
58+ DocumentConfiguration . versionMapKey: [
59+ // Until we move to OpenAPIKit v5.0+ we will parse OAS 3.2.0 as if it were OAS 3.1.2
60+ " 3.2.0 " : OpenAPI . Document. Version. v3_1_2
61+ ]
62+ ]
63+
5764 struct OpenAPIVersionedDocument : Decodable { var openapi : String ? }
5865
5966 let versionedDocument : OpenAPIVersionedDocument
@@ -73,7 +80,8 @@ public struct YamsParser: ParserProtocol {
7380 case " 3.0.0 " , " 3.0.1 " , " 3.0.2 " , " 3.0.3 " , " 3.0.4 " :
7481 let openAPI30Document = try decoder. decode ( OpenAPIKit30 . OpenAPI. Document. self, from: input. contents)
7582 document = openAPI30Document. convert ( to: . v3_1_0)
76- case " 3.1.0 " , " 3.1.1 " : document = try decoder. decode ( OpenAPIKit . OpenAPI. Document. self, from: input. contents)
83+ case " 3.1.0 " , " 3.1.1 " , " 3.1.2 " : document = try decoder. decode ( OpenAPIKit . OpenAPI. Document. self, from: input. contents)
84+ case " 3.2.0 " : document = try decoder. decode ( OpenAPIKit . OpenAPI. Document. self, from: input. contents, userInfo: decodingOptions)
7785 default :
7886 throw Diagnostic . openAPIVersionError (
7987 versionString: " openapi: \( openAPIVersion) " ,
@@ -128,7 +136,7 @@ extension Diagnostic {
128136 static func openAPIVersionError( versionString: String , location: Location ) -> Diagnostic {
129137 error (
130138 message:
131- " Unsupported document version: \( versionString) . Please provide a document with OpenAPI versions in the 3.0.x or 3.1 .x sets. " ,
139+ " Unsupported document version: \( versionString) . Please provide a document with OpenAPI versions in the 3.0.x, 3.1.x, or 3.2 .x sets. " ,
132140 location: location
133141 )
134142 }
@@ -139,7 +147,7 @@ extension Diagnostic {
139147 static func openAPIMissingVersionError( location: Location ) -> Diagnostic {
140148 error (
141149 message:
142- " No key named openapi found. Please provide a valid OpenAPI document with OpenAPI versions in the 3.0.x or 3.1 .x sets. " ,
150+ " No key named openapi found. Please provide a valid OpenAPI document with OpenAPI versions in the 3.0.x, 3.1.x, or 3.2 .x sets. " ,
143151 location: location
144152 )
145153 }
0 commit comments