Skip to content

Commit d6c8bbd

Browse files
authored
feat(api): update aip schema (#3636)
1 parent 5cfa60c commit d6c8bbd

File tree

18 files changed

+761
-626
lines changed

18 files changed

+761
-626
lines changed

api/api.gen.go

Lines changed: 252 additions & 252 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/client/go/client.gen.go

Lines changed: 252 additions & 252 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/openapi.cloud.yaml

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ paths:
178178
operationId: createAddon
179179
summary: Create an add-on
180180
description: Create a new add-on.
181-
parameters: []
182181
responses:
183182
'201':
184183
description: The request has succeeded and a new resource has been created as a result.
@@ -1767,7 +1766,6 @@ paths:
17671766
New pending line items will be created for the period between now() and the next billing cycle's begining date for any metered item.
17681767

17691768
The call can return multiple invoices if the pending line items are in different currencies.
1770-
parameters: []
17711769
responses:
17721770
'201':
17731771
description: The request has succeeded and a new resource has been created as a result.
@@ -2611,7 +2609,6 @@ paths:
26112609

26122610
Billing profiles are representations of a customer's billing information. Customer overrides
26132611
can be applied to a billing profile to customize the billing behavior for a specific customer.
2614-
parameters: []
26152612
responses:
26162613
'201':
26172614
description: The request has succeeded and a new resource has been created as a result.
@@ -2907,7 +2904,6 @@ paths:
29072904
operationId: createCustomer
29082905
summary: Create customer
29092906
description: Create a new customer.
2910-
parameters: []
29112907
responses:
29122908
'201':
29132909
description: The request has succeeded and a new resource has been created as a result.
@@ -3925,7 +3921,6 @@ paths:
39253921
Returns debug metrics (in OpenMetrics format) like the number of ingested events since mindnight UTC.
39263922

39273923
The OpenMetrics Counter(s) reset every day at midnight UTC.
3928-
parameters: []
39293924
responses:
39303925
'200':
39313926
description: The request has succeeded.
@@ -4323,9 +4318,8 @@ paths:
43234318
- Events
43244319
post:
43254320
operationId: ingestEvents
4326-
parameters: []
43274321
description: Ingests an event or batch of events following the CloudEvents specification.
4328-
summary: 'Ingest events '
4322+
summary: Ingest events
43294323
responses:
43304324
'204':
43314325
description: 'There is no content to send for this request, but the headers may be useful. '
@@ -4476,7 +4470,6 @@ paths:
44764470
For metered features you can pass additional filters that will be applied when calculating feature usage, based on the meter's groupBy fields.
44774471
Only meters with SUM and COUNT aggregation are supported for features.
44784472
Features cannot be updated later, only archived.
4479-
parameters: []
44804473
responses:
44814474
'201':
44824475
description: The request has succeeded and a new resource has been created as a result.
@@ -4849,7 +4842,6 @@ paths:
48494842
operationId: listCurrencies
48504843
summary: List supported currencies
48514844
description: List all supported currencies.
4852-
parameters: []
48534845
responses:
48544846
'200':
48554847
description: The request has succeeded.
@@ -5433,7 +5425,6 @@ paths:
54335425
operationId: createMeter
54345426
summary: Create meter
54355427
description: Create a meter.
5436-
parameters: []
54375428
responses:
54385429
'201':
54395430
description: The request has succeeded and a new resource has been created as a result.
@@ -6135,7 +6126,6 @@ paths:
61356126
operationId: createNotificationChannel
61366127
summary: Create a notification channel
61376128
description: Create a new notification channel.
6138-
parameters: []
61396129
responses:
61406130
'201':
61416131
description: The request has succeeded and a new resource has been created as a result.
@@ -6803,7 +6793,6 @@ paths:
68036793
operationId: createNotificationRule
68046794
summary: Create a notification rule
68056795
description: Create a new notification rule.
6806-
parameters: []
68076796
responses:
68086797
'201':
68096798
description: The request has succeeded and a new resource has been created as a result.
@@ -7281,7 +7270,6 @@ paths:
72817270
operationId: createPlan
72827271
summary: Create a plan
72837272
description: Create a new plan.
7284-
parameters: []
72857273
responses:
72867274
'201':
72877275
description: The request has succeeded and a new resource has been created as a result.
@@ -8313,7 +8301,6 @@ paths:
83138301
operationId: createPortalToken
83148302
summary: Create consumer portal token
83158303
description: Create a consumer portal token.
8316-
parameters: []
83178304
responses:
83188305
'200':
83198306
description: The request has succeeded.
@@ -8444,7 +8431,6 @@ paths:
84448431
operationId: invalidatePortalTokens
84458432
summary: Invalidate portal tokens
84468433
description: Invalidates consumer portal tokens by ID or subject.
8447-
parameters: []
84488434
responses:
84498435
'204':
84508436
description: 'There is no content to send for this request, but the headers may be useful. '
@@ -8510,7 +8496,6 @@ paths:
85108496
operationId: createStripeCheckoutSession
85118497
summary: Create checkout session
85128498
description: Create checkout session.
8513-
parameters: []
85148499
responses:
85158500
'201':
85168501
description: The request has succeeded and a new resource has been created as a result.
@@ -8579,7 +8564,6 @@ paths:
85798564
operationId: listSubjects
85808565
summary: List subjects
85818566
description: List subjects.
8582-
parameters: []
85838567
responses:
85848568
'200':
85858569
description: The request has succeeded.
@@ -8641,7 +8625,6 @@ paths:
86418625

86428626
If the subject doesn't exist, it will be created.
86438627
If the subject exists, it will be partially updated with the provided fields.
8644-
parameters: []
86458628
responses:
86468629
'200':
86478630
description: The request has succeeded.
@@ -9668,7 +9651,6 @@ paths:
96689651
post:
96699652
operationId: createSubscription
96709653
summary: Create subscription
9671-
parameters: []
96729654
responses:
96739655
'201':
96749656
description: The request has succeeded and a new resource has been created as a result.

api/openapi.yaml

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ paths:
177177
operationId: createAddon
178178
summary: Create an add-on
179179
description: Create a new add-on.
180-
parameters: []
181180
responses:
182181
'201':
183182
description: The request has succeeded and a new resource has been created as a result.
@@ -1766,7 +1765,6 @@ paths:
17661765
New pending line items will be created for the period between now() and the next billing cycle's begining date for any metered item.
17671766

17681767
The call can return multiple invoices if the pending line items are in different currencies.
1769-
parameters: []
17701768
responses:
17711769
'201':
17721770
description: The request has succeeded and a new resource has been created as a result.
@@ -2610,7 +2608,6 @@ paths:
26102608

26112609
Billing profiles are representations of a customer's billing information. Customer overrides
26122610
can be applied to a billing profile to customize the billing behavior for a specific customer.
2613-
parameters: []
26142611
responses:
26152612
'201':
26162613
description: The request has succeeded and a new resource has been created as a result.
@@ -2906,7 +2903,6 @@ paths:
29062903
operationId: createCustomer
29072904
summary: Create customer
29082905
description: Create a new customer.
2909-
parameters: []
29102906
responses:
29112907
'201':
29122908
description: The request has succeeded and a new resource has been created as a result.
@@ -3927,7 +3923,6 @@ paths:
39273923
Returns debug metrics (in OpenMetrics format) like the number of ingested events since mindnight UTC.
39283924

39293925
The OpenMetrics Counter(s) reset every day at midnight UTC.
3930-
parameters: []
39313926
responses:
39323927
'200':
39333928
description: The request has succeeded.
@@ -4325,9 +4320,8 @@ paths:
43254320
- Events
43264321
post:
43274322
operationId: ingestEvents
4328-
parameters: []
43294323
description: Ingests an event or batch of events following the CloudEvents specification.
4330-
summary: 'Ingest events '
4324+
summary: Ingest events
43314325
responses:
43324326
'204':
43334327
description: 'There is no content to send for this request, but the headers may be useful. '
@@ -4478,7 +4472,6 @@ paths:
44784472
For metered features you can pass additional filters that will be applied when calculating feature usage, based on the meter's groupBy fields.
44794473
Only meters with SUM and COUNT aggregation are supported for features.
44804474
Features cannot be updated later, only archived.
4481-
parameters: []
44824475
responses:
44834476
'201':
44844477
description: The request has succeeded and a new resource has been created as a result.
@@ -4851,7 +4844,6 @@ paths:
48514844
operationId: listCurrencies
48524845
summary: List supported currencies
48534846
description: List all supported currencies.
4854-
parameters: []
48554847
responses:
48564848
'200':
48574849
description: The request has succeeded.
@@ -5435,7 +5427,6 @@ paths:
54355427
operationId: createMeter
54365428
summary: Create meter
54375429
description: Create a meter.
5438-
parameters: []
54395430
responses:
54405431
'201':
54415432
description: The request has succeeded and a new resource has been created as a result.
@@ -6137,7 +6128,6 @@ paths:
61376128
operationId: createNotificationChannel
61386129
summary: Create a notification channel
61396130
description: Create a new notification channel.
6140-
parameters: []
61416131
responses:
61426132
'201':
61436133
description: The request has succeeded and a new resource has been created as a result.
@@ -6805,7 +6795,6 @@ paths:
68056795
operationId: createNotificationRule
68066796
summary: Create a notification rule
68076797
description: Create a new notification rule.
6808-
parameters: []
68096798
responses:
68106799
'201':
68116800
description: The request has succeeded and a new resource has been created as a result.
@@ -7283,7 +7272,6 @@ paths:
72837272
operationId: createPlan
72847273
summary: Create a plan
72857274
description: Create a new plan.
7286-
parameters: []
72877275
responses:
72887276
'201':
72897277
description: The request has succeeded and a new resource has been created as a result.
@@ -8315,7 +8303,6 @@ paths:
83158303
operationId: createPortalToken
83168304
summary: Create consumer portal token
83178305
description: Create a consumer portal token.
8318-
parameters: []
83198306
responses:
83208307
'200':
83218308
description: The request has succeeded.
@@ -8446,7 +8433,6 @@ paths:
84468433
operationId: invalidatePortalTokens
84478434
summary: Invalidate portal tokens
84488435
description: Invalidates consumer portal tokens by ID or subject.
8449-
parameters: []
84508436
responses:
84518437
'204':
84528438
description: 'There is no content to send for this request, but the headers may be useful. '
@@ -8512,7 +8498,6 @@ paths:
85128498
operationId: createStripeCheckoutSession
85138499
summary: Create checkout session
85148500
description: Create checkout session.
8515-
parameters: []
85168501
responses:
85178502
'201':
85188503
description: The request has succeeded and a new resource has been created as a result.
@@ -8581,7 +8566,6 @@ paths:
85818566
operationId: listSubjects
85828567
summary: List subjects
85838568
description: List subjects.
8584-
parameters: []
85858569
responses:
85868570
'200':
85878571
description: The request has succeeded.
@@ -8643,7 +8627,6 @@ paths:
86438627

86448628
If the subject doesn't exist, it will be created.
86458629
If the subject exists, it will be partially updated with the provided fields.
8646-
parameters: []
86478630
responses:
86488631
'200':
86498632
description: The request has succeeded.
@@ -9670,7 +9653,6 @@ paths:
96709653
post:
96719654
operationId: createSubscription
96729655
summary: Create subscription
9673-
parameters: []
96749656
responses:
96759657
'201':
96769658
description: The request has succeeded and a new resource has been created as a result.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
components:
2+
securitySchemes:
3+
personalAccessToken:
4+
type: http
5+
scheme: bearer
6+
bearerFormat: Token
7+
systemAccountAccessToken:
8+
type: http
9+
scheme: bearer
10+
bearerFormat: Token
11+
konnectAccessToken:
12+
type: http
13+
scheme: bearer
14+
bearerFormat: JWT

api/spec/lib/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
import { defineLinter } from '@typespec/compiler'
22
import { casingAIPRule, casingRule } from './rules/casing.js'
33
import { docDecoratorRule } from './rules/docs.js'
4-
import { friendlyNameRule } from './rules/friendlyName.js'
5-
import { operationSummaryRule } from './rules/operationSummary.js'
4+
import { friendlyNameRule } from './rules/friendly-name.js'
5+
import { operationSummaryRule } from './rules/operation-summary.js'
6+
import { operationIdKebabCaseRule } from './rules/operation-id.js'
67
import { noNullableRule } from './rules/no-nullable.js'
78
import { compositionOverInheritanceRule } from './rules/composition-over-inheritance.js'
89

910
const packageName = '@openmeter/api-spec'
1011

12+
// See example rules: https://github.com/Azure/typespec-azure/tree/main/packages/typespec-azure-core/src/rules
1113
const rules = [
1214
casingRule,
1315
casingAIPRule,
1416
docDecoratorRule,
1517
friendlyNameRule,
1618
noNullableRule,
1719
operationSummaryRule,
20+
operationIdKebabCaseRule,
1821
compositionOverInheritanceRule,
1922
]
2023

21-
// Linter experimentation
22-
// See: https://github.com/Azure/typespec-azure/tree/main/packages/typespec-azure-core/src/rules
2324
export const $linter = defineLinter({
2425
rules,
2526
ruleSets: {
@@ -40,6 +41,7 @@ export const $linter = defineLinter({
4041
[`${packageName}/${friendlyNameRule.name}`]: true,
4142
[`${packageName}/${noNullableRule.name}`]: true,
4243
[`${packageName}/${operationSummaryRule.name}`]: true,
44+
[`${packageName}/${operationIdKebabCaseRule.name}`]: true,
4345
[`${packageName}/${compositionOverInheritanceRule.name}`]: true,
4446
},
4547
},

api/spec/lib/rules/operation-id.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { createRule, paramMessage } from '@typespec/compiler'
2+
import { isKebabCase } from './utils.js'
3+
4+
export const operationIdKebabCaseRule = createRule({
5+
name: 'operation-id-kebab-case',
6+
severity: 'error',
7+
description: 'Ensure @operationId values are in kebab-case.',
8+
messages: {
9+
default: paramMessage`The operationId "${'operationId'}" should be in kebab-case.`,
10+
},
11+
create: (context) => ({
12+
operation: (node) => {
13+
const operationIdDecorator = node.decorators.find(
14+
(d) => d.decorator.name === '$operationId',
15+
)
16+
17+
if (operationIdDecorator) {
18+
const operationId = operationIdDecorator.args[0]?.jsValue
19+
if (
20+
operationId &&
21+
typeof operationId === 'string' &&
22+
!isKebabCase(operationId)
23+
) {
24+
context.reportDiagnostic({
25+
format: {
26+
operationId,
27+
},
28+
target: node,
29+
messageId: 'default',
30+
})
31+
}
32+
}
33+
},
34+
}),
35+
})

0 commit comments

Comments
 (0)