Skip to content

Commit

Permalink
(#25) Update OAS2/3 detector logic
Browse files Browse the repository at this point in the history
  • Loading branch information
hahwul committed Aug 19, 2023
1 parent ae69981 commit 7cfbd7d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/detector/detectors/oas2.cr
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class DetectorOas2 < Detector
if valid_json? file_contents
data = JSON.parse(file_contents)
begin
if data["swagger"].as_s == "2.0"
if data["swagger"].as_s.includes? "2."
check = true
locator = CodeLocator.instance
locator.set("swagger-json", filename)
Expand All @@ -19,7 +19,7 @@ class DetectorOas2 < Detector
elsif valid_yaml? file_contents
data = YAML.parse(file_contents)
begin
if data["swagger"].as_s == "2.0"
if data["swagger"].as_s.includes? "2."
check = true
locator = CodeLocator.instance
locator.set("swagger-yaml", filename)
Expand Down
4 changes: 2 additions & 2 deletions src/detector/detectors/oas3.cr
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class DetectorOas3 < Detector
if valid_json? file_contents
data = JSON.parse(file_contents)
begin
if data["openapi"].as_s == "3.0.0"
if data["openapi"].as_s.includes? "3."
check = true
locator = CodeLocator.instance
locator.set("oas3-json", filename)
Expand All @@ -19,7 +19,7 @@ class DetectorOas3 < Detector
elsif valid_yaml? file_contents
data = YAML.parse(file_contents)
begin
if data["openapi"].as_s == "3.0.0"
if data["openapi"].as_s.includes? "3."
check = true
locator = CodeLocator.instance
locator.set("oas3-yaml", filename)
Expand Down

0 comments on commit 7cfbd7d

Please sign in to comment.