Skip to content

fix: regenerate Management API client code… - #41

Closed
brettchaldecott wants to merge 2 commits into
kinde-oss:mainfrom
brettchaldecott:fix/regenerated-api
Closed

fix: regenerate Management API client code…#41
brettchaldecott wants to merge 2 commits into
kinde-oss:mainfrom
brettchaldecott:fix/regenerated-api

Conversation

@brettchaldecott

@brettchaldecott brettchaldecott commented Oct 24, 2025

Copy link
Copy Markdown

Explain your changes

This PR regenerates the Management API client code from the latest OpenAPI specification.

Checklist

🛟 If you need help, consider asking for advice over in the Kinde community.

@brettchaldecott
brettchaldecott requested a review from a team as a code owner October 24, 2025 12:01
@coderabbitai

coderabbitai Bot commented Oct 24, 2025

Copy link
Copy Markdown

Walkthrough

Introduces build infrastructure via Makefile for the SDK with code generation, build, and test targets. Updates documentation with code generation and authentication details. Expands the Management API client with new endpoints for entitlements, feature flags, portal links, user permissions, profile, properties, roles, and OAuth2 token introspection/revocation, updating the OpenAPI spec URL and regenerating all associated client scaffolding.

Changes

Cohort / File(s) Summary
Build and Documentation
Makefile, README.md, README_MANAGEMENT_API.md
Adds Makefile with phony targets for code generation, build, test, and clean. Extends README files with Code Generation section detailing ogen-based generation from OpenAPI spec and Authentication/Session Management documentation for M2M flows.
Code Generation Configuration
kinde/management_api/generate.go
Updates OpenAPI spec URL from https://api-spec.kinde.com/kinde-management-api-spec.yaml to https://kinde.com/api/kinde-mgmt-api-specs.yaml.
API Operations Definition
kinde/management_api/oas_operations_gen.go
Adds ten new operation name constants: GetEntitlement, GetEntitlements, GetFeatureFlags, GetPortalLink, GetUserPermissions, GetUserProfileV2, GetUserProperties, GetUserRoles, TokenIntrospection, TokenRevocation.
Interface Definitions
kinde/management_api/oas_interfaces_gen.go
Introduces ten new public response interfaces (GetEntitlementRes, GetEntitlementsRes, GetFeatureFlagsRes, GetPortalLinkRes, GetUserPermissionsRes, GetUserProfileV2Res, GetUserPropertiesRes, GetUserRolesRes, TokenIntrospectionRes, TokenRevocationRes) following existing getXRes() pattern.
Request Parameter Handling
kinde/management_api/oas_parameters_gen.go
Adds five new parameter types with unpacking and decoding logic: GetEntitlementParams (path), GetEntitlementsParams (query), GetFeatureFlagsParams (query), GetPortalLinkParams (query), GetUserPropertyValuesParams (path/query).
Client and Invoker Interface
kinde/management_api/oas_client_gen.go
Adds eleven new public methods to Invoker interface and Client: GetEntitlement, GetEntitlements, GetFeatureFlags, GetPortalLink, GetUserPermissions, GetUserProfileV2, GetUserProperties, GetUserRoles, TokenIntrospection, TokenRevocation, plus associated request/response wiring with security checks and telemetry.
Server Handler Interface
kinde/management_api/oas_server_gen.go
Expands public Handler interface with ten new operation methods mirroring the client additions.
Unimplemented Handler Stubs
kinde/management_api/oas_unimplemented_gen.go
Adds ten new unimplemented handler methods that return ErrNotImplemented, providing default stubs for all new operations.
Request Encoding
kinde/management_api/oas_request_encoders_gen.go
Introduces two new form-encoded request encoders: encodeTokenIntrospectionRequest and encodeTokenRevocationRequest for OAuth2 token operations.
Request Decoding
kinde/management_api/oas_request_decoders_gen.go
Adds two new form-encoded request decoders: decodeTokenIntrospectionRequest and decodeTokenRevocationRequest for parsing token-related POST bodies with proper error handling.
Response Decoding
kinde/management_api/oas_response_decoders_gen.go
Adds nine new response decoders for entitlements, feature flags, portal link, token operations, and user endpoints (permissions, profile, properties, roles) with status-specific error handling.
Response Encoding
kinde/management_api/oas_response_encoders_gen.go
Introduces nine new response encoders for the added operations, each setting JSON content-type, handling 200/403/429 statuses with OpenTelemetry updates.
Security Configuration
kinde/management_api/oas_security_gen.go
Registers all ten new operations in the KindeBearerAuth security roles map with empty role slices.
Validation Logic
kinde/management_api/oas_validators_gen.go
Adds validation for GetPortalLinkSubnav enum, TokenIntrospectionReq/Req validation with token_type_hint constraints (access_token, refresh_token), and updates UpdateOrganizationSessionsReqSSOSessionPersistenceMode enum value from "non-persistent" to "non_persistent".

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

This diff spans 20+ modified files in the kinde/management_api/ directory with extensive generated code additions. While changes follow consistent patterns, the review requires verification of: the OpenAPI spec URL update, eleven new public method signatures across client/server/invoker interfaces, parameter and response type unpacking/decoding logic correctness, proper security/telemetry wiring for each endpoint, form-encoded request handling for token operations, validation enum changes, and ensuring all new types and methods integrate correctly with existing scaffolding. The high file count and mixed nature of generated code (operations, parameters, encoders, decoders, validators) across heterogeneous layers demands careful examination despite pattern repetition.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The PR title "fix: regenerate Management API client code…" directly and accurately summarizes the primary change in the changeset. The raw summary confirms that the pull request extensively regenerates multiple generated files within kinde/management_api/ (oas_client_gen.go, oas_interfaces_gen.go, oas_operations_gen.go, and numerous others), adds a Makefile with code generation targets, updates the OpenAPI spec URL in generate.go, and adds documentation about the code generation process. The title is concise, uses conventional commit formatting, and clearly conveys the core purpose of the changes. A developer scanning the repository history would immediately understand that this PR is about updating the auto-generated API client code.
Description Check ✅ Passed The PR description states "This PR regenerates the Management API client code from the latest OpenAPI specification," which is directly related to the changeset. The summary confirms that the generate.go file was updated to point to a new OpenAPI spec URL and that numerous generated files were regenerated with new operations and interfaces. The description provides meaningful context about the purpose of the changes, and the included checklist demonstrates the contributor followed the project's contribution guidelines. The description is neither vague nor generic—it explicitly identifies what was regenerated and why.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
README_MANAGEMENT_API.md (1)

98-105: Fix placeholder URL in code sample.

In the CLI session example the string literal includes < / >, which would actually pass " <https://…>" to WithKindeManagementAPI. Copy/pasting that snippet will fail audience matching. Please remove the angle brackets from the literal so it mirrors the earlier example.

-  client_credentials.WithKindeManagementAPI("<https://my_kinde_tenant.kinde.com>"),
+  client_credentials.WithKindeManagementAPI("https://my_kinde_tenant.kinde.com"),
🧹 Nitpick comments (7)
Makefile (1)

3-4: Add remaining phony declarations.

all and dev are declared targets but missing from the .PHONY list. Tools like checkmake already flag this, and it can lead to make treating real files named all/dev as up-to-date. Please append both targets to the .PHONY line.

-.PHONY: help generate build test clean install-tools
+.PHONY: help generate build test clean install-tools all dev

Also applies to: 41-45

kinde/management_api/oas_request_decoders_gen.go (1)

2138-2252: Add request.Validate() to form-decoded token request handlers for consistency.

These two form-decoder functions skip the full request validation that other decoders perform. While individual field validation occurs on optional TokenTypeHint, the wrapper validation pattern applied elsewhere in the file is absent here. Adding the validation wrapper at the return point aligns these decoders with the established pattern and ensures uniform validation coverage.

Both decodeTokenIntrospectionRequest and decodeTokenRevocationRequest return &request, close, nil without wrapping in the if err := request.Validate() block used by other decoders.

kinde/management_api/oas_parameters_gen.go (1)

8925-9056: Consider validating return_url (open-redirect hardening).

ReturnURL is OptNilString with no format/host checks. Recommend adding format: uri to the OpenAPI spec so ogen emits validation, or validate in handler: allow-listed scheme/host only.

kinde/management_api/oas_client_gen.go (4)

741-752: Doc nit: fix grammar in entitlement summary.

“a the user” → “the user.” If this comes from the spec, fix there and regenerate.


16842-17412: LGTM: GetUserPermissions request; minor doc nit elsewhere.

Encoding for pagination correct; security/decode consistent. Minor separate nit: comment “Gets properties for an user” (later hunk) should be “a user” — fix in spec and regenerate.


20848-21063: Telemetry name casing + auth/content-type verification for oauth2 ops.

  • OperationID strings use lowercased names (“tokenIntrospection”, “tokenRevocation”); others use PascalCase. Align for consistent metrics.
  • Please verify security scheme and request content type for these endpoints vs spec (bearer vs client auth, JSON vs x-www-form-urlencoded). If the spec differs, update spec and regenerate.

Patch (telemetry name only):

- otelogen.OperationID("tokenIntrospection"),
+ otelogen.OperationID("TokenIntrospection"),
- otelogen.OperationID("tokenRevocation"),
+ otelogen.OperationID("TokenRevocation"),

16958-17051: Telemetry name casing for GetUserProfileV2.

Use “GetUserProfileV2” to match OperationName and other ops; current string is “getUserProfileV2”.

- otelogen.OperationID("getUserProfileV2"),
+ otelogen.OperationID("GetUserProfileV2"),
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b21470f and 56fabad.

