Skip to content

Conversation

@tacklequestions
Copy link
Contributor

@tacklequestions tacklequestions commented Oct 26, 2025

Change1 Add Environment Management module

1

Portal Controller Analysis

The original portal's environment controller only has one method to get all env

2 3

those two are openapi-generated method and endpoint definition

Change2 Modification of OpenClusterDTO

4

Analysis of the original OpenClusterDTO issue:
Compared with ClusterDTO, it was missing the following fields: id, parentClusterId, and comment.

Problem scenario example:
When the frontend calls the getCluster method of OpenAPI (which corresponds to the loadCluster method of the portal), using OpenClusterDTO causes clusters with comments to fail to display their comment information correctly on the frontend.

5

Solution

The newly added fields are consistent with ClusterDTO and compatible with the original OpenClusterDTO

Change3 fix the operator missing issue of the portal call

6

Problem Analysis

In the original method "deleteCluster" definition, the operator param is restricted as required, but this param would be missing when portal call this openapi method.

Solution

Compatible solution design: If it is a portal request, the operator will skip the current verification from UserInfoHolder. If it is an openapi request, the operator will perform the current verification process. But at first, we have to change the param to a optional param.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added environment listing endpoint to retrieve all available environments
    • Enhanced cluster information with additional metadata fields (ID, parent cluster reference, and comments)
  • Improvements

    • Simplified cluster deletion API by making the operator parameter optional for certain scenarios

@coderabbitai
Copy link

coderabbitai bot commented Oct 26, 2025

Walkthrough

The PR introduces a new Environment Management API endpoint (GET /openapi/v1/envs) for retrieving environment names, extends the OpenClusterDTO model with three new fields (id, parentClusterId, comment), and makes the operator parameter optional (instead of required) in the delete cluster endpoint with clarified description for external API calls. Changes are reflected across OpenAPI specifications and all generated client/server libraries.

Changes

Cohort / File(s) Summary
OpenAPI Specification
apollo-openapi.yaml, java-client/api/openapi.yaml, spring-boot2/src/main/resources/openapi.yaml
Added Environment Management tag and new GET /openapi/v1/envs endpoint returning List. Extended OpenClusterDTO with id, parentClusterId, comment fields. Made operator parameter optional (required: false) in DELETE cluster endpoint with updated description.
Java Client: EnvironmentManagementApi
java-client/src/main/java/org/openapitools/client/api/EnvironmentManagementApi.java, java-client/.openapi-generator/FILES
New EnvironmentManagementApi class exposing getEnvs(), getEnvsWithHttpInfo(), and getEnvsAsync() methods with ApiKeyAuth support and proper request/response handling.
Java Client: ClusterManagementApi
java-client/src/main/java/org/openapitools/client/api/ClusterManagementApi.java
Made operator parameter optional in deleteCluster by removing null check and conditionally adding to query parameters.
Java Client: Models & Tests
java-client/src/main/java/org/openapitools/client/model/OpenClusterDTO.java, java-client/src/test/java/org/openapitools/client/model/OpenClusterDTOTest.java
Added id, parentClusterId, comment fields with getters/setters, fluent builders, and updated equals/hashCode/toString. Added test stubs for new fields.
Java Client: Documentation
java-client/README.md, java-client/docs/ClusterManagementApi.md, java-client/docs/EnvironmentManagementApi.md, java-client/docs/OpenClusterDTO.md
Updated API documentation tables and created new EnvironmentManagementApi.md. Updated deleteCluster parameter docs to mark operator as optional.
Java Client: Tests
java-client/src/test/java/org/openapitools/client/api/EnvironmentManagementApiTest.java
New test class with disabled test stub for getEnvs().
Python Client: API Wrappers
python/apollo_openapi/apis/tags/environment_management_api.py, python/apollo_openapi/apis/paths/openapi_v1_envs/get.py, python/apollo_openapi/apis/paths/openapi_v1_envs/get.pyi
New EnvironmentManagementApi class and comprehensive GET endpoint implementation with response handling, schemas, and typed overloads.
Python Client: Path & Tag Registration
python/apollo_openapi/apis/path_to_api.py, python/apollo_openapi/apis/tag_to_api.py, python/apollo_openapi/apis/tags/__init__.py, python/apollo_openapi/paths/__init__.py, python/apollo_openapi/paths/openapi_v1_envs/__init__.py
Added ENVIRONMENT_MANAGEMENT tag enum, PathValues.OPENAPI_V1_ENVS path constant, and registered in tag/path routing dictionaries.
Python Client: Delete Endpoint
python/apollo_openapi/paths/openapi_v1_envs_env_apps_app_id_clusters_cluster_name/delete.py, python/apollo_openapi/paths/openapi_v1_envs_env_apps_app_id_clusters_cluster_name/delete.pyi
Moved operator from required to optional query parameters (removed required=True).
Python Client: Models
python/apollo_openapi/model/open_cluster_dto.py, python/apollo_openapi/model/open_cluster_dto.pyi
Added id, parentClusterId, comment fields with types, property overloads for \__getitem\_\_, get_item_oapg, and updated constructor signature.
Python Client: Documentation & Tests
python/README.md, python/docs/apis/tags/ClusterManagementApi.md, python/docs/apis/tags/EnvironmentManagementApi.md, python/docs/models/OpenClusterDTO.md, python/test/test_paths/test_openapi_v1_envs/...
Updated API docs with new endpoint entry, marked operator optional in delete_cluster, added EnvironmentManagementApi.md guide, and created test module structure.
Spring Boot: API Interfaces & Controller
spring-boot2/src/main/java/com/apollo/openapi/server/api/EnvironmentManagementApi.java, spring-boot2/src/main/java/com/apollo/openapi/server/api/EnvironmentManagementApiController.java, spring-boot2/src/main/java/com/apollo/openapi/server/api/EnvironmentManagementApiDelegate.java
New EnvironmentManagementApi interface with getEnvs() default method, controller implementation with delegate injection, and delegate interface with NOT_IMPLEMENTED placeholder and example response support.
Spring Boot: ClusterManagementApi
spring-boot2/src/main/java/com/apollo/openapi/server/api/ClusterManagementApi.java
Changed operator @RequestParam from required=true to required=false with updated Javadoc description.
Spring Boot: Models
spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenClusterDTO.java
Added id, parentClusterId, comment fields with @JsonProperty/@Schema annotations, getters/setters, fluent builders, and updated equals/hashCode/toString.
TypeScript Client: API
typescript/src/apis/EnvironmentManagementApi.ts, typescript/src/apis/index.ts
New EnvironmentManagementApi class with getEnvsRaw() and getEnvs() methods performing GET /openapi/v1/envs with ApiKey authorization. Re-exported in index.
TypeScript Client: ClusterManagementApi & Models
typescript/src/apis/ClusterManagementApi.ts, typescript/src/models/OpenClusterDTO.ts
Made operator field optional in DeleteClusterRequest interface (operator?: string). Added id?, parentClusterId?, comment? optional properties to OpenClusterDTO.
Rust
rust/src/models/open_cluster_dto.rs, rust/docs/OpenClusterDto.md
Added id, parent_cluster_id, comment fields as Option/Option with serde renames. Updated new() to initialize new fields to None.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant EnvironmentManagementApi
    participant ApiClient
    participant AuthHandler
    participant Server as GET /openapi/v1/envs

    Client->>EnvironmentManagementApi: getEnvs()
    EnvironmentManagementApi->>EnvironmentManagementApi: getEnvsRaw()
    EnvironmentManagementApi->>ApiClient: execute(GET, /openapi/v1/envs)
    ApiClient->>AuthHandler: attachApiKeyAuth()
    AuthHandler->>ApiClient: add Authorization header
    ApiClient->>Server: GET /openapi/v1/envs<br/>[Authorization: ApiKey ...]
    Server->>ApiClient: 200 OK<br/>["DEV", "FAT", "UAT", "PRO"]
    ApiClient->>EnvironmentManagementApi: ApiResponse<List<String>>
    EnvironmentManagementApi->>Client: List<String>
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Operator parameter change across implementations: Verify that the required flag change from true to false is correctly propagated across all generated code (Java, Python, Spring Boot, TypeScript) and that descriptions are consistently updated to note external OpenAPI caller context.
  • New EnvironmentManagementApi implementations: Check correctness of endpoint path (/openapi/v1/envs), response type (List), and authentication mechanism (ApiKeyAuth) across each language.
  • OpenClusterDTO field additions: Verify all three new fields (id, parentClusterId, comment) are consistently added across all models with correct types (Long/int64 for ids, String for comment) and proper serialization names (@SerializedName, serde rename, etc.).
  • Generated code quality: Spot-check a representative sample (e.g., Python get.py and Java EnvironmentManagementApi.java) for completeness and consistency with existing patterns.

