Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions api/spec/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ generate: ## Generate OpenAPI spec
REF_VAL="$$AIP_REF/$$schema" SCHEMA="$$schema" yq -i '.components.schemas[strenv(SCHEMA)] = {"$$ref": strenv(REF_VAL)}' "$$FILE"; \
fi; \
done
# Prefix addon operationIds with `product-catalog-` for the v3 MeteringAndBilling output
@FILE="packages/aip/output/definitions/metering-and-billing/v3/openapi.MeteringAndBilling.yaml"; \
for op in list-addons create-addon update-addon get-addon delete-addon archive-addon publish-addon; do \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Rewrite Targets Wrong Spec

The loop rewrites openapi.MeteringAndBilling.yaml, but the committed v3 spec is bundled from openapi.OpenMeter.yaml on the next command. A normal generate run therefore leaves the addon operation IDs in api/v3/openapi.yaml as list-addons, create-addon, and the other old names, so generated clients and handlers keep the unprefixed contract instead of the intended product-catalog-prefixed one.

Prompt To Fix With AI
This is a comment left during a code review.
Path: api/spec/Makefile
Line: 18

Comment:
**Rewrite Targets Wrong Spec**

The loop rewrites `openapi.MeteringAndBilling.yaml`, but the committed v3 spec is bundled from `openapi.OpenMeter.yaml` on the next command. A normal `generate` run therefore leaves the addon operation IDs in `api/v3/openapi.yaml` as `list-addons`, `create-addon`, and the other old names, so generated clients and handlers keep the unprefixed contract instead of the intended product-catalog-prefixed one.

How can I resolve this? If you propose a fix, please make it concise.

Fix in Claude Code Fix in Codex

new_op="$${op/-addon/-product-catalog-addon}"; \
OLD_OP="$$op" NEW_OP="$$new_op" yq -i '(.paths[][] | select(.operationId == strenv(OLD_OP)) | .operationId) = strenv(NEW_OP)' "$$FILE"; \
done
pnpm --filter @openmeter/api-spec-aip exec openapi bundle output/definitions/metering-and-billing/v3/openapi.OpenMeter.yaml -o ../../../v3/openapi.yaml
cp packages/legacy/output/openapi.OpenMeter.yaml ../openapi.yaml
cp packages/legacy/output/openapi.OpenMeterCloud.yaml ../openapi.cloud.yaml
Expand Down
3 changes: 3 additions & 0 deletions api/spec/packages/aip/src/invoices/operations.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ interface InvoicesOperations {
@get
@operationId("get-invoice")
@summary("Get a billing invoice")
@extension(Shared.UnstableExtension, true)
@extension(Shared.InternalExtension, true)
@extension(Shared.PrivateExtension, true)
get(@path invoiceId: Shared.ULID):
| Shared.GetResponse<Invoice>
| Common.NotFound
Expand Down
2 changes: 1 addition & 1 deletion api/spec/packages/aip/src/konnect.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ using TypeSpec.OpenAPI;
*/
@service(#{ title: "Konnect ${Shared.MeteringAndBillingTitle}" })
@info(#{
version: "0.0.1",
version: "1.0.0",
contact: #{ name: "Kong", url: "https://cloud.konghq.com" },
})
@server("https://us.api.konghq.com/v3", "United-States Production region")
Expand Down
Loading
Loading