Skip to content

Commit 03e0e4c

Browse files
authored
fix: address PR #102 reviewer feedback
- Add validation error when override YAML top-level is not a mapping - Fix docs: add APIOps Toolkit hyperlink in environment-overrides guide - Fix docs: note that gateway/subscription overrides are not supported - Fix docs: rename overrides.prod.yaml → configuration.prod.yaml in getting-started.md and specs/quickstart.md for consistency"
1 parent 3e078cf commit 03e0e4c

4 files changed

Lines changed: 12 additions & 5 deletions

File tree

docs/getting-started.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Referenced backends, named values, and policy fragments are included automatical
7676

7777
## 4. Publish to a Target Environment
7878

79-
Create `overrides.prod.yaml` for environment-specific values:
79+
Create `configuration.prod.yaml` for environment-specific values:
8080

8181
```yaml
8282
namedValues:
@@ -97,7 +97,7 @@ apiops publish \
9797
--resource-group prod-rg \
9898
--service-name prod-apim \
9999
--source ./apim-artifacts \
100-
--overrides overrides.prod.yaml
100+
--overrides configuration.prod.yaml
101101
```
102102

103103
## 5. Preview Changes with Dry-Run

docs/guides/environment-overrides.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ apiops publish \
2525

2626
## Override file format (APIOps Toolkit-compatible)
2727

28-
`apiops-cli` uses the APIOps Toolkit override layout:
28+
`apiops-cli` uses the [APIOps Toolkit](https://github.com/Azure/apiops) override layout:
2929

3030
- Top-level resource sections: `namedValues`, `backends`, `apis`, `diagnostics`, `loggers`
31+
> **Note:** Gateway and subscription overrides are not currently supported.
3132
- Each section is a list
3233
- Each list item contains `name` and `properties`
3334

specs/quickstart.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Referenced backends, named values, and policy fragments are included automatical
4444

4545
## Publish to a target environment
4646

47-
Create `overrides.prod.yaml` for environment-specific values:
47+
Create `configuration.prod.yaml` for environment-specific values:
4848

4949
```yaml
5050
namedValues:
@@ -62,7 +62,7 @@ apiops publish \
6262
--resource-group prod-rg \
6363
--service-name prod-apim \
6464
--source ./apim-artifacts \
65-
--overrides overrides.prod.yaml
65+
--overrides configuration.prod.yaml
6666
```
6767

6868
## Preview changes before publishing

src/lib/config-loader.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@ export async function loadOverrideConfig(filePath: string): Promise<OverrideConf
110110
try {
111111
const content = await fs.readFile(filePath, 'utf-8');
112112
const loaded = yaml.load(content);
113+
if (loaded !== null && loaded !== undefined && !isPlainObject(loaded)) {
114+
throw new Error(
115+
`Override file at ${filePath} must be a YAML mapping (key: value pairs) at the top level, ` +
116+
`but got ${Array.isArray(loaded) ? 'an array' : typeof loaded}.`
117+
);
118+
}
113119
const parsed = isPlainObject(loaded) ? loaded : {};
114120
const normalized = normalizeOverrideConfig(parsed);
115121

0 commit comments

Comments
 (0)