Skip to content

Commit

Permalink
[fix] Support OAS 3.1X
Browse files Browse the repository at this point in the history
Update spec_info.go , handle version prefix
  • Loading branch information
LasneF authored and daveshanley committed Nov 18, 2024
1 parent c757033 commit 4318337
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions datamodel/spec_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,13 @@ func ExtractSpecInfoWithDocumentCheck(spec []byte, bypass bool) (*SpecInfo, erro
specInfo.Version = version
specInfo.SpecFormat = OAS3

switch specInfo.Version {
case "3.1.0", "3.1":
// Extract the prefix version
prefixVersion := specInfo.Version
if len(specInfo.Version) >= 3 {
prefixVersion = specInfo.Version[:3]
}
switch prefixVersion {
case "3.1":
specInfo.VersionNumeric = 3.1
specInfo.APISchema = OpenAPI31SchemaData
specInfo.SpecFormat = OAS31
Expand Down

0 comments on commit 4318337

Please sign in to comment.