Possibly related PRs

  • fix: fixed operator issue #11: Both PRs modify the operator query parameter in the DELETE /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName} endpoint—this PR makes operator optional while related PR addresses operator requirement semantics.

Suggested reviewers

  • arrow1991
  • hezhangjian

Poem

🐰 A new path emerges, bright and green,
Environments listed, now plainly seen,
Fields grow rich with id and comment's gleam,
The operator relaxes—optional dream,
Codegen hops through languages with glee! 🌟

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.69% 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title accurately reflects the three primary changes introduced in the changeset: adding an Environment Management module (evidenced by the new EnvironmentManagementApi across all SDK generators, the new /openapi/v1/envs endpoint, and related documentation), making the operator parameter optional for portal compatibility (reflected in updated parameter configurations across multiple API files), and augmenting OpenClusterDTO with missing fields id, parentClusterId, and comment (present in OpenAPI schemas and generated model classes across all languages). The title is specific and clear without being vague, directly mapping to substantial, real changes throughout the codebase rather than generic terms, and appropriately conveys the scope of the update even though it encompasses multiple coordinated changes.
✨ 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.

Copy link

@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

🧹 Nitpick comments (8)
python/apollo_openapi/paths/openapi_v1_envs/get.pyi (1)

10-11: Remove duplicate import.

typing_extensions is imported twice. Keep a single import.

-from dataclasses import dataclass
-import typing_extensions
+from dataclasses import dataclass
@@
-import typing_extensions  # noqa: F401
+import typing_extensions  # noqa: F401

Also applies to: 21-22

java-client/src/main/java/org/openapitools/client/model/OpenClusterDTO.java (2)

396-399: Add numeric JSON validation for id and parentClusterId.

Currently only comment is type-checked. Guard id and parentClusterId to reject non-numeric inputs early.

       if ((jsonObj.get("appId") != null && !jsonObj.get("appId").isJsonNull()) && !jsonObj.get("appId").isJsonPrimitive()) {
         throw new IllegalArgumentException(String.format("Expected the field `appId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("appId").toString()));
       }
+      if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull())) {
+        if (!jsonObj.get("id").isJsonPrimitive() || !jsonObj.get("id").getAsJsonPrimitive().isNumber()) {
+          throw new IllegalArgumentException(String.format("Expected the field `id` to be a number in the JSON string but got `%s`", jsonObj.get("id").toString()));
+        }
+      }
+      if ((jsonObj.get("parentClusterId") != null && !jsonObj.get("parentClusterId").isJsonNull())) {
+        if (!jsonObj.get("parentClusterId").isJsonPrimitive() || !jsonObj.get("parentClusterId").getAsJsonPrimitive().isNumber()) {
+          throw new IllegalArgumentException(String.format("Expected the field `parentClusterId` to be a number in the JSON string but got `%s`", jsonObj.get("parentClusterId").toString()));
+        }
+      }
       if ((jsonObj.get("comment") != null && !jsonObj.get("comment").isJsonNull()) && !jsonObj.get("comment").isJsonPrimitive()) {
         throw new IllegalArgumentException(String.format("Expected the field `comment` to be a primitive type in the JSON string but got `%s`", jsonObj.get("comment").toString()));
       }

