Skip to content

Commit 2271e82

Browse files
Peter HaugeCopilot
andcommitted
fix: quote wildcard patterns in YAML and warn on unmatched workspaces
Quote wildcard patterns starting with * in YAML examples to prevent YAML alias interpretation. Add warning when exact workspace names in a mixed wildcard/exact filter don't match any discovered workspace. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 126578e commit 2271e82

4 files changed

Lines changed: 15 additions & 5 deletions

File tree

docs/commands/extract.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ To extract only specific resources, pass a YAML filter file with `--filter`. Fil
102102
apis:
103103
- echo-api
104104
- petstore-api
105-
- prod-* # Wildcard: all APIs starting with prod-
105+
- 'prod-*' # Wildcard: all APIs starting with prod-
106106
products:
107107
- starter
108108
backends:

docs/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Extract only the APIs you care about. Create a `filter.yaml`:
6161
apiNames:
6262
- pet-store-api
6363
- user-api
64-
- staging-* # Wildcard: all APIs starting with staging-
64+
- 'staging-*' # Wildcard: all APIs starting with staging-
6565
```
6666
6767
```bash

src/services/workspace-extractor.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,16 @@ export async function extractWorkspaces(
7171
: pattern.toLowerCase() === name.toLowerCase()
7272
)
7373
);
74+
75+
// Warn about exact (non-wildcard) entries that didn't match any discovered workspace
76+
for (const entry of filter.workspaces) {
77+
if (!isWildcardPattern(entry)) {
78+
const matched = discovered.some((d) => d.toLowerCase() === entry.toLowerCase());
79+
if (!matched) {
80+
logger.warn(`Workspace filter entry "${entry}" did not match any discovered workspace`);
81+
}
82+
}
83+
}
7484
} else {
7585
workspaceNames = filter.workspaces;
7686
}

src/templates/configs/filter-config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ export function generateFilterConfig(): string {
1515
# apis:
1616
# - echo-api
1717
# - petstore-api
18-
# - prod-* # Wildcard: all APIs starting with prod-
19-
# - *-internal-* # Wildcard: all APIs containing -internal-
18+
# - 'prod-*' # Wildcard: all APIs starting with prod-
19+
# - '*-internal-*' # Wildcard: all APIs containing -internal-
2020
2121
# Advanced: Filter API sub-resources (operations, diagnostics, schemas, releases)
2222
# apis:
@@ -25,7 +25,7 @@ export function generateFilterConfig(): string {
2525
# operations:
2626
# - get-pets
2727
# - create-pet
28-
# - list-* # Wildcard: all operations starting with list-
28+
# - 'list-*' # Wildcard: all operations starting with list-
2929
# diagnostics:
3030
# - applicationinsights
3131
# schemas: [] # Exclude all schemas

0 commit comments

Comments
 (0)