Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
e471d93e
Commit
e471d93e
authored
Mar 23, 2020
by
Roger Meier
Committed by
Nick Thomas
Mar 23, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix/openapi file detector
parent
af161ca2
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
3 deletions
+19
-3
changelogs/unreleased/fix-openapi-file-detector.yml
changelogs/unreleased/fix-openapi-file-detector.yml
+5
-0
lib/gitlab/file_detector.rb
lib/gitlab/file_detector.rb
+1
-1
spec/lib/gitlab/file_detector_spec.rb
spec/lib/gitlab/file_detector_spec.rb
+13
-2
No files found.
changelogs/unreleased/fix-openapi-file-detector.yml
0 → 100644
View file @
e471d93e
---
title
:
Fix OpenAPI file detector
merge_request
:
27321
author
:
Roger Meier
type
:
fixed
lib/gitlab/file_detector.rb
View file @
e471d93e
...
@@ -40,7 +40,7 @@ module Gitlab
...
@@ -40,7 +40,7 @@ module Gitlab
yarn_lock:
'yarn.lock'
,
yarn_lock:
'yarn.lock'
,
# OpenAPI Specification files
# OpenAPI Specification files
openapi:
%r{
.*(openapi|swagger).
*
\.
(yaml|yml|json)
\z
}i
openapi:
%r{
[^/]*(openapi|swagger)[^/]
*
\.
(yaml|yml|json)
\z
}i
}.
freeze
}.
freeze
# Returns an Array of file types based on the given paths.
# Returns an Array of file types based on the given paths.
...
...
spec/lib/gitlab/file_detector_spec.rb
View file @
e471d93e
...
@@ -96,14 +96,25 @@ describe Gitlab::FileDetector do
...
@@ -96,14 +96,25 @@ describe Gitlab::FileDetector do
'swagger.yml'
,
'swagger.yaml'
,
'swagger.json'
,
'swagger.yml'
,
'swagger.yaml'
,
'swagger.json'
,
'gitlab_swagger.yml'
,
'openapi_gitlab.yml'
,
'gitlab_swagger.yml'
,
'openapi_gitlab.yml'
,
'OpenAPI.YML'
,
'openapi.Yaml'
,
'openapi.JSON'
,
'OpenAPI.YML'
,
'openapi.Yaml'
,
'openapi.JSON'
,
'openapi.gitlab.yml'
,
'gitlab.openapi.yml'
'openapi.gitlab.yml'
,
'gitlab.openapi.yml'
,
'attention/openapi.yml'
,
'attention/swagger.yml'
,
'attention/gitlab_swagger.yml'
,
'attention/openapi_gitlab.yml'
,
'openapi/openapi.yml'
,
'openapi/swagger.yml'
,
'openapi/my_openapi.yml'
,
'openapi/swagger_one.yml'
]
]
openapi_types
.
each
do
|
type_name
|
openapi_types
.
each
do
|
type_name
|
expect
(
described_class
.
type_of
(
type_name
)).
to
eq
(
:openapi
)
expect
(
described_class
.
type_of
(
type_name
)).
to
eq
(
:openapi
)
end
end
expect
(
described_class
.
type_of
(
'openapiyml'
)).
to
be_nil
openapi_bad_types
=
[
'openapiyml'
,
'openapi/attention.yaml'
,
'swagger/attention.yaml'
]
openapi_bad_types
.
each
do
|
type_name
|
expect
(
described_class
.
type_of
(
type_name
)).
to
be_nil
end
end
end
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment