Skip to content

Support storing properties in the gateway#922

Open
VirajSalaka wants to merge 3 commits intowso2:mainfrom
VirajSalaka:gw-label-fix2
Open

Support storing properties in the gateway#922
VirajSalaka wants to merge 3 commits intowso2:mainfrom
VirajSalaka:gw-label-fix2

Conversation

@VirajSalaka
Copy link
Contributor

@VirajSalaka VirajSalaka commented Feb 4, 2026

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 properties field 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:

  • Added a Properties field (map[string]interface{}) to the CreateGatewayRequest, UpdateGatewayRequest, and GatewayResponse structs, allowing clients to specify and receive custom gateway properties. [1] [2] [3]

Service and handler updates:

  • Updated the gateway creation and update handlers and service methods to accept and process the new Properties field, 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:

  • Modified the Gateway model to include a Properties field 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:

  • Updated the OpenAPI specification to document the new properties field for gateway request and response schemas, including type information and usage examples. [1] [2] [3]## Purpose

Explain why this feature or fix is required. Describe the underlying problems, issues, or needs driving this feature/fix and include links to related issues in the following format: Resolves issue1, issue2, etc.

Goals

Describe what solutions this feature or fix introduces to address the problems outlined above.

Approach

Describe how you are implementing the solutions. Include an animated GIF or screenshot if the change affects the UI. Include a link to a Markdown file or Google doc if the feature write-up is too long to paste here.

User stories

Summary of user stories addressed by this change>

Documentation

Link(s) to product documentation that addresses the changes of this PR. If no doc impact, enter “N/A” plus brief explanation of why there’s no doc impact

Automation tests

  • Unit tests

    Code coverage information

  • Integration tests

    Details about the test cases and coverage

Security checks

Samples

Provide high-level details about the samples related to this feature

Related PRs

List any other related PRs

Test environment

List all JDK versions, operating systems, databases, and browser/versions on which this feature/fix was tested

Summary by CodeRabbit

  • New Features

    • Gateways now support custom properties (arbitrary key-value metadata) during creation and updates.
    • Properties are persisted and returned in gateway API responses.
  • Documentation

    • API schema updated to expose properties in create, update, and response payloads.
  • Tests

    • Added tests covering creation and update behaviors for gateway properties.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 4, 2026

Walkthrough

Adds 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

Cohort / File(s) Summary
Request/Response DTOs
platform-api/src/internal/dto/gateway.go
Added Properties (map[string]interface{}) to CreateGatewayRequest, GatewayResponse, and UpdateGatewayRequest (optional) to carry arbitrary metadata.
HTTP Handler
platform-api/src/internal/handler/gateway.go
Handlers now forward req.Properties to service calls for Register and Update flows.
Business Logic / Service
platform-api/src/internal/service/gateway.go, platform-api/src/internal/service/gateway_properties_test.go
Extended RegisterGateway and UpdateGateway signatures to accept properties; applied properties at create/update and included in responses. Added unit tests for property creation and update behaviors.
Domain Model
platform-api/src/internal/model/gateway.go
Added Properties map[string]interface{} json:"properties,omitempty" db:"properties"toGatewayandAPIGatewayWithDetails`. Field ordering adjusted.
Persistence Layer
platform-api/src/internal/repository/gateway.go, platform-api/src/internal/repository/api.go
Persist gateway.properties as JSON in a new properties column; serialize on Create/Update and deserialize on reads (Get, List, GetByName, GetByOrg, GetAPIGatewaysWithDetails) with error handling. Added encoding/json usage.
API Spec
platform-api/src/resources/openapi.yaml
Added properties schema (type: object, additionalProperties: true) to CreateGatewayRequest, GatewayResponse, and UpdateGatewayRequest.
Module / Misc
go.mod
Minor module changes referenced by diff (kept for completeness).

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 } }
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I tucked new keys in burrows deep,

where gateways wake from restful sleep.
From request to row, in JSON bright,
Properties hop into the light.
A tiny field that makes things right.

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description provides technical details about implementation across multiple layers but lacks key template sections like Purpose (why), Goals, User stories, Documentation impact, Security checks, and Test environment details. Complete the PR description by filling in all template sections: Purpose (problem statement with issue links), Goals, User stories, Documentation links, detailed test coverage, security verification checklist, and test environment specifications.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding support for storing properties in gateways, which aligns with the changeset across DTOs, models, service, repository, and OpenAPI.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Important

Action Needed: IP Allowlist Update

If your organization protects your Git platform with IP whitelisting, please add the new CodeRabbit IP address to your allowlist:

  • 136.113.208.247/32 (new)
  • 34.170.211.100/32
  • 35.222.179.152/32

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.

❤️ Share

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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.

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.

1 participant