-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add env management, fix missing operator in portal call, add fields to OpenClusterDTO #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe 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
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>
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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 |
…elds to OpenClusterDTO
There was a problem hiding this 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_extensionsis 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: F401Also 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
commentis type-checked. GuardidandparentClusterIdto 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
noqadirectives.Static analysis flags that the
# noqa: E501directives 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
getEnvsendpoint 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: F401directives 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 schemasIf 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
📒 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__.pyis 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_ENVSenum 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: truetorequired: falsewith 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, andcommentalters 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.tsand is correctly exported fromtypescript/src/apis/index.tsvia 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
pathalias for the new/openapi/v1/envsendpoint.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_oapgoverloads correctly handle the new fields with properUniontypes includingschemas.Unset.
140-157: LGTM - Constructor signature properly updated.The
__new__method correctly accepts the new fields with appropriate types (Int64 fields acceptdecimal.Decimalorint) and default toschemas.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
RequestRequiredQueryParamstoRequestOptionalQueryParams(withtotal=False), and therequired=Trueflag 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
OpenapiV1Envsclass correctly inherits fromApiForgetand 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, andcommentare 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
EnvironmentManagementApiclass correctly inherits fromGetEnvsand 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
EnvironmentManagementApiis 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
@Disabledannotation 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/envspath 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
operatorparameter has been moved fromRequestRequiredQueryParamstoRequestOptionalQueryParams, 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
EnvironmentManagementApiclass properly implements thegetEnvsendpoint 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
deleteClustermethod signature has been updated to make theoperatorparameter optional:
@NotNullannotation removedrequired = falseadded 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:
- Portal usage (empty query_params) - Lines 229-240
- 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: truetorequired: falsealigns 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 identifierparentClusterId(int64): Parent cluster referencecomment(string): Cluster annotation/notesThe 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
| used_path = path.value | ||
|
|
||
| _headers = HTTPHeaderDict() | ||
| # TODO add cookie handling |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
hezhangjian
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Change1 Add Environment Management module
Portal Controller Analysis
The original portal's environment controller only has one method to get all env
those two are openapi-generated method and endpoint definition
Change2 Modification of OpenClusterDTO
Analysis of the original
OpenClusterDTOissue:Compared with
ClusterDTO, it was missing the following fields: id, parentClusterId, and comment.Problem scenario example:
When the frontend calls the
getClustermethod of OpenAPI (which corresponds to theloadClustermethod of the portal), usingOpenClusterDTOcauses clusters with comments to fail to display their comment information correctly on the frontend.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
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
Improvements