Skip to content

Commit 10999a2

Browse files
authored
feat(api): typed feature meter reference (#4332)
1 parent 45e1532 commit 10999a2

6 files changed

Lines changed: 327 additions & 345 deletions

File tree

api/spec/packages/aip/src/features/feature.tsp

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,23 @@ using TypeSpec.JsonSchema;
77

88
namespace Features;
99

10+
@friendlyName("FeatureMeterReference")
11+
model FeatureMeterReference {
12+
/**
13+
* The ID of the meter to associate with this feature.
14+
*/
15+
@visibility(Lifecycle.Read, Lifecycle.Create)
16+
@summary("Meter ID")
17+
id: Shared.ULID;
18+
19+
/**
20+
* Filters to apply to the dimensions of the meter.
21+
*/
22+
@maxProperties(10)
23+
@summary("Meter dimensions filters")
24+
filters?: Record<Shared.QueryFilterStringMapItem>;
25+
}
26+
1027
/**
1128
* A capability or billable dimension offered by a provider.
1229
*/
@@ -20,28 +37,15 @@ model Feature {
2037
*/
2138
@summary("Meter reference")
2239
@visibility(Lifecycle.Read, Lifecycle.Create)
23-
meter?: {
24-
/**
25-
* The ID of the meter to associate with this feature.
26-
*/
27-
@visibility(Lifecycle.Read, Lifecycle.Create)
28-
id: Shared.ULID;
29-
30-
/**
31-
* Filters to apply to the dimensions of the meter.
32-
*/
33-
@maxProperties(10)
34-
@summary("Meter dimensions filters")
35-
filters?: Record<Shared.QueryFilterStringMapItem>;
36-
};
40+
meter?: FeatureMeterReference;
3741

3842
/**
3943
* Optional per-unit cost configuration.
4044
* Use "manual" for a fixed per-unit cost, or "llm" to look up cost
4145
* from the LLM cost database based on meter group-by properties.
4246
*/
4347
@summary("Unit cost")
44-
@visibility(Lifecycle.Read, Lifecycle.Create)
48+
@visibility(Lifecycle.Read, Lifecycle.Create, Lifecycle.Update)
4549
unit_cost?: FeatureUnitCost;
4650
}
4751

0 commit comments

Comments
 (0)