⛔ Files ignored due to path filters (1)
  • .github/workflows/ci.yml is excluded by !**/*.yml
📒 Files selected for processing (16)
  • Makefile (1 hunks)
  • README.md (1 hunks)
  • README_MANAGEMENT_API.md (1 hunks)
  • kinde/management_api/generate.go (1 hunks)
  • kinde/management_api/oas_client_gen.go (23 hunks)
  • kinde/management_api/oas_interfaces_gen.go (5 hunks)
  • kinde/management_api/oas_operations_gen.go (4 hunks)
  • kinde/management_api/oas_parameters_gen.go (14 hunks)
  • kinde/management_api/oas_request_decoders_gen.go (2 hunks)
  • kinde/management_api/oas_request_encoders_gen.go (2 hunks)
  • kinde/management_api/oas_response_decoders_gen.go (20 hunks)
  • kinde/management_api/oas_response_encoders_gen.go (6 hunks)
  • kinde/management_api/oas_security_gen.go (4 hunks)
  • kinde/management_api/oas_server_gen.go (6 hunks)
  • kinde/management_api/oas_unimplemented_gen.go (6 hunks)
  • kinde/management_api/oas_validators_gen.go (3 hunks)
🧰 Additional context used
🧬 Code graph analysis (10)
kinde/management_api/oas_response_encoders_gen.go (2)
kinde/management_api/oas_interfaces_gen.go (10)
  • GetEntitlementRes (316-318)
  • GetEntitlementsRes (320-322)
  • GetFeatureFlagsRes (348-350)
  • GetPortalLinkRes (404-406)
  • GetUserPermissionsRes (448-450)
  • GetUserProfileV2Res (452-454)
  • GetUserPropertiesRes (456-458)
  • GetUserRolesRes (464-466)
  • TokenIntrospectionRes (564-566)
  • TokenRevocationRes (568-570)
kinde/management_api/oas_schemas_gen.go (66)
  • GetEntitlementResponse (7209-7212)
  • GetEntitlementResponse (7234-7234)
  • GetEntitlementForbidden (7204-7204)
  • GetEntitlementForbidden (7206-7206)
  • Error (4747-4752)
  • GetEntitlementTooManyRequests (7366-7366)
  • GetEntitlementTooManyRequests (7368-7368)
  • GetEntitlementsResponse (7376-7379)
  • GetEntitlementsResponse (7401-7401)
  • GetEntitlementsForbidden (7371-7371)
  • GetEntitlementsForbidden (7373-7373)
  • GetEntitlementsTooManyRequests (7608-7608)
  • GetEntitlementsTooManyRequests (7610-7610)
  • GetFeatureFlagsResponse (8802-8804)
  • GetFeatureFlagsResponse (8816-8816)
  • GetFeatureFlagsForbidden (8797-8797)
  • GetFeatureFlagsForbidden (8799-8799)
  • GetFeatureFlagsTooManyRequests (9024-9024)
  • GetFeatureFlagsTooManyRequests (9026-9026)
  • PortalLink (19639-19642)
  • PortalLink (19654-19654)
  • GetPortalLinkForbidden (10628-10628)
  • GetPortalLinkForbidden (10630-10630)
  • GetPortalLinkTooManyRequests (10709-10709)
  • GetPortalLinkTooManyRequests (10711-10711)
  • GetUserPermissionsResponse (11595-11598)
  • GetUserPermissionsResponse (11620-11620)
  • GetUserPermissionsForbidden (11590-11590)
  • GetUserPermissionsForbidden (11592-11592)
  • GetUserPermissionsTooManyRequests (11716-11716)
  • GetUserPermissionsTooManyRequests (11718-11718)
  • UserProfileV2 (24913-24936)
  • UserProfileV2 (25048-25048)
  • GetUserProfileV2Forbidden (11721-11721)
  • GetUserProfileV2Forbidden (11723-11723)
  • GetUserProfileV2TooManyRequests (11726-11726)
  • GetUserProfileV2TooManyRequests (11728-11728)
  • GetUserPropertiesResponse (11736-11739)
  • GetUserPropertiesResponse (11761-11761)
  • GetUserPropertiesForbidden (11731-11731)
  • GetUserPropertiesForbidden (11733-11733)
  • GetUserPropertiesTooManyRequests (11954-11954)
  • GetUserPropertiesTooManyRequests (11956-11956)
  • GetUserRolesResponse (11974-11977)
  • GetUserRolesResponse (11999-11999)
  • GetUserRolesForbidden (11969-11969)
  • GetUserRolesForbidden (11971-11971)
  • GetUserRolesTooManyRequests (12095-12095)
  • GetUserRolesTooManyRequests (12097-12097)
  • TokenIntrospect (21894-21905)
  • TokenIntrospect (21957-21957)
  • TokenErrorResponse (21863-21868)
  • TokenErrorResponse (21890-21890)
  • TokenErrorResponse (21891-21891)
  • TokenIntrospectionForbidden (21960-21960)
  • TokenIntrospectionForbidden (21962-21962)
  • TokenIntrospectionTooManyRequests (22034-22034)
  • TokenIntrospectionTooManyRequests (22036-22036)
  • TokenRevocationOK (22047-22047)
  • TokenRevocationOK (22049-22049)
  • TokenRevocationBadRequest (22038-22038)
  • TokenRevocationBadRequest (22040-22040)
  • TokenRevocationForbidden (22042-22042)
  • TokenRevocationForbidden (22044-22044)
  • TokenRevocationTooManyRequests (22144-22144)
  • TokenRevocationTooManyRequests (22146-22146)
kinde/management_api/oas_unimplemented_gen.go (3)
kinde/management_api/oas_parameters_gen.go (7)
  • GetEntitlementParams (6958-6961)
  • GetEntitlementsParams (6990-6995)
  • GetFeatureFlagsParams (7239-7244)
  • GetPortalLinkParams (8926-8931)
  • GetUserPermissionsParams (10379-10384)
  • GetUserPropertiesParams (10496-10501)
  • GetUserRolesParams (10679-10684)
kinde/management_api/oas_interfaces_gen.go (10)
  • GetEntitlementRes (316-318)
  • GetEntitlementsRes (320-322)
  • GetFeatureFlagsRes (348-350)
  • GetPortalLinkRes (404-406)
  • GetUserPermissionsRes (448-450)
  • GetUserProfileV2Res (452-454)
  • GetUserPropertiesRes (456-458)
  • GetUserRolesRes (464-466)
  • TokenIntrospectionRes (564-566)
  • TokenRevocationRes (568-570)
kinde/management_api/oas_schemas_gen.go (2)
  • TokenIntrospectionReq (21964-21969)
  • TokenRevocationReq (22051-22060)
kinde/management_api/oas_validators_gen.go (1)
kinde/management_api/oas_schemas_gen.go (8)
  • GetPortalLinkSubnav (10632-10632)
  • GetPortalLinkSubnav (10645-10655)
  • TokenIntrospectionReq (21964-21969)
  • TokenIntrospectionReqTokenTypeHint (21992-21992)
  • TokenIntrospectionReqTokenTypeHint (22000-22005)
  • TokenRevocationReq (22051-22060)
  • TokenRevocationReqTokenTypeHint (22103-22103)
  • TokenRevocationReqTokenTypeHint (22111-22116)
kinde/management_api/oas_request_encoders_gen.go (1)
kinde/management_api/oas_schemas_gen.go (2)
  • TokenIntrospectionReq (21964-21969)
  • TokenRevocationReq (22051-22060)
kinde/management_api/oas_security_gen.go (1)
kinde/management_api/oas_operations_gen.go (10)
  • GetEntitlementOperation (87-87)
  • GetEntitlementsOperation (88-88)
  • GetFeatureFlagsOperation (95-95)
  • GetPortalLinkOperation (109-109)
  • GetUserPermissionsOperation (120-120)
  • GetUserProfileV2Operation (121-121)
  • GetUserPropertiesOperation (122-122)
  • GetUserRolesOperation (124-124)
  • TokenIntrospectionOperation (149-149)
  • TokenRevocationOperation (150-150)
kinde/management_api/oas_server_gen.go (3)
kinde/management_api/oas_parameters_gen.go (7)
  • GetEntitlementParams (6958-6961)
  • GetEntitlementsParams (6990-6995)
  • GetFeatureFlagsParams (7239-7244)
  • GetPortalLinkParams (8926-8931)
  • GetUserPermissionsParams (10379-10384)
  • GetUserPropertiesParams (10496-10501)
  • GetUserRolesParams (10679-10684)
kinde/management_api/oas_interfaces_gen.go (10)
  • GetEntitlementRes (316-318)
  • GetEntitlementsRes (320-322)
  • GetFeatureFlagsRes (348-350)
  • GetPortalLinkRes (404-406)
  • GetUserPermissionsRes (448-450)
  • GetUserProfileV2Res (452-454)
  • GetUserPropertiesRes (456-458)
  • GetUserRolesRes (464-466)
  • TokenIntrospectionRes (564-566)
  • TokenRevocationRes (568-570)
kinde/management_api/oas_schemas_gen.go (2)
  • TokenIntrospectionReq (21964-21969)
  • TokenRevocationReq (22051-22060)
kinde/management_api/oas_request_decoders_gen.go (1)
kinde/management_api/oas_schemas_gen.go (6)
  • TokenIntrospectionReq (21964-21969)
  • TokenIntrospectionReqTokenTypeHint (21992-21992)
  • TokenIntrospectionReqTokenTypeHint (22000-22005)
  • TokenRevocationReq (22051-22060)
  • TokenRevocationReqTokenTypeHint (22103-22103)
  • TokenRevocationReqTokenTypeHint (22111-22116)
kinde/management_api/oas_parameters_gen.go (1)
kinde/management_api/oas_schemas_gen.go (6)
  • OptNilInt (17774-17778)
  • OptNilString (17837-17841)
  • OptNilGetPortalLinkSubnav (17459-17463)
  • GetPortalLinkSubnav (10632-10632)
  • GetPortalLinkSubnav (10645-10655)
  • OptNilGetPropertiesContext (17522-17526)
kinde/management_api/oas_response_decoders_gen.go (2)
kinde/management_api/oas_interfaces_gen.go (13)
  • GetEntitlementRes (316-318)
  • GetEntitlementsRes (320-322)
  • GetFeatureFlagsRes (348-350)
  • GetPortalLinkRes (404-406)
  • GetUserPermissionsRes (448-450)
  • GetUserProfileV2Res (452-454)
  • GetUserPropertiesRes (456-458)
  • GetUserPropertyValuesRes (460-462)
  • GetUserRolesRes (464-466)
  • GetUserSessionsRes (468-470)
  • GetUsersRes (476-478)
  • TokenIntrospectionRes (564-566)
  • TokenRevocationRes (568-570)
kinde/management_api/oas_schemas_gen.go (95)
  • GetEntitlementResponse (7209-7212)
  • GetEntitlementResponse (7234-7234)
  • GetEntitlementForbidden (7204-7204)
  • GetEntitlementForbidden (7206-7206)
  • GetEntitlementTooManyRequests (7366-7366)
  • GetEntitlementTooManyRequests (7368-7368)
  • GetEntitlementsResponse (7376-7379)
  • GetEntitlementsResponse (7401-7401)
  • GetEntitlementsForbidden (7371-7371)
  • GetEntitlementsForbidden (7373-7373)
  • GetEntitlementsTooManyRequests (7608-7608)
  • GetEntitlementsTooManyRequests (7610-7610)
  • GetFeatureFlagsResponse (8802-8804)
  • GetFeatureFlagsResponse (8816-8816)
  • GetFeatureFlagsForbidden (8797-8797)
  • GetFeatureFlagsForbidden (8799-8799)
  • GetFeatureFlagsTooManyRequests (9024-9024)
  • GetFeatureFlagsTooManyRequests (9026-9026)
  • PortalLink (19639-19642)
  • PortalLink (19654-19654)
  • GetPortalLinkForbidden (10628-10628)
  • GetPortalLinkForbidden (10630-10630)
  • GetPortalLinkTooManyRequests (10709-10709)
  • GetPortalLinkTooManyRequests (10711-10711)
  • GetUserPermissionsResponse (11595-11598)
  • GetUserPermissionsResponse (11620-11620)
  • GetUserPermissionsForbidden (11590-11590)
  • GetUserPermissionsForbidden (11592-11592)
  • GetUserPermissionsTooManyRequests (11716-11716)
  • GetUserPermissionsTooManyRequests (11718-11718)
  • UserProfileV2 (24913-24936)
  • UserProfileV2 (25048-25048)
  • GetUserProfileV2Forbidden (11721-11721)
  • GetUserProfileV2Forbidden (11723-11723)
  • GetUserProfileV2TooManyRequests (11726-11726)
  • GetUserProfileV2TooManyRequests (11728-11728)
  • GetUserPropertiesResponse (11736-11739)
  • GetUserPropertiesResponse (11761-11761)
  • GetUserPropertiesForbidden (11731-11731)
  • GetUserPropertiesForbidden (11733-11733)
  • GetUserPropertiesTooManyRequests (11954-11954)
  • GetUserPropertiesTooManyRequests (11956-11956)
  • GetPropertyValuesResponse (10828-10836)
  • GetPropertyValuesResponse (10878-10878)
  • GetPropertyValuesResponse (10879-10879)
  • GetPropertyValuesResponse (10880-10880)
  • ErrorResponse (4775-4777)
  • ErrorResponse (4789-4789)
  • ErrorResponse (4790-4790)
  • ErrorResponse (4791-4791)
  • ErrorResponse (4792-4792)
  • ErrorResponse (4793-4793)
  • ErrorResponse (4794-4794)
  • ErrorResponse (4795-4795)
  • ErrorResponse (4796-4796)
  • ErrorResponse (4797-4797)
  • ErrorResponse (4798-4798)
  • ErrorResponse (4799-4799)
  • ErrorResponse (4800-4800)
  • ErrorResponse (4801-4801)
  • ErrorResponse (4802-4802)
  • ErrorResponse (4803-4803)
  • GetUserRolesResponse (11974-11977)
  • GetUserRolesResponse (11999-11999)
  • GetUserRolesForbidden (11969-11969)
  • GetUserRolesForbidden (11971-11971)
  • GetUserRolesTooManyRequests (12095-12095)
  • GetUserRolesTooManyRequests (12097-12097)
  • GetUserSessionsResponse (12108-12113)
  • GetUserSessionsResponse (12155-12155)
  • GetUserSessionsBadRequest (12099-12099)
  • GetUserSessionsBadRequest (12101-12101)
  • GetUserSessionsForbidden (12103-12103)
  • GetUserSessionsForbidden (12105-12105)
  • GetUserSessionsTooManyRequests (12304-12304)
  • GetUserSessionsTooManyRequests (12306-12306)
  • UsersResponse (25051-25059)
  • UsersResponse (25101-25101)
  • TokenIntrospect (21894-21905)
  • TokenIntrospect (21957-21957)
  • TokenErrorResponse (21863-21868)
  • TokenErrorResponse (21890-21890)
  • TokenErrorResponse (21891-21891)
  • TokenIntrospectionForbidden (21960-21960)
  • TokenIntrospectionForbidden (21962-21962)
  • TokenIntrospectionTooManyRequests (22034-22034)
  • TokenIntrospectionTooManyRequests (22036-22036)
  • TokenRevocationOK (22047-22047)
  • TokenRevocationOK (22049-22049)
  • TokenRevocationBadRequest (22038-22038)
  • TokenRevocationBadRequest (22040-22040)
  • TokenRevocationForbidden (22042-22042)
  • TokenRevocationForbidden (22044-22044)
  • TokenRevocationTooManyRequests (22144-22144)
  • TokenRevocationTooManyRequests (22146-22146)
kinde/management_api/oas_client_gen.go (4)
kinde/management_api/oas_parameters_gen.go (11)
  • GetEntitlementParams (6958-6961)
  • GetEntitlementsParams (6990-6995)
  • GetFeatureFlagsParams (7239-7244)
  • GetPortalLinkParams (8926-8931)
  • GetUserPermissionsParams (10379-10384)
  • GetUserPropertiesParams (10496-10501)
  • GetUserRolesParams (10679-10684)
  • GetIdentityParams (7356-7359)
  • GetPropertiesParams (9058-9067)
  • GetRoleParams (9294-9297)
  • GetUserPropertyValuesParams (10613-10616)
kinde/management_api/oas_interfaces_gen.go (14)
  • GetEntitlementRes (316-318)
  • GetEntitlementsRes (320-322)
  • GetFeatureFlagsRes (348-350)
  • GetPortalLinkRes (404-406)
  • GetUserPermissionsRes (448-450)
  • GetUserProfileV2Res (452-454)
  • GetUserPropertiesRes (456-458)
  • GetUserRolesRes (464-466)
  • TokenIntrospectionRes (564-566)
  • TokenRevocationRes (568-570)
  • GetIdentityRes (352-354)
  • GetPropertiesRes (408-410)
  • GetRoleRes (416-418)
  • GetUserPropertyValuesRes (460-462)
kinde/management_api/oas_schemas_gen.go (2)
  • TokenIntrospectionReq (21964-21969)
  • TokenRevocationReq (22051-22060)
kinde/management_api/oas_operations_gen.go (14)
  • GetEntitlementOperation (87-87)
  • GetEntitlementsOperation (88-88)
  • GetFeatureFlagsOperation (95-95)
  • GetIdentityOperation (96-96)
  • GetPortalLinkOperation (109-109)
  • GetPropertiesOperation (110-110)
  • GetRoleOperation (111-111)
  • GetUserPermissionsOperation (120-120)
  • GetUserProfileV2Operation (121-121)
  • GetUserPropertiesOperation (122-122)
  • GetUserPropertyValuesOperation (123-123)
  • GetUserRolesOperation (124-124)
  • TokenIntrospectionOperation (149-149)
  • TokenRevocationOperation (150-150)
🪛 checkmake (0.2.2)
Makefile

[warning] 3-3: Missing required phony target "all"

(minphony)


[warning] 41-41: Target "all" should be declared PHONY.

(phonydeclared)


[warning] 6-6: Target body for "help" exceeds allowed length of 5 (7).

(maxbodylength)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (55)
kinde/management_api/oas_request_decoders_gen.go (1)

14-18: New imports align with added form decoders.

kinde/management_api/oas_interfaces_gen.go (1)

316-318: Verification confirmed—all marker interface methods have concrete implementations.

The script output shows each of the 10 new response interfaces (getEntitlementRes, getEntitlementsRes, getFeatureFlagsRes, getPortalLinkRes, getUserPermissionsRes, getUserProfileV2Res, getUserPropertiesRes, getUserRolesRes, tokenIntrospectionRes, tokenRevocationRes) has multiple concrete implementers. No interface assertion issues would occur.

kinde/management_api/oas_validators_gen.go (1)

1281-1301: Review comment is incorrect; no breaking change detected.

The validator correctly accepts both "persistent" and "non_persistent" values. Both enum constants are defined (oas_schemas_gen.go:23831–23832), and the JSON decoders invoke Validate() as expected (oas_validators_gen.go:1776, oas_json_gen.go:46725). No rename or removal occurred—this is not a breaking change.

Likely an incorrect or invalid review comment.

kinde/management_api/oas_security_gen.go (1)

116-118: Verify scheme requirements against authoritative OpenAPI spec.

The operations are mapped to empty authorization lists, but the generated security handler comment specifies "client_credentials flow"—a machine-to-machine token grant. User-facing endpoints like GetUserProfileV2Operation, GetEntitlementsOperation, and GetPermissionsOperation typically require user bearer tokens instead.

Since the code is generated and no OpenAPI spec is in the repository, manual verification is needed:

  • Confirm the spec defines the correct security scheme for these account_api endpoints
  • Ensure the client_credentials comment matches the intended token type
  • Verify whether empty role lists are intentional or need authorization checks
kinde/management_api/oas_operations_gen.go (1)

87-88: LGTM! Generated operation constants are consistent.

The new operation name constants follow the established pattern and are properly integrated into the alphabetically sorted list. All additions align with the expanded Management API surface for entitlements, feature flags, user data, and OAuth2 token operations.

Also applies to: 95-95, 109-109, 120-122, 124-124, 149-150

kinde/management_api/oas_server_gen.go (1)

720-731: Implementation stubs found but no actual implementations exist.

Verification confirms all 10 new Handler methods have unimplemented stubs in oas_unimplemented_gen.go (lines 964, 973, 1055, 1223, 1357, 1367, 1376, 1397, 1699, 1709), but no actual implementations were found in non-generated code.

This may be expected if this is generated SDK code where developers are expected to implement these methods. Verify with the team whether implementations should already exist or if they're intentionally left for future development.

kinde/management_api/oas_parameters_gen.go (13)

6989-7105: LGTM: paging params decoding for GetEntitlements.
Pattern matches the rest (optional ints/strings, no missing validation).


7238-7354: LGTM: GetFeatureFlags paging params.
Consistent with established decode/unpack.


9057-9068: LGTM: GetProperties params surface (Context, paging).
Enum Context will be validated downstream where provided.


10105-10205: LGTM: GetUserData query (id, expand).
Optional expand stays free-form as per spec.


10207-10376: LGTM: GetUserIdentities (path + cursors).
Decoding follows standard pattern.


10379-10493: LGTM: GetUserPermissions paging params.
No issues.


10495-10611: LGTM: GetUserProperties paging params.
Looks consistent.


10612-10677: LGTM: GetUserPropertyValues (path param parsing).
Signature args [1]string and decoding look correct.


10678-10794: LGTM: GetUserRoles paging params.
Matches other list endpoints.


10875-10876: Docstring tweak only.
No code impact.


12841-12844: LGTM: SearchUsers query doc updates.
Clearer description.


12872-12880: LGTM: SearchUsers adds api_scopes filter.
Optional string aligns with other comma-separated filters.
If api_scopes expects multiple values, consider array-of-string in the spec to get typed []string decoding.


13004-13045: LGTM: Decode for api_scopes.
Decodes single string; no validation needed unless spec adds enum.

kinde/management_api/oas_response_decoders_gen.go (14)

9777-9823: LGTM: GetEntitlement decoder added correctly.

Status mappings and JSON decode path match GetEntitlementRes and related schema types.


9824-9870: LGTM: GetEntitlements decoder.

Mappings and decode flow align with interfaces/schemas.


10637-10683: LGTM: GetFeatureFlags decoder.

403/429 no-body variants are consistent with schema.


12210-12256: LGTM: GetPortalLink decoder.

200 returns PortalLink; 403/429 mapped to empty structs per schema.


13394-13439: LGTM: GetUserPermissions decoder (renamed path).

Return type and status handling match new GetUserPermissionsRes.


13441-13486: LGTM: GetUserProfileV2 decoder.

200 returns UserProfileV2 as expected; 403/429 mapped correctly.


13488-13533: LGTM: GetUserProperties decoder.

Type and status coverage look correct.


13535-13615: LGTM: GetUserPropertyValues decoder.

Shares GetPropertyValuesResponse across resource scopes; status paths OK.


13617-13662: LGTM: GetUserRoles decoder.

Mappings consistent with GetUserRolesRes variants.


13664-13843: LGTM: GetUserSessions decoder.

Distinct 400/403/404/429 variants decoded to their specific types; good fidelity to schema.


13845-13990: LGTM: GetUsers decoder.

200 UsersResponse + standard error variants; consistent with interfaces.


17099-17179: LGTM: Token introspection decoder.

200 returns TokenIntrospect; 401 decodes TokenErrorResponse per RFC semantics.


17181-17328: LGTM: Token revocation decoder.

200 no-body OK; 400/401 decode structured errors; 403/429 covered.


9787-9792: The resp.Body lifecycle concern is already properly handled.

Every HTTP method in oas_client_gen.go follows the safe pattern: defers resp.Body.Close() immediately after the HTTP call succeeds, then invokes the decoder. This ensures the connection is released after the decoder finishes reading the body, preventing leaks. No action required.

kinde/management_api/oas_client_gen.go (22)

808-813: LGTM: new GetFeatureFlags interface method.

Signature and route comment look consistent.


933-939: LGTM: new GetPortalLink interface method.

Parameters (Subnav, ReturnURL) match oas_parameters_gen.go.


1035-1053: LGTM: user endpoints wiring (permissions, profile v2, properties).

Interfaces align with params/res types.


1063-1068: LGTM: GetUserRoles interface method.

Route and params are consistent.


12310-12453: LGTM: GetEntitlements implementation.

Query params (page_size, starting_after), security, tracing, and decode are consistent.


13138-13154: LGTM: GetFeatureFlags instrumentation scaffold.

Operation ID, method, route align; see next hunk for params encode.


13166-13316: LGTM: GetFeatureFlags request assembly.

Correct query encoding for page_size and starting_after; security and decode paths OK.


15172-15189: LGTM: GetPortalLink scaffold.

Operation ID and route look correct.


15202-15205: LGTM: GetPortalLink span start.

Consistent with other ops.


15217-15259: LGTM: GetPortalLink query encoding.

subnav (enum) and return_url encoded properly.


15271-15275: LGTM: GetPortalLink security.

Bearer security applied like other account_api endpoints.


15307-15314: LGTM: GetPortalLink response decode.

Decode function and error wrapping consistent.


15316-15334: LGTM: GetProperties scaffold.

Operation ID, route and scopes comment consistent.


15348-15351: LGTM: GetProperties span start.


15363-15568: LGTM: GetProperties URL and query encoding.

page_size, starting_after, ending_before, context encoded; security and decode OK.


15509-15566: LGTM: GetRole path param encoding.

role_id encoded via PathEncoder; route correct.


16804-16819: LGTM: GetUserPermissions scaffold.

Operation ID and route match account_api.


16833-16836: LGTM: GetUserPermissions span start.


17421-17425: LGTM: GetUserRoles security.


17457-17460: LGTM: GetUserRoles response decode.


20576-20592: Verify api_scopes parameter cardinality against OpenAPI specification.

The code currently treats api_scopes as a single string (OptNilString) in SearchUsersParams and encodes it accordingly with StringStyleForm and StringToString() conversion. This implementation is internally consistent throughout the generated code (parameter decoding, encoding, and handling all align).

However, I could not locate the OpenAPI specification file in the repository to confirm whether this single-string treatment matches the intended spec. Without access to the specification, it's impossible to definitively verify if the parameter cardinality is correct or if it should instead be an array with repeated query parameters or CSV format as the review comment suggests.

Please manually verify the OpenAPI specification for the SearchUsers operation's api_scopes query parameter to confirm:

  • Whether it's defined as type: string (current implementation) or type: array (would require code changes)
  • The intended encoding format if it is an array

1290-1302: Verify upstream OpenAPI spec for correct security scheme on introspect/revoke.

The generated Go code cannot be manually edited. Kinde requires client authentication (client_id + client_secret via HTTP Basic or form-encoded) for /oauth2/introspect and /oauth2/revoke, not bearer auth. The OpenAPI spec is maintained externally and not in this repository. Confirm the upstream spec declares these endpoints with the correct security scheme (client auth), and regenerate if needed.

Comment on lines +12205 to +12308
// GetEntitlement invokes GetEntitlement operation.
//
// Returns a single entitlement by the feature key.
//
// GET /account_api/v1/entitlement
func (c *Client) GetEntitlement(ctx context.Context, params GetEntitlementParams) (GetEntitlementRes, error) {
res, err := c.sendGetEntitlement(ctx, params)
return res, err
}

func (c *Client) sendGetEntitlement(ctx context.Context, params GetEntitlementParams) (res GetEntitlementRes, err error) {
otelAttrs := []attribute.KeyValue{
otelogen.OperationID("GetEntitlement"),
semconv.HTTPRequestMethodKey.String("GET"),
semconv.HTTPRouteKey.String("/account_api/v1/entitlement"),
}

// Run stopwatch.
startTime := time.Now()
defer func() {
// Use floating point division here for higher precision (instead of Millisecond method).
elapsedDuration := time.Since(startTime)
c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...))
}()

// Increment request counter.
c.requests.Add(ctx, 1, metric.WithAttributes(otelAttrs...))

// Start a span for this request.
ctx, span := c.cfg.Tracer.Start(ctx, GetEntitlementOperation,
trace.WithAttributes(otelAttrs...),
clientSpanKind,
)
// Track stage for error reporting.
var stage string
defer func() {
if err != nil {
span.RecordError(err)
span.SetStatus(codes.Error, stage)
c.errors.Add(ctx, 1, metric.WithAttributes(otelAttrs...))
}
span.End()
}()

stage = "BuildURL"
u := uri.Clone(c.requestURL(ctx))
var pathParts [1]string
pathParts[0] = "/account_api/v1/entitlement"
uri.AddPathParts(u, pathParts[:]...)

stage = "EncodeRequest"
r, err := ht.NewRequest(ctx, "GET", u)
if err != nil {
return res, errors.Wrap(err, "create request")
}

{
type bitset = [1]uint8
var satisfied bitset
{
stage = "Security:KindeBearerAuth"
switch err := c.securityKindeBearerAuth(ctx, GetEntitlementOperation, r); {
case err == nil: // if NO error
satisfied[0] |= 1 << 0
case errors.Is(err, ogenerrors.ErrSkipClientSecurity):
// Skip this security.
default:
return res, errors.Wrap(err, "security \"KindeBearerAuth\"")
}
}

if ok := func() bool {
nextRequirement:
for _, requirement := range []bitset{
{0b00000001},
} {
for i, mask := range requirement {
if satisfied[i]&mask != mask {
continue nextRequirement
}
}
return true
}
return false
}(); !ok {
return res, ogenerrors.ErrSecurityRequirementIsNotSatisfied
}
}

stage = "SendRequest"
resp, err := c.cfg.Client.Do(r)
if err != nil {
return res, errors.Wrap(err, "do request")
}
defer resp.Body.Close()

stage = "DecodeResponse"
result, err := decodeGetEntitlementResponse(resp)
if err != nil {
return res, errors.Wrap(err, "decode response")
}

return result, nil
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Critical: GetEntitlement does not encode required ‘key’ parameter.

GetEntitlementParams.Key is never sent; server won’t know which entitlement to return. Encode it as a query param (likely “key”). Prefer fixing the spec and regenerating; patch below unblocks now.

Run to confirm no “key” encoding exists:

Patch:

 stage = "BuildURL"
 u := uri.Clone(c.requestURL(ctx))
 var pathParts [1]string
 pathParts[0] = "/account_api/v1/entitlement"
 uri.AddPathParts(u, pathParts[:]...)
 
+stage = "EncodeQueryParams"
+q := uri.NewQueryEncoder()
+{
+  // Encode "key" parameter.
+  cfg := uri.QueryParameterEncodingConfig{
+    Name:    "key",
+    Style:   uri.QueryStyleForm,
+    Explode: true,
+  }
+  if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
+    return e.EncodeValue(conv.StringToString(params.Key))
+  }); err != nil {
+    return res, errors.Wrap(err, "encode query")
+  }
+}
+u.RawQuery = q.Values().Encode()
+
 stage = "EncodeRequest"
 r, err := ht.NewRequest(ctx, "GET", u)

🏁 Script executed:

#!/bin/bash
rg -nC2 'sendGetEntitlement|Encode "key"|key"' kinde/management_api/oas_client_gen.go

Length of output: 3515



---

🏁 Script executed:

```shell
#!/bin/bash
# Get the full sendGetEntitlement function and surrounding context
sed -n '12215,12310p' kinde/management_api/oas_client_gen.go

Length of output: 2541


🏁 Script executed:

#!/bin/bash
# Find GetEntitlementParams struct definition
rg -nA 20 'type GetEntitlementParams struct' kinde/management_api/oas_client_gen.go

Length of output: 0


🏁 Script executed:

#!/bin/bash
# Find examples of query param encoding to understand the pattern
rg -nB 5 -A 10 'uri.NewQueryEncoder' kinde/management_api/oas_client_gen.go | head -60

Length of output: 1771


🏁 Script executed:

#!/bin/bash
# Check if there's an OpenAPI spec or schema reference
fd -e yaml -e json -e yml | head -20

Length of output: 30



---

🏁 Script executed:

```shell
#!/bin/bash
# Search for GetEntitlementParams as a type (not just struct)
rg -n 'GetEntitlementParams' kinde/management_api/oas_client_gen.go | head -30

Length of output: 342


🏁 Script executed:

#!/bin/bash
# Search for GetEntitlements (plural) to see if it has param encoding for comparison
sed -n '12320,12450p' kinde/management_api/oas_client_gen.go

Length of output: 3415


🏁 Script executed:

#!/bin/bash
# Look for type definitions of GetEntitlementParams anywhere (could be type alias)
rg -nB 2 -A 15 'type GetEntitlementParams' kinde/management_api/oas_client_gen.go

Length of output: 0


🏁 Script executed:

#!/bin/bash
# Search file size and find where type definitions typically are
wc -l kinde/management_api/oas_client_gen.go && echo "---" && rg -n '^type.*Params struct' kinde/management_api/oas_client_gen.go | tail -20

Length of output: 48



---

🏁 Script executed:

```shell
#!/bin/bash
# Search for GetEntitlementParams with = (type alias)
rg -n 'GetEntitlementParams\s*=' kinde/management_api/oas_client_gen.go

Length of output: 0


🏁 Script executed:

#!/bin/bash
# Search more broadly for the type definition with all variations
rg -nB 2 -A 5 'GetEntitlementParams' kinde/management_api/oas_client_gen.go | grep -A 5 'type '

Length of output: 0


🏁 Script executed:

#!/bin/bash
# Check git diff to see what changed in this PR for GetEntitlement
git diff HEAD~1 HEAD -- kinde/management_api/oas_client_gen.go | grep -A 30 -B 10 'GetEntitlement' | head -80

Length of output: 0


🏁 Script executed:

#!/bin/bash
# Look for interface or empty struct definition that might not match the pattern
grep -n 'GetEntitlementParams' kinde/management_api/oas_client_gen.go | while read line; do
  linenum=$(echo "$line" | cut -d: -f1)
  # Check 50 lines before each usage
  start=$((linenum - 50))
  [ $start -lt 1 ] && start=1
  sed -n "${start},${linenum}p" kinde/management_api/oas_client_gen.go | tail -20
done | head -40

Length of output: 1257


🏁 Script executed:

#!/bin/bash
# Search for the complete type definition in a different way
awk '/type GetEntitlementParams/,/^}/' kinde/management_api/oas_client_gen.go | head -30

Length of output: 0



---

🏁 Script executed:

```shell
#!/bin/bash
# Find all Go files in the management_api directory
find kinde/management_api -name "*.go" -type f | head -20

Length of output: 832


🏁 Script executed:

#!/bin/bash
# Search all Go files in management_api for GetEntitlementParams
rg -l 'GetEntitlementParams' kinde/management_api/ 

Length of output: 207


🏁 Script executed:

#!/bin/bash
# Search across the entire repo for the type definition
rg -n 'type GetEntitlementParams' . 

Length of output: 84


🏁 Script executed:

#!/bin/bash
# Check if there's a types_gen.go or similar file
find kinde -name "*types*" -type f

Length of output: 0



---

🏁 Script executed:

```shell
#!/bin/bash
# Extract GetEntitlementParams struct definition
sed -n '6958,6980p' kinde/management_api/oas_parameters_gen.go

Length of output: 568


🏁 Script executed:

#!/bin/bash
# Find and extract GetEntitlementsParams struct definition
rg -n 'type GetEntitlementsParams struct' kinde/management_api/oas_parameters_gen.go

Length of output: 40


🏁 Script executed:

#!/bin/bash
# Get broader context around GetEntitlementParams
sed -n '6950,6990p' kinde/management_api/oas_parameters_gen.go

Length of output: 879



---

🏁 Script executed:

```shell
#!/bin/bash
# Extract GetEntitlementsParams to see the field structure and compare
sed -n '6990,7020p' kinde/management_api/oas_parameters_gen.go

Length of output: 806


🏁 Script executed:

#!/bin/bash
# Check sendGetEntitlements URL pattern to see if it encodes parameters into path
sed -n '12320,12370p' kinde/management_api/oas_client_gen.go | grep -A 5 "pathParts\|BuildURL"

Length of output: 260


🏁 Script executed:

#!/bin/bash
# Look for similar single-key endpoints to understand the pattern
rg -n 'In:.*"path"' kinde/management_api/oas_parameters_gen.go | head -10

Length of output: 205


🏁 Script executed:

#!/bin/bash
# Check if there are examples of path parameter encoding in the client
rg -nB 5 -A 10 'uri.NewPathEncoder' kinde/management_api/oas_client_gen.go | grep -A 15 'GetEntity\|GetFeature' | head -40

Length of output: 0



---

🏁 Script executed:

```shell
#!/bin/bash
# Find a function that properly encodes a path parameter
rg -nB 10 -A 20 'uri.NewPathEncoder.*Param.*key' kinde/management_api/oas_client_gen.go | head -60

Length of output: 0


🏁 Script executed:

#!/bin/bash
# Look at lines around 6141 where we saw path encoding examples earlier
sed -n '6135,6165p' kinde/management_api/oas_client_gen.go

Length of output: 799


🏁 Script executed:

#!/bin/bash
# Find what the correct endpoint pattern should be by looking at the OpenAPI spec or interface
rg -n 'GetEntitlement.*operation' kinde/management_api/ -A 5

Length of output: 8406


🏁 Script executed:

#!/bin/bash
# Check the interfaces file to see how GetEntitlement is declared
rg -nB 2 -A 5 'GetEntitlement.*context.Context.*GetEntitlementParams' kinde/management_api/oas_interfaces_gen.go

Length of output: 0


Critical: GetEntitlement does not encode required 'key' path parameter.

GetEntitlementParams.Key is defined as a path parameter but is never encoded into the URL; the endpoint needs /account_api/v1/entitlement/{key}. The review suggestion uses query param encoding, but the spec defines this as a path parameter. Use path encoding instead. Prefer fixing the spec and regenerating; corrected patch below.

 stage = "BuildURL"
 u := uri.Clone(c.requestURL(ctx))
 var pathParts [2]string
 pathParts[0] = "/account_api/v1/entitlement/"
 {
+	// Encode "key" parameter.
+	e := uri.NewPathEncoder(uri.PathEncoderConfig{
+		Param:   "key",
+		Style:   uri.PathStyleSimple,
+		Explode: false,
+	})
+	if err := func() error {
+		return e.EncodeValue(conv.StringToString(params.Key))
+	}(); err != nil {
+		return res, errors.Wrap(err, "encode path")
+	}
+	encoded, err := e.Result()
+	if err != nil {
+		return res, errors.Wrap(err, "encode path")
+	}
+	pathParts[1] = encoded
 }
 uri.AddPathParts(u, pathParts[:]...)
 
 stage = "EncodeRequest"

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In kinde/management_api/oas_client_gen.go around lines 12205-12308, the handler
builds the URL for GET /account_api/v1/entitlement but never inserts the
required path parameter key; update the path to include the {key} value, ensure
the HTTP route attribute matches (/account_api/v1/entitlement/{key}), and encode
the param into the URL (e.g., replace the static pathParts with one that
includes the URL-encoded params.Key or call uri.AddPathParts with params.Key),
adjust the pathParts size accordingly, and validate params.Key is present
(return an error if empty); ideally fix the OpenAPI spec to mark key as a path
parameter and regenerate the client.

Comment on lines +6957 to +6988
// GetEntitlementParams is parameters of GetEntitlement operation.
type GetEntitlementParams struct {
// The key of the feature.
Key string
}

func unpackGetEntitlementParams(packed middleware.Parameters) (params GetEntitlementParams) {
{
key := middleware.ParameterKey{
Name: "key",
In: "path",
}
params.Key = packed[key].(string)
}
return params
}

func decodeGetEntitlementParams(args [0]string, argsEscaped bool, r *http.Request) (params GetEntitlementParams, _ error) {
// Decode path: key.
if err := func() error {
// Not used.
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "key",
In: "path",
Err: err,
}
}
return params, nil
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Blocker: path param "key" is never decoded (args length 0).

decodeGetEntitlementParams declares args [0]string and doesn’t parse the required path param, so params.Key stays empty. Fix by decoding like the other path params.

Apply this diff (or regenerate after fixing the OpenAPI spec):

-func decodeGetEntitlementParams(args [0]string, argsEscaped bool, r *http.Request) (params GetEntitlementParams, _ error) {
-  // Decode path: key.
-  if err := func() error {
-    // Not used.
-    return nil
-  }(); err != nil {
-    return params, &ogenerrors.DecodeParamError{
-      Name: "key",
-      In:   "path",
-      Err:  err,
-    }
-  }
-  return params, nil
-}
+func decodeGetEntitlementParams(args [1]string, argsEscaped bool, r *http.Request) (params GetEntitlementParams, _ error) {
+  // Decode path: key.
+  if err := func() error {
+    param := args[0]
+    if argsEscaped {
+      unescaped, err := url.PathUnescape(args[0])
+      if err != nil {
+        return errors.Wrap(err, "unescape path")
+      }
+      param = unescaped
+    }
+    if len(param) > 0 {
+      d := uri.NewPathDecoder(uri.PathDecoderConfig{
+        Param:   "key",
+        Value:   param,
+        Style:   uri.PathStyleSimple,
+        Explode: false,
+      })
+      if err := func() error {
+        val, err := d.DecodeValue()
+        if err != nil {
+          return err
+        }
+        c, err := conv.ToString(val)
+        if err != nil {
+          return err
+        }
+        params.Key = c
+        return nil
+      }(); err != nil {
+        return err
+      }
+    } else {
+      return validate.ErrFieldRequired
+    }
+    return nil
+  }(); err != nil {
+    return params, &ogenerrors.DecodeParamError{
+      Name: "key",
+      In:   "path",
+      Err:  err,
+    }
+  }
+  return params, nil
+}

Run to find similar generator glitches:


🏁 Script executed:

#!/bin/bash
set -euo pipefail
rg -nP 'func\s+decode\w+Params\(\s*args\s*\[\s*0\s*\]string' -C2
rg -nP 'Not used\.' -C2

Length of output: 13078



Output results are needed; execute the script.

---

🏁 Script executed:

```shell
#!/bin/bash
set -euo pipefail
# Find all functions with "// Decode path:" comments and their function signatures
rg -nP '// Decode path:' -B5 kinde/management_api/oas_parameters_gen.go | grep -E "(func decode|// Decode path:)"

Length of output: 82


🏁 Script executed:

#!/bin/bash
set -euo pipefail
# Find all lines with "// Decode path:" and extract the function signature (args size)
rg -nP 'func decode\w+Params\(args \[[0-9]+\]string' -C3 | grep -E "(func decode|Decode path:)" | head -40

Length of output: 5215


🏁 Script executed:

#!/bin/bash
set -euo pipefail
# Find ALL decode functions with args [0]string and check if any have "// Decode path:"
rg -nA10 'func decode\w+Params\(args \[0\]string' kinde/management_api/oas_parameters_gen.go | grep -E "(func decode|// Decode path:)" | head -60

Length of output: 3795


Blocker: path param "key" is never decoded (args length 0).

decodeGetEntitlementParams declares args [0]string and doesn't parse the required path param, so params.Key stays empty. Fix by decoding like the other path params.

Apply this diff (or regenerate after fixing the OpenAPI spec):

-func decodeGetEntitlementParams(args [0]string, argsEscaped bool, r *http.Request) (params GetEntitlementParams, _ error) {
-  // Decode path: key.
-  if err := func() error {
-    // Not used.
-    return nil
-  }(); err != nil {
-    return params, &ogenerrors.DecodeParamError{
-      Name: "key",
-      In:   "path",
-      Err:  err,
-    }
-  }
-  return params, nil
-}
+func decodeGetEntitlementParams(args [1]string, argsEscaped bool, r *http.Request) (params GetEntitlementParams, _ error) {
+  // Decode path: key.
+  if err := func() error {
+    param := args[0]
+    if argsEscaped {
+      unescaped, err := url.PathUnescape(args[0])
+      if err != nil {
+        return errors.Wrap(err, "unescape path")
+      }
+      param = unescaped
+    }
+    if len(param) > 0 {
+      d := uri.NewPathDecoder(uri.PathDecoderConfig{
+        Param:   "key",
+        Value:   param,
+        Style:   uri.PathStyleSimple,
+        Explode: false,
+      })
+      if err := func() error {
+        val, err := d.DecodeValue()
+        if err != nil {
+          return err
+        }
+        c, err := conv.ToString(val)
+        if err != nil {
+          return err
+        }
+        params.Key = c
+        return nil
+      }(); err != nil {
+        return err
+      }
+    } else {
+      return validate.ErrFieldRequired
+    }
+    return nil
+  }(); err != nil {
+    return params, &ogenerrors.DecodeParamError{
+      Name: "key",
+      In:   "path",
+      Err:  err,
+    }
+  }
+  return params, nil
+}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// GetEntitlementParams is parameters of GetEntitlement operation.
type GetEntitlementParams struct {
// The key of the feature.
Key string
}
func unpackGetEntitlementParams(packed middleware.Parameters) (params GetEntitlementParams) {
{
key := middleware.ParameterKey{
Name: "key",
In: "path",
}
params.Key = packed[key].(string)
}
return params
}
func decodeGetEntitlementParams(args [0]string, argsEscaped bool, r *http.Request) (params GetEntitlementParams, _ error) {
// Decode path: key.
if err := func() error {
// Not used.
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "key",
In: "path",
Err: err,
}
}
return params, nil
}
// GetEntitlementParams is parameters of GetEntitlement operation.
type GetEntitlementParams struct {
// The key of the feature.
Key string
}
func unpackGetEntitlementParams(packed middleware.Parameters) (params GetEntitlementParams) {
{
key := middleware.ParameterKey{
Name: "key",
In: "path",
}
params.Key = packed[key].(string)
}
return params
}
func decodeGetEntitlementParams(args [1]string, argsEscaped bool, r *http.Request) (params GetEntitlementParams, _ error) {
// Decode path: key.
if err := func() error {
param := args[0]
if argsEscaped {
unescaped, err := url.PathUnescape(args[0])
if err != nil {
return errors.Wrap(err, "unescape path")
}
param = unescaped
}
if len(param) > 0 {
d := uri.NewPathDecoder(uri.PathDecoderConfig{
Param: "key",
Value: param,
Style: uri.PathStyleSimple,
Explode: false,
})
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToString(val)
if err != nil {
return err
}
params.Key = c
return nil
}(); err != nil {
return err
}
} else {
return validate.ErrFieldRequired
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "key",
In: "path",
Err: err,
}
}
return params, nil
}

GetEntitlement(ctx context.Context, params GetEntitlementParams) (GetEntitlementRes, error)
// GetEntitlements implements GetEntitlements operation.
//
// Returns all the entitlements a the user currently has access to.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Minor: Grammar error in generated comment (source spec issue).

The comment contains "a the user" which should be "the user". However, since this is generated code, the error originates in the source OpenAPI specification. Consider updating the OpenAPI spec to fix this typo.

🤖 Prompt for AI Agents
In kinde/management_api/oas_server_gen.go around line 728, the generated comment
reads "a the user" (grammar typo) coming from the OpenAPI spec; correct the
source OpenAPI operation/parameter description to replace "a the user" with "the
user" and then re-run the code generator to regenerate this file; if you cannot
update the spec immediately, apply a one-line manual fix to the generated
comment and add a TODO or note to fix the source spec so the generator produces
the correct text on next run.

Comment on lines +959 to +966
// GetEntitlement implements GetEntitlement operation.
//
// Returns a single entitlement by the feature key.
//
// GET /account_api/v1/entitlement
func (UnimplementedHandler) GetEntitlement(ctx context.Context, params GetEntitlementParams) (r GetEntitlementRes, _ error) {
return r, ht.ErrNotImplemented
}

@coderabbitai coderabbitai Bot Oct 24, 2025

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

UnimplementedHandler wiring added — OK.

Endpoints and comments align with new operations; stubs properly return ht.ErrNotImplemented. Minor nit: “a the user” in GetEntitlements doc (Lines 970-971).

  • Confirm router/security wiring covers these paths:

  • If the doc typo originates in the OpenAPI spec, please fix it there so regen picks it up.

Also applies to: 968-975, 1050-1057, 1217-1225, 1352-1359, 1361-1369, 1371-1379, 1392-1399, 1694-1701, 1703-1711


🏁 Script executed:

#!/bin/bash
rg -nP '/account_api/v1/(entitlement|entitlements|feature_flags|portal_link)|/oauth2/(v2/user_profile|introspect|revoke)' -C2 kinde/management_api
rg -nP 'Get(Entitlement|Entitlements|FeatureFlags|PortalLink|UserPermissions|UserProfileV2|UserProperties|UserRoles|TokenIntrospection|TokenRevocation)Operation' -n kinde/management_api

Length of output: 35094


Router and security wiring verified — all endpoints properly registered. Fix doc typo in OpenAPI spec source.

Verification confirms all 7 new endpoints are correctly wired in router, security map, and handlers with proper operation constants. However, the doc typo "a the user" (GetEntitlements operation, line 970) appears across all generated files (oas_server_gen.go, oas_client_gen.go, oas_handlers_gen.go), indicating it originates in the OpenAPI specification. Locate and fix this in the spec source, then re-run the code generator to ensure the correction propagates to all generated files.

🤖 Prompt for AI Agents
In kinde/management_api/oas_unimplemented_gen.go around lines 959–966 the
generated comment shows the typo "a the user" originating from the OpenAPI spec;
search the OpenAPI source for the GetEntitlements operation description (or
globally for the phrase "a the user"), correct the typo to the intended text
(e.g., "the user" or "a user") in the spec, then re-run the code generator to
regenerate oas_server_gen.go, oas_client_gen.go, oas_handlers_gen.go (and any
other generated files) so the corrected wording propagates everywhere.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I've raised a PR internally to fix the typo in spec.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@coel, thank you for raising the PR to fix the typo in the spec! That's the right approach—once the spec is updated and you regenerate the client code, the correction will propagate across all the generated files automatically. 🎉


If you found this review helpful, would you consider giving us a shout-out on X?

Thank you for using CodeRabbit!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The change to the spec has been deployed now.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@coel, excellent! 🎉 Thank you for fixing the spec and deploying it.

To pick up the corrected documentation, you'll want to regenerate the Management API client code from the updated spec. Running:

make generate

should pull the latest spec and regenerate all the oas_*.go files with the typo fixed. Once you do that, the corrected wording will appear throughout the generated code.

Thanks for addressing this so promptly!

@onderay
onderay requested a review from a team November 6, 2025 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants