-
Notifications
You must be signed in to change notification settings - Fork 1
fix: fixed unintuitive function naming #13
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
WalkthroughThis PR updates OpenAPI specifications to introduce new instance management endpoints with improved naming conventions. It adds operationId Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant NewGetByRelease as InstanceManagementApi<br/>getByRelease()
participant OldGetByNamespace as InstanceManagementApi<br/>getInstanceCountByNamespace()
participant OldInstancesNotInt as InstanceManagementApi<br/>instances_not_int
participant NewInstancesNotIn as InstanceManagementApi<br/>getByReleasesNotIn()
participant APIEndpoint as OpenAPI Endpoint
Note over Client,APIEndpoint: OLD FLOW
Client->>OldGetByNamespace: getInstanceCountByNamespace(env, appId, cluster, namespace)
OldGetByNamespace->>APIEndpoint: GET /apps/{appId}/clusters/{cluster}/namespaces/{namespace}/instances
APIEndpoint-->>OldGetByNamespace: Integer (count)
OldGetByNamespace-->>Client: Integer
Note over Client,APIEndpoint: OLD NOT-IN FLOW
Client->>OldInstancesNotInt: openapiV1Envs...InstancesNotIntGet(...)
OldInstancesNotInt->>APIEndpoint: GET /.../instances_not_int
APIEndpoint-->>OldInstancesNotInt: List<OpenInstanceDTO>
OldInstancesNotInt-->>Client: List<OpenInstanceDTO>
Note over Client,APIEndpoint: NEW FLOW - Get By Release (Paginated)
Client->>NewGetByRelease: getByRelease(env, releaseId, page, size)
NewGetByRelease->>APIEndpoint: GET /releases/{releaseId}/instances?page=X&size=Y
APIEndpoint-->>NewGetByRelease: OpenPageDTOOpenInstanceDTO (paginated)
NewGetByRelease-->>Client: OpenPageDTOOpenInstanceDTO
Note over Client,APIEndpoint: NEW FLOW - Not In Releases
Client->>NewInstancesNotIn: getByReleasesNotIn(env, appId, cluster, namespace, excludeReleases)
NewInstancesNotIn->>APIEndpoint: GET /.../instances_not_in?excludeReleases=...
APIEndpoint-->>NewInstancesNotIn: List<OpenInstanceDTO>
NewInstancesNotIn-->>Client: List<OpenInstanceDTO>
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes The PR involves significant API method refactoring across multiple generated client libraries (Java, Python) and server implementations (Spring Boot). While many changes are annotation date updates (homogeneous, low effort), the InstanceManagementApi class modifications introduce parameter changes, return type changes, and method renames across multiple interconnected files. The changes are consistent in pattern but require careful verification of parameter mapping, return types, and path consistency across all implementations. 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 |
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: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (16)
java-client/src/main/java/org/openapitools/client/model/MultiResponseEntity.java (1)
18-41: Remove duplicate imports from generated code.Imports
TypeAdapter,JsonReader,JsonWriter, andIOExceptionare declared twice (lines 18–23 and lines 28–41). This appears to be a code-generation artifact and should be cleaned up in the OpenAPI Generator configuration or template.Proposed fix (lines 28–41): Remove the duplicate import statements:
-import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -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.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken;(Alternatively, consolidate all Gson imports into a single block at lines 18–41.)
java-client/src/main/java/org/openapitools/client/model/OpenEnvClusterInfo.java (1)
18-23: Critical: Duplicate imports will prevent compilation.The file contains duplicate import statements that will cause a Java compilation error:
TypeAdapterimported at lines 18 and 38JsonReaderimported at lines 21 and 39JsonWriterimported at lines 22 and 40IOExceptionimported at lines 23 and 41Since this is an auto-generated file, re-run the OpenAPI code generator to ensure clean output without duplicates.
spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenItemChangeSets.java (1)
173-178: Critical: NullPointerException in add methods - fix the code generator template.All three
add*Itemmethods (addCreateItemsItem,addUpdateItemsItem,addDeleteItemsItem) contain identical critical bugs. When the respective list isnull, each method sets it tonullagain instead of initializing a newArrayList, then attempts to call.add()on the null reference, causing aNullPointerException.For example, in
addCreateItemsItem(lines 173-178):if (this.createItems == null) { this.createItems = null; // Should be: new ArrayList<>() } this.createItems.add(createItemsItem); // NPE if createItems was nullSince this is generated code, the underlying code generator template must be fixed to properly initialize the lists.
Apply this pattern to fix all three methods in the generator template:
public OpenItemChangeSets addCreateItemsItem(OpenItemDTO createItemsItem) { if (this.createItems == null) { - this.createItems = null; + this.createItems = new ArrayList<>(); } this.createItems.add(createItemsItem); return this; }The same fix applies to
addUpdateItemsItem(line 203) andaddDeleteItemsItem(line 231).Also applies to: 201-206, 229-234
java-client/src/main/java/org/openapitools/client/model/OpenNamespaceDTO.java (1)
18-23: Duplicate imports will break/dirty the build — dedupe them.This class repeats several imports (TypeAdapter, JsonReader, JsonWriter, IOException, List). Deduplicate to avoid compiler errors/noise. Prefer fixing the codegen template so it doesn’t re‑emit duplicates.
Apply this minimal diff to remove the later duplicates:
@@ -import com.google.gson.TypeAdapter; @@ -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; @@ -import java.util.List;Generator/template fix (recommended): ensure unique import emission for model.mustache.
Also applies to: 25-25, 38-41, 46-46
java-client/src/main/java/org/openapitools/client/model/OpenNamespaceIdentifier.java (1)
18-23: Duplicate imports — remove repeated gson/java.io imports.Repeated imports (TypeAdapter, JsonReader, JsonWriter, IOException) should be deduped to keep the build clean.
@@ -import com.google.gson.TypeAdapter; @@ -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException;Also applies to: 35-39
java-client/src/main/java/org/openapitools/client/model/OpenItemChangeSets.java (3)
229-235: NPE bug in addCreateItemsItem when list is null.List is set to null instead of initialized, then
.add()dereferences null.public OpenItemChangeSets addCreateItemsItem(OpenItemDTO createItemsItem) { if (this.createItems == null) { - this.createItems = null; + this.createItems = new java.util.ArrayList<>(); } this.createItems.add(createItemsItem); return this; }
259-263: Same NPE risk in addUpdateItemsItem.public OpenItemChangeSets addUpdateItemsItem(OpenItemDTO updateItemsItem) { if (this.updateItems == null) { - this.updateItems = null; + this.updateItems = new java.util.ArrayList<>(); } this.updateItems.add(updateItemsItem); return this; }
287-292: Same NPE risk in addDeleteItemsItem.public OpenItemChangeSets addDeleteItemsItem(OpenItemDTO deleteItemsItem) { if (this.deleteItems == null) { - this.deleteItems = null; + this.deleteItems = new java.util.ArrayList<>(); } this.deleteItems.add(deleteItemsItem); return this; }java-client/src/main/java/org/openapitools/client/ApiException.java (1)
162-165: Avoid leaking full HTTP bodies in exception messages; truncate/redact and guard by type/size.Exception messages are often logged; raw bodies may include tokens, credentials, or PII. Truncate (e.g., 4KB), skip binary, and redact obvious secrets. Also add @OverRide.
Apply:
+ @Override public String getMessage() { - return String.format("Message: %s%nHTTP response code: %s%nHTTP response body: %s%nHTTP response headers: %s", - super.getMessage(), this.getCode(), this.getResponseBody(), this.getResponseHeaders()); + return String.format( + "Message: %s%nHTTP response code: %s%nHTTP response body: %s%nHTTP response headers: %s", + super.getMessage(), + this.getCode(), + sanitizeBody(this.getResponseBody(), this.getResponseHeaders()), + this.getResponseHeaders()); } + + private static String sanitizeBody(String body, Map<String, List<String>> headers) { + if (body == null) return null; + // Best-effort binary/content-type check + String ct = null; + if (headers != null) { + List<String> cts = headers.get("Content-Type"); + if (cts != null && !cts.isEmpty()) ct = cts.get(0); + } + if (ct != null && !ct.toLowerCase().contains("json") && !ct.toLowerCase().contains("text")) { + return "<non-textual body omitted>"; + } + String redacted = body + .replaceAll("(?i)(authorization|token|access[_-]?token|password)[:=\\s]+\\S+", "$1=<redacted>"); + int limit = 4096; + return redacted.length() > limit ? redacted.substring(0, limit) + "...<truncated>" : redacted; + }Optionally add a toggle to include bodies only when a debug flag is set.
spring-boot2/src/main/java/com/apollo/openapi/server/api/ReleaseManagementApi.java (1)
295-298: InconsistentreleaseIdtype (Integer vs Long) across endpoints.
getReleaseByIduses Integer, whilerollbackuses Long for the same identifier. This can break for IDs > 2,147,483,647 and is an avoidable client/server mismatch. Please align both to Long.Suggested fix (update OpenAPI, then regen):
- Set the
releaseIdpath param schema totype: integer,format: int64everywhere it appears.- Regenerate server and clients to make both methods take
Long.
If you prefer a quick patch here, changegetReleaseById’s parameter toLong, but the source of truth should be the OpenAPI spec.Also applies to: 429-433
python/docs/apis/tags/InstanceManagementApi.md (1)
314-314: Broken model links from leftover template tokens.Replace {{complexTypePrefix}} placeholders with real paths.
-[**OpenInstanceDTO**]({{complexTypePrefix}}OpenInstanceDTO.md) +[**OpenInstanceDTO**](../../models/OpenInstanceDTO.md)spring-boot2/src/main/java/com/apollo/openapi/server/api/InstanceManagementApiDelegate.java (1)
56-66: Docstring path mismatch.Description line references “instances?excludeReleases=…”. The mapped path is “/instances_not_in”. Align the comment to prevent confusion.
- * GET /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/instances?excludeReleases=1,2,3 + * GET /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/instances_not_in?excludeReleases=1,2,3java-client/src/test/java/org/openapitools/client/api/InstanceManagementApiTest.java (1)
55-66: Test Javadoc path mismatch.Update the documented GET line to use /instances_not_in to match the API and generators.
- * GET /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/instances?excludeReleases=1,2,3 + * GET /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/instances_not_in?excludeReleases=1,2,3java-client/docs/InstanceManagementApi.md (1)
93-93: Docs: not-in path should include /instances_not_in.The method table is correct, but the inline GET line still shows /instances?excludeReleases=…; fix it.
-GET /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/instances?excludeReleases=1,2,3 +GET /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/instances_not_in?excludeReleases=1,2,3Also applies to: 160-162
spring-boot2/src/main/java/com/apollo/openapi/server/api/InstanceManagementApi.java (1)
92-96: Annotation description path mismatch.Operation description shows GET …/instances?excludeReleases…, but mapping is /instances_not_in. Align for accuracy.
- description = "GET /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/instances?excludeReleases=1,2,3", + description = "GET /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/instances_not_in?excludeReleases=1,2,3",Also applies to: 105-116
java-client/src/main/java/org/openapitools/client/api/InstanceManagementApi.java (1)
269-274: Update Javadoc across InstanceManagementApi to document correct/instances_not_inendpoint.The verification confirms the mismatch: your code correctly calls
/instances_not_in(line 269), but Javadoc at lines 332, 353, and 375 incorrectly documents it as/instances?excludeReleases=1,2,3. Update all three method Javadocs inInstanceManagementApi.java:- * GET /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/instances?excludeReleases=1,2,3 + * GET /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/instances_not_inAlso update the corresponding test file at line 55 and review the OpenAPI YAML source definitions (apollo-openapi.yaml:2472, spring-boot2/openapi.yaml:2839) to ensure the description field reflects the correct path.
🧹 Nitpick comments (32)
java-client/src/main/java/org/openapitools/client/model/OpenInstanceConfigDTO.java (1)
16-49: Duplicate imports in auto-generated code.Imports for
JsonReader(lines 21, 37),JsonWriter(lines 22, 38), andTypeAdapter(lines 18, 36) are declared twice. While this is harmless and doesn't affect functionality, it indicates the OpenAPI code generator may need configuration adjustment to avoid duplicate imports during regeneration.If regenerating this file frequently, consider updating the OpenAPI Generator template or configuration to prevent duplicate imports. Otherwise, this can be safely ignored as a minor artifact of code generation.
java-client/src/main/java/org/openapitools/client/model/OpenNamespaceLockDTO.java (1)
18-38: Deduplicate imports in the generated code.Lines 35–38 duplicate imports already declared in lines 18–23 (
TypeAdapter,JsonReader,JsonWriter, andIOException). While this is auto-generated code, duplicate imports suggest a template or configuration issue in the OpenAPI Generator.Remove the duplicate imports:
-import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException;Consider checking your OpenAPI Generator configuration (codegen templates or version) to prevent duplicate imports in future regenerations.
java-client/src/main/java/org/openapitools/client/model/OpenPageDTOOpenItemDTO.java (1)
18-22: Duplicate imports detected.Lines 18–22 and 38–40 contain duplicate imports for
TypeAdapter,JsonReader, andJsonWriter. While this is a common artifact from code generation, consider reviewing the OpenAPI Generator configuration to eliminate redundant imports.Also applies to: 38-40
java-client/src/main/java/org/openapitools/client/model/RichResponseEntity.java (1)
18-22: Remove duplicate imports in auto-generated code.The imports for
TypeAdapter,JsonReader,JsonWriter, andIOExceptionare duplicated. Since this is generated code, verify whether the OpenAPI Generator configuration can be adjusted to prevent duplicate imports in future regenerations.If this duplication persists across regenerations, consider reporting it to the OpenAPI Generator project or cleaning it up manually post-generation.
Also applies to: 35-38
java-client/src/main/java/org/openapitools/client/model/OpenAppDTO.java (3)
53-53: Reduce timestamp churn in generated headers.Consider setting hideGenerationTimestamp=true in your OpenAPI Generator config to avoid noisy diffs from changing @generated dates.
16-47: Duplicate/unused imports in generated model.There are duplicate imports (TypeAdapter, JsonReader, JsonWriter, IOException) and unused ones (e.g., Arrays, GsonBuilder, JsonArray, JsonDeserializer, JsonDeserializationContext, JsonParseException, HashMap, List, Map). Recommend tightening templates or running an import optimizer on generated sources to keep diffs clean.
392-405: Exception messages include full JSON payload (possible PII leak).validateJsonObject() throws with the entire JSON string in the message (fields include ownerEmail). Prefer keys-only or redacted payloads to avoid leaking PII in logs.
Do our logging/telemetry pipelines scrub exception messages that might include payloads?
Also applies to: 406-436
spring-boot2/src/main/java/com/apollo/openapi/server/api/AppManagementApiDelegate.java (3)
3-3: Duplicate import of Map.Remove one of the repeated
import java.util.Map;.import java.util.Map; @@ -import java.util.Map;Also applies to: 15-15
20-22: Javadoc typo: extra closing brace.
{@link AppManagementApiController}}→{@link AppManagementApiController}.- * A delegate to be called by the {@link AppManagementApiController}}. + * A delegate to be called by the {@link AppManagementApiController}.
82-86: Doc consistency: method verb mismatch.Section title says GET, next line shows POST for the same path. Change POST → GET for consistency.
- * POST /openapi/v1/apps + * GET /openapi/v1/appsjava-client/src/main/java/org/openapitools/client/model/OpenItemChangeSets.java (2)
84-92: Initialize lists eagerly to avoid repeated null checks.Optional, but improves safety/readability.
- private List<OpenItemDTO> createItems = null; + private List<OpenItemDTO> createItems = new java.util.ArrayList<>(); @@ - private List<OpenItemDTO> updateItems = null; + private List<OpenItemDTO> updateItems = new java.util.ArrayList<>(); @@ - private List<OpenItemDTO> deleteItems = null; + private List<OpenItemDTO> deleteItems = new java.util.ArrayList<>();
18-23: Remove duplicate imports.
TypeAdapter,JsonReader,JsonWriter,IOException, andListare imported multiple times.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; @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; @@ -import java.util.List; +// (keep single List import above)Also applies to: 28-41, 46-46
java-client/README.md (1)
5-5: Doc timestamp OK; prefer UTC for consistency.Consider emitting build timestamps in UTC across modules to avoid timezone diffs between generators.
java-client/src/main/java/org/openapitools/client/ApiException.java (1)
29-29: Storing response body is useful — consider making it final.If immutability is desired, declare responseBody as final and initialize via constructors only.
- private String responseBody = null; + private final String responseBody;Note: Adjust no-arg/legacy constructors to set this.responseBody = null.
spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenPageDTOOpenInstanceDTO.java (1)
25-25: LGTM — timestamp-only regenerationNo functional changes. Consider disabling codegen timestamps to reduce diff churn in future runs (optional).
spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenGrayReleaseRuleItemDTO.java (1)
24-24: LGTM — metadata timestamp updateNo behavior change. Optional: suppress generation timestamps to keep PRs cleaner.
spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenInstanceDTO.java (1)
24-24: LGTM — timestamp-only changeAll good. Optional: configure codegen to hide timestamps to avoid noisy diffs.
spring-boot2/src/main/java/com/apollo/openapi/server/api/ReleaseManagementApiDelegate.java (2)
3-16: Remove duplicate import of java.util.MapMap is imported twice (Lines 3 and 15). Drop one to tidy imports.
-import java.util.Map; import com.apollo.openapi.server.model.NamespaceGrayDelReleaseDTO; @@ -import java.util.Map; +import java.util.Map;
199-201: Inconsistent releaseId types (Integer vs Long)getReleaseById uses Integer releaseId; rollback uses Long releaseId. Prefer a single type across APIs to prevent client schema inconsistencies.
Please confirm intended type and align both signatures.
Also applies to: 289-291
spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenGrayReleaseRuleDTO.java (1)
25-25: LGTM — timestamp refresh onlyNo functional diffs detected. Optional: hide generation timestamps to minimize noise.
spring-boot2/src/main/java/com/apollo/openapi/server/api/ReleaseManagementApi.java (1)
8-8: Duplicate import ofjava.util.Map.
Harmless but noisy. If you maintain custom templates, dedupe imports in the generator output.Also applies to: 32-32
java-client/api/openapi.yaml (2)
2683-2719: Polish pagination/ID schemas for getByRelease.
- Add minimum constraints to page/size (page >= 0, size >= 1).
- Consider declaring releaseId as int64 for consistency with other endpoints.
Apply patch:
- - description: "" + - description: 环境标识 explode: false in: path name: env required: true schema: type: string style: simple - - description: "" + - description: 发布ID explode: false in: path name: releaseId required: true schema: - type: integer + type: integer + format: int64 style: simple - - description: "" + - description: 页码,从0开始 example: 0 explode: true in: query name: page required: true schema: - type: integer + type: integer + minimum: 0 style: form - - description: "" + - description: 每页数量 example: 20 explode: true in: query name: size required: true schema: - type: integer + type: integer + minimum: 1 style: form
2759-2763: Fix description path and model excludeReleases as array.
- Description still references /instances; should reflect /instances_not_in.
- Prefer array schema with CSV (style=form, explode=false) over raw string.
Apply patch:
- /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/instances_not_in: + /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/instances_not_in: get: deprecated: false - description: "GET /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/instances?excludeReleases=1,2,3" + description: "GET /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/instances_not_in?excludeReleases=1,2,3" operationId: getByReleasesNotIn @@ - - description: 排除的发布ID列表,用逗号分隔 - explode: true + - description: 排除的发布ID列表(CSV),例如 1,2,3 + explode: false in: query name: excludeReleases required: false - schema: - type: string + schema: + type: array + items: + type: integer + format: int64 style: formOptional: add pagination (page, size) if this list can be large.
python/docs/apis/tags/InstanceManagementApi.md (2)
75-75: Grammar nit.Use “file-like object”.
-...loaded from a file like object. +...loaded from a file-like object.Also applies to: 380-380
70-101: Multiple markdownlint errors in tables.Several tables have 3 columns but 4 headers, trailing pipes, and missing blank lines. Please reformat tables (or re-generate docs) to satisfy MD001/055/056/058 consistently.
Also applies to: 228-236, 290-316, 424-441
spring-boot2/src/main/java/com/apollo/openapi/server/api/InstanceManagementApiDelegate.java (1)
42-50: Guard against null Accept header.MediaType.parseMediaTypes(request.getHeader("Accept")) can throw on null/invalid. Default to application/json or skip parsing when header is absent.
- getRequest().ifPresent(request -> { - for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + getRequest().ifPresent(request -> { + String accept = request.getHeader("Accept"); + List<MediaType> mediaTypes = (accept == null || accept.isBlank()) + ? List.of(MediaType.APPLICATION_JSON) + : MediaType.parseMediaTypes(accept); + for (MediaType mediaType: mediaTypes) {java-client/docs/InstanceManagementApi.md (1)
223-223: Formatting nit.Avoid emphasis-as-heading; use code font for types.
-**Integer** +`Integer`spring-boot2/src/main/java/com/apollo/openapi/server/api/InstanceManagementApi.java (1)
70-75: Add validation for page/size.Enforce sensible bounds (page >= 0, size in [1, 100] or as per your policy).
-@NotNull @RequestParam(value = "page", required = true) Integer page, -@NotNull @RequestParam(value = "size", required = true) Integer size +@NotNull @Min(0) @RequestParam(value = "page", required = true) Integer page, +@NotNull @Min(1) @Max(100) @RequestParam(value = "size", required = true) Integer sizejava-client/src/main/java/org/openapitools/client/api/InstanceManagementApi.java (4)
92-126: Make page/size either truly optional or truly required; align validation, query building, and docs.Right now page/size are marked “(required)” and enforced in validation, but query params are only added if non-null. Decide one way:
- If optional (defaults on server): drop required validation and update Javadoc.
- If required: keep validation and always add them (the null checks around query assembly are redundant).
Suggested (optional) — treat as optional with server defaults:
- * @param page (required) - * @param size (required) + * @param page (optional) + * @param size (optional) @@ - // verify the required parameter 'page' is set - if (page == null) { - throw new ApiException("Missing the required parameter 'page' when calling getByRelease(Async)"); - } - - // verify the required parameter 'size' is set - if (size == null) { - throw new ApiException("Missing the required parameter 'size' when calling getByRelease(Async)"); - } + // page/size optional: rely on server defaults when nullPlease confirm from the OpenAPI spec whether page/size are required. If required, I’ll provide the inverse diff (remove null-guards when adding query params).
Also applies to: 147-169
147-169: Add basic range checks for pagination.Guard against invalid inputs early to avoid server-side 400s.
// verify the required parameter 'env' is set if (env == null) { throw new ApiException("Missing the required parameter 'env' when calling getByRelease(Async)"); } @@ if (releaseId == null) { throw new ApiException("Missing the required parameter 'releaseId' when calling getByRelease(Async)"); } - // page/size optional or required — see other comment + if (page != null && page < 0) { + throw new ApiException("Parameter 'page' must be >= 0"); + } + if (size != null && size <= 0) { + throw new ApiException("Parameter 'size' must be > 0"); + }
441-447: Integer response may be served as text/plain; consider widening Accept.If the count endpoint returns a bare number with text/plain, the current Accept:["application/json"] can 406. Safer to include text/plain.
- final String[] localVarAccepts = { - "application/json" - }; + final String[] localVarAccepts = { + "text/plain", + "application/json" + };Please confirm the response Content-Type in the OpenAPI spec or server. If it’s strictly application/json, ignore this change.
184-185: Fill in 200 descriptions for clarity.Add brief response descriptions to aid users.
Examples:
- getByRelease: “成功返回分页结果 OpenPageDTO”
- getByReleasesNotIn: “成功返回实例列表”
Also applies to: 343-344
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (107)
apollo-openapi.yaml(2 hunks)java-client/README.md(2 hunks)java-client/api/openapi.yaml(2 hunks)java-client/docs/InstanceManagementApi.md(9 hunks)java-client/src/main/java/org/openapitools/client/ApiException.java(1 hunks)java-client/src/main/java/org/openapitools/client/Configuration.java(1 hunks)java-client/src/main/java/org/openapitools/client/Pair.java(1 hunks)java-client/src/main/java/org/openapitools/client/StringUtil.java(1 hunks)java-client/src/main/java/org/openapitools/client/api/InstanceManagementApi.java(11 hunks)java-client/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java(1 hunks)java-client/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java(1 hunks)java-client/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java(1 hunks)java-client/src/main/java/org/openapitools/client/model/KVEntity.java(1 hunks)java-client/src/main/java/org/openapitools/client/model/MultiResponseEntity.java(1 hunks)java-client/src/main/java/org/openapitools/client/model/NamespaceGrayDelReleaseDTO.java(1 hunks)java-client/src/main/java/org/openapitools/client/model/NamespaceReleaseDTO.java(1 hunks)java-client/src/main/java/org/openapitools/client/model/OpenAppDTO.java(1 hunks)java-client/src/main/java/org/openapitools/client/model/OpenAppNamespaceDTO.java(1 hunks)java-client/src/main/java/org/openapitools/client/model/OpenClusterDTO.java(1 hunks)java-client/src/main/java/org/openapitools/client/model/OpenCreateAppDTO.java(1 hunks)java-client/src/main/java/org/openapitools/client/model/OpenEnvClusterDTO.java(1 hunks)java-client/src/main/java/org/openapitools/client/model/OpenEnvClusterInfo.java(1 hunks)java-client/src/main/java/org/openapitools/client/model/OpenGrayReleaseRuleDTO.java(1 hunks)java-client/src/main/java/org/openapitools/client/model/OpenGrayReleaseRuleItemDTO.java(1 hunks)java-client/src/main/java/org/openapitools/client/model/OpenInstanceConfigDTO.java(1 hunks)java-client/src/main/java/org/openapitools/client/model/OpenInstanceDTO.java(1 hunks)java-client/src/main/java/org/openapitools/client/model/OpenItemChangeSets.java(1 hunks)java-client/src/main/java/org/openapitools/client/model/OpenItemDTO.java(1 hunks)java-client/src/main/java/org/openapitools/client/model/OpenItemDiffs.java(1 hunks)java-client/src/main/java/org/openapitools/client/model/OpenNamespaceDTO.java(1 hunks)java-client/src/main/java/org/openapitools/client/model/OpenNamespaceIdentifier.java(1 hunks)java-client/src/main/java/org/openapitools/client/model/OpenNamespaceLockDTO.java(1 hunks)java-client/src/main/java/org/openapitools/client/model/OpenNamespaceSyncModel.java(1 hunks)java-client/src/main/java/org/openapitools/client/model/OpenNamespaceTextModel.java(1 hunks)java-client/src/main/java/org/openapitools/client/model/OpenOrganizationDto.java(1 hunks)java-client/src/main/java/org/openapitools/client/model/OpenPageDTOOpenInstanceDTO.java(1 hunks)java-client/src/main/java/org/openapitools/client/model/OpenPageDTOOpenItemDTO.java(1 hunks)java-client/src/main/java/org/openapitools/client/model/OpenReleaseBO.java(1 hunks)java-client/src/main/java/org/openapitools/client/model/OpenReleaseDTO.java(1 hunks)java-client/src/main/java/org/openapitools/client/model/RichResponseEntity.java(1 hunks)java-client/src/test/java/org/openapitools/client/api/InstanceManagementApiTest.java(2 hunks)python/README.md(1 hunks)python/apollo_openapi/apis/path_to_api.py(3 hunks)python/apollo_openapi/apis/paths/openapi_v1_envs_env_apps_app_id_clusters_cluster_name_namespaces_namespace_name_instances_not_int.py(0 hunks)python/apollo_openapi/apis/tags/instance_management_api.py(1 hunks)python/apollo_openapi/paths/__init__.py(1 hunks)python/apollo_openapi/paths/openapi_v1_envs_env_apps_app_id_clusters_cluster_name_namespaces_namespace_name_instances_not_int/__init__.py(0 hunks)python/apollo_openapi/paths/openapi_v1_envs_env_apps_app_id_clusters_cluster_name_namespaces_namespace_name_instances_not_int/get.py(0 hunks)python/apollo_openapi/paths/openapi_v1_envs_env_apps_app_id_clusters_cluster_name_namespaces_namespace_name_instances_not_int/get.pyi(0 hunks)python/apollo_openapi/paths/openapi_v1_envs_env_releases_release_id_instances/get.py(10 hunks)python/apollo_openapi/paths/openapi_v1_envs_env_releases_release_id_instances/get.pyi(10 hunks)python/docs/apis/tags/InstanceManagementApi.md(7 hunks)python/test/test_paths/test_openapi_v1_envs_env_apps_app_id_clusters_cluster_name_namespaces_namespace_name_instances_not_int/__init__.py(0 hunks)python/test/test_paths/test_openapi_v1_envs_env_apps_app_id_clusters_cluster_name_namespaces_namespace_name_instances_not_int/test_get.py(0 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/api/AppManagementApi.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/api/AppManagementApiController.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/api/AppManagementApiDelegate.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/api/ClusterManagementApi.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/api/ClusterManagementApiController.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/api/ClusterManagementApiDelegate.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/api/InstanceManagementApi.java(6 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/api/InstanceManagementApiController.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/api/InstanceManagementApiDelegate.java(3 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/api/ItemManagementApi.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/api/ItemManagementApiController.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/api/ItemManagementApiDelegate.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/api/NamespaceBranchManagementApi.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/api/NamespaceBranchManagementApiController.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/api/NamespaceBranchManagementApiDelegate.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/api/NamespaceManagementApi.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/api/NamespaceManagementApiController.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/api/NamespaceManagementApiDelegate.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/api/OrganizationManagementApi.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/api/OrganizationManagementApiController.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/api/OrganizationManagementApiDelegate.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/api/ReleaseManagementApi.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/api/ReleaseManagementApiController.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/api/ReleaseManagementApiDelegate.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/model/KVEntity.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/model/MultiResponseEntity.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/model/NamespaceGrayDelReleaseDTO.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/model/NamespaceReleaseDTO.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenAppDTO.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenAppNamespaceDTO.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenClusterDTO.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenCreateAppDTO.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenEnvClusterDTO.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenEnvClusterInfo.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenGrayReleaseRuleDTO.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenGrayReleaseRuleItemDTO.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenInstanceConfigDTO.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenInstanceDTO.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenItemChangeSets.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenItemDTO.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenItemDiffs.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenNamespaceDTO.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenNamespaceIdentifier.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenNamespaceLockDTO.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenNamespaceSyncModel.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenNamespaceTextModel.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenOrganizationDto.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenPageDTOOpenInstanceDTO.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenPageDTOOpenItemDTO.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenReleaseBO.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/model/OpenReleaseDTO.java(1 hunks)spring-boot2/src/main/java/com/apollo/openapi/server/model/RichResponseEntity.java(1 hunks)spring-boot2/src/main/resources/openapi.yaml(2 hunks)
⛔ Files not processed due to max files limit (1)
- typescript/src/apis/InstanceManagementApi.ts
💤 Files with no reviewable changes (6)
- python/apollo_openapi/apis/paths/openapi_v1_envs_env_apps_app_id_clusters_cluster_name_namespaces_namespace_name_instances_not_int.py
- python/test/test_paths/test_openapi_v1_envs_env_apps_app_id_clusters_cluster_name_namespaces_namespace_name_instances_not_int/test_get.py
- python/test/test_paths/test_openapi_v1_envs_env_apps_app_id_clusters_cluster_name_namespaces_namespace_name_instances_not_int/init.py
- python/apollo_openapi/paths/openapi_v1_envs_env_apps_app_id_clusters_cluster_name_namespaces_namespace_name_instances_not_int/init.py
- python/apollo_openapi/paths/openapi_v1_envs_env_apps_app_id_clusters_cluster_name_namespaces_namespace_name_instances_not_int/get.py
- python/apollo_openapi/paths/openapi_v1_envs_env_apps_app_id_clusters_cluster_name_namespaces_namespace_name_instances_not_int/get.pyi
🧰 Additional context used
🧬 Code graph analysis (5)
java-client/src/test/java/org/openapitools/client/api/InstanceManagementApiTest.java (1)
typescript/src/apis/InstanceManagementApi.ts (3)
getByRelease(106-109)getByReleasesNotIn(158-161)getInstanceCountByNamespace(210-213)
spring-boot2/src/main/java/com/apollo/openapi/server/api/InstanceManagementApi.java (1)
typescript/src/apis/InstanceManagementApi.ts (3)
getByRelease(106-109)getByReleasesNotIn(158-161)getInstanceCountByNamespace(210-213)
python/apollo_openapi/apis/path_to_api.py (1)
python/apollo_openapi/paths/__init__.py (1)
PathValues(8-54)
java-client/src/main/java/org/openapitools/client/api/InstanceManagementApi.java (1)
typescript/src/apis/InstanceManagementApi.ts (3)
getByRelease(106-109)getByReleasesNotIn(158-161)getInstanceCountByNamespace(210-213)
spring-boot2/src/main/java/com/apollo/openapi/server/api/InstanceManagementApiDelegate.java (1)
typescript/src/apis/InstanceManagementApi.ts (3)
getByRelease(106-109)getByReleasesNotIn(158-161)getInstanceCountByNamespace(210-213)
🪛 LanguageTool
python/docs/apis/tags/InstanceManagementApi.md
[grammar] ~75-~75: Use a hyphen to join words.
Context: ... will be streamed and loaded from a file like object. When downloading a file, se...
(QB_NEW_EN_HYPHEN)
[grammar] ~380-~380: Use a hyphen to join words.
Context: ... will be streamed and loaded from a file like object. When downloading a file, se...
(QB_NEW_EN_HYPHEN)
🪛 markdownlint-cli2 (0.18.1)
java-client/docs/InstanceManagementApi.md
223-223: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
python/docs/apis/tags/InstanceManagementApi.md
20-20: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3
(MD001, heading-increment)
72-72: Table pipe style
Expected: no_leading_or_trailing; Actual: trailing_only; Unexpected trailing pipe
(MD055, table-pipe-style)
72-72: Table column count
Expected: 4; Actual: 3; Too few cells, row will be missing data
(MD056, table-column-count)
73-73: Table pipe style
Expected: no_leading_or_trailing; Actual: trailing_only; Unexpected trailing pipe
(MD055, table-pipe-style)
73-73: Table column count
Expected: 4; Actual: 3; Too few cells, row will be missing data
(MD056, table-column-count)
84-84: Table pipe style
Expected: no_leading_or_trailing; Actual: trailing_only; Unexpected trailing pipe
(MD055, table-pipe-style)
84-84: Table column count
Expected: 4; Actual: 3; Too few cells, row will be missing data
(MD056, table-column-count)
85-85: Table pipe style
Expected: no_leading_or_trailing; Actual: trailing_only; Unexpected trailing pipe
(MD055, table-pipe-style)
85-85: Table column count
Expected: 4; Actual: 3; Too few cells, row will be missing data
(MD056, table-column-count)
91-91: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
93-93: Table pipe style
Expected: no_leading_or_trailing; Actual: trailing_only; Unexpected trailing pipe
(MD055, table-pipe-style)
93-93: Table column count
Expected: 4; Actual: 3; Too few cells, row will be missing data
(MD056, table-column-count)
98-98: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
100-100: Table pipe style
Expected: no_leading_or_trailing; Actual: trailing_only; Unexpected trailing pipe
(MD055, table-pipe-style)
100-100: Table column count
Expected: 4; Actual: 3; Too few cells, row will be missing data
(MD056, table-column-count)
107-107: Table pipe style
Expected: no_leading_or_trailing; Actual: trailing_only; Unexpected trailing pipe
(MD055, table-pipe-style)
107-107: Table column count
Expected: 4; Actual: 3; Too few cells, row will be missing data
(MD056, table-column-count)
108-108: Table pipe style
Expected: no_leading_or_trailing; Actual: trailing_only; Unexpected trailing pipe
(MD055, table-pipe-style)
108-108: Table column count
Expected: 4; Actual: 3; Too few cells, row will be missing data
(MD056, table-column-count)
113-113: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
115-115: Table pipe style
Expected: no_leading_or_trailing; Actual: trailing_only; Unexpected trailing pipe
(MD055, table-pipe-style)
115-115: Table column count
Expected: 4; Actual: 3; Too few cells, row will be missing data
(MD056, table-column-count)
120-120: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
122-122: Table pipe style
Expected: no_leading_or_trailing; Actual: trailing_only; Unexpected trailing pipe
(MD055, table-pipe-style)
122-122: Table column count
Expected: 4; Actual: 3; Too few cells, row will be missing data
(MD056, table-column-count)
129-129: Link fragments should be valid
(MD051, link-fragments)
129-129: Table pipe style
Expected: no_leading_or_trailing; Actual: trailing_only; Unexpected trailing pipe
(MD055, table-pipe-style)
129-129: Table column count
Expected: 3; Actual: 2; Too few cells, row will be missing data
(MD056, table-column-count)
132-132: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
134-134: Table pipe style
Expected: no_leading_or_trailing; Actual: trailing_only; Unexpected trailing pipe
(MD055, table-pipe-style)
134-134: Table column count
Expected: 4; Actual: 3; Too few cells, row will be missing data
(MD056, table-column-count)
135-135: Table pipe style
Expected: no_leading_or_trailing; Actual: trailing_only; Unexpected trailing pipe
(MD055, table-pipe-style)
135-135: Table column count
Expected: 4; Actual: 3; Too few cells, row will be missing data
(MD056, table-column-count)
136-136: Table pipe style
Expected: no_leading_or_trailing; Actual: trailing_only; Unexpected trailing pipe
(MD055, table-pipe-style)
136-136: Table column count
Expected: 4; Actual: 3; Too few cells, row will be missing data
(MD056, table-column-count)
139-139: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
141-141: Table pipe style
Expected: no_leading_or_trailing; Actual: trailing_only; Unexpected trailing pipe
(MD055, table-pipe-style)
141-141: Table column count
Expected: 3; Actual: 2; Too few cells, row will be missing data
(MD056, table-column-count)
144-144: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3
(MD001, heading-increment)
295-295: Link fragments should be valid
(MD051, link-fragments)
295-295: Table pipe style
Expected: no_leading_or_trailing; Actual: trailing_only; Unexpected trailing pipe
(MD055, table-pipe-style)
295-295: Table column count
Expected: 3; Actual: 2; Too few cells, row will be missing data
(MD056, table-column-count)
378-378: Table pipe style
Expected: no_leading_or_trailing; Actual: trailing_only; Unexpected trailing pipe
(MD055, table-pipe-style)
378-378: Table column count
Expected: 4; Actual: 3; Too few cells, row will be missing data
(MD056, table-column-count)
389-389: Table pipe style
Expected: no_leading_or_trailing; Actual: trailing_only; Unexpected trailing pipe
(MD055, table-pipe-style)
389-389: Table column count
Expected: 4; Actual: 3; Too few cells, row will be missing data
(MD056, table-column-count)
390-390: Table pipe style
Expected: no_leading_or_trailing; Actual: trailing_only; Unexpected trailing pipe
(MD055, table-pipe-style)
390-390: Table column count
Expected: 4; Actual: 3; Too few cells, row will be missing data
(MD056, table-column-count)
391-391: Table pipe style
Expected: no_leading_or_trailing; Actual: trailing_only; Unexpected trailing pipe
(MD055, table-pipe-style)
391-391: Table column count
Expected: 4; Actual: 3; Too few cells, row will be missing data
(MD056, table-column-count)
392-392: Table pipe style
Expected: no_leading_or_trailing; Actual: trailing_only; Unexpected trailing pipe
(MD055, table-pipe-style)
392-392: Table column count
Expected: 4; Actual: 3; Too few cells, row will be missing data
(MD056, table-column-count)
394-394: Multiple headings with the same content
(MD024, no-duplicate-heading)
397-397: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
399-399: Table pipe style
Expected: no_leading_or_trailing; Actual: trailing_only; Unexpected trailing pipe
(MD055, table-pipe-style)
399-399: Table column count
Expected: 4; Actual: 3; Too few cells, row will be missing data
(MD056, table-column-count)
401-401: Multiple headings with the same content
(MD024, no-duplicate-heading)
404-404: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
406-406: Table pipe style
Expected: no_leading_or_trailing; Actual: trailing_only; Unexpected trailing pipe
(MD055, table-pipe-style)
406-406: Table column count
Expected: 4; Actual: 3; Too few cells, row will be missing data
(MD056, table-column-count)
408-408: Multiple headings with the same content
(MD024, no-duplicate-heading)
411-411: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
413-413: Table pipe style
Expected: no_leading_or_trailing; Actual: trailing_only; Unexpected trailing pipe
(MD055, table-pipe-style)
413-413: Table column count
Expected: 4; Actual: 3; Too few cells, row will be missing data
(MD056, table-column-count)
415-415: Multiple headings with the same content
(MD024, no-duplicate-heading)
418-418: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
420-420: Table pipe style
Expected: no_leading_or_trailing; Actual: trailing_only; Unexpected trailing pipe
(MD055, table-pipe-style)
420-420: Table column count
Expected: 4; Actual: 3; Too few cells, row will be missing data
(MD056, table-column-count)
427-427: Link fragments should be valid
(MD051, link-fragments)
430-430: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
432-432: Table pipe style
Expected: no_leading_or_trailing; Actual: trailing_only; Unexpected trailing pipe
(MD055, table-pipe-style)
432-432: Table column count
Expected: 4; Actual: 3; Too few cells, row will be missing data
(MD056, table-column-count)
433-433: Table pipe style
Expected: no_leading_or_trailing; Actual: trailing_only; Unexpected trailing pipe
(MD055, table-pipe-style)
433-433: Table column count
Expected: 4; Actual: 3; Too few cells, row will be missing data
(MD056, table-column-count)
434-434: Table pipe style
Expected: no_leading_or_trailing; Actual: trailing_only; Unexpected trailing pipe
(MD055, table-pipe-style)
434-434: Table column count
Expected: 4; Actual: 3; Too few cells, row will be missing data
(MD056, table-column-count)
436-436: Multiple headings with the same content
(MD024, no-duplicate-heading)
439-439: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
441-441: Table pipe style
Expected: no_leading_or_trailing; Actual: trailing_only; Unexpected trailing pipe
(MD055, table-pipe-style)
441-441: Table column count
Expected: 4; Actual: 3; Too few cells, row will be missing data
(MD056, table-column-count)
apollo-openapi.yaml
Outdated
| /openapi/v1/envs/{env}/releases/{releaseId}/instances: | ||
| get: | ||
| summary: 根据发布版本查询实例(支持分页) (new added) | ||
| operationId: getByRelease |
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.
🛠️ Refactor suggestion | 🟠 Major
🧩 Analysis chain
New/renamed instance endpoints — add param constraints, proper array typing, and standard error responses.
- getByRelease: specify page/size bounds/defaults like elsewhere.
- instances_not_in: model excludeReleases as an array (form, explode=false) instead of free-form string; consider making it required or define empty-behavior.
- Add 400/401/403/404 responses for parity with other endpoints.
- Fix comment typo “avoidng”.
Apply:
@@
/openapi/v1/envs/{env}/releases/{releaseId}/instances:
get:
summary: 根据发布版本查询实例(支持分页) (new added)
operationId: getByRelease
@@
- name: page
in: query
description: ''
required: true
example: 0
schema:
type: integer
+ minimum: 0
+ default: 0
- name: size
in: query
description: ''
required: true
example: 20
schema:
type: integer
+ minimum: 1
+ maximum: 200
+ default: 20
@@
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/OpenPageDTOOpenInstanceDTO'
+ '400':
+ description: '请求参数错误'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ExceptionResponse'
+ '401':
+ description: '未授权访问'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ExceptionResponse'
+ '403':
+ description: '权限不足'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ExceptionResponse'
+ '404':
+ description: '资源未找到'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ExceptionResponse'
@@
- /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/instances_not_in: # avoidng confliction with other server endpoint
+ /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/instances_not_in: # avoiding conflict with other server endpoints
get:
summary: 查询不在指定发布版本中的实例 (new added)
operationId: getByReleasesNotIn
@@
- - name: excludeReleases
+ - name: excludeReleases
in: query
- description: '排除的发布ID列表,用逗号分隔'
- required: false
- schema:
- type: string
+ description: '排除的发布ID列表'
+ required: false
+ style: form
+ explode: false
+ schema:
+ type: array
+ items:
+ type: integer
+ format: int64
+ example: [1,2,3]
@@
responses:
'200':
description: ''
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/OpenInstanceDTO'
+ '400':
+ description: '请求参数错误'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ExceptionResponse'
+ '401':
+ description: '未授权访问'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ExceptionResponse'
+ '403':
+ description: '权限不足'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ExceptionResponse'
+ '404':
+ description: '资源未找到'
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ExceptionResponse'Optionally consider pagination for instances_not_in to avoid large payloads.
Also applies to: 2465-2465, 2469-2469
🏁 Script executed:
#!/bin/bash
# Ensure no stale misspelling remains
rg -n "instances_not_int|getByReleasesNotInt" -SLength of output: 0
🏁 Script executed:
#!/bin/bash
# Extract lines around 2398, 2465, 2469 to see current state
echo "=== Lines 2390-2410 (around 2398) ==="
sed -n '2390,2410p' apollo-openapi.yaml
echo ""
echo "=== Lines 2460-2475 (around 2465, 2469) ==="
sed -n '2460,2475p' apollo-openapi.yaml
echo ""
echo "=== Search for 'avoidng' typo ==="
rg -n "avoidng" apollo-openapi.yamlLength of output: 1559
🏁 Script executed:
#!/bin/bash
# Extract complete getByRelease endpoint (from operationId line to next endpoint marker)
echo "=== getByRelease endpoint (full) ==="
sed -n '2398,2470p' apollo-openapi.yaml | head -80
echo ""
echo "=== instances_not_in endpoint parameters ==="
sed -n '2465,2540p' apollo-openapi.yaml
echo ""
echo "=== Check similar endpoint for constraint patterns ==="
rg -A 15 "name: page" apollo-openapi.yaml | head -40Length of output: 5706
Fix typo, add parameter constraints/defaults, convert excludeReleases to array, and add standard error responses.
The verification confirms all issues in the review comment are present:
- Typo at line 2465: "avoidng confliction" exists and should be "avoiding conflict"
- getByRelease (line 2398): page/size parameters lack constraints and defaults; other endpoints in the file use
minimum: 0for page - getByRelease responses: only 200 status defined; missing 400/401/403/404 like other endpoints
- instances_not_in (line 2465): excludeReleases is currently
type: stringdescribed as comma-separated, should betype: arraywithstyle: form, explode: false - instances_not_in responses: only 200 status defined; missing 400/401/403/404
Apply the suggested diff to ensure consistency with existing endpoints and proper API documentation.
🤖 Prompt for AI Agents
In apollo-openapi.yaml around lines 2398 and 2465, fix several docs issues:
correct the typo "avoidng confliction" to "avoiding conflict" at ~2465; for the
getByRelease operation at line 2398 add pagination parameter constraints and
defaults (page: integer minimum: 0 default: 0, size: integer minimum: 1 default:
<choose consistent default used elsewhere>), and add standard error responses
(400, 401, 403, 404) mirroring other endpoints; for the instances_not_in
parameter at ~2465 change excludeReleases from type: string to type: array with
items: string and set style: form, explode: false, and add the same standard
error responses (400, 401, 403, 404) to that operation to match existing
endpoints.
| [**get_by_release**](#get_by_release) | **get** /openapi/v1/envs/{env}/releases/{releaseId}/instances | 根据发布版本查询实例(支持分页) (new added) | ||
| [**get_by_releases_not_in**](#get_by_releases_not_in) | **get** /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/instances_not_in | 查询不在指定发布版本中的实例 (new added) |
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.
Path inconsistency: use /instances_not_in everywhere.
The method table uses /instances_not_in but the “GET …” lines/examples still show /instances?excludeReleases=… and related error strings. Align to the mapped path.
Apply:
-GET /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/instances?excludeReleases=1,2,3
+GET /openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/instances_not_in?excludeReleases=1,2,3
- print("Exception when calling InstanceManagementApi->get_by_releases_not_in: %s\n" % e)
+ print("Exception when calling InstanceManagementApi->get_by_releases_not_in: %s\n" % e)(Adjust both example blocks and any surrounding GET lines to match /instances_not_in.)
Also applies to: 156-156, 197-205, 218-224
🤖 Prompt for AI Agents
In python/docs/apis/tags/InstanceManagementApi.md around lines 8-9 (also apply
changes at 156, 197-205, 218-224), the documentation shows a mismatch between
the method table path (/instances_not_in) and example/request lines that still
use /instances?excludeReleases=…; update every example block and any "GET ..."
request lines and error string references to use the mapped path
/instances_not_in (including path params for env/appId/clusterName/namespaceName
and release filters) so the path is consistent throughout the file.
| > int get_instance_count_by_namespace(envapp_idcluster_namenamespace_name) | ||
| # **get_by_release** | ||
| <a id="get_by_release"></a> | ||
| > OpenPageDTOOpenInstanceDTO get_by_release(envrelease_idpagesize) |
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.
Fix signature rendering.
“OpenPageDTOOpenInstanceDTO get_by_release(envrelease_idpagesize)” is missing commas/underscores.
- > OpenPageDTOOpenInstanceDTO get_by_release(envrelease_idpagesize)
+ > OpenPageDTOOpenInstanceDTO get_by_release(env, releaseId, page, size)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| > OpenPageDTOOpenInstanceDTO get_by_release(envrelease_idpagesize) | |
| > OpenPageDTOOpenInstanceDTO get_by_release(env, releaseId, page, size) |
🤖 Prompt for AI Agents
In python/docs/apis/tags/InstanceManagementApi.md around line 14, the rendered
signature "OpenPageDTOOpenInstanceDTO get_by_release(envrelease_idpagesize)"
lacks separators; update the signature to include proper delimiters so types and
parameters are distinct (e.g., separate return types with a comma or space and
separate parameters with commas or underscores) — change it to show
"OpenPageDTO, OpenInstanceDTO get_by_release(env, release_id, page_size)" or the
repository's preferred delimiter format so types and parameters render
correctly.
fixed unintuitive function naming and wrong URI spelling.
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes