Skip to content

Commit b6a7cc9

Browse files
committed
feat: extend scan directory for oas.yaml
1 parent 7435fb9 commit b6a7cc9

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "directus-extension-api-docs",
3-
"version": "2.3.0",
3+
"version": "2.3.1",
44
"description": "directus extension for swagger interface and openapi including custom endpoints definitions // custom endpoint validations middleware based on openapi",
55
"licence": "MIT",
66
"icon": "api",

src/utils.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,20 @@ export function getConfig(): oasConfig {
102102

103103
const extensionPath = path.join(dirPath, file.name);
104104

105-
// Check for oas.yaml at root level (non-bundle extensions)
105+
// Check for oas.yaml at root
106106
const rootOasPath = path.join(extensionPath, 'oas.yaml');
107107
if (fs.existsSync(rootOasPath)) {
108108
mergeConfig(rootOasPath);
109109
}
110110

111-
// Check for oas.yaml in src subdirectories (bundled extensions - green option)
111+
// Check for oas.yaml in src subdirectories
112112
const srcPath = path.join(extensionPath, 'src');
113113
if (fs.existsSync(srcPath)) {
114+
const srcOasPath = path.join(srcPath, 'oas.yaml');
115+
if (fs.existsSync(srcOasPath)) {
116+
mergeConfig(srcOasPath);
117+
}
118+
114119
const srcFiles = fs.readdirSync(srcPath, { withFileTypes: true });
115120
for (const srcFile of srcFiles) {
116121
if (srcFile.isDirectory()) {

0 commit comments

Comments
 (0)