Skip to content

Commit

Permalink
Merge pull request #1709 from openmeterio/fix/api-typespec
Browse files Browse the repository at this point in the history
Fix OpenAPI types
  • Loading branch information
tothandras authored Oct 19, 2024
2 parents 8ca1548 + 4eee661 commit cf6073d
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 113 deletions.
164 changes: 82 additions & 82 deletions api/api.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4060,7 +4060,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/Event'
$ref: '#/components/schemas/NotificationEvent'
'400':
description: The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).
content:
Expand Down Expand Up @@ -4481,7 +4481,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/Event'
$ref: '#/components/schemas/NotificationEvent'
'400':
description: The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).
content:
Expand Down
28 changes: 1 addition & 27 deletions api/spec/src/cloud/subjects.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -59,30 +59,4 @@ interface Subjects {
currentPeriodEnd: DateTime.fromISO("2023-02-01T00:00:00Z"),
stripeCustomerId: "cus_JMOlctsKV8",
})
model SubjectUpsert {
/**
* A unique, human-readable identifier for the subject.
*/
@example("customer-id")
key: string;

/**
* A human-readable display name for the subject.
*/
@example("Customer Name")
displayName?: string;

// TODO: figure out if we want to support arbitrary values or string only

@example(#{ hubspotId: "123456" })
metadata?: Record<unknown> | null;

@example(DateTime.fromISO("2023-01-01T00:00:00Z"))
currentPeriodStart?: DateTime;

@example(DateTime.fromISO("2023-02-01T00:00:00Z"))
currentPeriodEnd?: DateTime;

@example("cus_JMOlctsKV8")
stripeCustomerId?: string | null;
}
model SubjectUpsert is Rest.Resource.ResourceCreateModel<OpenMeter.Subject>;
2 changes: 1 addition & 1 deletion api/spec/src/notification/event.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -283,5 +283,5 @@ interface Events {
@summary("Get notification event")
get(
@path eventId: string,
): Event | OpenMeter.NotFoundError | OpenMeter.CommonErrors;
): NotificationEvent | OpenMeter.NotFoundError | OpenMeter.CommonErrors;
}
2 changes: 1 addition & 1 deletion api/spec/src/notification/rule.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,6 @@ interface Rules {
@operationId("testNotificationRule")
test(@path ruleId: ULID): {
@statusCode _: 201;
@body body: Event;
@body body: NotificationEvent;
} | OpenMeter.NotFoundError | OpenMeter.CommonErrors;
}

0 comments on commit cf6073d

Please sign in to comment.