Support storing properties in the gateway#922
Conversation
WalkthroughAdds a Properties map[string]interface{} field across DTOs, domain models, service layer, handlers, repository persistence, and OpenAPI so arbitrary key-value gateway properties are accepted, stored (JSON), returned, and tested end-to-end. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant HTTP as HTTP Handler
participant Service
participant Repo
participant DB
Client->>HTTP: POST /gateways { ..., properties }
HTTP->>Service: RegisterGateway(..., properties)
Service->>Repo: CreateGateway(model{..., Properties})
Repo->>DB: INSERT INTO gateways (..., properties = json)
DB-->>Repo: OK
Repo-->>Service: created gateway (with properties JSON)
Service-->>HTTP: GatewayResponse (includes properties)
HTTP-->>Client: 201 Created { gateway: { ..., properties } }
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Important Action Needed: IP Allowlist UpdateIf your organization protects your Git platform with IP whitelisting, please add the new CodeRabbit IP address to your allowlist:
Reviews will stop working after February 8, 2026 if the new IP is not added to your allowlist. 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@platform-api/src/internal/model/gateway.go`:
- Around line 24-33: APIGatewayWithDetails is missing the new Properties field
and the DB query/scan in GetAPIGatewaysWithDetails doesn't include g.properties,
so add Properties map[string]interface{} `json:"properties,omitempty"
db:"properties"` to the APIGatewayWithDetails struct, add g.properties to the
SELECT list in GetAPIGatewaysWithDetails, and update the rows.Scan (or
db.QueryRow/Scan usage) that constructs APIGatewayWithDetails to include the
corresponding destination for Properties so it gets populated when reading from
the database.
This pull request adds support for custom key-value properties on gateways throughout the API, service, repository, and OpenAPI specification. Gateways can now have a flexible
propertiesfield for storing additional metadata, which is handled in all create, update, retrieve, and list operations. The implementation includes changes to data models, DTOs, database storage (as JSON), service logic, handlers, and documentation.API and DTO enhancements:
Propertiesfield (map[string]interface{}) to theCreateGatewayRequest,UpdateGatewayRequest, andGatewayResponsestructs, allowing clients to specify and receive custom gateway properties. [1] [2] [3]Service and handler updates:
Propertiesfield, ensuring the properties are passed through to the repository and returned in responses. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]Repository and model changes:
Gatewaymodel to include aPropertiesfield and updated repository methods to serialize/deserialize this field as JSON when storing and retrieving gateways from the database. All relevant queries and scans were updated to handle the new column. [1] [2] [3] [4] [5] [6] [7]OpenAPI documentation:
propertiesfield for gateway request and response schemas, including type information and usage examples. [1] [2] [3]## PurposeGoals
Approach
User stories
Documentation
Automation tests
Security checks
Samples
Related PRs
Test environment
Summary by CodeRabbit
New Features
Documentation
Tests