18-39: Duplicate imports — clean up.

The block re-imports several Gson and IO classes. Remove the second set to avoid clutter.

-import com.google.gson.TypeAdapter;
-...
-import com.google.gson.TypeAdapter;
-import com.google.gson.stream.JsonReader;
-import com.google.gson.stream.JsonWriter;
-import java.io.IOException;
+import com.google.gson.TypeAdapter;
+import com.google.gson.annotations.JsonAdapter;
+import com.google.gson.annotations.SerializedName;
+import com.google.gson.stream.JsonReader;
+import com.google.gson.stream.JsonWriter;
+import java.io.IOException;

(Note: keep only one import per class; adjust the exact removals to dedupe the repeated lines.)

python/test/test_paths/test_openapi_v1_envs/test_get.py (1)

1-41: LGTM! Test structure is correct.

The test class follows the standard pattern for path-based API tests. The placeholder structure is appropriate for auto-generated code.

Optional: Remove unused noqa directives.

Static analysis flags that the # noqa: E501 directives on lines 15 and 30 are unnecessary since the E501 rule is not enabled.

-from apollo_openapi.paths.openapi_v1_envs import get  # noqa: E501
+from apollo_openapi.paths.openapi_v1_envs import get
-        self.api = get.ApiForget(api_client=used_api_client)  # noqa: E501
+        self.api = get.ApiForget(api_client=used_api_client)
python/docs/apis/tags/EnvironmentManagementApi.md (1)

1-87: LGTM! Documentation is complete and accurate.

The documentation properly describes the new getEnvs endpoint with clear examples and parameter descriptions. The content is well-structured and informative.

Optional: Address markdown linting issues.

Static analysis flags several markdown formatting issues (bare URLs, table formatting, heading levels) in this auto-generated documentation. While these don't affect functionality, fixing them would improve consistency. Consider configuring the OpenAPI generator to produce compliant markdown if these warnings are a concern.

spring-boot2/src/main/java/com/apollo/openapi/server/api/EnvironmentManagementApi.java (1)

39-68: Endpoint wiring looks good; optional: trim unused imports (codegen noise).

Mapping, security, and delegate handoff are correct. If you’re customizing templates, consider dropping unused imports (e.g., ExternalDocumentation, Parameter, Parameters, ParameterIn, MultipartFile, Valid, javax.validation.constraints.*, Map) to cut warnings. Otherwise safe to keep as‑is since this is generated.

spring-boot2/src/main/java/com/apollo/openapi/server/api/EnvironmentManagementApiDelegate.java (1)

32-42: Guard against null Accept header to avoid parse errors.

request.getHeader("Accept") may be null. Add a null‑safe fallback before parseMediaTypes; also drop unused imports.

Apply:

@@
-import org.springframework.web.multipart.MultipartFile;
+// (none)
@@
-import java.util.List;
-import java.util.Map;
+import java.util.List;
+import java.util.Collections;
@@
-        getRequest().ifPresent(request -> {
-            for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
+        getRequest().ifPresent(request -> {
+            String accept = request.getHeader("Accept");
+            List<MediaType> mediaTypes = (accept != null)
+                ? MediaType.parseMediaTypes(accept)
+                : Collections.emptyList();
+            for (MediaType mediaType: mediaTypes) {
                 if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
                     String exampleString = "[ \"\", \"\" ]";
                     ApiUtil.setExampleResponse(request, "application/json", exampleString);
                     break;
                 }
             }
         });
python/apollo_openapi/paths/openapi_v1_envs/get.py (1)

9-26: Clean up duplicate imports and unused noqa to satisfy Ruff.

Remove the second typing_extensions import and drop unused # noqa: F401 directives flagged by Ruff.

Apply:

@@
-from dataclasses import dataclass
-import typing_extensions
+from dataclasses import dataclass
+import typing_extensions
@@
-from apollo_openapi import api_client, exceptions
-from datetime import date, datetime  # noqa: F401
-import decimal  # noqa: F401
-import functools  # noqa: F401
-import io  # noqa: F401
-import re  # noqa: F401
-import typing  # noqa: F401
-import typing_extensions  # noqa: F401
-import uuid  # noqa: F401
+from apollo_openapi import api_client, exceptions
+from datetime import date, datetime
+import decimal
+import functools
+import io
+import re
+import typing
+# typing_extensions already imported above
+import uuid
@@
-import frozendict  # noqa: F401
+import frozendict
@@
-from apollo_openapi import schemas  # noqa: F401
+from apollo_openapi import schemas

If you prefer keeping noqa, enable F401 in Ruff instead. Based on static analysis hints.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6c1d182 and feac274.

📒 Files selected for processing (47)
  • apollo-openapi.yaml (4 hunks)
  • java-client/.openapi-generator/FILES (3 hunks)
  • java-client/README.md (1 hunks)
  • java-client/api/openapi.yaml (5 hunks)
  • java-client/docs/ClusterManagementApi.md (2 hunks)
  • java-client/docs/EnvironmentManagementApi.md (1 hunks)
  • java-client/docs/OpenClusterDTO.md (1 hunks)
  • java-client/src/main/java/org/openapitools/client/api/ClusterManagementApi.java (4 hunks)
  • java-client/src/main/java/org/openapitools/client/api/EnvironmentManagementApi.java (1 hunks)
  • java-client/src/main/java/org/openapitools/client/model/OpenClusterDTO.java (6 hunks)
  • java-client/src/test/java/org/openapitools/client/api/EnvironmentManagementApiTest.java (1 hunks)
  • java-client/src/test/java/org/openapitools/client/model/OpenClusterDTOTest.java (1 hunks)
  • python/.openapi-generator/FILES (2 hunks)
  • python/README.md (2 hunks)
  • python/apollo_openapi/apis/path_to_api.py (3 hunks)
  • python/apollo_openapi/apis/paths/openapi_v1_envs.py (1 hunks)
  • python/apollo_openapi/apis/tag_to_api.py (3 hunks)
  • python/apollo_openapi/apis/tags/__init__.py (1 hunks)
  • python/apollo_openapi/apis/tags/environment_management_api.py (1 hunks)
  • python/apollo_openapi/model/open_cluster_dto.py (5 hunks)
  • python/apollo_openapi/model/open_cluster_dto.pyi (5 hunks)
  • python/apollo_openapi/paths/__init__.py (1 hunks)
  • python/apollo_openapi/paths/openapi_v1_envs/__init__.py (1 hunks)
  • python/apollo_openapi/paths/openapi_v1_envs/get.py (1 hunks)
  • python/apollo_openapi/paths/openapi_v1_envs/get.pyi (1 hunks)
  • python/apollo_openapi/paths/openapi_v1_envs_env_apps_app_id_clusters_cluster_name/delete.py (1 hunks)
  • python/apollo_openapi/paths/openapi_v1_envs_env_apps_app_id_clusters_cluster_name/delete.pyi (1 hunks)
  • python/docs/apis/tags/ClusterManagementApi.md (4 hunks)
  • python/docs/apis/tags/EnvironmentManagementApi.md (1 hunks)
  • python/docs/models/OpenClusterDTO.md (1 hunks)
  • python/test/test_paths/test_openapi_v1_envs/__init__.py (1 hunks)
  • python/test/test_paths/test_openapi_v1_envs/test_get.py (1 hunks)
  • rust/docs/OpenClusterDto.md (1 hunks)
  • rust/src/models/open_cluster_dto.rs (2 hunks)
  • spring-boot2/.openapi-generator/FILES (1 hunks)
  • spring-boot2/src/main/java/com/apollo/openapi/server/api/ClusterManagementApi.java (2 hunks)
  • spring-boot2/src/main/java/com/apollo/openapi/server/api/ClusterManagementApiDelegate.java (3 hunks)
  • spring-boot2/src/main/java/com/apollo/openapi/server/api/EnvironmentManagementApi.java (1 hunks)
  • spring-boot2/src/main/java/com/apollo/openapi/server/api/EnvironmentManagementApiController.java (1 hunks)
  • spring-boot2/src/main/java/com/apollo/openapi/server/api/EnvironmentManagementApiDelegate.java (1 hunks)
  • spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenClusterDTO.java (4 hunks)
  • spring-boot2/src/main/resources/openapi.yaml (5 hunks)
  • typescript/.openapi-generator/FILES (1 hunks)
  • typescript/src/apis/ClusterManagementApi.ts (1 hunks)
  • typescript/src/apis/EnvironmentManagementApi.ts (1 hunks)
  • typescript/src/apis/index.ts (1 hunks)
  • typescript/src/models/OpenClusterDTO.ts (3 hunks)
🧰 Additional context used
🧬 Code graph analysis (15)
spring-boot2/src/main/java/com/apollo/openapi/server/api/EnvironmentManagementApiDelegate.java (2)
spring-boot2/src/main/java/com/apollo/openapi/server/api/EnvironmentManagementApiController.java (1)
  • Generated (27-43)
typescript/src/apis/EnvironmentManagementApi.ts (1)
  • getEnvs (50-53)
typescript/src/apis/EnvironmentManagementApi.ts (2)
java-client/src/main/java/org/openapitools/client/api/EnvironmentManagementApi.java (1)
  • EnvironmentManagementApi (38-188)
python/apollo_openapi/apis/tags/environment_management_api.py (1)
  • EnvironmentManagementApi (15-23)
python/apollo_openapi/apis/tags/environment_management_api.py (1)
python/apollo_openapi/paths/openapi_v1_envs/get.py (5)
  • get (218-226)
  • get (229-235)
  • get (238-247)
  • get (249-261)
  • GetEnvs (164-211)
python/apollo_openapi/model/open_cluster_dto.pyi (1)
python/apollo_openapi/model/open_cluster_dto.py (13)
  • MetaOapg (38-60)
  • properties (40-60)
  • get_item_oapg (98-98)
  • get_item_oapg (101-101)
  • get_item_oapg (104-104)
  • get_item_oapg (107-107)
  • get_item_oapg (110-110)
  • get_item_oapg (113-113)
  • get_item_oapg (116-116)
  • get_item_oapg (119-119)
  • get_item_oapg (122-122)
  • get_item_oapg (125-125)
  • get_item_oapg (127-128)
python/apollo_openapi/apis/paths/openapi_v1_envs.py (1)
python/apollo_openapi/paths/openapi_v1_envs/get.py (5)
  • get (218-226)
  • get (229-235)
  • get (238-247)
  • get (249-261)
  • ApiForget (214-261)
python/apollo_openapi/apis/tag_to_api.py (2)
python/apollo_openapi/apis/tags/environment_management_api.py (1)
  • EnvironmentManagementApi (15-23)
python/apollo_openapi/apis/tags/__init__.py (1)
  • TagValues (8-18)
python/apollo_openapi/apis/path_to_api.py (2)
python/apollo_openapi/apis/paths/openapi_v1_envs.py (1)
  • OpenapiV1Envs (4-7)
python/apollo_openapi/paths/__init__.py (1)
  • PathValues (8-55)
java-client/src/test/java/org/openapitools/client/api/EnvironmentManagementApiTest.java (1)
typescript/src/apis/EnvironmentManagementApi.ts (1)
  • getEnvs (50-53)
python/apollo_openapi/model/open_cluster_dto.py (1)
python/apollo_openapi/model/open_cluster_dto.pyi (2)
  • MetaOapg (38-60)
  • properties (40-60)
python/apollo_openapi/paths/openapi_v1_envs/get.py (1)
python/apollo_openapi/paths/openapi_v1_envs/get.pyi (18)
  • SchemaFor200ResponseBodyApplicationJson (30-50)
  • MetaOapg (35-36)
  • ApiResponseFor200 (54-59)
  • BaseApi (74-153)
  • _get_envs_oapg (76-84)
  • _get_envs_oapg (87-93)
  • _get_envs_oapg (96-105)
  • _get_envs_oapg (107-153)
  • get (210-218)
  • get (221-227)
  • get (230-239)
  • get (241-253)
  • GetEnvs (156-203)
  • get_envs (160-168)
  • get_envs (171-177)
  • get_envs (180-189)
  • get_envs (191-203)
  • ApiForget (206-253)
java-client/src/main/java/org/openapitools/client/api/EnvironmentManagementApi.java (1)
java-client/src/main/java/org/openapitools/client/ApiException.java (1)
  • SuppressWarnings (24-166)
spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenClusterDTO.java (3)
spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenAppNamespaceDTO.java (1)
  • Schema (21-299)
spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenItemDTO.java (1)
  • Schema (21-251)
spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenReleaseDTO.java (1)
  • Schema (23-334)
spring-boot2/src/main/java/com/apollo/openapi/server/api/EnvironmentManagementApi.java (2)
spring-boot2/src/main/java/com/apollo/openapi/server/api/EnvironmentManagementApiController.java (1)
  • Generated (27-43)
java-client/src/main/java/org/openapitools/client/api/EnvironmentManagementApi.java (1)
  • EnvironmentManagementApi (38-188)
python/test/test_paths/test_openapi_v1_envs/test_get.py (2)
python/apollo_openapi/paths/openapi_v1_envs/get.py (5)
  • get (218-226)
  • get (229-235)
  • get (238-247)
  • get (249-261)
  • ApiForget (214-261)
python/apollo_openapi/paths/openapi_v1_envs/get.pyi (5)
  • get (210-218)
  • get (221-227)
  • get (230-239)
  • get (241-253)
  • ApiForget (206-253)
python/apollo_openapi/paths/openapi_v1_envs/__init__.py (1)
python/apollo_openapi/paths/__init__.py (1)
  • PathValues (8-55)
🪛 LanguageTool
python/docs/models/OpenClusterDTO.md

[grammar] ~19-~19: Use a hyphen to join words.
Context: ...集群的唯一标识符 | [optional] value must be a 64 bit integer parentClusterId | decima...

(QB_NEW_EN_HYPHEN)


[style] ~20-~20: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...Id** | decimal.Decimal, int, | decimal.Decimal, | 父集群的ID | [optional] value must be a...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[grammar] ~20-~20: Use a hyphen to join words.
Context: ...| 父集群的ID | [optional] value must be a 64 bit integer comment | str, | str, ...

(QB_NEW_EN_HYPHEN)

🪛 markdownlint-cli2 (0.18.1)
java-client/docs/EnvironmentManagementApi.md

3-3: Bare URL used

(MD034, no-bare-urls)


20-20: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3

(MD001, heading-increment)

python/docs/apis/tags/EnvironmentManagementApi.md

4-4: Bare URL used

(MD034, no-bare-urls)


18-18: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3

(MD001, heading-increment)


62-62: Link fragments should be valid

(MD051, link-fragments)


65-65: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


67-67: Table pipe style
Expected: no_leading_or_trailing; Actual: trailing_only; Unexpected trailing pipe

(MD055, table-pipe-style)


67-67: Table column count
Expected: 4; Actual: 3; Too few cells, row will be missing data

(MD056, table-column-count)


68-68: Table pipe style
Expected: no_leading_or_trailing; Actual: trailing_only; Unexpected trailing pipe

(MD055, table-pipe-style)


68-68: Table column count
Expected: 4; Actual: 3; Too few cells, row will be missing data

(MD056, table-column-count)


69-69: Table pipe style
Expected: no_leading_or_trailing; Actual: trailing_only; Unexpected trailing pipe

(MD055, table-pipe-style)


69-69: Table column count
Expected: 4; Actual: 3; Too few cells, row will be missing data

(MD056, table-column-count)


74-74: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


76-76: Table pipe style
Expected: no_leading_or_trailing; Actual: trailing_only; Unexpected trailing pipe

(MD055, table-pipe-style)


76-76: Table column count
Expected: 4; Actual: 3; Too few cells, row will be missing data

(MD056, table-column-count)


79-79: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


81-81: Table pipe style
Expected: no_leading_or_trailing; Actual: trailing_only; Unexpected trailing pipe

(MD055, table-pipe-style)


81-81: Table column count
Expected: 5; Actual: 4; Too few cells, row will be missing data

(MD056, table-column-count)

python/docs/apis/tags/ClusterManagementApi.md

62-62: Link fragments should be valid

(MD051, link-fragments)

🪛 Ruff (0.14.1)
python/apollo_openapi/apis/tags/environment_management_api.py

6-6: Docstring contains ambiguous (FULLWIDTH COLON). Did you mean : (COLON)?

(RUF002)


6-6: Docstring contains ambiguous (FULLWIDTH COLON). Did you mean : (COLON)?

(RUF002)


6-6: Docstring contains ambiguous (FULLWIDTH COMMA). Did you mean , (COMMA)?

(RUF002)


6-6: Docstring contains ambiguous (FULLWIDTH COLON). Did you mean : (COLON)?

(RUF002)


6-6: Docstring contains ambiguous (FULLWIDTH COLON). Did you mean : (COLON)?

(RUF002)


6-6: Docstring contains ambiguous (FULLWIDTH COMMA). Did you mean , (COMMA)?

(RUF002)

python/apollo_openapi/paths/openapi_v1_envs/get.py

15-15: Unused noqa directive (non-enabled: F401)

Remove unused noqa directive

(RUF100)


16-16: Unused noqa directive (non-enabled: F401)

Remove unused noqa directive

(RUF100)


17-17: Unused noqa directive (non-enabled: F401)

Remove unused noqa directive

(RUF100)


18-18: Unused noqa directive (non-enabled: F401)

Remove unused noqa directive

(RUF100)


19-19: Unused noqa directive (non-enabled: F401)

Remove unused noqa directive

(RUF100)


20-20: Unused noqa directive (non-enabled: F401)

Remove unused noqa directive

(RUF100)


21-21: Redefinition of unused typing_extensions from line 10

Remove definition: typing_extensions

(F811)


21-21: Unused noqa directive (non-enabled: F401)

Remove unused noqa directive

(RUF100)


22-22: Unused noqa directive (non-enabled: F401)

Remove unused noqa directive

(RUF100)


24-24: Unused noqa directive (non-enabled: F401)

Remove unused noqa directive

(RUF100)


26-26: Unused noqa directive (non-enabled: F401)

Remove unused noqa directive

(RUF100)

python/test/test_paths/test_openapi_v1_envs/test_get.py

15-15: Unused noqa directive (non-enabled: E501)

Remove unused noqa directive

(RUF100)


30-30: Unused noqa directive (non-enabled: E501)

Remove unused noqa directive

(RUF100)

🔇 Additional comments (60)
python/test/test_paths/test_openapi_v1_envs/__init__.py (1)

1-1: Correct Python package structure.

The empty __init__.py is appropriate and follows standard Python packaging conventions. It properly registers the directory as a package, enabling test discovery and import.

python/apollo_openapi/paths/__init__.py (1)

55-55: LGTM! New environment path added correctly.

The new OPENAPI_V1_ENVS enum member follows the existing naming convention and pattern.

python/README.md (1)

232-232: LGTM! Documentation updated for new Environment Management API.

The new API endpoint entry is properly documented in the endpoints table.

python/.openapi-generator/FILES (1)

11-11: LGTM! Generator files list updated.

New Environment Management API files properly registered in the generator output manifest.

Also applies to: 88-88

java-client/src/main/java/org/openapitools/client/api/ClusterManagementApi.java (1)

232-232: LGTM! Operator parameter correctly made optional.

The parameter is now optional and only added to the query when non-null (lines 273-275), which aligns with the PR's goal of supporting portal calls where operator may be missing. The server-side implementation should handle the missing operator by skipping verification from UserInfoHolder for portal requests.

Also applies to: 273-275

spring-boot2/.openapi-generator/FILES (1)

13-15: LGTM! Server-side Environment Management API files registered.

New Spring Boot2 server stubs for Environment Management API properly listed in generator manifest.

rust/src/models/open_cluster_dto.rs (1)

35-43: LGTM! New OpenClusterDto fields properly implemented.

The three new fields (id, parent_cluster_id, comment) are correctly added as optional fields with proper serde annotations and initialized to None in the constructor. This matches the OpenAPI spec changes.

Also applies to: 56-58

spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenClusterDTO.java (1)

37-41: LGTM! OpenClusterDTO properly extended with new fields.

The three new fields (id, parentClusterId, comment) are correctly implemented following the existing DTO pattern:

  • Proper fluent builder methods
  • Appropriate Schema annotations
  • equals/hashCode/toString updated consistently

This aligns with the PR objective to include fields that were present in ClusterDTO but missing in OpenClusterDTO.

Also applies to: 163-221, 237-240, 245-245, 258-260

apollo-openapi.yaml (4)

41-42: LGTM! New Environment Management tag added.

The new tag properly categorizes the environment-related endpoint introduced in this PR.


1664-1665: LGTM! Operator parameter correctly made optional.

The change from required: true to required: false with the updated description aligns with the PR's compatibility goal: allowing portal calls (which may not provide operator) to work while external OpenAPI calls can still provide it for verification.


3604-3626: LGTM! New environment listing endpoint is well-defined.

The GET /openapi/v1/envs endpoint has a clear contract returning an array of environment name strings, with appropriate description and example values.


3770-3780: LGTM! OpenClusterDTO schema properly extended.

The three new fields (id, parentClusterId, comment) are correctly added to the schema with appropriate types and descriptions. This resolves the issue where cluster comments weren't displaying correctly because OpenClusterDTO was missing fields present in ClusterDTO.

java-client/src/main/java/org/openapitools/client/model/OpenClusterDTO.java (1)

298-307: equals/hashCode semantics changed — confirm impact.

Including id, parentClusterId, and comment alters equality and hashing. Verify no clients relied on prior semantics (e.g., equality by name/appId only).

typescript/src/apis/index.ts (1)

5-5: LGTM — re-export added.

Public TS surface now exposes EnvironmentManagementApi.

typescript/.openapi-generator/FILES (1)

8-8: EnvironmentManagementApi file listing verified successfully.

The file exists at typescript/src/apis/EnvironmentManagementApi.ts and is correctly exported from typescript/src/apis/index.ts via the barrel export.

java-client/README.md (1)

152-152: All documentation verified and correct.

The docs entry for EnvironmentManagementApi#getEnvs is properly documented with matching method signature, HTTP endpoint path, anchor link, and description. No issues found.

spring-boot2/src/main/java/com/apollo/openapi/server/api/ClusterManagementApiDelegate.java (3)

45-45: LGTM! Example response updated to reflect OpenClusterDTO field additions.

The example JSON correctly includes the new fields (id, parentClusterId, comment) that were added to the OpenClusterDTO model.


62-62: Documentation correctly reflects optional operator parameter.

The updated description clarifies that the operator parameter is needed for external OpenAPI calls, which aligns with the compatibility design described in the PR objectives.


94-94: LGTM! Consistent with OpenClusterDTO changes.

The example response correctly includes the new fields, matching the model extensions applied throughout the PR.

rust/docs/OpenClusterDto.md (1)

13-15: LGTM! Documentation reflects the new OpenClusterDto fields.

The three new optional fields (id, parent_cluster_id, comment) are properly documented with correct types and descriptions. The snake_case naming follows Rust conventions.

typescript/src/models/OpenClusterDTO.ts (2)

58-75: LGTM! New fields properly added to TypeScript interface.

The three new optional properties (id, parentClusterId, comment) are correctly declared with appropriate types and JSDoc comments.


103-105: LGTM! Serialization/deserialization correctly handles new fields.

The new fields are properly handled in both deserialization (lines 103-105) and serialization (lines 124-126) logic, with appropriate undefined checks.

Also applies to: 124-126

java-client/docs/ClusterManagementApi.md (1)

120-120: LGTM! Documentation correctly reflects optional operator parameter.

The parameter is now documented as optional (line 142) with clear guidance about when it should be provided (line 120). This aligns with the compatibility design for portal vs. external API calls.

Also applies to: 142-142

java-client/docs/OpenClusterDTO.md (1)

17-19: LGTM! Documentation reflects the extended OpenClusterDTO model.

The three new optional fields (id, parentClusterId, comment) are properly documented with correct Java types (Long for IDs, String for comment) and clear descriptions.

python/apollo_openapi/apis/tags/__init__.py (1)

17-17: LGTM! New tag added for Environment Management API.

The ENVIRONMENT_MANAGEMENT enum member is correctly added to support the new API endpoint documented in the PR objectives.

python/apollo_openapi/paths/openapi_v1_envs/__init__.py (1)

1-7: LGTM! Path module correctly initialized for new endpoint.

The module follows the established pattern for memory-efficient path imports, providing a module-level path alias for the new /openapi/v1/envs endpoint.

typescript/src/apis/ClusterManagementApi.ts (2)

35-35: LGTM! Operator parameter correctly made optional.

The DeleteClusterRequest interface now properly declares operator as optional (operator?: string), aligning with the compatibility design for portal vs. external API usage.


115-117: LGTM! Correct conditional handling of optional operator parameter.

The implementation properly checks if operator is defined before adding it to query parameters, avoiding the transmission of undefined values while maintaining backward compatibility.

python/apollo_openapi/model/open_cluster_dto.pyi (4)

47-60: LGTM - Fields properly added to schema.

The three new fields (id, parentClusterId, comment) are correctly defined in the properties class with appropriate schema types and annotations.


80-94: LGTM - Item access overloads correctly extended.

The __getitem__ overloads properly cover the new fields with correct type hints.


115-128: LGTM - OpenAPI item access properly extended.

The get_item_oapg overloads correctly handle the new fields with proper Union types including schemas.Unset.


140-157: LGTM - Constructor signature properly updated.

The __new__ method correctly accepts the new fields with appropriate types (Int64 fields accept decimal.Decimal or int) and default to schemas.unset.

python/apollo_openapi/paths/openapi_v1_envs_env_apps_app_id_clusters_cluster_name/delete.py (1)

34-57: LGTM - Operator parameter correctly made optional.

The operator parameter has been properly moved from RequestRequiredQueryParams to RequestOptionalQueryParams (with total=False), and the required=True flag removed from the parameter definition. This aligns with the PR objective to support portal calls where operator may be missing.

python/docs/models/OpenClusterDTO.md (1)

19-21: LGTM - Documentation properly added for new fields.

The documentation correctly describes the three new fields with appropriate type information and Chinese descriptions.

python/apollo_openapi/apis/paths/openapi_v1_envs.py (1)

1-7: LGTM - Standard API path wrapper.

The OpenapiV1Envs class correctly inherits from ApiForget and follows the established pattern for generated API path wrappers.

java-client/src/test/java/org/openapitools/client/model/OpenClusterDTOTest.java (1)

88-110: LGTM - Test stubs added for new fields.

The test methods for id, parentClusterId, and comment are properly structured and consistent with the existing test pattern in this file.

java-client/.openapi-generator/FILES (3)

11-11: LGTM - Environment Management documentation added.


70-70: LGTM - Environment Management API class added.


112-112: LGTM - Environment Management test added.

java-client/docs/EnvironmentManagementApi.md (1)

1-73: LGTM - Comprehensive API documentation.

The documentation clearly describes the new Environment Management API with proper example code and parameter details. The endpoint correctly documents the GET /openapi/v1/envs operation returning List.

python/apollo_openapi/apis/tags/environment_management_api.py (1)

1-23: LGTM - Standard API tag wrapper.

The EnvironmentManagementApi class correctly inherits from GetEnvs and follows the established pattern for generated API tag classes.

python/apollo_openapi/apis/tag_to_api.py (1)

12-12: LGTM! Correct integration of the new Environment Management API.

The new EnvironmentManagementApi is properly integrated into both the type definitions and runtime mappings, following the established pattern for other API tags.

Also applies to: 26-26, 41-41

java-client/src/test/java/org/openapitools/client/api/EnvironmentManagementApiTest.java (1)

1-46: LGTM! Well-structured test stub for the new API.

The test class follows the standard pattern with @Disabled annotation and placeholder implementation. The test structure is ready for future implementation.

python/apollo_openapi/apis/path_to_api.py (1)

50-50: LGTM! Correct integration of the new environments endpoint path.

The new /openapi/v1/envs path is properly integrated into both the type definitions and runtime mappings, consistent with the pattern used for other API paths.

Also applies to: 101-101, 153-153

python/apollo_openapi/paths/openapi_v1_envs_env_apps_app_id_clusters_cluster_name/delete.pyi (1)

32-55: LGTM! Operator parameter correctly changed to optional.

The operator parameter has been moved from RequestRequiredQueryParams to RequestOptionalQueryParams, aligning with the PR objective to support both portal calls (which may not provide an operator) and OpenAPI calls (which should provide an operator). This is a backward-compatible change.

typescript/src/apis/EnvironmentManagementApi.ts (1)

21-55: LGTM! TypeScript client implementation is correct.

The EnvironmentManagementApi class properly implements the getEnvs endpoint with:

  • Correct authentication header handling (lines 32-34)
  • Proper async/await patterns
  • Type-safe return types (Array<string>)
  • Standard raw/convenience method pair
spring-boot2/src/main/java/com/apollo/openapi/server/api/ClusterManagementApi.java (1)

87-135: LGTM! Operator parameter correctly changed to optional.

The deleteCluster method signature has been updated to make the operator parameter optional:

  • @NotNull annotation removed
  • required = false added to @RequestParam (line 132)
  • Javadoc updated to clarify usage for external OpenAPI calls (line 94)

This aligns with the PR objective to support both portal calls (which may not provide an operator from UserInfoHolder) and external OpenAPI calls (which should explicitly provide an operator).

spring-boot2/src/main/java/com/apollo/openapi/server/api/EnvironmentManagementApiController.java (1)

32-41: Ensure a concrete delegate is wired; otherwise endpoint returns 501.

Without a @service implementing EnvironmentManagementApiDelegate#getEnvs, the controller falls back to the default 501 behavior. Confirm a bean exists in this module or another starter.

python/apollo_openapi/model/open_cluster_dto.py (1)

47-60: DTO field additions are consistent and backward‑compatible.

id, parentClusterId, and comment are correctly plumbed through properties, accessors, and constructor with unset defaults. LGTM.

Please confirm server responses are updated to populate these fields so clients see cluster comments as intended.

Also applies to: 80-88, 92-93, 115-123, 127-128, 140-158

spring-boot2/src/main/resources/openapi.yaml (4)

42-43: LGTM! Environment Management tag added.

The new tag is well-defined and consistent with existing management tags in the API specification.


1837-1841: Well-designed compatibility approach for operator parameter.

Making the operator parameter optional while clarifying in the description that external OpenAPI callers should provide it is a good compatibility design. This allows portal calls (where operator can be inferred from UserInfoHolder) to omit it while maintaining clarity for external API consumers.


4164-4188: LGTM! New environment listing endpoint is well-defined.

The GET /openapi/v1/envs endpoint is clean and straightforward, returning a simple array of environment names. The example clearly demonstrates the expected response format.


4355-4390: LGTM! OpenClusterDTO fields added with proper backward compatibility.

The three new fields (id, parentClusterId, comment) are correctly defined as optional, which maintains backward compatibility with existing API consumers. The field types (int64 for IDs, string for comment) and descriptions are appropriate. This change addresses the PR objective to fix the cluster comment display issue by aligning OpenClusterDTO with ClusterDTO.

python/docs/apis/tags/ClusterManagementApi.md (2)

62-64: LGTM! Documentation correctly reflects OpenClusterDTO changes.

The Python client documentation properly shows the new fields with appropriate snake_case naming conventions and example values.


188-276: Excellent documentation with dual usage examples.

The documentation effectively shows both usage patterns for delete_cluster:

  1. Portal usage (empty query_params) - Lines 229-240
  2. External API usage (with operator) - Lines 241-259

This dual-example approach clearly demonstrates the optional nature of the operator parameter and helps developers understand when to include it.

java-client/src/main/java/org/openapitools/client/api/EnvironmentManagementApi.java (1)

1-188: LGTM! Well-formed generated API client code.

The EnvironmentManagementApi class is properly generated and consistent with the OpenAPI specification:

  • Correct endpoint path (/openapi/v1/envs)
  • Proper return type (List)
  • ApiKeyAuth authentication configured
  • Standard sync/async/withHttpInfo method variants provided
  • Appropriate JavaDoc documentation
java-client/api/openapi.yaml (4)

42-43: Environment Management tag properly integrated.

The new "Environment Management" tag follows the existing naming and structure conventions. Placement is consistent with other top-level tags in the specification.


1787-1791: Operator parameter correctly made optional with clear compatibility guidance.

The change from required: true to required: false aligns with the PR objective to support portal calls where the operator may not be provided. The updated description ("操作人用户名,openapi外部调用时需传入") appropriately signals that external OpenAPI callers should provide this parameter, while portal-internal calls may omit it.


4044-4066: New /openapi/v1/envs endpoint correctly specified.

The endpoint is properly documented with:

  • Correct HTTP method (GET)
  • Clear example data (DEV, FAT, UAT, PRO)
  • Accurate schema (array of strings)
  • Proper tag assignment (Environment Management)
  • Success response (200) with example

The implementation meets the PR objective for environment management.


4227-4236: OpenClusterDTO extended with id, parentClusterId, and comment fields.

The three new fields are properly added to both the example (lines 4233-4235) and properties (lines 4258-4268) sections:

  • id (int64): Cluster unique identifier
  • parentClusterId (int64): Parent cluster reference
  • comment (string): Cluster annotation/notes

The fields are correctly typed and documented. Critically, they are not marked as required, which maintains backward compatibility with existing API consumers who may not expect these fields in responses. This is the correct approach for extending an existing DTO.

Also applies to: 4258-4268

Comment on lines +120 to +123
used_path = path.value

_headers = HTTPHeaderDict()
# TODO add cookie handling
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Undefined names: path, _auth, _status_code_to_response.

These are referenced but not defined/imported in this stub, which can break parity with the .py implementation and confuse tooling. Add the missing import and definitions.

Apply these additions:

@@
-from dataclasses import dataclass
-import typing_extensions
+from dataclasses import dataclass
@@
 from apollo_openapi import schemas  # noqa: F401
+from apollo_openapi.paths.openapi_v1_envs import path
@@
 _response_for_200 = api_client.OpenApiResponse(
@@
 )
+_status_code_to_response = {
+    '200': _response_for_200,
+}
+_auth = ['ApiKeyAuth']

Also applies to: 132-133, 140-145

🤖 Prompt for AI Agents
In python/apollo_openapi/paths/openapi_v1_envs/get.pyi around lines 120-123 (and
similarly at 132-133 and 140-145), the stub references undefined names path,
_auth, and _status_code_to_response; update the stub to match the .py
implementation by importing or declaring those symbols: import Path or alias the
parameter name used in the .py file (so used_path = path.value resolves), add
the _auth type/variable (or an appropriate typing.Any placeholder) so
authentication parameter references exist, and add a typed
_status_code_to_response mapping (or a typing.Dict placeholder) so response
resolution is defined; ensure the added names use the same types/names as the
.py file to maintain parity with runtime code and tooling.

Copy link
Member

@hezhangjian hezhangjian left a comment

Choose a reason for hiding this comment

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

LGTM

@hezhangjian hezhangjian merged commit 2464709 into apolloconfig:main Oct 26, 2025
4 checks passed
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.

3 participants