-
Notifications
You must be signed in to change notification settings - Fork 1
fix: fixed operator issue #11
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
|
Warning Rate limit exceeded@tacklequestions has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 16 minutes and 45 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (107)
WalkthroughThe OpenAPI spec and generated Java client were overhauled: new wrapper response models introduced, many endpoints refactored to env-scoped paths and to require an operator query param, several models renamed/removed/added, and client runtime internals adjusted (JSON handling, auth, ApiClient). Build toolchains and CI were downgraded for broader compatibility. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Client
participant Api as Java ApiClient
participant Srv as Apollo OpenAPI Server
Client->>Api: call updateItem(..., operator, body)
Api->>Srv: HTTP PUT /openapi/v1/envs/{env}/.../items/{key}?operator={op}
Note over Srv: Endpoint now env-scoped and requires operator
Srv-->>Api: 200 MultiResponseEntity{entities:[RichResponseEntity{code,message,body}]}
Api-->>Client: Deserialize to MultiResponseEntity/RichResponseEntity
sequenceDiagram
autonumber
actor Client
participant Api as Java ApiClient
participant Auth as HttpBearerAuth
participant Srv as Apollo OpenAPI Server
Client->>Auth: setBearerToken("token")
Client->>Api: getCluster(env, appId, clusterName)
Api->>Srv: GET .../envs/{env}/apps/{appId}/clusters/{clusterName}\nAuthorization: Bearer token
Srv-->>Api: 200 OpenClusterDTO
Api-->>Client: OpenClusterDTO
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
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: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
apollo-openapi.yaml (2)
62-74: Schema/example mismatch and unintended breaking change for createAppResponse schema changed to SuccessEmptyResponse, but the example still returns an OpenAppDTO. Also the inline comment says this original endpoint “should not be modified this time”. This will break clients and generators.
Please revert to the original schema or update the example and call‑out the breaking change. Suggested revert:
- schema: - $ref: '#/components/schemas/SuccessEmptyResponse' + schema: + $ref: '#/components/schemas/OpenAppDTO'
469-484: MultiResponseEntity usage doesn’t match examples; clarify payload shapeYou switched responses to MultiResponseEntity, but the examples still show raw arrays (e.g., navtree returns a list of env/clusters). This contradicts the schema and will confuse generators/clients.
Either:
- Keep the raw array schema, or
- Update the examples to match MultiResponseEntity, e.g.:
example: code: 200 entities: - code: 200 message: "OK" body: env: "DEV" clusters: - "default" - "test-cluster"Same concern for miss_envs: specify what RichResponseEntity.body contains (e.g., array of strings or specific DTO) and align examples accordingly.
Also applies to: 554-560
🧹 Nitpick comments (2)
apollo-openapi.yaml (2)
293-299: Operator audit param additions look good; consolidate via reusable parameter and check gapsGood call adding required query param operator across write/delete endpoints. To reduce duplication and ensure consistency, define a reusable parameter and $ref it everywhere. Also, a few write endpoints still don’t take operator (e.g., updateItem, updateItemByEncodedKey, and POST branches/{branchName}/merge). Confirm if that’s intentional or add operator there too.
DRY suggestion (add under components.parameters and replace in paths):
components: + parameters: + OperatorParam: + name: operator + in: query + description: 操作人用户名 + required: true + schema: + type: stringThen in each operation:
- - name: operator - in: query - description: '操作人用户名' - required: true - schema: - type: string + - $ref: '#/components/parameters/OperatorParam'Please also update endpoints that still miss operator if auditing requires it (PUT items, PUT encodedItems, POST .../branches/{branchName}/merge). For endpoints where the DTO already carries the actor (e.g., releasedBy), clarify in description to avoid confusion.
Also applies to: 354-359, 500-505, 899-905, 1183-1188, 1431-1436, 1564-1568, 1671-1676, 2160-2163, 2916-2920, 3159-3163, 3456-3461, 760-763, 1133-1138, 3317-3323, 3391-3396
1127-1138: Fill in operator description for consistencyThis endpoint’s operator parameter has an empty description while others use 操作人用户名. Align the description for consistency and better docs.
- - name: operator - in: query - description: '' + - name: operator + in: query + description: '操作人用户名' required: true schema: type: string
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apollo-openapi.yaml(21 hunks)
🔇 Additional comments (1)
apollo-openapi.yaml (1)
1912-1970: Consider requiring operator on branch merge (POST) tooThe PATCH merge adds operator, but the existing POST merge endpoint doesn’t. If both perform privileged merge operations, require operator consistently or document the difference.
| MultiResponseEntity: | ||
| type: object | ||
| description: A response container holding multiple RichResponseEntity objects | ||
| properties: | ||
| code: | ||
| type: integer | ||
| description: Overall HTTP status code | ||
| example: 200 | ||
| entities: | ||
| type: array | ||
| description: List of rich response entities | ||
| items: | ||
| $ref: '#/components/schemas/RichResponseEntity' | ||
| required: | ||
| - code | ||
| - entities | ||
|
|
||
| RichResponseEntity: | ||
| type: object | ||
| description: A wrapper for a single response entity with code, message, and body | ||
| properties: | ||
| code: | ||
| type: integer | ||
| description: HTTP status code | ||
| example: 200 | ||
| message: | ||
| type: object | ||
| description: Response message (can be string or object) | ||
| example: "OK" | ||
| body: | ||
| type: object | ||
| description: Response payload (generic type T) | ||
| required: | ||
| - code | ||
| - message | ||
|
|
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 RichResponseEntity typing; current definition conflicts with examples
- message is typed object, but examples use a string ("OK"). Use oneOf for string|object.
- Consider allowing body to be null when no payload is present.
Minimal schema tweaks:
RichResponseEntity:
type: object
properties:
code:
type: integer
description: HTTP status code
example: 200
message:
- type: object
- description: Response message (can be string or object)
- example: "OK"
+ description: Response message (string or object)
+ oneOf:
+ - type: string
+ - type: object
+ example: "OK"
body:
- type: object
- description: Response payload (generic type T)
+ type: object
+ nullable: true
+ description: Response payload (generic type)Optionally, if different endpoints have known concrete body types, define specialized wrappers (e.g., RichResponseEntityOfNamespace) to retain strong typing in OpenAPI.
📝 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.
| MultiResponseEntity: | |
| type: object | |
| description: A response container holding multiple RichResponseEntity objects | |
| properties: | |
| code: | |
| type: integer | |
| description: Overall HTTP status code | |
| example: 200 | |
| entities: | |
| type: array | |
| description: List of rich response entities | |
| items: | |
| $ref: '#/components/schemas/RichResponseEntity' | |
| required: | |
| - code | |
| - entities | |
| RichResponseEntity: | |
| type: object | |
| description: A wrapper for a single response entity with code, message, and body | |
| properties: | |
| code: | |
| type: integer | |
| description: HTTP status code | |
| example: 200 | |
| message: | |
| type: object | |
| description: Response message (can be string or object) | |
| example: "OK" | |
| body: | |
| type: object | |
| description: Response payload (generic type T) | |
| required: | |
| - code | |
| - message | |
| RichResponseEntity: | |
| type: object | |
| description: A wrapper for a single response entity with code, message, and body | |
| properties: | |
| code: | |
| type: integer | |
| description: HTTP status code | |
| example: 200 | |
| message: | |
| description: Response message (string or object) | |
| oneOf: | |
| - type: string | |
| - type: object | |
| example: "OK" | |
| body: | |
| type: object | |
| nullable: true | |
| description: Response payload (generic type) | |
| required: | |
| - code | |
| - message |
🤖 Prompt for AI Agents
In apollo-openapi.yaml around lines 4225 to 4260, RichResponseEntity's message
is typed as object but examples use a string and body cannot currently be null;
update the schema so message accepts either a string or an object (use oneOf
with type: string and type: object) and make body nullable (either set nullable:
true or use oneOf with object and "null") so endpoints that return no payload
are valid; keep code and message as required but ensure examples still match the
updated types and consider creating specialized RichResponseEntityOfX wrappers
for endpoints that need concrete body schemas.
7037620 to
a5c49b1
Compare
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: 24
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (13)
java-client/src/main/java/org/openapitools/client/model/OpenClusterDTO.java (1)
280-312: Guard null JSON objects before iterating.If
jsonObjis null and there are no required fields, the method falls through and dereferencesjsonObj.entrySet(), causing aNullPointerException. Please return immediately after the null check.public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!OpenClusterDTO.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in OpenClusterDTO is not found in the empty JSON string", OpenClusterDTO.openapiRequiredFields.toString())); - } - } + if (jsonObj == null) { + if (!OpenClusterDTO.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OpenClusterDTO is not found in the empty JSON string", OpenClusterDTO.openapiRequiredFields.toString())); + } + return; + }java-client/src/main/java/org/openapitools/client/model/OpenItemDTO.java (1)
336-371: Return after handling null JSON payloads.When
jsonObjis null and there are no required fields, the logic drops through tojsonObj.entrySet(), triggering aNullPointerException. Add an early return right after the null check.public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!OpenItemDTO.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in OpenItemDTO is not found in the empty JSON string", OpenItemDTO.openapiRequiredFields.toString())); - } - } + if (jsonObj == null) { + if (!OpenItemDTO.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OpenItemDTO is not found in the empty JSON string", OpenItemDTO.openapiRequiredFields.toString())); + } + return; + }java-client/src/main/java/org/openapitools/client/model/OpenGrayReleaseRuleDTO.java (1)
375-427: Short‑circuit when the JSON object is null.For optional payloads,
jsonObjcan be null. Without returning immediately, the subsequentjsonObj.entrySet()call will throw aNullPointerException. Please exit the method once the null case is handled.public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!OpenGrayReleaseRuleDTO.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in OpenGrayReleaseRuleDTO is not found in the empty JSON string", OpenGrayReleaseRuleDTO.openapiRequiredFields.toString())); - } - } + if (jsonObj == null) { + if (!OpenGrayReleaseRuleDTO.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OpenGrayReleaseRuleDTO is not found in the empty JSON string", OpenGrayReleaseRuleDTO.openapiRequiredFields.toString())); + } + return; + }java-client/src/main/java/org/openapitools/client/model/OpenPageDTOOpenItemDTO.java (1)
235-263: Prevent null JSON from reaching the entry iteration.If the deserialized element is null and no required fields are declared, we still proceed to
jsonObj.entrySet(), resulting in aNullPointerException. Add an early return after the null check.public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!OpenPageDTOOpenItemDTO.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in OpenPageDTOOpenItemDTO is not found in the empty JSON string", OpenPageDTOOpenItemDTO.openapiRequiredFields.toString())); - } - } + if (jsonObj == null) { + if (!OpenPageDTOOpenItemDTO.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OpenPageDTOOpenItemDTO is not found in the empty JSON string", OpenPageDTOOpenItemDTO.openapiRequiredFields.toString())); + } + return; + }java-client/src/main/java/org/openapitools/client/model/OpenInstanceDTO.java (1)
319-362: Exit early after the null JSON check.When
jsonObjis null and no required fields are present, we still try to iterate overjsonObj.entrySet(), which throws aNullPointerException. Please insert an early return after handling the null case.public static void validateJsonObject(JsonObject jsonObj) throws IOException { - if (jsonObj == null) { - if (!OpenInstanceDTO.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in OpenInstanceDTO is not found in the empty JSON string", OpenInstanceDTO.openapiRequiredFields.toString())); - } - } + if (jsonObj == null) { + if (!OpenInstanceDTO.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OpenInstanceDTO is not found in the empty JSON string", OpenInstanceDTO.openapiRequiredFields.toString())); + } + return; + }java-client/src/main/java/org/openapitools/client/JSON.java (1)
167-187: Re-add the InputStream deserialize overload.Removing
deserialize(InputStream, Type)breaks existing clients that stream responses (it was part of the published API). Please keep the overload and delegate to the String-based version to avoid regressions.@SuppressWarnings("unchecked") public static <T> T deserialize(String body, Type returnType) { ... } + + public static <T> T deserialize(InputStream inputStream, Type returnType) throws IOException { + try (InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { + return deserialize(CharStreams.toString(reader), returnType); + } + }(Use your existing helper utilities; the key is to retain the InputStream signature.)
java-client/docs/InstanceManagementApi.md (1)
93-95: Fix inconsistent endpoint path.Line 93 still shows
/instances?excludeReleases=..., but both the method table and generated client call/instances_not_int. Following the current text would hit the wrong URL and return 404. Please align the HTTP request line with the actual path.-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_int?excludeReleases=1,2,3java-client/src/main/java/org/openapitools/client/model/OpenReleaseBO.java (1)
181-211: Return immediately whenjsonObjis null.The null guard doesn’t exit, so
jsonObj.entrySet()runs on a null reference and will throw for JSON payloads that are simplynull.Use the same pattern as other generated models:
public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { if (!OpenReleaseBO.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in OpenReleaseBO is not found in the empty JSON string", OpenReleaseBO.openapiRequiredFields.toString())); } + return; }java-client/src/main/java/org/openapitools/client/model/OpenEnvClusterInfo.java (1)
179-210: Guard null JSON objects before iteratingLine 180 allows a null
jsonObjwhen no required fields exist, but we still fall through to Line 187 (jsonObj.entrySet()), causing aNullPointerException. Please return immediately after the null check.- if (jsonObj == null) { - if (!OpenEnvClusterInfo.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in OpenEnvClusterInfo is not found in the empty JSON string", OpenEnvClusterInfo.openapiRequiredFields.toString())); - } - } + if (jsonObj == null) { + if (!OpenEnvClusterInfo.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OpenEnvClusterInfo is not found in the empty JSON string", OpenEnvClusterInfo.openapiRequiredFields.toString())); + } + return; + }java-client/src/main/java/org/openapitools/client/model/OpenNamespaceTextModel.java (1)
336-371: Avoid NPE when JSON is nullWhen
jsonObjis null (Line 337) and there are no required fields, the method should exit. Currently we proceed to Line 343 and dereference the null, throwing aNullPointerException. Add an early return.- if (jsonObj == null) { - if (!OpenNamespaceTextModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in OpenNamespaceTextModel is not found in the empty JSON string", OpenNamespaceTextModel.openapiRequiredFields.toString())); - } - } + if (jsonObj == null) { + if (!OpenNamespaceTextModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OpenNamespaceTextModel is not found in the empty JSON string", OpenNamespaceTextModel.openapiRequiredFields.toString())); + } + return; + }java-client/src/main/java/org/openapitools/client/model/OpenNamespaceIdentifier.java (1)
224-249: Return after accepting a null JSON payloadLine 225 allows
jsonObjto be null when there are no required fields, yet we still fall through to Line 231 and dereference it. Add an earlyreturn;to avoid the resultingNullPointerException.- if (jsonObj == null) { - if (!OpenNamespaceIdentifier.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in OpenNamespaceIdentifier is not found in the empty JSON string", OpenNamespaceIdentifier.openapiRequiredFields.toString())); - } - } + if (jsonObj == null) { + if (!OpenNamespaceIdentifier.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OpenNamespaceIdentifier is not found in the empty JSON string", OpenNamespaceIdentifier.openapiRequiredFields.toString())); + } + return; + }java-client/src/main/java/org/openapitools/client/model/OpenItemChangeSets.java (1)
391-465: Handle null JSON objects safelyAs with the other models, if
jsonObjis null (Line 392) and no required fields exist, we should return. Falling through to Line 398 causes aNullPointerException. Please exit early.- if (jsonObj == null) { - if (!OpenItemChangeSets.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in OpenItemChangeSets is not found in the empty JSON string", OpenItemChangeSets.openapiRequiredFields.toString())); - } - } + if (jsonObj == null) { + if (!OpenItemChangeSets.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OpenItemChangeSets is not found in the empty JSON string", OpenItemChangeSets.openapiRequiredFields.toString())); + } + return; + }java-client/src/main/java/org/openapitools/client/ApiClient.java (1)
1162-1198: Critical: auth query parameters no longer reach the request URL
allQueryParamsis a defensive copy, so any query values injected byAuthentication.applyToParams(e.g., API keys in the query string) stay in that copy and never flow back intoqueryParams/collectionQueryParams. The URL is still built from the original lists, so those auth params are silently dropped and every query-based auth now breaks. Please either pass the original lists intoupdateParamsForAuthor propagate the newly added pairs back into the lists that feedbuildUrlbefore constructing the request.
♻️ Duplicate comments (1)
apollo-openapi.yaml (1)
4214-4249: Unresolved issue: RichResponseEntity typing conflicts with examples.As flagged in the previous review, the
messagefield is typed asobjectbut the examples use a string value"OK". This creates ambiguity for API consumers.Additionally, the past review suggested making
bodynullable to support endpoints that return no payload.
🧹 Nitpick comments (8)
java-client/src/main/java/org/openapitools/client/model/KVEntity.java (2)
17-17: Remove unused and duplicate imports.The following imports are problematic:
- Line 17:
Arraysis imported but not used anywhere in the code.- Lines 35-38: Duplicate imports of
TypeAdapter,JsonReader,JsonWriter, andIOException(already imported at lines 18-23).- Line 40:
java.lang.reflect.Typeis imported but not used in the visible code.Apply this diff to clean up the imports:
import java.util.Objects; -import java.util.Arrays; 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.lang.reflect.Type; import java.util.HashMap;Also applies to: 35-38, 40-40
66-70: Clarify null-safety contract or add validation.The setter methods accept
Stringparameters without@Nullableannotations, suggesting a non-null contract. However:
- No validation prevents null values from being set
- The getter methods still have
@Nullableannotations (lines 76, 97)- This creates an inconsistent API contract
If null values are not allowed, add validation in the setters:
public KVEntity key(String key) { - + if (key == null) { + throw new IllegalArgumentException("key cannot be null"); + } this.key = key; return this; }public void setKey(String key) { + if (key == null) { + throw new IllegalArgumentException("key cannot be null"); + } this.key = key; }Apply similar changes for the
valuesetters at lines 87-91 and 103-105.If null values are allowed, add
@Nullableannotations to the setter parameters for clarity.Note: Since this is auto-generated code (line 53), you may need to adjust the OpenAPI generator configuration to properly handle nullable vs. non-nullable fields.
Also applies to: 82-84, 87-91, 103-105
java-client/src/main/java/org/openapitools/client/Pair.java (2)
18-19: Consider restoringfinalmodifiers for immutability.The fields are no longer
final, which removes immutability guarantees. For a simple data holder likePair, immutability is typically preferred as it makes the class thread-safe and prevents accidental mutation.Apply this diff to restore immutability:
- private String name = ""; - private String value = ""; + private final String name; + private final String value;Note: This would require reworking the constructor to handle validation differently (see separate comment on constructor validation).
50-56: Simplify null check.The
isValidStringmethod can be simplified to a single return statement.Apply this diff:
private boolean isValidString(String arg) { - if (arg == null) { - return false; - } - - return true; + return arg != null; }java-client/gradlew (1)
85-85: Remove unusedAPP_NAMEdefinition
APP_NAMEis defined at line 85 but never referenced; delete it to reduce clutter.java-client/src/main/java/org/openapitools/client/model/OpenOrganizationDto.java (1)
17-17: Remove unused imports.The imports for
Arrays(line 17) andType(line 40) appear to be unused in this file. TheArraysimport was likely needed for the oldArrays.asList()initialization pattern, but the code now uses explicitadd()calls. TheTypeimport is not visible in any usage.Apply this diff to remove the unused imports:
-import java.util.Arrays;-import java.lang.reflect.Type;Also applies to: 40-40
java-client/pom.xml (1)
53-53: Evaluate the need for Maven plugin downgrades.Multiple Maven plugins are being downgraded:
- maven-enforcer-plugin: 3.4.1 → 3.1.0
- maven-dependency-plugin: 3.6.1 → 3.3.0
- maven-build-helper-plugin: 3.5.0 → 3.3.0
- maven-javadoc-plugin: 3.6.3 → 3.4.1
- maven-source-plugin: 3.3.0 → 3.2.1
- maven-gpg-plugin: 3.2.1 → 3.0.1
While these are build-time plugins (not runtime dependencies), the downgrades may remove bug fixes, performance improvements, or compatibility with newer Maven versions.
Also applies to: 96-96, 127-127, 158-158, 181-181, 244-244
apollo-openapi.yaml (1)
458-458: Consider type safety implications of generic response wrappers.Replacing specific response types (like arrays of DTOs) with generic
MultiResponseEntityandRichResponseEntitywrappers reduces compile-time type safety. Clients lose the ability to rely on generated types for these endpoints.Consider defining specialized wrapper types per endpoint (e.g.,
MultiResponseEntityOfOpenEnvClusterInfo) to maintain strong typing while using the wrapper pattern.Also applies to: 548-548
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
java-client/gradle/wrapper/gradle-wrapper.jaris excluded by!**/*.jar
📒 Files selected for processing (107)
apollo-openapi.yaml(21 hunks)java-client/.github/workflows/maven.yml(1 hunks)java-client/.openapi-generator/FILES(3 hunks)java-client/.openapi-generator/VERSION(1 hunks)java-client/README.md(4 hunks)java-client/build.gradle(2 hunks)java-client/build.sbt(1 hunks)java-client/docs/AppManagementApi.md(33 hunks)java-client/docs/Change.md(0 hunks)java-client/docs/ClusterDTO.md(0 hunks)java-client/docs/ClusterManagementApi.md(10 hunks)java-client/docs/EntityPairKVEntity.md(0 hunks)java-client/docs/EnvClusterInfo.md(0 hunks)java-client/docs/InstanceManagementApi.md(7 hunks)java-client/docs/ItemChangeSets.md(0 hunks)java-client/docs/ItemDTO.md(0 hunks)java-client/docs/ItemManagementApi.md(34 hunks)java-client/docs/KVEntity.md(1 hunks)java-client/docs/ListItemDiffs.md(0 hunks)java-client/docs/MapString.md(0 hunks)java-client/docs/MultiResponseEntity.md(1 hunks)java-client/docs/NamespaceBranchManagementApi.md(18 hunks)java-client/docs/NamespaceIdentifier.md(0 hunks)java-client/docs/NamespaceManagementApi.md(26 hunks)java-client/docs/NamespaceSyncModel.md(0 hunks)java-client/docs/NamespaceTextModel.md(0 hunks)java-client/docs/OpenEnvClusterDTO.md(1 hunks)java-client/docs/OpenEnvClusterInfo.md(1 hunks)java-client/docs/OpenInstanceConfigDTO.md(1 hunks)java-client/docs/OpenInstanceDTO.md(1 hunks)java-client/docs/OpenItemChangeSets.md(1 hunks)java-client/docs/OpenItemDiffs.md(1 hunks)java-client/docs/OpenNamespaceIdentifier.md(1 hunks)java-client/docs/OpenNamespaceSyncModel.md(1 hunks)java-client/docs/OpenNamespaceTextModel.md(1 hunks)java-client/docs/OpenOrganizationDto.md(1 hunks)java-client/docs/OpenReleaseBO.md(1 hunks)java-client/docs/OpenReleaseDTO.md(1 hunks)java-client/docs/OpenapiV1AppsGet401Response.md(0 hunks)java-client/docs/OpenapiV1AppsPost400Response.md(0 hunks)java-client/docs/OpenapiV1AppsPostRequest.md(0 hunks)java-client/docs/OpenapiV1EnvsEnvAppsAppIdClustersClusterNameNamespacesNamespaceNameItemsValidatePost200Response.md(0 hunks)java-client/docs/OpenapiV1EnvsEnvAppsAppIdClustersClusterNameNamespacesNamespaceNameItemsValidatePost400Response.md(0 hunks)java-client/docs/OpenapiV1EnvsEnvReleasesCompareGet200Response.md(0 hunks)java-client/docs/OrganizationManagementApi.md(2 hunks)java-client/docs/ReleaseDTO.md(0 hunks)java-client/docs/ReleaseManagementApi.md(19 hunks)java-client/docs/RichResponseEntity.md(1 hunks)java-client/gradle/wrapper/gradle-wrapper.properties(1 hunks)java-client/gradlew(5 hunks)java-client/gradlew.bat(4 hunks)java-client/pom.xml(9 hunks)java-client/src/main/java/org/openapitools/client/ApiCallback.java(1 hunks)java-client/src/main/java/org/openapitools/client/ApiClient.java(17 hunks)java-client/src/main/java/org/openapitools/client/ApiException.java(2 hunks)java-client/src/main/java/org/openapitools/client/ApiResponse.java(1 hunks)java-client/src/main/java/org/openapitools/client/Configuration.java(2 hunks)java-client/src/main/java/org/openapitools/client/GzipRequestInterceptor.java(1 hunks)java-client/src/main/java/org/openapitools/client/JSON.java(2 hunks)java-client/src/main/java/org/openapitools/client/Pair.java(2 hunks)java-client/src/main/java/org/openapitools/client/ProgressRequestBody.java(1 hunks)java-client/src/main/java/org/openapitools/client/ProgressResponseBody.java(1 hunks)java-client/src/main/java/org/openapitools/client/ServerConfiguration.java(0 hunks)java-client/src/main/java/org/openapitools/client/ServerVariable.java(0 hunks)java-client/src/main/java/org/openapitools/client/StringUtil.java(2 hunks)java-client/src/main/java/org/openapitools/client/api/ClusterManagementApi.java(9 hunks)java-client/src/main/java/org/openapitools/client/api/InstanceManagementApi.java(13 hunks)java-client/src/main/java/org/openapitools/client/api/OrganizationManagementApi.java(4 hunks)java-client/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java(2 hunks)java-client/src/main/java/org/openapitools/client/auth/Authentication.java(1 hunks)java-client/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java(2 hunks)java-client/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java(4 hunks)java-client/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java(3 hunks)java-client/src/main/java/org/openapitools/client/model/Change.java(0 hunks)java-client/src/main/java/org/openapitools/client/model/ClusterDTO.java(0 hunks)java-client/src/main/java/org/openapitools/client/model/EntityPairKVEntity.java(0 hunks)java-client/src/main/java/org/openapitools/client/model/ItemDTO.java(0 hunks)java-client/src/main/java/org/openapitools/client/model/KVEntity.java(5 hunks)java-client/src/main/java/org/openapitools/client/model/MapString.java(0 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(7 hunks)java-client/src/main/java/org/openapitools/client/model/NamespaceReleaseDTO.java(5 hunks)java-client/src/main/java/org/openapitools/client/model/OpenAppDTO.java(5 hunks)java-client/src/main/java/org/openapitools/client/model/OpenAppNamespaceDTO.java(5 hunks)java-client/src/main/java/org/openapitools/client/model/OpenClusterDTO.java(5 hunks)java-client/src/main/java/org/openapitools/client/model/OpenCreateAppDTO.java(6 hunks)java-client/src/main/java/org/openapitools/client/model/OpenEnvClusterDTO.java(6 hunks)java-client/src/main/java/org/openapitools/client/model/OpenEnvClusterInfo.java(8 hunks)java-client/src/main/java/org/openapitools/client/model/OpenGrayReleaseRuleDTO.java(7 hunks)java-client/src/main/java/org/openapitools/client/model/OpenGrayReleaseRuleItemDTO.java(7 hunks)java-client/src/main/java/org/openapitools/client/model/OpenInstanceConfigDTO.java(5 hunks)java-client/src/main/java/org/openapitools/client/model/OpenInstanceDTO.java(7 hunks)java-client/src/main/java/org/openapitools/client/model/OpenItemChangeSets.java(10 hunks)java-client/src/main/java/org/openapitools/client/model/OpenItemDTO.java(5 hunks)java-client/src/main/java/org/openapitools/client/model/OpenItemDiffs.java(7 hunks)java-client/src/main/java/org/openapitools/client/model/OpenNamespaceDTO.java(7 hunks)java-client/src/main/java/org/openapitools/client/model/OpenNamespaceIdentifier.java(7 hunks)java-client/src/main/java/org/openapitools/client/model/OpenNamespaceLockDTO.java(5 hunks)java-client/src/main/java/org/openapitools/client/model/OpenNamespaceSyncModel.java(9 hunks)java-client/src/main/java/org/openapitools/client/model/OpenNamespaceTextModel.java(7 hunks)java-client/src/main/java/org/openapitools/client/model/OpenOrganizationDto.java(5 hunks)java-client/src/main/java/org/openapitools/client/model/OpenPageDTOOpenInstanceDTO.java(7 hunks)java-client/src/main/java/org/openapitools/client/model/OpenPageDTOOpenItemDTO.java(7 hunks)java-client/src/main/java/org/openapitools/client/model/OpenReleaseBO.java(8 hunks)java-client/src/main/java/org/openapitools/client/model/OpenReleaseDTO.java(5 hunks)java-client/src/main/java/org/openapitools/client/model/OpenapiV1AppsGet401Response.java(0 hunks)java-client/src/main/java/org/openapitools/client/model/OpenapiV1AppsPost400Response.java(0 hunks)
⛔ Files not processed due to max files limit (1)
- java-client/src/main/java/org/openapitools/client/model/OpenapiV1AppsPostRequest.java
💤 Files with no reviewable changes (27)
- java-client/docs/OpenapiV1AppsGet401Response.md
- java-client/docs/OpenapiV1AppsPost400Response.md
- java-client/docs/ItemChangeSets.md
- java-client/docs/OpenapiV1AppsPostRequest.md
- java-client/src/main/java/org/openapitools/client/model/ItemDTO.java
- java-client/docs/ListItemDiffs.md
- java-client/docs/OpenapiV1EnvsEnvAppsAppIdClustersClusterNameNamespacesNamespaceNameItemsValidatePost400Response.md
- java-client/docs/NamespaceTextModel.md
- java-client/docs/ItemDTO.md
- java-client/docs/NamespaceSyncModel.md
- java-client/src/main/java/org/openapitools/client/ServerConfiguration.java
- java-client/src/main/java/org/openapitools/client/model/OpenapiV1AppsPost400Response.java
- java-client/docs/OpenapiV1EnvsEnvReleasesCompareGet200Response.md
- java-client/docs/ClusterDTO.md
- java-client/docs/ReleaseDTO.md
- java-client/docs/MapString.md
- java-client/docs/EntityPairKVEntity.md
- java-client/src/main/java/org/openapitools/client/model/OpenapiV1AppsGet401Response.java
- java-client/docs/NamespaceIdentifier.md
- java-client/src/main/java/org/openapitools/client/model/EntityPairKVEntity.java
- java-client/src/main/java/org/openapitools/client/model/MapString.java
- java-client/docs/Change.md
- java-client/docs/OpenapiV1EnvsEnvAppsAppIdClustersClusterNameNamespacesNamespaceNameItemsValidatePost200Response.md
- java-client/src/main/java/org/openapitools/client/model/Change.java
- java-client/docs/EnvClusterInfo.md
- java-client/src/main/java/org/openapitools/client/model/ClusterDTO.java
- java-client/src/main/java/org/openapitools/client/ServerVariable.java
✅ Files skipped from review due to trivial changes (18)
- java-client/docs/OpenEnvClusterInfo.md
- java-client/src/main/java/org/openapitools/client/GzipRequestInterceptor.java
- java-client/docs/OpenInstanceDTO.md
- java-client/docs/OpenOrganizationDto.md
- java-client/docs/OpenItemChangeSets.md
- java-client/docs/OpenReleaseDTO.md
- java-client/docs/OpenNamespaceSyncModel.md
- java-client/src/main/java/org/openapitools/client/ProgressResponseBody.java
- java-client/docs/RichResponseEntity.md
- java-client/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java
- java-client/src/main/java/org/openapitools/client/auth/Authentication.java
- java-client/src/main/java/org/openapitools/client/ApiResponse.java
- java-client/docs/MultiResponseEntity.md
- java-client/docs/OpenNamespaceIdentifier.md
- java-client/.openapi-generator/VERSION
- java-client/src/main/java/org/openapitools/client/ProgressRequestBody.java
- java-client/src/main/java/org/openapitools/client/ApiCallback.java
- java-client/docs/OpenInstanceConfigDTO.md
🧰 Additional context used
🪛 GitHub Actions: General CI Checks
apollo-openapi.yaml
[error] 5190-5190: LineEnd: File has multiple trailing line endings in this file.
java-client/README.md
[warning] 109-109: TrailingWhitespace: Line contains trailing whitespace.
[warning] 117-117: TrailingWhitespace: Line contains trailing whitespace.
java-client/docs/NamespaceManagementApi.md
[warning] 972-972: LineEnd: File has multiple trailing line endings.
🪛 markdownlint-cli2 (0.18.1)
java-client/docs/ClusterManagementApi.md
146-146: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
java-client/docs/AppManagementApi.md
81-81: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
82-82: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
85-85: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
148-148: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
156-156: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
157-157: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
160-160: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
221-221: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
java-client/README.md
203-203: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
204-204: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
205-205: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
206-206: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
207-207: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
208-208: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
209-209: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
210-210: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
211-211: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
212-212: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
213-213: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
214-214: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
215-215: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
216-216: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
217-217: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
218-218: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
219-219: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
220-220: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
221-221: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
222-222: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
223-223: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
224-224: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
225-225: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
226-226: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
227-227: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
228-228: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
229-229: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
230-230: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
java-client/docs/NamespaceManagementApi.md
30-30: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3
(MD001, heading-increment)
87-87: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
88-88: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
91-91: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
158-158: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
159-159: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
162-162: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
176-176: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3
(MD001, heading-increment)
225-225: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
249-249: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3
(MD001, heading-increment)
302-302: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
310-310: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
311-311: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
314-314: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
525-525: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
526-526: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
529-529: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
685-685: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3
(MD001, heading-increment)
738-738: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
739-739: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
742-742: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
java-client/docs/NamespaceBranchManagementApi.md
316-316: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
317-317: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
320-320: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
472-472: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
java-client/docs/ReleaseManagementApi.md
89-89: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
90-90: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
93-93: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
168-168: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
169-169: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
172-172: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
245-245: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
246-246: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
249-249: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
326-326: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
327-327: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
330-330: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
492-492: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3
(MD001, heading-increment)
551-551: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
552-552: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
555-555: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
633-633: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
634-634: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
637-637: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
651-651: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3
(MD001, heading-increment)
java-client/docs/ItemManagementApi.md
94-94: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
95-95: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
98-98: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
172-172: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
173-173: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
176-176: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
324-324: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
332-332: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
333-333: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
336-336: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
403-403: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
411-411: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
412-412: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
415-415: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
585-585: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3
(MD001, heading-increment)
646-646: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
647-647: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
650-650: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
794-794: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
802-802: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
803-803: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
806-806: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
875-875: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
958-958: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
966-966: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
967-967: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
970-970: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
1042-1042: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
1122-1122: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
🔇 Additional comments (33)
java-client/src/main/java/org/openapitools/client/model/NamespaceGrayDelReleaseDTO.java (1)
17-17: ...java-client/src/main/java/org/openapitools/client/StringUtil.java (3)
1-11: LGTM! Metadata-only header update.The header documentation has been updated with Apollo OpenAPI authentication details. This is a standard auto-generated change from the OpenAPI generator with no runtime impact.
19-19: LGTM! Generation timestamp updated.The
@Generatedannotation timestamp has been refreshed to reflect the current code generation time. This is a metadata-only change with no functional impact.
3-3: AI summary incorrectly describes documentation language.The AI summary states the header was "replaced with an English HTML documentation block," but the actual documentation at line 3 is in Chinese (e.g., "Apollo配置中心OpenAPI接口文档").
java-client/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java (2)
3-3: Inconsistency with AI-generated summary.The AI summary claims the Javadoc "switched from a Chinese description to an English/OpenAPI-generated header," but the current code still contains extensive Chinese documentation (e.g., "Apollo配置中心OpenAPI接口文档", "认证方式", "获取 Token 的方式"). Please verify whether:
- The Chinese documentation is intentional for this codebase, or
- The change direction is reversed (went FROM English TO Chinese rather than Chinese to English)
23-80: LGTM!The timestamp update in the
@Generatedannotation is typical for auto-generated code. The authentication implementation remains unchanged and correctly handles API key authentication across query parameters, headers, and cookies with proper prefix handling.java-client/.github/workflows/maven.yml (1)
20-20: Confirm dropping newer JDKs from the build matrixWe now only exercise Java 8. If we still claim support for 11/17 (or newer), this quietly removes CI coverage and risks shipping regressions. Please confirm the support policy or keep the broader matrix.
java-client/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java (2)
3-3: Auto-generated documentation header updated.The documentation header has been updated with HTML-formatted Chinese text describing Apollo OpenAPI authentication. This is an auto-generated change from the OpenAPI spec update.
53-55: Verify null token handling.The null check ensures that authentication is skipped when no token is set. This behavior is correct and prevents sending malformed Authorization headers.
java-client/src/main/java/org/openapitools/client/model/KVEntity.java (3)
152-160: LGTM!The static initialization block correctly sets up the
openapiFieldsandopenapiRequiredFieldscollections. The explicitadd()calls are clear and maintainable.
168-188: LGTM!The
validateJsonObjectmethod provides comprehensive validation:
- Null and required field checks
- Unknown field detection
- Type validation for string fields
The type-safe approach using
JsonObjectinstead ofJsonElementimproves clarity and reduces potential casting errors.
210-212: LGTM!The TypeAdapter correctly updated to use
validateJsonObjectwithJsonObjectparameter, maintaining type safety throughout the deserialization process.java-client/gradle/wrapper/gradle-wrapper.properties (1)
3-3: Allow Gradle 7.2 wrapper The Java client is configured for Java 1.8 (seejava-client/build.gradlewithsourceCompatibility = JavaVersion.VERSION_1_8), so using Gradle 7.2 is compatible.Likely an incorrect or invalid review comment.
java-client/gradlew (2)
89-89: LGTM! UTF-8 encoding ensures consistent character handling.The addition of
-Dfile.encoding=UTF-8toDEFAULT_JVM_OPTSensures consistent UTF-8 encoding across different JVM environments, which is a best practice for modern Java applications.
58-58: LGTM! Formatting improvements enhance readability.The formatting and spacing changes throughout the script improve consistency and align with modern Gradle wrapper conventions.
Also applies to: 72-83, 94-103, 110-115, 122-140, 144-155, 167-194, 196-206, 227-232
java-client/gradlew.bat (2)
36-36: LGTM! UTF-8 encoding ensures consistent character handling.The addition of
-Dfile.encoding=UTF-8toDEFAULT_JVM_OPTSensures consistent UTF-8 encoding across different JVM environments, matching the Unix wrapper script.
17-17: LGTM! Formatting improvements enhance readability.The spacing improvements in conditionals (adding spaces around
==), error message reformatting withecho.statements, and exit handling updates improve consistency and readability of the Windows batch script.Also applies to: 28-28, 43-43, 45-49, 59-63, 78-78, 83-84
java-client/src/main/java/org/openapitools/client/model/OpenOrganizationDto.java (3)
154-160: LGTM!The refactored static field initialization using explicit
add()calls is equivalent to the previousArrays.asList()pattern and removes the dependency on theArraysclass.
209-213: LGTM!The deserialization logic correctly uses the new
validateJsonObjectmethod and explicitly works withJsonObjecttypes, improving type safety.
168-188: No internal calls tovalidateJsonElementremain; rename is safe. Search across all Java sources found no references to the old method. External clients invoking this directly will need to update tovalidateJsonObject.java-client/pom.xml (3)
75-80: LGTM!The change from
systemPropertyVariablestosystemPropertiesis a valid Maven Surefire configuration. Both forms are acceptable, andsystemPropertiesis the standard element name in Maven Surefire 2.x.
303-313: Verify JAX-RS API migration compatibility.The addition of
javax.ws.rs:jsr311-apiandjavax.ws.rs:javax.ws.rs-apireplaces the Jakarta WS RS API. Ensure that the generated OpenAPI client code is compatible with this Java EE API migration.Based on learnings, the combination of
jsr311-api1.1.1 (JAX-RS 1.1 API) andjavax.ws.rs-api2.1.1 (JAX-RS 2.1 API) provides both legacy and modern API surfaces.
327-332: LGTM!Adding
mockito-coreas a test dependency is a good practice for mocking in unit tests. The version 3.12.4 is reasonable for Java 8 compatibility.java-client/build.gradle (2)
109-109: LGTM!Adding
io.swagger:swagger-annotations:1.6.8provides annotation support for OpenAPI/Swagger specifications in the generated client code.
111-122: Confirm downgraded dependencies don’t reintroduce vulnerabilities
- Versions now align across
java-client/build.gradle,build.sbt, andpom.xml: OkHttp 4.10.0, gson-fire 1.8.5, commons-lang3 3.12.0, JUnit 5.9.1, JAX-RS APIs.- Run a dependency scan (e.g. OWASP Dependency-Check) and full integration tests to ensure no CVEs or compatibility breaks.
java-client/build.sbt (1)
17-18: No jakarta.ws.rs imports found; verify JAX-RS API migration compatibility. The generated client now depends onjavax.ws.rs-api2.1.1 andjsr311-api1.1.1—manually confirm it compiles and runs correctly, especially around client and async features absent in JAX-RS 1.1.java-client/docs/OpenEnvClusterDTO.md (1)
10-11: LGTM! Documentation enhancement adds clarity.The Chinese descriptions provide helpful context for the
envandclustersproperties.java-client/docs/OpenNamespaceTextModel.md (1)
1-20: LGTM! Well-structured documentation for new model.The OpenNamespaceTextModel documentation is clear and follows the established format, including the new
operatorfield for audit tracking.java-client/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java (1)
20-20: LGTM! Type system enhancement for generic schema handling.The shift from
Class<?>toGenericTypein the schema mapping improves type safety for polymorphic schemas. This is auto-generated code consistent with the OpenAPI generator updates.Also applies to: 49-49
java-client/src/main/java/org/openapitools/client/model/OpenEnvClusterDTO.java (1)
1-249: LGTM! Generated code reflects spec updates correctly.The model updates include:
- Enhanced validation using
JsonObject(more precise thanJsonElement)- Updated Javadoc with Chinese descriptions matching the spec
- Consistent fluent API patterns
- Proper null handling
All changes are appropriate for generated code.
java-client/src/main/java/org/openapitools/client/api/OrganizationManagementApi.java (1)
37-37: LGTM! Improved method naming enhances readability.The rename from
openapiV1OrganizationsGettogetOrganization(and related methods) follows clearer naming conventions. TheGenericTypeimport addition is consistent with other API changes.Also applies to: 77-192
java-client/docs/OrganizationManagementApi.md (1)
7-52: LGTM! Documentation synchronized with code changes.The method reference updates from
openapiV1OrganizationsGettogetOrganizationcorrectly reflect the API renaming and maintain consistency with the generated Java client.java-client/src/main/java/org/openapitools/client/ApiException.java (1)
19-30: No action needed: serialVersionUID removal is safe
Auto-generated code suppresses serial warnings and ApiException isn’t persisted, so omitting the field has no impact.
| - code | ||
| - message | ||
|
|
||
| servers: [] |
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 pipeline failure: Remove extra trailing line endings.
The pipeline reports multiple trailing line endings at the end of this file.
Apply this fix to remove extra blank lines:
-
-
+Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In apollo-openapi.yaml around line 4250, the file ends with extraneous
blank/trailing line endings; remove the extra blank lines at the end so the file
ends immediately after the final content (e.g., the line "servers: []") with a
single newline (no multiple empty lines) to satisfy the pipeline check.
| - uses: actions/checkout@v2 | ||
| - name: Set up JDK | ||
| uses: actions/setup-java@v4 | ||
| uses: actions/setup-java@v2 |
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.
Restore the hardened action versions
Rolling back to actions/checkout@v2 and actions/setup-java@v2 reintroduces Node 12/16 based actions, which GitHub is removing; the workflow will start failing once those runtimes are disabled. Please stick with the latest majors.
Apply this diff to revert the downgrade:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v4
- name: Set up JDK
- uses: actions/setup-java@v2
+ uses: actions/setup-java@v4📝 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.
| - uses: actions/checkout@v2 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v4 | |
| uses: actions/setup-java@v2 | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v4 |
🤖 Prompt for AI Agents
In java-client/.github/workflows/maven.yml around lines 22 to 24, the workflow
was downgraded to older action majors that rely on Node 12/16; update the action
references to the current major releases to avoid future failures: replace
actions/checkout@v2 with actions/checkout@v4 and actions/setup-java@v2 with
actions/setup-java@v3 (or the latest stable majors) so the workflow uses
hardened versions that do not depend on deprecated Node runtimes.
| task.from variant.javaCompile.destinationDir | ||
| task.destinationDir = project.file("${project.buildDir}/outputs/jar") | ||
| task.archiveName = "${project.name}-${variant.baseName}-${version}.jar" |
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: Using deprecated Gradle properties.
The changes are replacing modern Gradle properties with deprecated ones:
destinationDirectory→destinationDir(deprecated)archiveFileName→archiveName(deprecated)
These properties were deprecated in Gradle 5.x and should be avoided. The modern properties (destinationDirectory, archiveFileName) provide better compatibility with Gradle's Provider API and lazy configuration.
Apply this diff to use modern properties:
- task.from variant.javaCompile.destinationDir
- task.destinationDir = project.file("${project.buildDir}/outputs/jar")
- task.archiveName = "${project.name}-${variant.baseName}-${version}.jar"
+ task.from variant.javaCompile.destinationDirectory
+ task.destinationDirectory = project.file("${project.buildDir}/outputs/jar")
+ task.archiveFileName = "${project.name}-${variant.baseName}-${version}.jar"📝 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.
| task.from variant.javaCompile.destinationDir | |
| task.destinationDir = project.file("${project.buildDir}/outputs/jar") | |
| task.archiveName = "${project.name}-${variant.baseName}-${version}.jar" | |
| task.from variant.javaCompile.destinationDirectory | |
| task.destinationDirectory = project.file("${project.buildDir}/outputs/jar") | |
| task.archiveFileName = "${project.name}-${variant.baseName}-${version}.jar" |
🤖 Prompt for AI Agents
In java-client/build.gradle around lines 65 to 67, the build uses deprecated
Gradle properties destinationDir and archiveName; replace them with the modern
Provider-based properties: set the task.destinationDirectory (or assign
project.layout.dir(...)/project.buildDir via a Provider) instead of
destinationDir, and set task.archiveFileName (or use
task.archiveFileName.set(...)) instead of archiveName, and ensure any references
to variant.javaCompile.destinationDir use
variant.javaCompile.destinationDirectory (or .get() as a Provider) so the
configuration uses the Provider API and avoids deprecated properties.
| name := "apollo-openapi-client", | ||
| version := "0.0.1", | ||
| scalaVersion := "2.11.12", | ||
| scalaVersion := "2.11.4", |
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.
🧩 Analysis chain
Verify the Scala version downgrade is necessary.
Downgrading from Scala 2.11.12 (2016) to 2.11.4 (2013) removes approximately three years of bug fixes, performance improvements, and security patches. This is a significant regression that may reintroduce fixed issues.
Run the following script to check for known vulnerabilities in Scala 2.11.4:
🏁 Script executed:
#!/bin/bash
# Check for security advisories for Scala 2.11.4
gh api graphql -f query='
{
securityVulnerabilities(first: 10, ecosystem: MAVEN, package: "org.scala-lang:scala-library") {
nodes {
advisory {
summary
severity
publishedAt
}
vulnerableVersionRange
firstPatchedVersion {
identifier
}
}
}
}'Length of output: 345
Revert scalaVersion to 2.11.12 or justify the downgrade
Downgrading from 2.11.12 to 2.11.4 removes three years of bug fixes and patches.
🤖 Prompt for AI Agents
java-client/build.sbt around line 6: the scalaVersion was set to "2.11.4" which
downgrades from 2.11.12; either revert the version back to "2.11.12" or, if the
downgrade is intentional, add a clear inline comment justifying the change and
update CI/compatibility notes (include target JDK, dependency constraints, and
test results) so reviewers can verify the reason; make the change by restoring
scalaVersion to 2.11.12 unless you can provide the required justification and
compatibility evidence.
| "com.squareup.okhttp3" % "okhttp" % "4.10.0", | ||
| "com.squareup.okhttp3" % "logging-interceptor" % "4.10.0", | ||
| "com.google.code.gson" % "gson" % "2.9.1", | ||
| "org.apache.commons" % "commons-lang3" % "3.18.0", | ||
| "jakarta.ws.rs" % "jakarta.ws.rs-api" % "2.1.6", | ||
| "org.apache.commons" % "commons-lang3" % "3.12.0", | ||
| "javax.ws.rs" % "jsr311-api" % "1.1.1", | ||
| "javax.ws.rs" % "javax.ws.rs-api" % "2.1.1", | ||
| "org.openapitools" % "jackson-databind-nullable" % "0.2.6", | ||
| "io.gsonfire" % "gson-fire" % "1.9.0" % "compile", | ||
| "io.gsonfire" % "gson-fire" % "1.8.5" % "compile", |
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.
🧩 Analysis chain
Verify dependency downgrades don't reintroduce vulnerabilities.
Multiple dependencies are being downgraded to older versions:
- OkHttp: 4.12.0 → 4.10.0 (HTTP client library)
- gson-fire: 1.9.0 → 1.8.5 (Gson extension)
- commons-lang3: 3.18.0 → 3.12.0 (Apache Commons utilities)
These downgrades may reintroduce security vulnerabilities and bugs that were fixed in newer versions.
Run the following script to check for security advisories:
🏁 Script executed:
#!/bin/bash
# Check for security advisories for downgraded dependencies
for package in "com.squareup.okhttp3:okhttp" "io.gsonfire:gson-fire" "org.apache.commons:commons-lang3"; do
echo "Checking $package..."
gh api graphql -f query="
{
securityVulnerabilities(first: 5, ecosystem: MAVEN, package: \"$package\") {
nodes {
advisory {
summary
severity
publishedAt
}
vulnerableVersionRange
firstPatchedVersion {
identifier
}
}
}
}"
doneLength of output: 956
Upgrade commons-lang3 to ≥3.18.0 – versions <3.18.0 (including 3.12.0) are vulnerable to uncontrolled recursion (Apache advisory published 2025-07-11).
🤖 Prompt for AI Agents
In java-client/build.sbt around lines 13 to 20 the project depends on
org.apache.commons:commons-lang3:3.12.0 which is vulnerable; update that
dependency to at least 3.18.0 (e.g., change the version string to "3.18.0" or
later), run a clean build and tests to verify compatibility, and commit the
updated build.sbt (and any updated lock files) so the safe version is used.
| public OpenItemChangeSets addCreateItemsItem(OpenItemDTO createItemsItem) { | ||
| if (this.createItems == null) { | ||
| this.createItems = new ArrayList<>(); | ||
| this.createItems = null; | ||
| } | ||
| this.createItems.add(createItemsItem); | ||
| return this; | ||
| } | ||
|
|
||
| /** | ||
| * | ||
| /** | ||
| * 待创建的配置项列表 | ||
| * @return createItems | ||
| */ | ||
| **/ | ||
| @javax.annotation.Nullable | ||
| public List<ItemDTO> getCreateItems() { | ||
| public List<OpenItemDTO> getCreateItems() { | ||
| return createItems; | ||
| } | ||
|
|
||
| public void setCreateItems(@javax.annotation.Nullable List<ItemDTO> createItems) { | ||
|
|
||
| public void setCreateItems(List<OpenItemDTO> createItems) { | ||
| this.createItems = createItems; | ||
| } | ||
|
|
||
|
|
||
| public ItemChangeSets updateItems(@javax.annotation.Nullable List<ItemDTO> updateItems) { | ||
| public OpenItemChangeSets updateItems(List<OpenItemDTO> updateItems) { | ||
|
|
||
| this.updateItems = updateItems; | ||
| return this; | ||
| } | ||
|
|
||
| public ItemChangeSets addUpdateItemsItem(ItemDTO updateItemsItem) { | ||
| public OpenItemChangeSets addUpdateItemsItem(OpenItemDTO updateItemsItem) { | ||
| if (this.updateItems == null) { | ||
| this.updateItems = new ArrayList<>(); | ||
| this.updateItems = null; | ||
| } | ||
| this.updateItems.add(updateItemsItem); | ||
| return this; | ||
| } | ||
|
|
||
| /** | ||
| * | ||
| /** | ||
| * 待更新的配置项列表 | ||
| * @return updateItems | ||
| */ | ||
| **/ | ||
| @javax.annotation.Nullable | ||
| public List<ItemDTO> getUpdateItems() { | ||
| public List<OpenItemDTO> getUpdateItems() { | ||
| return updateItems; | ||
| } | ||
|
|
||
| public void setUpdateItems(@javax.annotation.Nullable List<ItemDTO> updateItems) { | ||
|
|
||
| public void setUpdateItems(List<OpenItemDTO> updateItems) { | ||
| this.updateItems = updateItems; | ||
| } | ||
|
|
||
|
|
||
| public ItemChangeSets deleteItems(@javax.annotation.Nullable List<ItemDTO> deleteItems) { | ||
| public OpenItemChangeSets deleteItems(List<OpenItemDTO> deleteItems) { | ||
|
|
||
| this.deleteItems = deleteItems; | ||
| return this; | ||
| } | ||
|
|
||
| public ItemChangeSets addDeleteItemsItem(ItemDTO deleteItemsItem) { | ||
| public OpenItemChangeSets addDeleteItemsItem(OpenItemDTO deleteItemsItem) { | ||
| if (this.deleteItems == null) { | ||
| this.deleteItems = new ArrayList<>(); | ||
| this.deleteItems = null; | ||
| } | ||
| this.deleteItems.add(deleteItemsItem); | ||
| return this; | ||
| } |
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.
Initialize item lists before adding elements
Lines 230-292 try to add entries to createItems, updateItems, and deleteItems, but when the lists are null you set them to null again, leading to a NullPointerException on the subsequent add. Instantiate a list instead.
public OpenItemChangeSets addCreateItemsItem(OpenItemDTO createItemsItem) {
if (this.createItems == null) {
- this.createItems = null;
+ this.createItems = new ArrayList<>();
}
this.createItems.add(createItemsItem);
return this;
}
...
public OpenItemChangeSets addUpdateItemsItem(OpenItemDTO updateItemsItem) {
if (this.updateItems == null) {
- this.updateItems = null;
+ this.updateItems = new ArrayList<>();
}
this.updateItems.add(updateItemsItem);
return this;
}
...
public OpenItemChangeSets addDeleteItemsItem(OpenItemDTO deleteItemsItem) {
if (this.deleteItems == null) {
- this.deleteItems = null;
+ this.deleteItems = new ArrayList<>();
}
this.deleteItems.add(deleteItemsItem);
return this;
}📝 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.
| public OpenItemChangeSets addCreateItemsItem(OpenItemDTO createItemsItem) { | |
| if (this.createItems == null) { | |
| this.createItems = new ArrayList<>(); | |
| this.createItems = null; | |
| } | |
| this.createItems.add(createItemsItem); | |
| return this; | |
| } | |
| /** | |
| * | |
| /** | |
| * 待创建的配置项列表 | |
| * @return createItems | |
| */ | |
| **/ | |
| @javax.annotation.Nullable | |
| public List<ItemDTO> getCreateItems() { | |
| public List<OpenItemDTO> getCreateItems() { | |
| return createItems; | |
| } | |
| public void setCreateItems(@javax.annotation.Nullable List<ItemDTO> createItems) { | |
| public void setCreateItems(List<OpenItemDTO> createItems) { | |
| this.createItems = createItems; | |
| } | |
| public ItemChangeSets updateItems(@javax.annotation.Nullable List<ItemDTO> updateItems) { | |
| public OpenItemChangeSets updateItems(List<OpenItemDTO> updateItems) { | |
| this.updateItems = updateItems; | |
| return this; | |
| } | |
| public ItemChangeSets addUpdateItemsItem(ItemDTO updateItemsItem) { | |
| public OpenItemChangeSets addUpdateItemsItem(OpenItemDTO updateItemsItem) { | |
| if (this.updateItems == null) { | |
| this.updateItems = new ArrayList<>(); | |
| this.updateItems = null; | |
| } | |
| this.updateItems.add(updateItemsItem); | |
| return this; | |
| } | |
| /** | |
| * | |
| /** | |
| * 待更新的配置项列表 | |
| * @return updateItems | |
| */ | |
| **/ | |
| @javax.annotation.Nullable | |
| public List<ItemDTO> getUpdateItems() { | |
| public List<OpenItemDTO> getUpdateItems() { | |
| return updateItems; | |
| } | |
| public void setUpdateItems(@javax.annotation.Nullable List<ItemDTO> updateItems) { | |
| public void setUpdateItems(List<OpenItemDTO> updateItems) { | |
| this.updateItems = updateItems; | |
| } | |
| public ItemChangeSets deleteItems(@javax.annotation.Nullable List<ItemDTO> deleteItems) { | |
| public OpenItemChangeSets deleteItems(List<OpenItemDTO> deleteItems) { | |
| this.deleteItems = deleteItems; | |
| return this; | |
| } | |
| public ItemChangeSets addDeleteItemsItem(ItemDTO deleteItemsItem) { | |
| public OpenItemChangeSets addDeleteItemsItem(OpenItemDTO deleteItemsItem) { | |
| if (this.deleteItems == null) { | |
| this.deleteItems = new ArrayList<>(); | |
| this.deleteItems = null; | |
| } | |
| this.deleteItems.add(deleteItemsItem); | |
| return this; | |
| } | |
| import java.util.ArrayList; | |
| import java.util.List; | |
| public class OpenItemChangeSets { | |
| // … | |
| public OpenItemChangeSets addCreateItemsItem(OpenItemDTO createItemsItem) { | |
| if (this.createItems == null) { | |
| this.createItems = new ArrayList<>(); | |
| } | |
| this.createItems.add(createItemsItem); | |
| return this; | |
| } | |
| // … | |
| public OpenItemChangeSets addUpdateItemsItem(OpenItemDTO updateItemsItem) { | |
| if (this.updateItems == null) { | |
| this.updateItems = new ArrayList<>(); | |
| } | |
| this.updateItems.add(updateItemsItem); | |
| return this; | |
| } | |
| // … | |
| public OpenItemChangeSets addDeleteItemsItem(OpenItemDTO deleteItemsItem) { | |
| if (this.deleteItems == null) { | |
| this.deleteItems = new ArrayList<>(); | |
| } | |
| this.deleteItems.add(deleteItemsItem); | |
| return this; | |
| } | |
| // … | |
| } |
🤖 Prompt for AI Agents
In
java-client/src/main/java/org/openapitools/client/model/OpenItemChangeSets.java
around lines 229 to 293, the
addCreateItemsItem/addUpdateItemsItem/addDeleteItemsItem methods set lists to
null when they are null, causing a NullPointerException on add; change each
conditional to instantiate a new ArrayList<OpenItemDTO>() (e.g. if
(this.createItems == null) { this.createItems = new ArrayList<>(); }) for
createItems, updateItems and deleteItems, and add an import for
java.util.ArrayList if missing.
| if (jsonObj == null) { | ||
| if (!OpenItemDiffs.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null | ||
| throw new IllegalArgumentException(String.format("The required field(s) %s in OpenItemDiffs is not found in the empty JSON string", OpenItemDiffs.openapiRequiredFields.toString())); | ||
| } | ||
| } | ||
|
|
||
| Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); | ||
| Set<Entry<String, JsonElement>> entries = jsonObj.entrySet(); | ||
| // check to see if the JSON string contains additional fields | ||
| for (Map.Entry<String, JsonElement> entry : entries) { | ||
| if (!ListItemDiffs.openapiFields.contains(entry.getKey())) { | ||
| throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ListItemDiffs` properties. JSON: %s", entry.getKey(), jsonElement.toString())); | ||
| for (Entry<String, JsonElement> entry : entries) { | ||
| if (!OpenItemDiffs.openapiFields.contains(entry.getKey())) { | ||
| throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OpenItemDiffs` properties. JSON: %s", entry.getKey(), jsonObj.toString())); | ||
| } | ||
| } |
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.
Return immediately when jsonObj is null.
validateJsonObject continues past the null check and dereferences jsonObj, so a JSON payload of null will crash with an NPE even though no required fields exist.
Apply this fix:
public static void validateJsonObject(JsonObject jsonObj) throws IOException {
if (jsonObj == null) {
if (!OpenItemDiffs.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null
throw new IllegalArgumentException(String.format("The required field(s) %s in OpenItemDiffs is not found in the empty JSON string", OpenItemDiffs.openapiRequiredFields.toString()));
}
+ return;
}📝 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.
| if (jsonObj == null) { | |
| if (!OpenItemDiffs.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null | |
| throw new IllegalArgumentException(String.format("The required field(s) %s in OpenItemDiffs is not found in the empty JSON string", OpenItemDiffs.openapiRequiredFields.toString())); | |
| } | |
| } | |
| Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); | |
| Set<Entry<String, JsonElement>> entries = jsonObj.entrySet(); | |
| // check to see if the JSON string contains additional fields | |
| for (Map.Entry<String, JsonElement> entry : entries) { | |
| if (!ListItemDiffs.openapiFields.contains(entry.getKey())) { | |
| throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ListItemDiffs` properties. JSON: %s", entry.getKey(), jsonElement.toString())); | |
| for (Entry<String, JsonElement> entry : entries) { | |
| if (!OpenItemDiffs.openapiFields.contains(entry.getKey())) { | |
| throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OpenItemDiffs` properties. JSON: %s", entry.getKey(), jsonObj.toString())); | |
| } | |
| } | |
| public static void validateJsonObject(JsonObject jsonObj) throws IOException { | |
| if (jsonObj == null) { | |
| if (!OpenItemDiffs.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null | |
| throw new IllegalArgumentException(String.format( | |
| "The required field(s) %s in OpenItemDiffs is not found in the empty JSON string", | |
| OpenItemDiffs.openapiRequiredFields.toString() | |
| )); | |
| } | |
| return; | |
| } | |
| Set<Entry<String, JsonElement>> entries = jsonObj.entrySet(); | |
| // check to see if the JSON string contains additional fields | |
| for (Entry<String, JsonElement> entry : entries) { | |
| if (!OpenItemDiffs.openapiFields.contains(entry.getKey())) { | |
| throw new IllegalArgumentException(String.format( | |
| "The field `%s` in the JSON string is not defined in the `OpenItemDiffs` properties. JSON: %s", | |
| entry.getKey(), jsonObj.toString() | |
| )); | |
| } | |
| } | |
| } |
🤖 Prompt for AI Agents
In java-client/src/main/java/org/openapitools/client/model/OpenItemDiffs.java
around lines 199 to 211, the validateJsonObject method checks if jsonObj is null
but then continues and dereferences it, causing an NPE for a null payload; after
verifying that openapiRequiredFields is empty, return immediately (or otherwise
short-circuit) when jsonObj is null so the subsequent jsonObj.entrySet() and
loop are not executed. Ensure the method returns right after the null-check
success path so additional-field validation runs only when jsonObj is non-null.
| public static void validateJsonObject(JsonObject jsonObj) throws IOException { | ||
| if (jsonObj == null) { | ||
| if (!OpenNamespaceLockDTO.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null | ||
| throw new IllegalArgumentException(String.format("The required field(s) %s in OpenNamespaceLockDTO is not found in the empty JSON string", OpenNamespaceLockDTO.openapiRequiredFields.toString())); | ||
| } | ||
| } | ||
|
|
||
| Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); | ||
| Set<Entry<String, JsonElement>> entries = jsonObj.entrySet(); | ||
| // check to see if the JSON string contains additional fields | ||
| for (Map.Entry<String, JsonElement> entry : entries) { | ||
| for (Entry<String, JsonElement> entry : entries) { | ||
| if (!OpenNamespaceLockDTO.openapiFields.contains(entry.getKey())) { | ||
| throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OpenNamespaceLockDTO` properties. JSON: %s", entry.getKey(), jsonElement.toString())); | ||
| throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OpenNamespaceLockDTO` properties. JSON: %s", entry.getKey(), jsonObj.toString())); | ||
| } | ||
| } |
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.
Handle null JSON without throwing NPE.
jsonObj can be null; after the guard we still call jsonObj.entrySet(), leading to a NullPointerException. Add a return; once the guard passes.
if (jsonObj == null) {
if (!OpenNamespaceLockDTO.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null
throw new IllegalArgumentException(String.format("The required field(s) %s in OpenNamespaceLockDTO is not found in the empty JSON string", OpenNamespaceLockDTO.openapiRequiredFields.toString()));
}
+ return;
}🤖 Prompt for AI Agents
In
java-client/src/main/java/org/openapitools/client/model/OpenNamespaceLockDTO.java
around lines 196-209, the method validateJsonObject can still dereference
jsonObj after checking for null which causes a NullPointerException; after the
guard that throws when required fields exist and jsonObj is null, add an
immediate return so execution stops when jsonObj is null (i.e., if jsonObj ==
null and no required fields, return), preventing further calls like
jsonObj.entrySet().
java-client/src/main/java/org/openapitools/client/model/OpenPageDTOOpenInstanceDTO.java
Show resolved
Hide resolved
| public Pair (String name, String value) { | ||
| setName(name); | ||
| setValue(value); | ||
| } | ||
|
|
||
| public String getName() { | ||
| return this.name; | ||
| } | ||
| private void setName(String name) { | ||
| if (!isValidString(name)) { | ||
| return; | ||
| } | ||
|
|
||
| public String getValue() { | ||
| return this.value; | ||
| } | ||
| this.name = name; | ||
| } | ||
|
|
||
| private static boolean isValidString(String arg) { | ||
| return arg != null; | ||
| } | ||
| private void setValue(String value) { | ||
| if (!isValidString(value)) { | ||
| return; | ||
| } | ||
|
|
||
| this.value = value; | ||
| } |
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.
Silent validation failure creates inconsistent object state.
When null is passed to the constructor, the setters return early without assigning the value, leaving the fields as empty strings. This silent failure is problematic because:
- The caller receives no indication that their input was rejected
- A
Pairobject is created with empty strings instead of the provided values nullinputs are silently converted to"", which could mask bugs
For example:
new Pair(null, "value")→ createsPair("", "value")instead of failingnew Pair("key", null)→ createsPair("key", "")instead of failing
Apply this diff to throw an exception for invalid inputs:
public Pair (String name, String value) {
- setName(name);
- setValue(value);
+ if (!isValidString(name)) {
+ throw new IllegalArgumentException("Pair name cannot be null");
+ }
+ if (!isValidString(value)) {
+ throw new IllegalArgumentException("Pair value cannot be null");
+ }
+ this.name = name;
+ this.value = value;
}
- private void setName(String name) {
- if (!isValidString(name)) {
- return;
- }
-
- this.name = name;
- }
-
- private void setValue(String value) {
- if (!isValidString(value)) {
- return;
- }
-
- this.value = value;
- }Alternatively, if empty strings are acceptable defaults, document this behavior explicitly in Javadoc comments.
🤖 Prompt for AI Agents
In java-client/src/main/java/org/openapitools/client/Pair.java around lines 21
to 40, the constructor silently ignores invalid (null/empty) name or value by
returning from the setters leaving fields as empty strings; change this to
validate inputs and fail fast: in the constructor (or the setters called by it)
throw an IllegalArgumentException with a clear message when name or value is
null/empty instead of returning, ensuring the Pair cannot be created with
invalid inputs; alternatively, if empty strings are acceptable, add Javadoc to
the constructor and setters documenting that nulls are coerced to empty strings
and keep current behavior.
a5c49b1 to
fa3174d
Compare
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: 14
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
java-client/src/main/java/org/openapitools/client/ProgressResponseBody.java (1)
1-11: Avoid manual edits to auto-generated files.This file is explicitly marked as auto-generated (line 8), but the header documentation has been manually modified. These changes will be overwritten the next time the OpenAPI Generator runs.
If documentation customization is required, consider:
- Using OpenAPI Generator templates to customize the header globally
- Moving custom documentation to a non-generated wrapper class
- Configuring generator options to preserve specific sections
java-client/src/main/java/org/openapitools/client/model/OpenGrayReleaseRuleDTO.java (1)
376-427: Avoid NPE on null JSON payloads.Similar to the issue in
OpenGrayReleaseRuleItemDTO, whenjsonObjis null and no fields are required, the method should return early. Currently, the code continues to line 382 and callsjsonObj.entrySet(), causing aNullPointerException.Apply this diff to fix the issue:
if (jsonObj == null) { if (!OpenGrayReleaseRuleDTO.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in OpenGrayReleaseRuleDTO is not found in the empty JSON string", OpenGrayReleaseRuleDTO.openapiRequiredFields.toString())); } + return; }
♻️ Duplicate comments (15)
java-client/README.md (1)
117-123: Update example to pass the required operator.
createAppnow demands the operator argument, yet the snippet still calls the old overload. Anyone using this example will hit a compile/runtime error. Please pass an operator string before the DTO argument.- Object result = apiInstance.createApp(openCreateAppDTO); + Object result = apiInstance.createApp("yourOperator", openCreateAppDTO);java-client/src/main/java/org/openapitools/client/model/NamespaceReleaseDTO.java (1)
225-236: Restore the null guard invalidateJsonObject.When
jsonObjis null and there are no required fields, we still fall through tojsonObj.entrySet(), causing aNullPointerException. Please add the earlyreturn;after the required-field check so optionalnullpayloads keep working.if (jsonObj == null) { if (!NamespaceReleaseDTO.openapiRequiredFields.isEmpty()) { throw new IllegalArgumentException(String.format("The required field(s) %s in NamespaceReleaseDTO is not found in the empty JSON string", NamespaceReleaseDTO.openapiRequiredFields.toString())); } + return; }java-client/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java (1)
26-26: Breaking change already flagged in previous review.The removal of
Supplier<String> tokenSupplierand thesetBearerToken(Supplier<String>)overload has been comprehensively documented in the past review comments. This change eliminates dynamic token refresh capability and breaks existing client code. Please refer to the previous review comment for detailed impact analysis and remediation options.Also applies to: 38-38, 47-47, 53-57
java-client/src/main/java/org/openapitools/client/model/OpenAppNamespaceDTO.java (1)
392-406: Critical NPE still not fixed.The issue flagged in the previous review remains unresolved. When
jsonObjisnullandopenapiRequiredFieldsis empty, execution falls through to line 399 wherejsonObj.entrySet()triggers aNullPointerException.Apply this diff to add the missing early return:
if (jsonObj == null) { if (!OpenAppNamespaceDTO.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in OpenAppNamespaceDTO is not found in the empty JSON string", OpenAppNamespaceDTO.openapiRequiredFields.toString())); } + return; }java-client/src/main/java/org/openapitools/client/model/OpenGrayReleaseRuleItemDTO.java (1)
214-228: Avoid NPE on null JSON payloads.This issue was flagged in a previous review and remains unresolved. When
jsonObjis null and no fields are required, the method should return early. Currently, the code continues to line 221 and callsjsonObj.entrySet(), causing aNullPointerException.Apply this diff to fix the issue:
if (jsonObj == null) { if (!OpenGrayReleaseRuleItemDTO.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in OpenGrayReleaseRuleItemDTO is not found in the empty JSON string", OpenGrayReleaseRuleItemDTO.openapiRequiredFields.toString())); } + return; }java-client/src/main/java/org/openapitools/client/model/OpenInstanceConfigDTO.java (1)
197-210: Still missing return statement after null check.The critical NPE issue previously flagged remains unresolved. When
jsonObjis null and there are no required fields, execution continues to line 204 wherejsonObj.entrySet()throws a NullPointerException.Apply this diff to fix:
if (jsonObj == null) { if (!OpenInstanceConfigDTO.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in OpenInstanceConfigDTO is not found in the empty JSON string", OpenInstanceConfigDTO.openapiRequiredFields.toString())); } + return; }Note: Since this is an auto-generated file, the fix should ideally be applied to the OpenAPI generator template to prevent recurrence.
java-client/src/main/java/org/openapitools/client/Pair.java (2)
21-40: Silent validation failure remains unresolved.The constructor still delegates to setters that return early on null input, leaving fields as empty strings. This creates inconsistent object state as flagged in the previous review.
21-40: [Duplicate] Silent validation failure creates inconsistent object state.This issue was previously flagged. The constructor's delegation to setters that return early without throwing exceptions when null is passed still creates Pair objects with empty strings instead of the provided values, silently masking bugs.
java-client/src/main/java/org/openapitools/client/model/OpenAppDTO.java (2)
392-406: NPE risk remains unresolved.After checking
jsonObj == nullat line 393, the code continues to line 399 and accessesjsonObj.entrySet(), which will throw a NullPointerException if no required fields are configured. This issue was flagged in the previous review.Apply this diff to fix the issue:
if (jsonObj == null) { if (!OpenAppDTO.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in OpenAppDTO is not found in the empty JSON string", OpenAppDTO.openapiRequiredFields.toString())); } + return; }
392-405: [Duplicate] Prevent NullPointerException when JSON is null.This issue was previously flagged. After checking
jsonObj == nullat line 393, the method continues to line 399 and callsjsonObj.entrySet(), causing a NullPointerException whenopenapiRequiredFieldsis empty.java-client/src/main/java/org/openapitools/client/JSON.java (1)
89-125: Restore static initialization ofgson.Changing the
static { ... }block to an instance initializer means it never executes (this class has only static members), sogsonstaysnulland every call toJSON.serialize/deserializewill throw an NPE. Switch the block back tostatic { ... }so the adapters register andgsongets created at class load time.- { + static { GsonBuilder gsonBuilder = createGson(); ... gson = gsonBuilder.create(); }java-client/src/main/java/org/openapitools/client/model/OpenCreateAppDTO.java (1)
222-224: Allow JSON null for optionaladmins.
jsonObj.get("admins")returnsJsonNullwhen the payload contains"admins": null. The current guard only checks!= null, so theisJsonArray()test fails and throws an exception, rejecting inputs that were previously valid for this optional field.- if (jsonObj.get("admins") != null && !jsonObj.get("admins").isJsonArray()) { + if (jsonObj.get("admins") != null && !jsonObj.get("admins").isJsonNull() && !jsonObj.get("admins").isJsonArray()) {apollo-openapi.yaml (1)
4235-4245:RichResponseEntity.messagemust accept strings too.The schema still says
messageis an object, yet all examples (and the existing services) return plain strings like"OK". Generated clients will therefore deserialize a string intoObject/Mapand fail. Please changemessagetooneOf [string, object](and consider makingbodynullable) as previously suggested.java-client/docs/AppManagementApi.md (1)
245-246: Fix the documented HTTP verb forfindApps.The method table correctly lists
GET /openapi/v1/apps, but this section still saysPOST, which will mislead client developers. Please update it toGET.java-client/docs/ItemManagementApi.md (1)
109-109: Path documentation issue already flagged.The documented path is missing the
/openapi/v1/envs/{env}prefix, which was already identified in a previous review. This issue remains unresolved.
🧹 Nitpick comments (12)
java-client/src/main/java/org/openapitools/client/StringUtil.java (1)
3-3: Mixed language documentation in auto-generated file.The class header documentation is in Chinese while the rest of the code (method docs, comments) is in English. If this is intentional for a Chinese audience, this is acceptable. However, for consistency and broader accessibility, consider using English throughout or providing i18n documentation.
Since this is auto-generated code, any changes should be made in the OpenAPI spec or generator templates, not directly in this file.
java-client/gradlew.bat (2)
78-78: Fix operator spacing inconsistency.Line 78 uses
"%ERRORLEVEL%"=="0"without spaces around the==operator, while lines 17, 28, and 43 consistently use" == "with spaces. Although both forms are functionally equivalent in Windows batch scripts, maintaining consistent formatting improves readability and maintainability.Apply this diff to standardize the spacing:
-if "%ERRORLEVEL%"=="0" goto mainEnd +if "%ERRORLEVEL%" == "0" goto mainEnd
83-83: Remove extra space in conditional.Line 83 has a double space after
if:if not "" ==should beif not "" ==for consistent formatting.Apply this diff to remove the extra space:
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1java-client/src/main/java/org/openapitools/client/model/OpenGrayReleaseRuleItemDTO.java (2)
17-17: Remove unused import.The
Arraysimport is not used anywhere in this file.Apply this diff to remove the unused import:
-import java.util.Arrays;
42-42: Remove unused import.The
java.lang.reflect.Typeimport is not used in this file.Apply this diff to remove the unused import:
-import java.lang.reflect.Type;java-client/src/main/java/org/openapitools/client/model/OpenGrayReleaseRuleDTO.java (2)
17-17: Remove unused import.The
Arraysimport is not used anywhere in this file.Apply this diff to remove the unused import:
-import java.util.Arrays;
43-43: Remove unused import.The
java.lang.reflect.Typeimport is not used in this file.Apply this diff to remove the unused import:
-import java.lang.reflect.Type;java-client/src/main/java/org/openapitools/client/model/NamespaceGrayDelReleaseDTO.java (1)
42-42: Unused import.The
java.lang.reflect.Typeimport is not used in this file.Apply this diff to remove the unused import:
-import java.lang.reflect.Type;java-client/src/main/java/org/openapitools/client/model/OpenEnvClusterDTO.java (2)
17-17: Remove unused import.The
java.util.Arraysimport is not used anywhere in the code.Apply this diff to remove the unused import:
-import java.util.Arrays;
68-72: Consider adding null validation for non-nullable parameters.The
@Nullableannotations were removed from the method parameters forenv(String),setEnv(String),clusters(List<String>), andsetClusters(List<String>), suggesting these parameters should not be null. However, there are no null checks in the method bodies to enforce this contract.If null values should be rejected, consider adding validation:
public OpenEnvClusterDTO env(String env) { + if (env == null) { + throw new IllegalArgumentException("env cannot be null"); + } this.env = env; return this; }Apply similar validation to the other methods as needed.
Also applies to: 84-86, 89-93, 113-115
java-client/src/main/java/org/openapitools/client/api/InstanceManagementApi.java (1)
38-38: Remove unused import.The
javax.ws.rs.core.GenericTypeimport is not used anywhere in this file.-import javax.ws.rs.core.GenericType;java-client/src/main/java/org/openapitools/client/api/OrganizationManagementApi.java (1)
37-37: Remove unused import.The
javax.ws.rs.core.GenericTypeimport is not used anywhere in this file.-import javax.ws.rs.core.GenericType;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
java-client/gradle/wrapper/gradle-wrapper.jaris excluded by!**/*.jar
📒 Files selected for processing (107)
apollo-openapi-old.yaml(1 hunks)apollo-openapi.yaml(21 hunks)generate.sh(1 hunks)java-client/.github/workflows/maven.yml(1 hunks)java-client/.openapi-generator/FILES(3 hunks)java-client/.openapi-generator/VERSION(1 hunks)java-client/README.md(3 hunks)java-client/build.gradle(2 hunks)java-client/build.sbt(1 hunks)java-client/docs/AppManagementApi.md(33 hunks)java-client/docs/Change.md(0 hunks)java-client/docs/ClusterDTO.md(0 hunks)java-client/docs/ClusterManagementApi.md(10 hunks)java-client/docs/EntityPairKVEntity.md(0 hunks)java-client/docs/EnvClusterInfo.md(0 hunks)java-client/docs/InstanceManagementApi.md(8 hunks)java-client/docs/ItemChangeSets.md(0 hunks)java-client/docs/ItemDTO.md(0 hunks)java-client/docs/ItemManagementApi.md(34 hunks)java-client/docs/KVEntity.md(1 hunks)java-client/docs/ListItemDiffs.md(0 hunks)java-client/docs/MapString.md(0 hunks)java-client/docs/MultiResponseEntity.md(1 hunks)java-client/docs/NamespaceBranchManagementApi.md(19 hunks)java-client/docs/NamespaceGrayDelReleaseDTO.md(0 hunks)java-client/docs/NamespaceIdentifier.md(0 hunks)java-client/docs/NamespaceManagementApi.md(26 hunks)java-client/docs/NamespaceReleaseDTO.md(0 hunks)java-client/docs/NamespaceSyncModel.md(0 hunks)java-client/docs/NamespaceTextModel.md(0 hunks)java-client/docs/OpenAppDTO.md(0 hunks)java-client/docs/OpenAppNamespaceDTO.md(0 hunks)java-client/docs/OpenClusterDTO.md(0 hunks)java-client/docs/OpenCreateAppDTO.md(0 hunks)java-client/docs/OpenEnvClusterDTO.md(1 hunks)java-client/docs/OpenEnvClusterInfo.md(1 hunks)java-client/docs/OpenGrayReleaseRuleDTO.md(0 hunks)java-client/docs/OpenGrayReleaseRuleItemDTO.md(0 hunks)java-client/docs/OpenInstanceConfigDTO.md(1 hunks)java-client/docs/OpenInstanceDTO.md(1 hunks)java-client/docs/OpenItemChangeSets.md(1 hunks)java-client/docs/OpenItemDTO.md(0 hunks)java-client/docs/OpenItemDiffs.md(1 hunks)java-client/docs/OpenNamespaceDTO.md(0 hunks)java-client/docs/OpenNamespaceIdentifier.md(1 hunks)java-client/docs/OpenNamespaceLockDTO.md(0 hunks)java-client/docs/OpenNamespaceSyncModel.md(1 hunks)java-client/docs/OpenNamespaceTextModel.md(1 hunks)java-client/docs/OpenOrganizationDto.md(1 hunks)java-client/docs/OpenPageDTOOpenInstanceDTO.md(0 hunks)java-client/docs/OpenPageDTOOpenItemDTO.md(0 hunks)java-client/docs/OpenReleaseBO.md(1 hunks)java-client/docs/OpenReleaseDTO.md(1 hunks)java-client/docs/OpenapiV1AppsGet401Response.md(0 hunks)java-client/docs/OpenapiV1AppsPost400Response.md(0 hunks)java-client/docs/OpenapiV1AppsPostRequest.md(0 hunks)java-client/docs/OpenapiV1EnvsEnvAppsAppIdClustersClusterNameNamespacesNamespaceNameItemsValidatePost200Response.md(0 hunks)java-client/docs/OpenapiV1EnvsEnvAppsAppIdClustersClusterNameNamespacesNamespaceNameItemsValidatePost400Response.md(0 hunks)java-client/docs/OpenapiV1EnvsEnvReleasesCompareGet200Response.md(0 hunks)java-client/docs/OrganizationManagementApi.md(3 hunks)java-client/docs/ReleaseDTO.md(0 hunks)java-client/docs/ReleaseManagementApi.md(19 hunks)java-client/docs/RichResponseEntity.md(1 hunks)java-client/gradle/wrapper/gradle-wrapper.properties(1 hunks)java-client/gradlew(5 hunks)java-client/gradlew.bat(4 hunks)java-client/pom.xml(9 hunks)java-client/src/main/java/org/openapitools/client/ApiCallback.java(1 hunks)java-client/src/main/java/org/openapitools/client/ApiClient.java(17 hunks)java-client/src/main/java/org/openapitools/client/ApiException.java(2 hunks)java-client/src/main/java/org/openapitools/client/ApiResponse.java(2 hunks)java-client/src/main/java/org/openapitools/client/Configuration.java(2 hunks)java-client/src/main/java/org/openapitools/client/GzipRequestInterceptor.java(1 hunks)java-client/src/main/java/org/openapitools/client/JSON.java(2 hunks)java-client/src/main/java/org/openapitools/client/Pair.java(2 hunks)java-client/src/main/java/org/openapitools/client/ProgressRequestBody.java(1 hunks)java-client/src/main/java/org/openapitools/client/ProgressResponseBody.java(1 hunks)java-client/src/main/java/org/openapitools/client/ServerConfiguration.java(0 hunks)java-client/src/main/java/org/openapitools/client/ServerVariable.java(0 hunks)java-client/src/main/java/org/openapitools/client/StringUtil.java(2 hunks)java-client/src/main/java/org/openapitools/client/api/ClusterManagementApi.java(9 hunks)java-client/src/main/java/org/openapitools/client/api/InstanceManagementApi.java(13 hunks)java-client/src/main/java/org/openapitools/client/api/OrganizationManagementApi.java(4 hunks)java-client/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java(2 hunks)java-client/src/main/java/org/openapitools/client/auth/Authentication.java(1 hunks)java-client/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java(2 hunks)java-client/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java(4 hunks)java-client/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java(3 hunks)java-client/src/main/java/org/openapitools/client/model/Change.java(0 hunks)java-client/src/main/java/org/openapitools/client/model/ClusterDTO.java(0 hunks)java-client/src/main/java/org/openapitools/client/model/EntityPairKVEntity.java(0 hunks)java-client/src/main/java/org/openapitools/client/model/ItemDTO.java(0 hunks)java-client/src/main/java/org/openapitools/client/model/KVEntity.java(5 hunks)java-client/src/main/java/org/openapitools/client/model/MapString.java(0 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(7 hunks)java-client/src/main/java/org/openapitools/client/model/NamespaceReleaseDTO.java(5 hunks)java-client/src/main/java/org/openapitools/client/model/OpenAppDTO.java(5 hunks)java-client/src/main/java/org/openapitools/client/model/OpenAppNamespaceDTO.java(5 hunks)java-client/src/main/java/org/openapitools/client/model/OpenClusterDTO.java(5 hunks)java-client/src/main/java/org/openapitools/client/model/OpenCreateAppDTO.java(6 hunks)java-client/src/main/java/org/openapitools/client/model/OpenEnvClusterDTO.java(6 hunks)java-client/src/main/java/org/openapitools/client/model/OpenEnvClusterInfo.java(8 hunks)java-client/src/main/java/org/openapitools/client/model/OpenGrayReleaseRuleDTO.java(7 hunks)java-client/src/main/java/org/openapitools/client/model/OpenGrayReleaseRuleItemDTO.java(7 hunks)java-client/src/main/java/org/openapitools/client/model/OpenInstanceConfigDTO.java(5 hunks)java-client/src/main/java/org/openapitools/client/model/OpenInstanceDTO.java(7 hunks)
⛔ Files not processed due to max files limit (4)
- java-client/src/main/java/org/openapitools/client/model/OpenItemChangeSets.java
- java-client/src/main/java/org/openapitools/client/model/OpenItemDTO.java
- java-client/src/main/java/org/openapitools/client/model/OpenItemDiffs.java
- java-client/src/main/java/org/openapitools/client/model/OpenNamespaceDTO.java
💤 Files with no reviewable changes (38)
- java-client/docs/OpenapiV1AppsPost400Response.md
- java-client/docs/OpenPageDTOOpenItemDTO.md
- java-client/docs/NamespaceReleaseDTO.md
- java-client/docs/NamespaceTextModel.md
- java-client/docs/OpenNamespaceLockDTO.md
- java-client/docs/OpenAppNamespaceDTO.md
- java-client/docs/OpenClusterDTO.md
- java-client/docs/OpenPageDTOOpenInstanceDTO.md
- java-client/docs/OpenapiV1EnvsEnvAppsAppIdClustersClusterNameNamespacesNamespaceNameItemsValidatePost400Response.md
- java-client/docs/ListItemDiffs.md
- java-client/src/main/java/org/openapitools/client/model/ClusterDTO.java
- java-client/docs/OpenapiV1AppsGet401Response.md
- java-client/src/main/java/org/openapitools/client/model/MapString.java
- java-client/docs/OpenapiV1AppsPostRequest.md
- java-client/docs/EnvClusterInfo.md
- java-client/docs/EntityPairKVEntity.md
- java-client/docs/OpenCreateAppDTO.md
- java-client/docs/OpenAppDTO.md
- java-client/src/main/java/org/openapitools/client/ServerConfiguration.java
- java-client/docs/ClusterDTO.md
- java-client/docs/OpenNamespaceDTO.md
- java-client/docs/OpenGrayReleaseRuleDTO.md
- java-client/src/main/java/org/openapitools/client/ServerVariable.java
- java-client/src/main/java/org/openapitools/client/model/Change.java
- java-client/docs/ReleaseDTO.md
- java-client/docs/OpenapiV1EnvsEnvReleasesCompareGet200Response.md
- java-client/docs/NamespaceSyncModel.md
- java-client/docs/OpenGrayReleaseRuleItemDTO.md
- java-client/docs/ItemChangeSets.md
- java-client/docs/OpenapiV1EnvsEnvAppsAppIdClustersClusterNameNamespacesNamespaceNameItemsValidatePost200Response.md
- java-client/docs/NamespaceIdentifier.md
- java-client/docs/NamespaceGrayDelReleaseDTO.md
- java-client/docs/OpenItemDTO.md
- java-client/src/main/java/org/openapitools/client/model/EntityPairKVEntity.java
- java-client/docs/Change.md
- java-client/src/main/java/org/openapitools/client/model/ItemDTO.java
- java-client/docs/MapString.md
- java-client/docs/ItemDTO.md
✅ Files skipped from review due to trivial changes (7)
- java-client/docs/RichResponseEntity.md
- java-client/docs/OpenOrganizationDto.md
- java-client/docs/OpenInstanceConfigDTO.md
- java-client/docs/OpenNamespaceSyncModel.md
- java-client/docs/OpenItemDiffs.md
- java-client/src/main/java/org/openapitools/client/ProgressRequestBody.java
- java-client/.openapi-generator/VERSION
🚧 Files skipped from review as they are similar to previous changes (19)
- java-client/docs/OpenNamespaceTextModel.md
- java-client/docs/MultiResponseEntity.md
- java-client/src/main/java/org/openapitools/client/GzipRequestInterceptor.java
- java-client/gradlew
- java-client/docs/InstanceManagementApi.md
- java-client/docs/OrganizationManagementApi.md
- java-client/build.sbt
- java-client/docs/OpenEnvClusterDTO.md
- java-client/docs/OpenNamespaceIdentifier.md
- java-client/src/main/java/org/openapitools/client/Configuration.java
- java-client/src/main/java/org/openapitools/client/model/OpenClusterDTO.java
- java-client/docs/OpenItemChangeSets.md
- java-client/gradle/wrapper/gradle-wrapper.properties
- java-client/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java
- java-client/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java
- java-client/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java
- java-client/docs/OpenReleaseBO.md
- java-client/build.gradle
- java-client/.github/workflows/maven.yml
🧰 Additional context used
🪛 Checkov (3.2.334)
apollo-openapi-old.yaml
[medium] 112-116: Ensure that arrays have a maximum number of items
(CKV_OPENAPI_21)
🪛 Gitleaks (8.28.0)
apollo-openapi-old.yaml
[high] 18-19: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.
(curl-auth-header)
🪛 markdownlint-cli2 (0.18.1)
java-client/docs/ClusterManagementApi.md
146-146: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
java-client/docs/NamespaceBranchManagementApi.md
472-472: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
java-client/docs/AppManagementApi.md
81-81: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
82-82: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
85-85: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
148-148: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
156-156: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
157-157: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
160-160: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
221-221: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
java-client/docs/ReleaseManagementApi.md
89-89: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
90-90: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
93-93: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
168-168: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
169-169: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
172-172: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
245-245: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
246-246: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
249-249: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
326-326: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
327-327: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
330-330: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
492-492: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3
(MD001, heading-increment)
551-551: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
552-552: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
555-555: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
633-633: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
634-634: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
637-637: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
651-651: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3
(MD001, heading-increment)
🔇 Additional comments (38)
java-client/docs/KVEntity.md (1)
10-11: Doc localization update looks good.Adding the Chinese descriptions for these fields keeps the docs consistent for localized audiences.
java-client/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java (1)
3-3: LGTM: Generated code updates.The documentation header, import reorganization, and generated annotation date updates are standard for OpenAPI-generated code and do not introduce issues.
Also applies to: 21-21, 23-23
java-client/src/main/java/org/openapitools/client/StringUtil.java (1)
19-19: LGTM!The @generated annotation timestamp has been updated, which is standard for auto-generated code regeneration. This change has no functional impact.
java-client/src/main/java/org/openapitools/client/ProgressResponseBody.java (2)
1-70: PR objective mismatch: No operator-related changes in this file.The PR is titled "fix: fixed operator issue" and the AI summary mentions that "numerous endpoints gained a required
operatorquery parameter," but this file contains only documentation changes with no operator-related modifications.Please verify:
- Are there additional files in this PR that contain the actual operator fix?
- Should this documentation-only change be in a separate PR?
3-3: Confirm Javadoc language usage
Chinese text appears consistently in Javadocs (e.g., in spring-boot2 models) and no explicit policy is documented in README/CONTRIBUTING; please verify with project maintainers whether Chinese-only documentation is acceptable.java-client/gradlew.bat (2)
36-36: LGTM! Good addition of UTF-8 encoding.Adding
-Dfile.encoding=UTF-8to the JVM options ensures consistent character encoding across different system locales, preventing encoding-related issues with non-ASCII characters in file paths, source code, and configuration files. This aligns with modern Java best practices.
45-49: LGTM! Error messages are clear and well-formatted.The error message formatting using
echo.for blank lines follows Windows batch script best practices and improves readability.Also applies to: 59-63
java-client/src/main/java/org/openapitools/client/model/OpenAppNamespaceDTO.java (2)
370-384: LGTM!The refactoring from
Arrays.asList(...)to explicitadd()calls is functionally equivalent and improves clarity.
452-454: Type adapter correctly updated.The adapter properly reads a
JsonObject, validates it, and instantiates the DTO. However, this depends on fixing the NPE issue invalidateJsonObject(see earlier comment).java-client/src/main/java/org/openapitools/client/model/OpenGrayReleaseRuleDTO.java (2)
423-423: LGTM!The validation correctly calls
validateJsonObjecton eachOpenGrayReleaseRuleItemDTOitem, consistent with the method rename across both DTOs.
92-92: No internal callers of getRuleItems(); external consumers may receive null—consider restoring default empty‐list initialization or clearly documenting @nullable.java-client/src/main/java/org/openapitools/client/model/OpenGrayReleaseRuleItemDTO.java (1)
63-67: Getters may now return null
Removed defaultnew ArrayList<>()forclientIpList/clientLabelList;getClientIpList()andgetClientLabelList()can returnnull. No internal consumers found—ensure external callers handle null or restore empty-list initialization.java-client/src/main/java/org/openapitools/client/model/NamespaceGrayDelReleaseDTO.java (3)
245-250: LGTM: Per-field initialization approach.Changing from
Arrays.asList(...)to individualadd()calls is a valid approach. While slightly more verbose, it's functionally equivalent and may improve clarity in generated code.
262-289: Validation logic correctly refactored.The change from
validateJsonElement(JsonElement)tovalidateJsonObject(JsonObject)with updated type handling (Entry<String, JsonElement>) is correct and improves type safety. The validation properly checks for:
- Unexpected fields
- Correct primitive types for string fields
- Correct array type for
grayDelKeysNote: This validation does not enforce required field presence because
openapiRequiredFieldsis empty (see separate comment on line 253).
253-253: Confirm absence of required fields: TheNamespaceGrayDelReleaseDTOschema defines norequiredarray in the OpenAPI spec, so all its properties are optional and leavingopenapiRequiredFieldsempty is correct.java-client/pom.xml (1)
305-313: Remove duplicate JAX-RS API dependencyIncluding both
jsr311-api:1.1.1andjavax.ws.rs-api:2.1.1brings overlappingjavax.ws.rs.*classes. Drop the older 1.1.1 dependency to prevent runtime conflicts:- <dependency> - <groupId>javax.ws.rs</groupId> - <artifactId>jsr311-api</artifactId> - <version>${jsr311-api-version}</version> - </dependency> <dependency> <groupId>javax.ws.rs</groupId> <artifactId>javax.ws.rs-api</artifactId> <version>${javax.ws.rs-api-version}</version> </dependency>java-client/src/main/java/org/openapitools/client/model/OpenEnvClusterDTO.java (3)
221-223: LGTM!The TypeAdapter's read method correctly uses
JsonObjectdirectly and validates it before deserialization. This is more efficient than the previous approach of reading asJsonElementand then converting.
172-199: Renaming validateJsonElement to validateJsonObject is safe
No references toOpenEnvClusterDTO.validateJsonElementfound in the codebase, so no external callers will break.
63-63: clusters field uninitialized; potential breaking change
clustersis no longer initialized, sogetClusters()may return null and cause NPEs in clients expecting an empty list. Restore default initialization (= new ArrayList<>()) or update the getter to returnCollections.emptyList()if null, and verify this change doesn’t break existing clients.java-client/docs/OpenInstanceDTO.md (1)
10-16: Documentation improvements look good.The Chinese descriptions enhance clarity for Chinese-speaking users and accurately describe each field's purpose.
java-client/src/main/java/org/openapitools/client/model/KVEntity.java (2)
168-188: JSON validation logic is correct.The
validateJsonObjectmethod properly handles null checks and validates field types. The null check at line 169 prevents NPE before accessingjsonObj.entrySet()at line 175.
209-213: Deserialization flow is well-structured.The TypeAdapter correctly validates the JsonObject before constructing the entity, ensuring data integrity.
java-client/src/main/java/org/openapitools/client/model/OpenAppDTO.java (3)
370-384: Static field initialization is correct.The explicit
add()calls foropenapiFieldsand emptyopenapiRequiredFieldsinitialization are consistent with the refactored validation approach.
457-461: TypeAdapter implementation is sound.The deserialization flow correctly validates the JsonObject before constructing the DTO, maintaining data integrity.
98-305: Inconsistent nullability annotations and missing validation across all setters.All setter method signatures changed to non-nullable parameters (dataChangeCreatedBy, dataChangeLastModifiedBy, dataChangeCreatedTime, dataChangeLastModifiedTime, name, appId, orgId, orgName, ownerName, ownerEmail), but:
- None of the setters validate for null, allowing null values to be assigned
- All getters retain
@Nullableannotations (lines 108, 129, 150, 171, 192, 213, 234, 255, 276, 297)This creates an inconsistent contract where the setters claim non-null but don't enforce it, and getters declare they may return null.
Either:
- Add null validation to all setters and remove
@Nullablefrom getters, or- Revert setter parameters to nullable and document the behavior
For the first approach, add validation similar to:
public OpenAppDTO dataChangeCreatedBy(String dataChangeCreatedBy) { - + if (dataChangeCreatedBy == null) { + throw new IllegalArgumentException("dataChangeCreatedBy cannot be null"); + } this.dataChangeCreatedBy = dataChangeCreatedBy; return this; }Apply this pattern to all 10 setter methods and their corresponding
set*methods.Likely an incorrect or invalid review comment.
apollo-openapi-old.yaml (1)
1-2542: LGTM!The OpenAPI specification is well-structured and provides comprehensive documentation for the Apollo configuration center API. The embedded Chinese documentation, security scheme, and endpoint definitions are appropriate for this baseline API specification.
Note: The static analysis warnings about the curl example and unbounded arrays are false positives in this context—documentation examples and flexible API schemas are expected here.
java-client/src/main/java/org/openapitools/client/api/InstanceManagementApi.java (1)
78-229: LGTM!The new
getInstanceCountByNamespacemethods properly introduce theenvparameter with appropriate validation (lines 143-145). The async and HTTP info variants maintain consistency with the existing API patterns.java-client/src/main/java/org/openapitools/client/api/OrganizationManagementApi.java (1)
77-192: LGTM!The method renaming from
openapiV1OrganizationsGet*togetOrganization*improves API clarity and consistency. All variants (sync, async, with HTTP info) are properly updated.java-client/src/main/java/org/openapitools/client/model/OpenEnvClusterInfo.java (1)
1-260: LGTM!The class renaming to
OpenEnvClusterInfoand the type update toList<OpenClusterDTO>align with the broader API surface evolution. The JSON validation logic (lines 196-209) properly validates array elements by delegating toOpenClusterDTO.validateJsonObject.java-client/src/main/java/org/openapitools/client/model/MultiResponseEntity.java (1)
1-262: LGTM!The new
MultiResponseEntitywrapper class is well-structured with proper validation logic. Bothcodeandentitiesare correctly marked as@Nonnulland included inopenapiRequiredFields(lines 171-172). The validation enforces required field presence (lines 197-201) and validates eachRichResponseEntityelement (lines 207-211).java-client/docs/OpenEnvClusterInfo.md (1)
1-11: LGTM!The documentation clearly describes the
OpenEnvClusterInfomodel properties with appropriate Chinese descriptions. Both properties are correctly marked as optional, which aligns with the Java model implementation.java-client/src/main/java/org/openapitools/client/ApiResponse.java (1)
1-76: LGTM!The changes are limited to documentation formatting updates (HTML-style header and Javadoc formatting). No functional changes to the API response handling.
java-client/src/main/java/org/openapitools/client/api/ClusterManagementApi.java (3)
76-226: LGTM: Clean env-scoped API implementation.The
createClustermethod correctly:
- Validates all required parameters including the new
envparameter- Builds the env-scoped path
/openapi/v1/envs/{env}/apps/{appId}/clusters- Provides synchronous, async, and HTTP-info variants consistently
227-394: LGTM: Proper operator parameter validation.The
deleteClustermethod correctly:
- Validates the new required
operatorparameter alongside existing parameters- Passes operator as a query parameter (lines 273-275)
- Returns Object type per the API contract
- Maintains consistent error handling across all variants
395-541: LGTM: Consistent env parameter integration.The
getClustermethod correctly:
- Validates the new required
envparameter- Builds the env-scoped path with proper parameter ordering
- Returns OpenClusterDTO consistently across all variants
java-client/src/main/java/org/openapitools/client/ApiClient.java (3)
63-146: LGTM: Appropriate visibility tightening.The visibility changes from
protectedtoprivatefor internal fields (basePath, debugging, authentication maps, SSL config, httpClient, etc.) and initialization methods properly encapsulate implementation details. This follows the principle of least privilege and reduces the exposed surface area for subclasses.
1162-1191: LGTM: Cleaner query parameter aggregation.The aggregation of
queryParamsandcollectionQueryParamsinto a singleallQueryParamslist (lines 1162-1164) before authentication simplifies the authentication flow (line 1191). This ensures all query parameters are consistently processed by authentication handlers without needing to track two separate collections.
876-906: LGTM: String-based deserialization approach.Reading the response body into a string first (lines 876-884) before deserialization allows for consistent error handling and supports the String return type path (lines 898-899). This is a reasonable tradeoff between memory usage and implementation simplicity for an API client.
| - name: operator | ||
| in: query | ||
| description: '操作人用户名' | ||
| required: true | ||
| schema: | ||
| type: string |
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.
Reconsider forcing operator as a required query parameter.
Turning operator into a required query parameter here (and across the other endpoints in this PR) is a breaking change: any existing client omitting it will now receive 4xx responses. Please either keep it optional with a default/fallback server-side, introduce a versioned path, or ship clear migration guidance before flipping the requirement.
🤖 Prompt for AI Agents
In apollo-openapi.yaml around lines 282 to 287, the change marks the query
parameter "operator" as required which is a breaking change for existing
clients; revert that breaking change by making "operator" optional again (remove
or set required: false) in this and all similar endpoint definitions, and either
implement a server-side fallback/default for missing operator or introduce a
versioned endpoint and clear migration notes; ensure the OpenAPI schema and
server validation remain consistent (if you choose fallback, update server
request handling to supply the default and add a note in the API changelog; if
you choose versioning, add the new path and keep the old one unchanged).
| > OpenapiV1AppsGet401Response openapiV1EnvsEnvAppsAppIdClustersClusterNameNamespacesNamespaceNameItemsRevertPost(appId, env, clusterName, namespaceName) | ||
| <a id="updateItem"></a> | ||
| # **updateItem** | ||
| > Object updateItem(appId, env, clusterName, namespaceName, key, createIfNotExists, openItemDTO) |
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.
Missing required operator parameter for update operation.
The updateItem method signature lacks an operator parameter, while other mutating operations (createItem, deleteItem, batchUpdateItemsByText, syncItems, revertItems) consistently include it. Update operations should track who performed the change for auditing and accountability.
Add the operator parameter to the method signature:
-public Object updateItem(appId, env, clusterName, namespaceName, key, createIfNotExists, openItemDTO)
+public Object updateItem(appId, env, clusterName, namespaceName, key, operator, createIfNotExists, openItemDTO)Also ensure the parameter documentation (line 953) and example code (line 931) are updated accordingly.
📝 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.
| > Object updateItem(appId, env, clusterName, namespaceName, key, createIfNotExists, openItemDTO) | |
| public Object updateItem(appId, env, clusterName, namespaceName, key, operator, createIfNotExists, openItemDTO) |
🤖 Prompt for AI Agents
In java-client/docs/ItemManagementApi.md around line 895, the updateItem method
signature is missing the required operator parameter; add operator to the
parameter list for updateItem to match other mutating APIs, update the parameter
documentation at line 953 to include operator (type/description) and update the
example code at line 931 to pass an operator value; ensure examples and docs
consistently reflect the new parameter name and position.
| > OpenapiV1AppsGet401Response openapiV1EnvsEnvAppsAppIdClustersClusterNameNamespacesNamespaceNameItemsSyncPost(appId, env, clusterName, namespaceName, namespaceSyncModel) | ||
| <a id="updateItemByEncodedKey"></a> | ||
| # **updateItemByEncodedKey** | ||
| > Object updateItemByEncodedKey(appId, env, clusterName, namespaceName, key, createIfNotExists, openItemDTO) |
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.
Missing required operator parameter for update operation.
Similar to updateItem, the updateItemByEncodedKey method lacks an operator parameter for tracking who performed the update. This inconsistency with other mutating operations breaks the audit trail.
Add the operator parameter to the method signature:
-public Object updateItemByEncodedKey(appId, env, clusterName, namespaceName, key, createIfNotExists, openItemDTO)
+public Object updateItemByEncodedKey(appId, env, clusterName, namespaceName, key, operator, createIfNotExists, openItemDTO)Also update the parameter documentation (line 1037) and example code (line 1015) accordingly.
📝 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.
| > Object updateItemByEncodedKey(appId, env, clusterName, namespaceName, key, createIfNotExists, openItemDTO) | |
| public Object updateItemByEncodedKey(appId, env, clusterName, namespaceName, key, operator, createIfNotExists, openItemDTO) |
🤖 Prompt for AI Agents
In java-client/docs/ItemManagementApi.md at line 979, the method signature for
updateItemByEncodedKey is missing the required operator parameter; add operator
to the method signature so it matches other mutating APIs, then update the
parameter documentation at line 1037 to describe the new operator param and
adjust the example code at line 1015 to pass a representative operator value;
ensure parameter order and formatting follow the surrounding style and update
any related cross-references if present.
| <systemProperties> | ||
| <property> | ||
| <name>loggerPath</name> | ||
| <value>conf/log4j.properties</value> | ||
| </property> | ||
| </systemPropertyVariables> | ||
| </systemProperties> |
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.
Restore <systemPropertyVariables> for Surefire.
maven-surefire-plugin 2.22.2 only honors <systemPropertyVariables>. Switching to <systemProperties> drops the configured values entirely, so the loggerPath property stops reaching the tests. Please revert to <systemPropertyVariables>.
- <configuration>
- <systemProperties>
+ <configuration>
+ <systemPropertyVariables>
<property>
<name>loggerPath</name>
<value>conf/log4j.properties</value>
</property>
- </systemProperties>
+ </systemPropertyVariables>📝 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.
| <systemProperties> | |
| <property> | |
| <name>loggerPath</name> | |
| <value>conf/log4j.properties</value> | |
| </property> | |
| </systemPropertyVariables> | |
| </systemProperties> | |
| <configuration> | |
| <systemPropertyVariables> | |
| <property> | |
| <name>loggerPath</name> | |
| <value>conf/log4j.properties</value> | |
| </property> | |
| </systemPropertyVariables> | |
| </configuration> |
🤖 Prompt for AI Agents
In java-client/pom.xml around lines 75 to 80, the surefire configuration
incorrectly uses <systemProperties> which Maven Surefire Plugin 2.22.2 does not
honor, causing loggerPath to not be passed to tests; revert that block to use
<systemPropertyVariables> with the same nested <property>/<name>/<value> (or
alternatively declare <loggerPath>conf/log4j.properties</loggerPath> under
<systemPropertyVariables>) so the loggerPath system property is properly
propagated to test JVMs.
| * @return releaseTitle | ||
| */ | ||
| **/ | ||
| @javax.annotation.Nullable |
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
Inconsistent nullability annotations with AI summary.
The AI summary states: "Nullable annotations removed: Eliminated @nullable on fields releaseTitle, releaseComment, releasedBy, isEmergencyPublish, grayDelKeys and updated corresponding accessors." However, the getters at lines 90, 111, 132, 153, and 182 still have @javax.annotation.Nullable annotations, while the fields themselves do not.
This creates confusion about the API contract—are these fields nullable or not?
Please verify:
- Should these fields be nullable according to the OpenAPI specification?
- If not, remove the
@javax.annotation.Nullableannotations from the getters. - If yes, consider adding the annotations back to the fields for consistency.
Run the following script to check the OpenAPI spec for these fields:
Also applies to: 111-111, 132-132, 153-153, 182-182
🏁 Script executed:
#!/bin/bash
# Description: Check OpenAPI spec for NamespaceGrayDelReleaseDTO field requirements
# Search for NamespaceGrayDelReleaseDTO schema definition in OpenAPI spec files
rg -A 20 "NamespaceGrayDelReleaseDTO" --type yaml --type jsonLength of output: 10138
Add @nullable to optional fields in NamespaceGrayDelReleaseDTO
The OpenAPI schema doesn’t list any of these properties as required, so they’re all optional. The getters are correctly annotated with @javax.annotation.Nullable, but the fields themselves lack it—add @javax.annotation.Nullable to the declarations of releaseTitle, releaseComment, releasedBy, isEmergencyPublish, and grayDelKeys in NamespaceGrayDelReleaseDTO.java for consistency.
🤖 Prompt for AI Agents
In
java-client/src/main/java/org/openapitools/client/model/NamespaceGrayDelReleaseDTO.java
around line 90, the private field declarations for releaseTitle, releaseComment,
releasedBy, isEmergencyPublish, and grayDelKeys are missing the
@javax.annotation.Nullable annotation; add @javax.annotation.Nullable to each of
those field declarations and ensure the import for javax.annotation.Nullable is
present (or fully-qualify the annotation) so the field annotations match the
existing getter annotations.
| public OpenAppDTO dataChangeCreatedBy(String dataChangeCreatedBy) { | ||
|
|
||
| this.dataChangeCreatedBy = dataChangeCreatedBy; | ||
| return this; | ||
| } | ||
|
|
||
| /** | ||
| /** | ||
| * 数据创建者用户名,记录是谁创建了这个应用 | ||
| * @return dataChangeCreatedBy | ||
| */ | ||
| **/ | ||
| @javax.annotation.Nullable | ||
| public String getDataChangeCreatedBy() { | ||
| return dataChangeCreatedBy; | ||
| } | ||
|
|
||
| public void setDataChangeCreatedBy(@javax.annotation.Nullable String dataChangeCreatedBy) { | ||
|
|
||
| public void setDataChangeCreatedBy(String dataChangeCreatedBy) { | ||
| this.dataChangeCreatedBy = dataChangeCreatedBy; | ||
| } | ||
|
|
||
|
|
||
| public OpenAppDTO dataChangeLastModifiedBy(@javax.annotation.Nullable String dataChangeLastModifiedBy) { | ||
| public OpenAppDTO dataChangeLastModifiedBy(String dataChangeLastModifiedBy) { | ||
|
|
||
| this.dataChangeLastModifiedBy = dataChangeLastModifiedBy; | ||
| return this; | ||
| } | ||
|
|
||
| /** | ||
| /** | ||
| * 数据最后修改者用户名,记录最后一次修改应用信息的用户 | ||
| * @return dataChangeLastModifiedBy | ||
| */ | ||
| **/ | ||
| @javax.annotation.Nullable | ||
| public String getDataChangeLastModifiedBy() { | ||
| return dataChangeLastModifiedBy; | ||
| } | ||
|
|
||
| public void setDataChangeLastModifiedBy(@javax.annotation.Nullable String dataChangeLastModifiedBy) { | ||
|
|
||
| public void setDataChangeLastModifiedBy(String dataChangeLastModifiedBy) { | ||
| this.dataChangeLastModifiedBy = dataChangeLastModifiedBy; | ||
| } | ||
|
|
||
|
|
||
| public OpenAppDTO dataChangeCreatedTime(@javax.annotation.Nullable String dataChangeCreatedTime) { | ||
| public OpenAppDTO dataChangeCreatedTime(String dataChangeCreatedTime) { | ||
|
|
||
| this.dataChangeCreatedTime = dataChangeCreatedTime; | ||
| return this; | ||
| } | ||
|
|
||
| /** | ||
| /** | ||
| * 数据创建时间,ISO 8601格式的时间戳 | ||
| * @return dataChangeCreatedTime | ||
| */ | ||
| **/ | ||
| @javax.annotation.Nullable | ||
| public String getDataChangeCreatedTime() { | ||
| return dataChangeCreatedTime; | ||
| } | ||
|
|
||
| public void setDataChangeCreatedTime(@javax.annotation.Nullable String dataChangeCreatedTime) { | ||
|
|
||
| public void setDataChangeCreatedTime(String dataChangeCreatedTime) { | ||
| this.dataChangeCreatedTime = dataChangeCreatedTime; | ||
| } | ||
|
|
||
|
|
||
| public OpenAppDTO dataChangeLastModifiedTime(@javax.annotation.Nullable String dataChangeLastModifiedTime) { | ||
| public OpenAppDTO dataChangeLastModifiedTime(String dataChangeLastModifiedTime) { | ||
|
|
||
| this.dataChangeLastModifiedTime = dataChangeLastModifiedTime; | ||
| return this; | ||
| } | ||
|
|
||
| /** | ||
| /** | ||
| * 数据最后修改时间,ISO 8601格式的时间戳 | ||
| * @return dataChangeLastModifiedTime | ||
| */ | ||
| **/ | ||
| @javax.annotation.Nullable | ||
| public String getDataChangeLastModifiedTime() { | ||
| return dataChangeLastModifiedTime; | ||
| } | ||
|
|
||
| public void setDataChangeLastModifiedTime(@javax.annotation.Nullable String dataChangeLastModifiedTime) { | ||
|
|
||
| public void setDataChangeLastModifiedTime(String dataChangeLastModifiedTime) { | ||
| this.dataChangeLastModifiedTime = dataChangeLastModifiedTime; | ||
| } | ||
|
|
||
|
|
||
| public OpenAppDTO name(@javax.annotation.Nullable String name) { | ||
| public OpenAppDTO name(String name) { | ||
|
|
||
| this.name = name; | ||
| return this; | ||
| } | ||
|
|
||
| /** | ||
| /** | ||
| * 应用名称,用于显示的友好名称 | ||
| * @return name | ||
| */ | ||
| **/ | ||
| @javax.annotation.Nullable | ||
| public String getName() { | ||
| return name; | ||
| } | ||
|
|
||
| public void setName(@javax.annotation.Nullable String name) { | ||
|
|
||
| public void setName(String name) { | ||
| this.name = name; | ||
| } | ||
|
|
||
|
|
||
| public OpenAppDTO appId(@javax.annotation.Nullable String appId) { | ||
| public OpenAppDTO appId(String appId) { | ||
|
|
||
| this.appId = appId; | ||
| return this; | ||
| } | ||
|
|
||
| /** | ||
| /** | ||
| * 应用唯一标识符,全局唯一的应用ID | ||
| * @return appId | ||
| */ | ||
| **/ | ||
| @javax.annotation.Nullable | ||
| public String getAppId() { | ||
| return appId; | ||
| } | ||
|
|
||
| public void setAppId(@javax.annotation.Nullable String appId) { | ||
|
|
||
| public void setAppId(String appId) { | ||
| this.appId = appId; | ||
| } | ||
|
|
||
|
|
||
| public OpenAppDTO orgId(@javax.annotation.Nullable String orgId) { | ||
| public OpenAppDTO orgId(String orgId) { | ||
|
|
||
| this.orgId = orgId; | ||
| return this; | ||
| } | ||
|
|
||
| /** | ||
| /** | ||
| * 组织ID,应用所属组织的唯一标识 | ||
| * @return orgId | ||
| */ | ||
| **/ | ||
| @javax.annotation.Nullable | ||
| public String getOrgId() { | ||
| return orgId; | ||
| } | ||
|
|
||
| public void setOrgId(@javax.annotation.Nullable String orgId) { | ||
|
|
||
| public void setOrgId(String orgId) { | ||
| this.orgId = orgId; | ||
| } | ||
|
|
||
|
|
||
| public OpenAppDTO orgName(@javax.annotation.Nullable String orgName) { | ||
| public OpenAppDTO orgName(String orgName) { | ||
|
|
||
| this.orgName = orgName; | ||
| return this; | ||
| } | ||
|
|
||
| /** | ||
| /** | ||
| * 组织名称,应用所属组织的显示名称 | ||
| * @return orgName | ||
| */ | ||
| **/ | ||
| @javax.annotation.Nullable | ||
| public String getOrgName() { | ||
| return orgName; | ||
| } | ||
|
|
||
| public void setOrgName(@javax.annotation.Nullable String orgName) { | ||
|
|
||
| public void setOrgName(String orgName) { | ||
| this.orgName = orgName; | ||
| } | ||
|
|
||
|
|
||
| public OpenAppDTO ownerName(@javax.annotation.Nullable String ownerName) { | ||
| public OpenAppDTO ownerName(String ownerName) { | ||
|
|
||
| this.ownerName = ownerName; | ||
| return this; | ||
| } | ||
|
|
||
| /** | ||
| /** | ||
| * 应用负责人姓名,应用的主要负责人 | ||
| * @return ownerName | ||
| */ | ||
| **/ | ||
| @javax.annotation.Nullable | ||
| public String getOwnerName() { | ||
| return ownerName; | ||
| } | ||
|
|
||
| public void setOwnerName(@javax.annotation.Nullable String ownerName) { | ||
|
|
||
| public void setOwnerName(String ownerName) { | ||
| this.ownerName = ownerName; | ||
| } | ||
|
|
||
|
|
||
| public OpenAppDTO ownerEmail(@javax.annotation.Nullable String ownerEmail) { | ||
| public OpenAppDTO ownerEmail(String ownerEmail) { | ||
|
|
||
| this.ownerEmail = ownerEmail; | ||
| return this; | ||
| } | ||
|
|
||
| /** | ||
| /** | ||
| * 应用负责人邮箱地址,用于接收应用相关通知 | ||
| * @return ownerEmail | ||
| */ | ||
| **/ | ||
| @javax.annotation.Nullable | ||
| public String getOwnerEmail() { | ||
| return ownerEmail; | ||
| } | ||
|
|
||
| public void setOwnerEmail(@javax.annotation.Nullable String ownerEmail) { | ||
|
|
||
| public void setOwnerEmail(String ownerEmail) { | ||
| this.ownerEmail = ownerEmail; | ||
| } |
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.
Inconsistent nullability contract across all setters.
All fluent setter methods (dataChangeCreatedBy, dataChangeLastModifiedBy, etc.) accept non-nullable parameters according to the AI summary, but:
- Getters retain
@javax.annotation.Nullableannotations - No validation enforces non-null inputs in setters
This pattern is repeated across all 10 fields and mirrors the issue in KVEntity.java.
For consistency and safety, either:
- Add null validation to all setters and update getter annotations to
@Nonnull, or - Revert to accepting nullable parameters if null values are valid
Since this is auto-generated code, consider updating the OpenAPI generator template to produce consistent nullability contracts.
🤖 Prompt for AI Agents
In java-client/src/main/java/org/openapitools/client/model/OpenAppDTO.java
around lines 98 to 305, the fluent setters accept unannotated (implicitly
non-null) parameters while getters are annotated @javax.annotation.Nullable,
creating an inconsistent nullability contract; fix by making the contract
consistent across all 10 fields: either (A) mark all setter parameters with
@javax.annotation.Nullable (e.g., public OpenAppDTO name(@Nullable String name))
to match the getters, or (B) enforce non-null by adding
Objects.requireNonNull(...) in each setter and change the corresponding getter
annotations to @javax.annotation.Nonnull; apply the chosen change uniformly for
dataChangeCreatedBy, dataChangeLastModifiedBy, dataChangeCreatedTime,
dataChangeLastModifiedTime, name, appId, orgId, orgName, ownerName, ownerEmail,
and update the OpenAPI generator template if this file is generated.
java-client/src/main/java/org/openapitools/client/model/OpenAppNamespaceDTO.java
Show resolved
Hide resolved
java-client/src/main/java/org/openapitools/client/model/OpenInstanceDTO.java
Show resolved
Hide resolved
| private boolean isValidString(String arg) { | ||
| if (arg == null) { | ||
| return false; | ||
| } | ||
|
|
||
| private static boolean isValidString(String arg) { | ||
| return arg != null; | ||
| } | ||
| return true; | ||
| } |
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.
Validation is incomplete.
The method only checks for null but doesn't validate empty strings, despite the fields being initialized to empty strings. This allows creating Pair objects with empty name/value, which may not be valid depending on use case.
Consider strengthening the validation:
private boolean isValidString(String arg) {
- if (arg == null) {
+ if (arg == null || arg.trim().isEmpty()) {
return false;
}
return true;
}🤖 Prompt for AI Agents
In java-client/src/main/java/org/openapitools/client/Pair.java around lines 50
to 56, the isValidString method only checks for null but allows empty or
whitespace-only strings; update the validation to return false for null, empty,
or all-whitespace inputs (e.g., check arg != null && !arg.trim().isEmpty()) so
name/value cannot be empty or blank; keep the method simple and deterministic
and use trim() before checking length to reject whitespace-only strings.
fa3174d to
43f1c6f
Compare
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: 5
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
apollo-openapi.yaml (1)
453-473: Schema/example mismatch for new wrapper response.The response now references
MultiResponseEntity, but the example (and the existing server implementation) still returns a bare array of env/cluster objects. Clients generated from this spec will attempt to deserialize the wrapper and break at runtime. Update the example (and server contract) to match the new wrapper, or leave the schema as the original array shape.java-client/src/main/java/org/openapitools/client/model/OpenEnvClusterInfo.java (1)
180-210: Return early on null JSON payloads.When
jsonObjis null and there are no required fields, we still calljsonObj.entrySet(), which will throw a NullPointerException. Return immediately after the null guard unless you’re throwing.if (jsonObj == null) { if (!OpenEnvClusterInfo.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in OpenEnvClusterInfo is not found in the empty JSON string", OpenEnvClusterInfo.openapiRequiredFields.toString())); } + return; }
♻️ Duplicate comments (22)
java-client/src/main/java/org/openapitools/client/model/OpenInstanceConfigDTO.java (1)
197-210: Return early whenjsonObjis null to prevent NullPointerException.This issue was previously identified: when
jsonObjis null and there are no required fields (which is the case here asopenapiRequiredFieldsis empty on line 188), the method does not return. This causes aNullPointerExceptionat line 204 whenjsonObj.entrySet()is called.Apply this diff to fix the issue:
if (jsonObj == null) { if (!OpenInstanceConfigDTO.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in OpenInstanceConfigDTO is not found in the empty JSON string", OpenInstanceConfigDTO.openapiRequiredFields.toString())); } + return; }java-client/src/main/java/org/openapitools/client/model/KVEntity.java (2)
168-188: CRITICAL: Unresolved NPE vulnerability flagged in previous reviews.The
validateJsonObjectmethod still has the critical bug identified in past reviews: whenjsonObj == nullandopenapiRequiredFields.isEmpty(), execution continues to line 175 and throwsNullPointerExceptiononjsonObj.entrySet().This critical issue must be fixed by adding an early return after the null check, as suggested in previous review comments.
66-84: Unresolved: Nullability inconsistency flagged in previous reviews.The setter methods accept non-nullable
Stringparameters but don't validate for null, while getters are still annotated@javax.annotation.Nullable. This issue was already identified in previous review comments but remains unresolved. Please address the past review suggestions by either:
- Adding null validation to the setters and updating getter annotations to
@Nonnull, or- Reverting to nullable parameters
java-client/src/main/java/org/openapitools/client/model/NamespaceGrayDelReleaseDTO.java (1)
59-75: Inconsistent nullability annotations remain unaddressed.This is the same issue flagged in a previous review: all getters have
@javax.annotation.Nullable(lines 90, 111, 132, 153, 182), but the field declarations lack this annotation. Since the OpenAPI schema marks these as optional, add@javax.annotation.Nullableto each field declaration for consistency.java-client/src/main/java/org/openapitools/client/model/OpenGrayReleaseRuleItemDTO.java (1)
215-221: Critical: NPE issue still not fixed.The previous review comment on lines 214-228 flagged a NullPointerException that occurs when
jsonObjis null but no required fields are defined. This issue is still present in the current code.When
jsonObjis null andopenapiRequiredFieldsis empty, the code does not throw an exception at Line 217, but continues to Line 221 wherejsonObj.entrySet()is called, causing a NullPointerException.Apply this diff to fix the issue:
if (jsonObj == null) { if (!OpenGrayReleaseRuleItemDTO.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in OpenGrayReleaseRuleItemDTO is not found in the empty JSON string", OpenGrayReleaseRuleItemDTO.openapiRequiredFields.toString())); } + return; }java-client/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java (1)
26-26: Breaking change already flagged in previous review.The change from
Supplier<String> tokenSuppliertoString bearerTokenremoves dynamic token refresh capability. This breaking change has been comprehensively reviewed and flagged in the previous review comment.java-client/src/main/java/org/openapitools/client/model/NamespaceReleaseDTO.java (1)
225-236: Restore the null guard invalidateJsonObject.When
jsonObjis null and there are no required fields, the code falls through to line 231 (jsonObj.entrySet()), triggering aNullPointerException. This will crash deserialization for responses legitimately returning JSONnull.Apply this diff to add the missing early return:
if (jsonObj == null) { if (!NamespaceReleaseDTO.openapiRequiredFields.isEmpty()) { throw new IllegalArgumentException(String.format("The required field(s) %s in NamespaceReleaseDTO is not found in the empty JSON string", NamespaceReleaseDTO.openapiRequiredFields.toString())); } + return; }apollo-openapi.yaml (2)
282-350: Do not makeoperatormandatory on legacy endpoints.Endpoints marked “original openapi” (e.g.,
updateApp,deleteApp,createItem, etc.) now require anoperatorquery parameter. Existing clients never sent this field, so this flips successful calls into 400/403 responses. Either keepoperatoroptional with a server-side fallback, or introduce versioned/new paths before enforcing it.
4240-4244: Keepmessageschema aligned with documented usage.
messageis declared as an object but the description and examples show plain strings like"OK". The generator will emit models expecting an object, while the real payload is a string, so deserialization will continue to fail. Model this asoneOf [string, object](or revert tostring) and makebodynullable if it can be absent.java-client/src/main/java/org/openapitools/client/model/OpenAppNamespaceDTO.java (2)
17-17: Remove unused import.The
Arraysimport is no longer used after refactoring the static field initialization fromArrays.asList(...)to explicitadd()calls at lines 370-384.Apply this diff:
-import java.util.Arrays;
392-406: Add early return after null check to prevent NPE.When
jsonObjisnullandopenapiRequiredFieldsis empty, the code falls through to line 399 (jsonObj.entrySet()), causing aNullPointerException.Apply this diff:
public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { if (!OpenAppNamespaceDTO.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in OpenAppNamespaceDTO is not found in the empty JSON string", OpenAppNamespaceDTO.openapiRequiredFields.toString())); } + return; } Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();java-client/src/main/java/org/openapitools/client/JSON.java (1)
89-125: Restore the static initializer to prevent NPE.The instance initializer
{at line 89 never executes because this class only exposes static members. The staticgsonfield remainsnull, causing all calls toJSON.serialize/deserializeto throwNullPointerException.Apply this diff to restore the static initializer:
- { + static { GsonBuilder gsonBuilder = createGson(); gsonBuilder.registerTypeAdapter(Date.class, dateTypeAdapter); ... gson = gsonBuilder.create(); }java-client/build.gradle (1)
65-67: Replace deprecated Gradle properties with modern equivalents.Lines 65-67 use deprecated properties (
destinationDir,archiveName) that were replaced in Gradle 5.x with Provider API equivalents (destinationDirectory,archiveFileName).Apply this diff:
- task.from variant.javaCompile.destinationDir - task.destinationDir = project.file("${project.buildDir}/outputs/jar") - task.archiveName = "${project.name}-${variant.baseName}-${version}.jar" + task.from variant.javaCompile.destinationDirectory + task.destinationDirectory = project.file("${project.buildDir}/outputs/jar") + task.archiveFileName = "${project.name}-${variant.baseName}-${version}.jar"java-client/src/main/java/org/openapitools/client/model/OpenCreateAppDTO.java (1)
222-224: Handle JSON null for optionaladminsfield.The validation at line 222 rejects explicit JSON null values for the optional
adminsfield. When the payload contains"admins": null,jsonObj.get("admins")returnsJsonNull, which fails theisJsonArray()check.Apply this diff:
- if (jsonObj.get("admins") != null && !jsonObj.get("admins").isJsonArray()) { + if (jsonObj.get("admins") != null && !jsonObj.get("admins").isJsonNull() && !jsonObj.get("admins").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `admins` to be an array in the JSON string but got `%s`", jsonObj.get("admins").toString())); }java-client/src/main/java/org/openapitools/client/model/OpenInstanceDTO.java (1)
319-360: Return early when the JSON object is absent.If
jsonObjis null and there are no required fields, execution falls through tojsonObj.entrySet()and crashes with an NPE. Return right after the null guard.if (jsonObj == null) { if (!OpenInstanceDTO.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in OpenInstanceDTO is not found in the empty JSON string", OpenInstanceDTO.openapiRequiredFields.toString())); } + return; }java-client/src/main/java/org/openapitools/client/model/OpenAppDTO.java (1)
392-435: Guard against null JSON inputs before iterating.
jsonObjmay be null; without an early return we hitjsonObj.entrySet()and crash. Add the missing return after the null check.if (jsonObj == null) { if (!OpenAppDTO.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in OpenAppDTO is not found in the empty JSON string", OpenAppDTO.openapiRequiredFields.toString())); } + return; }java-client/src/main/java/org/openapitools/client/Pair.java (1)
21-40: Silent validation failure creates inconsistent object state.This issue was previously flagged and remains unresolved. The setters return early on invalid input, leaving fields as empty strings without notifying the caller.
java-client/docs/AppManagementApi.md (1)
245-246: Correct the HTTP method for findApps documentation.The method table at line 10 correctly documents
findAppsasGET /openapi/v1/apps, but this section still showsPOST. This mismatch will confuse API consumers.Apply this diff:
-POST /openapi/v1/apps +GET /openapi/v1/appsjava-client/docs/ItemManagementApi.md (3)
109-109: Restore/openapi/v1/envs/{env}prefix forcompareItemspath.The documented path is missing the
/openapi/v1/envs/{env}segment. Correct it to/openapi/v1/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/items/compareto match the actual endpoint.
895-895: Add missingoperatorparameter toupdateItemmethod.The method signature lacks an
operatorparameter, breaking consistency with other mutating operations (createItem, deleteItem, batchUpdateItemsByText, syncItems, revertItems) that require it for audit tracking.Apply this diff to add the missing parameter:
-public Object updateItem(appId, env, clusterName, namespaceName, key, createIfNotExists, openItemDTO) +public Object updateItem(appId, env, clusterName, namespaceName, key, operator, createIfNotExists, openItemDTO)Also update the parameter documentation at line 953 and example code at line 931.
979-979: Add missingoperatorparameter toupdateItemByEncodedKeymethod.Similar to
updateItem, this method lacks anoperatorparameter for tracking who performed the update, breaking the audit trail.Apply this diff to add the missing parameter:
-public Object updateItemByEncodedKey(appId, env, clusterName, namespaceName, key, createIfNotExists, openItemDTO) +public Object updateItemByEncodedKey(appId, env, clusterName, namespaceName, key, operator, createIfNotExists, openItemDTO)Also update the parameter documentation at line 1037 and example code at line 1015.
java-client/src/main/java/org/openapitools/client/ApiClient.java (1)
1174-1176: Use case-insensitive, parameter-agnostic content-type matching.The exact
equals()checks only match verbatim strings and will miss content-types with parameters (e.g.,application/x-www-form-urlencoded; charset=UTF-8) or different casing. Extract the media type and compare case-insensitively.Apply this diff to fix the content-type matching:
- } else if ("application/x-www-form-urlencoded".equals(contentType)) { + } else if (contentType != null && contentType.split(";")[0].trim().equalsIgnoreCase("application/x-www-form-urlencoded")) { reqBody = buildRequestBodyFormEncoding(formParams); - } else if ("multipart/form-data".equals(contentType)) { + } else if (contentType != null && contentType.split(";")[0].trim().equalsIgnoreCase("multipart/form-data")) { reqBody = buildRequestBodyMultipart(formParams);
🧹 Nitpick comments (14)
java-client/src/main/java/org/openapitools/client/Configuration.java (2)
17-41: Consider adding a private constructor to prevent instantiation.Since
Configurationis a utility class with only static members, it should have a private constructor to prevent instantiation and clearly signal its intended usage pattern.Apply this diff to add a private constructor:
public class Configuration { public static final String VERSION = "0.0.1"; private static ApiClient defaultApiClient = new ApiClient(); + /** + * Private constructor to prevent instantiation + */ + private Configuration() { + throw new IllegalStateException("Utility class"); + } + /** * Get the default API client, which would be used when creating API * instances without providing an API client.
38-40: Add null validation to prevent NPEs.The
setDefaultApiClientmethod should validate that theapiClientparameter is not null to prevent potentialNullPointerExceptions whengetDefaultApiClient()is called later.Apply this diff to add null validation:
public static void setDefaultApiClient(ApiClient apiClient) { + if (apiClient == null) { + throw new IllegalArgumentException("apiClient cannot be null"); + } defaultApiClient = apiClient; }java-client/src/main/java/org/openapitools/client/model/OpenInstanceConfigDTO.java (1)
17-17: Remove unused imports.The imports
java.util.Arrays(line 17) andjava.lang.reflect.Type(line 41) do not appear to be used in the code. Since the field initialization was changed fromArrays.asList(...)to explicitadd()calls (lines 183-185), theArraysimport is no longer needed.Apply this diff to remove the unused imports:
-import java.util.Arrays;-import java.lang.reflect.Type;Also applies to: 41-41
java-client/src/main/java/org/openapitools/client/model/NamespaceGrayDelReleaseDTO.java (2)
17-17: Remove unused import.The
Arraysimport is no longer needed since the OpenAPI fields initialization (lines 245-250) was migrated fromArrays.asList(...)to individualadd(...)calls.Apply this diff to remove the unused import:
-import java.util.Arrays;
80-190: Add @nullable to setter parameters for consistency.All setter methods (
setReleaseTitle,setReleaseComment,setReleasedBy,setIsEmergencyPublish,setGrayDelKeys) accept parameters without@javax.annotation.Nullableannotations, while their corresponding getters are annotated as nullable. For consistent API contracts, add@javax.annotation.Nullableto all setter parameters.Example diff for
setReleaseTitle:- public void setReleaseTitle(String releaseTitle) { + public void setReleaseTitle(@javax.annotation.Nullable String releaseTitle) { this.releaseTitle = releaseTitle; }Apply similar changes to all other setters.
java-client/src/main/java/org/openapitools/client/GzipRequestInterceptor.java (1)
3-3: Extremely long documentation line.Line 3 contains over 500 characters of mixed Chinese and HTML documentation on a single line. While this is auto-generated code, such long lines can cause issues with code review tools, text editors, and git diffs.
If possible, consider adjusting the OpenAPI Generator template or spec to output multi-line documentation comments for better readability.
java-client/src/main/java/org/openapitools/client/model/OpenGrayReleaseRuleItemDTO.java (2)
17-17: Remove unused imports.The
Arraysimport at Line 17 andTypeimport at Line 42 are no longer used in the code. After switching fromArrays.asList(...)to individualadd()calls for static initialization, and with no usage ofTypeanywhere in the class, these imports should be removed.Apply this diff to remove the unused imports:
-import java.util.Arrays;-import java.lang.reflect.Type;Also applies to: 42-42
199-202: Consider more concise initialization.The static initialization of
openapiFieldsuses individualadd()calls. While functionally correct, the previousArrays.asList(...)approach was more concise.If desired, apply this diff for more concise initialization:
- openapiFields = new HashSet<String>(); - openapiFields.add("clientAppId"); - openapiFields.add("clientIpList"); - openapiFields.add("clientLabelList"); + openapiFields = new HashSet<String>(Arrays.asList( + "clientAppId", + "clientIpList", + "clientLabelList" + ));Note: If you apply this change, keep the
Arraysimport at Line 17.java-client/src/main/java/org/openapitools/client/model/OpenGrayReleaseRuleDTO.java (1)
17-17: Remove unused imports.The imports
java.util.Arraysandjava.lang.reflect.Typeare not used in this file.Apply this diff to remove the unused imports:
-import java.util.Arrays;-import java.lang.reflect.Type;Also applies to: 43-43
java-client/src/main/java/org/openapitools/client/model/OpenEnvClusterDTO.java (2)
17-17: Remove unused imports.The
ArraysandTypeimports appear to be unused.Arrayswas previously used forArrays.asList()in the static initializer (line 164 in the old code), but that pattern was replaced with explicitadd()calls. TheTypeimport for reflection is not visibly used anywhere in the file.Apply this diff to remove the unused imports:
import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter;import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap;Also applies to: 42-42
37-40: Remove duplicate imports.Lines 37-40 duplicate imports already declared earlier:
TypeAdapter(already at line 18)JsonReader(already at line 21)JsonWriter(already at line 22)IOException(already at line 23)While Java ignores duplicate imports, they create unnecessary clutter and suggest a code generation template issue.
Apply this diff to remove the duplicates:
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.lang.reflect.Type;java-client/src/main/java/org/openapitools/client/model/OpenClusterDTO.java (1)
262-268: Consider more concise initialization.The openapiFields initialization uses incremental
add()calls, which is more verbose and less efficient than using a pre-populated collection.Apply this diff for more concise initialization:
- openapiFields = new HashSet<String>(); - openapiFields.add("dataChangeCreatedBy"); - openapiFields.add("dataChangeLastModifiedBy"); - openapiFields.add("dataChangeCreatedTime"); - openapiFields.add("dataChangeLastModifiedTime"); - openapiFields.add("name"); - openapiFields.add("appId"); + openapiFields = new HashSet<String>(Arrays.asList( + "dataChangeCreatedBy", + "dataChangeLastModifiedBy", + "dataChangeCreatedTime", + "dataChangeLastModifiedTime", + "name", + "appId" + ));java-client/src/main/java/org/openapitools/client/api/InstanceManagementApi.java (1)
38-38: Remove unused import.Delete the unused
javax.ws.rs.core.GenericTypeimport (line 38). If this file is auto-generated, update the generator template to omit unused imports.java-client/src/main/java/org/openapitools/client/api/OrganizationManagementApi.java (1)
37-37: Remove unused importjavax.ws.rs.core.GenericType.The import isn’t referenced anywhere in this file. If this is auto-generated code, update the generator template to omit
GenericType.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
java-client/gradle/wrapper/gradle-wrapper.jaris excluded by!**/*.jar
📒 Files selected for processing (107)
apollo-openapi.yaml(21 hunks)generate.sh(1 hunks)java-client/.github/workflows/maven.yml(1 hunks)java-client/.openapi-generator/FILES(3 hunks)java-client/.openapi-generator/VERSION(1 hunks)java-client/README.md(3 hunks)java-client/build.gradle(2 hunks)java-client/build.sbt(1 hunks)java-client/docs/AppManagementApi.md(33 hunks)java-client/docs/Change.md(0 hunks)java-client/docs/ClusterDTO.md(0 hunks)java-client/docs/ClusterManagementApi.md(10 hunks)java-client/docs/EntityPairKVEntity.md(0 hunks)java-client/docs/EnvClusterInfo.md(0 hunks)java-client/docs/InstanceManagementApi.md(8 hunks)java-client/docs/ItemChangeSets.md(0 hunks)java-client/docs/ItemDTO.md(0 hunks)java-client/docs/ItemManagementApi.md(34 hunks)java-client/docs/KVEntity.md(1 hunks)java-client/docs/ListItemDiffs.md(0 hunks)java-client/docs/MapString.md(0 hunks)java-client/docs/MultiResponseEntity.md(1 hunks)java-client/docs/NamespaceBranchManagementApi.md(19 hunks)java-client/docs/NamespaceGrayDelReleaseDTO.md(0 hunks)java-client/docs/NamespaceIdentifier.md(0 hunks)java-client/docs/NamespaceManagementApi.md(26 hunks)java-client/docs/NamespaceReleaseDTO.md(0 hunks)java-client/docs/NamespaceSyncModel.md(0 hunks)java-client/docs/NamespaceTextModel.md(0 hunks)java-client/docs/OpenAppDTO.md(0 hunks)java-client/docs/OpenAppNamespaceDTO.md(0 hunks)java-client/docs/OpenClusterDTO.md(0 hunks)java-client/docs/OpenCreateAppDTO.md(0 hunks)java-client/docs/OpenEnvClusterDTO.md(1 hunks)java-client/docs/OpenEnvClusterInfo.md(1 hunks)java-client/docs/OpenGrayReleaseRuleDTO.md(0 hunks)java-client/docs/OpenGrayReleaseRuleItemDTO.md(0 hunks)java-client/docs/OpenInstanceConfigDTO.md(1 hunks)java-client/docs/OpenInstanceDTO.md(1 hunks)java-client/docs/OpenItemChangeSets.md(1 hunks)java-client/docs/OpenItemDTO.md(0 hunks)java-client/docs/OpenItemDiffs.md(1 hunks)java-client/docs/OpenNamespaceDTO.md(0 hunks)java-client/docs/OpenNamespaceIdentifier.md(1 hunks)java-client/docs/OpenNamespaceLockDTO.md(0 hunks)java-client/docs/OpenNamespaceSyncModel.md(1 hunks)java-client/docs/OpenNamespaceTextModel.md(1 hunks)java-client/docs/OpenOrganizationDto.md(1 hunks)java-client/docs/OpenPageDTOOpenInstanceDTO.md(0 hunks)java-client/docs/OpenPageDTOOpenItemDTO.md(0 hunks)java-client/docs/OpenReleaseBO.md(1 hunks)java-client/docs/OpenReleaseDTO.md(1 hunks)java-client/docs/OpenapiV1AppsGet401Response.md(0 hunks)java-client/docs/OpenapiV1AppsPost400Response.md(0 hunks)java-client/docs/OpenapiV1AppsPostRequest.md(0 hunks)java-client/docs/OpenapiV1EnvsEnvAppsAppIdClustersClusterNameNamespacesNamespaceNameItemsValidatePost200Response.md(0 hunks)java-client/docs/OpenapiV1EnvsEnvAppsAppIdClustersClusterNameNamespacesNamespaceNameItemsValidatePost400Response.md(0 hunks)java-client/docs/OpenapiV1EnvsEnvReleasesCompareGet200Response.md(0 hunks)java-client/docs/OrganizationManagementApi.md(3 hunks)java-client/docs/ReleaseDTO.md(0 hunks)java-client/docs/ReleaseManagementApi.md(19 hunks)java-client/docs/RichResponseEntity.md(1 hunks)java-client/gradle/wrapper/gradle-wrapper.properties(1 hunks)java-client/gradlew(5 hunks)java-client/gradlew.bat(4 hunks)java-client/pom.xml(9 hunks)java-client/settings.gradle(1 hunks)java-client/src/main/java/org/openapitools/client/ApiCallback.java(1 hunks)java-client/src/main/java/org/openapitools/client/ApiClient.java(17 hunks)java-client/src/main/java/org/openapitools/client/ApiException.java(2 hunks)java-client/src/main/java/org/openapitools/client/ApiResponse.java(2 hunks)java-client/src/main/java/org/openapitools/client/Configuration.java(2 hunks)java-client/src/main/java/org/openapitools/client/GzipRequestInterceptor.java(1 hunks)java-client/src/main/java/org/openapitools/client/JSON.java(2 hunks)java-client/src/main/java/org/openapitools/client/Pair.java(2 hunks)java-client/src/main/java/org/openapitools/client/ProgressRequestBody.java(1 hunks)java-client/src/main/java/org/openapitools/client/ProgressResponseBody.java(1 hunks)java-client/src/main/java/org/openapitools/client/ServerConfiguration.java(0 hunks)java-client/src/main/java/org/openapitools/client/ServerVariable.java(0 hunks)java-client/src/main/java/org/openapitools/client/StringUtil.java(2 hunks)java-client/src/main/java/org/openapitools/client/api/ClusterManagementApi.java(9 hunks)java-client/src/main/java/org/openapitools/client/api/InstanceManagementApi.java(13 hunks)java-client/src/main/java/org/openapitools/client/api/OrganizationManagementApi.java(4 hunks)java-client/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java(2 hunks)java-client/src/main/java/org/openapitools/client/auth/Authentication.java(1 hunks)java-client/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java(2 hunks)java-client/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java(4 hunks)java-client/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java(3 hunks)java-client/src/main/java/org/openapitools/client/model/Change.java(0 hunks)java-client/src/main/java/org/openapitools/client/model/ClusterDTO.java(0 hunks)java-client/src/main/java/org/openapitools/client/model/EntityPairKVEntity.java(0 hunks)java-client/src/main/java/org/openapitools/client/model/ItemDTO.java(0 hunks)java-client/src/main/java/org/openapitools/client/model/KVEntity.java(5 hunks)java-client/src/main/java/org/openapitools/client/model/MapString.java(0 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(7 hunks)java-client/src/main/java/org/openapitools/client/model/NamespaceReleaseDTO.java(5 hunks)java-client/src/main/java/org/openapitools/client/model/OpenAppDTO.java(5 hunks)java-client/src/main/java/org/openapitools/client/model/OpenAppNamespaceDTO.java(5 hunks)java-client/src/main/java/org/openapitools/client/model/OpenClusterDTO.java(5 hunks)java-client/src/main/java/org/openapitools/client/model/OpenCreateAppDTO.java(6 hunks)java-client/src/main/java/org/openapitools/client/model/OpenEnvClusterDTO.java(6 hunks)java-client/src/main/java/org/openapitools/client/model/OpenEnvClusterInfo.java(8 hunks)java-client/src/main/java/org/openapitools/client/model/OpenGrayReleaseRuleDTO.java(7 hunks)java-client/src/main/java/org/openapitools/client/model/OpenGrayReleaseRuleItemDTO.java(7 hunks)java-client/src/main/java/org/openapitools/client/model/OpenInstanceConfigDTO.java(5 hunks)java-client/src/main/java/org/openapitools/client/model/OpenInstanceDTO.java(7 hunks)
⛔ Files not processed due to max files limit (12)
- java-client/src/main/java/org/openapitools/client/model/OpenItemChangeSets.java
- java-client/src/main/java/org/openapitools/client/model/OpenItemDTO.java
- java-client/src/main/java/org/openapitools/client/model/OpenItemDiffs.java
- java-client/src/main/java/org/openapitools/client/model/OpenNamespaceDTO.java
- java-client/src/main/java/org/openapitools/client/model/OpenNamespaceIdentifier.java
- java-client/src/main/java/org/openapitools/client/model/OpenNamespaceLockDTO.java
- java-client/src/main/java/org/openapitools/client/model/OpenNamespaceSyncModel.java
- java-client/src/main/java/org/openapitools/client/model/OpenNamespaceTextModel.java
- java-client/src/main/java/org/openapitools/client/model/OpenOrganizationDto.java
- java-client/src/main/java/org/openapitools/client/model/OpenPageDTOOpenInstanceDTO.java
- java-client/src/main/java/org/openapitools/client/model/OpenPageDTOOpenItemDTO.java
- java-client/src/main/java/org/openapitools/client/model/OpenReleaseBO.java
💤 Files with no reviewable changes (38)
- java-client/docs/OpenNamespaceDTO.md
- java-client/docs/OpenapiV1EnvsEnvReleasesCompareGet200Response.md
- java-client/docs/NamespaceSyncModel.md
- java-client/docs/OpenPageDTOOpenInstanceDTO.md
- java-client/docs/ItemDTO.md
- java-client/docs/ListItemDiffs.md
- java-client/docs/ReleaseDTO.md
- java-client/src/main/java/org/openapitools/client/ServerConfiguration.java
- java-client/src/main/java/org/openapitools/client/ServerVariable.java
- java-client/docs/OpenGrayReleaseRuleItemDTO.md
- java-client/docs/MapString.md
- java-client/docs/OpenCreateAppDTO.md
- java-client/docs/OpenapiV1AppsGet401Response.md
- java-client/docs/NamespaceTextModel.md
- java-client/src/main/java/org/openapitools/client/model/ClusterDTO.java
- java-client/src/main/java/org/openapitools/client/model/MapString.java
- java-client/docs/OpenAppDTO.md
- java-client/docs/OpenapiV1EnvsEnvAppsAppIdClustersClusterNameNamespacesNamespaceNameItemsValidatePost200Response.md
- java-client/docs/OpenapiV1EnvsEnvAppsAppIdClustersClusterNameNamespacesNamespaceNameItemsValidatePost400Response.md
- java-client/docs/OpenapiV1AppsPostRequest.md
- java-client/docs/OpenAppNamespaceDTO.md
- java-client/src/main/java/org/openapitools/client/model/ItemDTO.java
- java-client/docs/NamespaceReleaseDTO.md
- java-client/docs/ClusterDTO.md
- java-client/docs/OpenGrayReleaseRuleDTO.md
- java-client/docs/OpenapiV1AppsPost400Response.md
- java-client/docs/OpenNamespaceLockDTO.md
- java-client/docs/OpenItemDTO.md
- java-client/docs/EntityPairKVEntity.md
- java-client/docs/OpenPageDTOOpenItemDTO.md
- java-client/src/main/java/org/openapitools/client/model/Change.java
- java-client/docs/NamespaceIdentifier.md
- java-client/docs/ItemChangeSets.md
- java-client/docs/Change.md
- java-client/docs/OpenClusterDTO.md
- java-client/docs/EnvClusterInfo.md
- java-client/docs/NamespaceGrayDelReleaseDTO.md
- java-client/src/main/java/org/openapitools/client/model/EntityPairKVEntity.java
✅ Files skipped from review due to trivial changes (2)
- java-client/settings.gradle
- java-client/src/main/java/org/openapitools/client/ApiResponse.java
🚧 Files skipped from review as they are similar to previous changes (24)
- java-client/docs/OpenReleaseBO.md
- java-client/.openapi-generator/VERSION
- java-client/docs/OpenReleaseDTO.md
- java-client/docs/OpenOrganizationDto.md
- java-client/docs/KVEntity.md
- java-client/docs/OpenNamespaceIdentifier.md
- java-client/docs/OpenItemDiffs.md
- java-client/src/main/java/org/openapitools/client/ProgressResponseBody.java
- java-client/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java
- generate.sh
- java-client/docs/MultiResponseEntity.md
- java-client/docs/OpenEnvClusterInfo.md
- java-client/src/main/java/org/openapitools/client/ApiException.java
- java-client/src/main/java/org/openapitools/client/auth/Authentication.java
- java-client/pom.xml
- java-client/docs/OpenNamespaceTextModel.md
- java-client/build.sbt
- java-client/src/main/java/org/openapitools/client/StringUtil.java
- java-client/docs/OpenInstanceConfigDTO.md
- java-client/docs/OpenItemChangeSets.md
- java-client/.github/workflows/maven.yml
- java-client/docs/OpenInstanceDTO.md
- java-client/docs/RichResponseEntity.md
- java-client/src/main/java/org/openapitools/client/ProgressRequestBody.java
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
java-client/docs/ClusterManagementApi.md
146-146: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
java-client/docs/ItemManagementApi.md
94-94: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
95-95: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
98-98: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
172-172: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
173-173: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
176-176: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
324-324: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
332-332: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
333-333: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
336-336: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
403-403: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
411-411: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
412-412: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
415-415: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
663-663: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3
(MD001, heading-increment)
724-724: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
725-725: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
728-728: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
794-794: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
802-802: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
803-803: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
806-806: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
875-875: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
958-958: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
966-966: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
967-967: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
970-970: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
1042-1042: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
1122-1122: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
java-client/docs/NamespaceManagementApi.md
30-30: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3
(MD001, heading-increment)
87-87: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
88-88: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
91-91: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
158-158: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
159-159: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
162-162: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
176-176: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3
(MD001, heading-increment)
225-225: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
302-302: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
310-310: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
311-311: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
314-314: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
326-326: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3
(MD001, heading-increment)
525-525: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
526-526: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
529-529: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
685-685: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3
(MD001, heading-increment)
738-738: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
739-739: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
742-742: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
java-client/docs/AppManagementApi.md
81-81: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
82-82: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
85-85: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
148-148: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
156-156: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
157-157: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
160-160: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
221-221: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
java-client/docs/ReleaseManagementApi.md
89-89: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
90-90: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
93-93: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
168-168: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
169-169: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
172-172: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
245-245: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
246-246: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
249-249: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
326-326: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
327-327: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
330-330: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
492-492: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3
(MD001, heading-increment)
551-551: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
552-552: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
555-555: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
633-633: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
634-634: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
637-637: Tables should be surrounded by blank lines
(MD058, blanks-around-tables)
651-651: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3
(MD001, heading-increment)
java-client/README.md
203-203: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
204-204: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
205-205: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
206-206: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
207-207: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
208-208: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
209-209: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
210-210: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
211-211: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
212-212: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
213-213: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
214-214: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
215-215: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
216-216: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
217-217: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
218-218: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
219-219: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
220-220: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
221-221: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
222-222: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
223-223: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
224-224: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
225-225: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
226-226: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
227-227: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
228-228: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
229-229: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
230-230: Unordered list indentation
Expected: 0; Actual: 1
(MD007, ul-indent)
java-client/docs/NamespaceBranchManagementApi.md
472-472: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
🔇 Additional comments (29)
java-client/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java (3)
1-11: LGTM! Documentation header updated via code regeneration.The file header has been updated with Apollo OpenAPI authentication documentation (in Chinese) and usage examples. Since this is auto-generated code (noted on lines 8-10), these changes are part of the OpenAPI Generator output and require no manual intervention.
23-23: LGTM! Timestamp reflects code regeneration.The
@Generatedannotation timestamp has been updated from2025-09-14T17:08:15.997407+08:00to2025-10-07T09:37:09.635+08:00, indicating that the code was regenerated. No functional logic changes were made to theApiKeyAuthclass implementation.
24-80: Note: No logic changes related to PR objective.The PR title mentions "fixed operator issue," but this file shows only documentation and timestamp updates with no changes to the actual authentication logic. If the operator fix is in other files, this is fine. Otherwise, verify that the intended changes were applied.
java-client/src/main/java/org/openapitools/client/model/OpenInstanceConfigDTO.java (1)
243-245: LGTM!The read method correctly calls the updated
validateJsonObjectmethod, which is consistent with the validation signature change fromJsonElementtoJsonObject.java-client/src/main/java/org/openapitools/client/model/KVEntity.java (1)
152-160: LGTM!The static initialization correctly sets up the field metadata using explicit
add()calls and properly initializesopenapiRequiredFieldsas an empty set, indicating both fields are optional.java-client/src/main/java/org/openapitools/client/model/NamespaceGrayDelReleaseDTO.java (3)
245-254: LGTM!The migration from
Arrays.asList(...)to individualadd(...)calls is functionally equivalent and the empty required fields set correctly reflects that no fields are mandatory per the OpenAPI spec.
256-289: LGTM!The rename from
validateJsonElementtovalidateJsonObjectaccurately reflects the updated parameter type and implementation. The validation logic correctly handles JsonObject operations and provides clear error messages.
310-314: LGTM!The type adapter's
readmethod correctly usesJsonObjectand calls the renamedvalidateJsonObjectmethod, maintaining consistency with the validation API changes.java-client/src/main/java/org/openapitools/client/GzipRequestInterceptor.java (1)
8-11: Auto-generated header update looks good.The header documentation has been properly updated by OpenAPI Generator. Since this is auto-generated code (as noted in lines 8-10), the changes are appropriate and no manual edits should be made.
java-client/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java (6)
1-11: LGTM: Auto-generated documentation updated.The structured HTML documentation and "Do not edit" notice are appropriate for generated code.
19-21: LGTM: Imports correctly updated.Import statements properly reflect the removal of Supplier-based token provisioning.
37-39: LGTM: Getter implementation correct.The method correctly returns the
bearerTokenfield, consistent with the simplified String-based approach.
46-48: LGTM: Setter implementation correct.The method correctly assigns the bearer token. The removal of the
setBearerToken(Supplier<String>)overload has already been flagged in the previous review.
50-58: LGTM: Token application logic correct.The method correctly checks for null token and properly formats the Authorization header with scheme uppercasing.
60-62: LGTM: Helper method implementation correct.The case-insensitive check and uppercasing logic properly handles the "Bearer" scheme formatting.
java-client/src/main/java/org/openapitools/client/model/OpenGrayReleaseRuleDTO.java (4)
97-115: Verify null-safety contract consistency.The setter parameters no longer have
@Nullableannotations, but the corresponding getters still return@javax.annotation.Nullable. This creates an asymmetry where fields can be null (as indicated by nullable getters), yet setters suggest a non-null contract. Since the setter implementations don't enforce null checks, null values can still be assigned.Ensure this annotation pattern aligns with the intended API contract and that downstream code properly handles potential null values from getters.
Also applies to: 118-136, 139-157, 160-178, 181-199, 202-220, 223-241, 244-262, 265-291
354-367: LGTM! Improved initialization pattern.The explicit field-by-field initialization is clearer and more maintainable for generated code compared to the previous approach.
369-427: LGTM! Improved type safety in validation.The refactoring from
validateJsonElement(JsonElement)tovalidateJsonObject(JsonObject)provides better type safety by explicitly requiring aJsonObjectparameter. This eliminates implicit casting and makes the validation contract clearer.
449-451: LGTM! Type-safe deserialization.The explicit casting to
JsonObjectfollowed by validation provides better type safety and fail-fast behavior if the JSON is not an object. This aligns well with the updatedvalidateJsonObjectmethod signature.java-client/src/main/java/org/openapitools/client/model/OpenEnvClusterDTO.java (2)
164-170: Static field initialization pattern is correct.The change from
Arrays.asList()to explicitadd()calls foropenapiFieldsis functionally equivalent and may reflect a code generator template update for better maintainability. The initialization logic correctly declares bothenvandclustersfields, andopenapiRequiredFieldsis properly initialized as an empty set.
172-223: Validation logic migration toJsonObjectis correct.The refactoring from
validateJsonElement(JsonElement)tovalidateJsonObject(JsonObject)strengthens type safety by explicitly requiring aJsonObjectparameter. TheCustomTypeAdapterFactory.readmethod now callsgetAsJsonObject()before validation (line 221), which will fail fast withIllegalStateExceptionif the JSON is not an object—this is the correct behavior for a deserializer.The validation checks remain sound:
- Required fields validation (line 180-182)
- Unknown fields detection (lines 185-191)
- Type validation for
envas primitive (lines 192-194)- Type validation for
clustersas array (lines 196-198)java-client/src/main/java/org/openapitools/client/model/NamespaceReleaseDTO.java (2)
208-215: LGTM!The refactored static initialization using explicit
add()calls is clear and functionally equivalent to the previousArrays.asList()approach. The emptyopenapiRequiredFieldsset correctly reflects that all fields in this DTO are optional.
269-271: LGTM with caveat!The refactored type adapter correctly uses
validateJsonObjectto validate the JSON structure before deserialization. This change aligns with the updated validation method signature.Note: This assumes the null guard issue in
validateJsonObject(lines 225-236) is addressed.java-client/src/main/java/org/openapitools/client/model/OpenClusterDTO.java (2)
274-312: LGTM: Validation logic is correct.The refactored validation method correctly:
- Checks for required fields when JSON object is null
- Validates no unexpected fields are present
- Allows null values for all fields (consistent with @nullable annotations)
- Validates field types when values are present
The API surface change from
validateJsonElementtovalidateJsonObjectaligns with the broader refactoring mentioned in the AI summary.
334-336: LGTM: Adapter correctly uses refactored validation.The type adapter correctly reads the JSON element, casts it to
JsonObject, and calls the updatedvalidateJsonObjectmethod before deserialization.java-client/build.gradle (1)
109-122: Verify intentionality of dependency downgrades.Multiple dependencies have been downgraded to older versions:
- okhttp: 4.12.0 → 4.10.0
- gson-fire: 1.9.0 → 1.8.5
- commons-lang3: 3.18.0 → 3.12.0
- junit-jupiter: 5.10.3 → 5.9.1
Confirm these downgrades are intentional for compatibility requirements. Older versions may lack security fixes or bug patches.
Based on learnings: gson-fire 1.8.5 includes a critical date/time serialization bugfix (fractional seconds). Version 1.9.0 likely contains additional fixes.
java-client/src/main/java/org/openapitools/client/ApiClient.java (3)
766-766: LGTM:replaceAllcorrectly sanitizes all path separators.The change from
replaceFirsttoreplaceAllensures all path separators (both forward and backward slashes) are removed from filenames, not just the first occurrence. This is the correct approach for sanitization.
876-906: LGTM: String-based deserialization improves consistency.Reading the response body as a string first (lines 876-884) before deserializing allows for cleaner handling of empty bodies and provides a consistent
respBodyvariable for error messages. This is a solid refactor.
1162-1164: LGTM: Query parameter aggregation supports auth flow.Aggregating
queryParamsandcollectionQueryParamsintoallQueryParamsenables unified authentication parameter updates (line 1191) while preserving the original URL construction logic. This consolidation is appropriate.
| distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip | ||
| networkTimeout=10000 | ||
| validateDistributionUrl=true | ||
| distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip |
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.
Do not downgrade the wrapper below the patched Gradle line.
Moving the wrapper to Gradle 7.2 re-introduces the wrapper supply-chain vulnerabilities that Gradle fixed in the 7.6.2+/8.x releases (e.g., CVE-2023-26045). It also forces us to drop validateDistributionUrl, removing the hardening we previously had. Please keep the wrapper on 8.7 (or at least ≥7.6.4 if you must stay on the 7.x line) so we retain those security mitigations.
🤖 Prompt for AI Agents
In java-client/gradle/wrapper/gradle-wrapper.properties around line 3, the
Gradle wrapper was downgraded to 7.2 which re-introduces known supply-chain
vulnerabilities and removes previously applied hardening; change the
distributionUrl to a secure supported version (set to gradle-8.7-bin.zip, or at
minimum >=7.6.4 if you must stay on 7.x), and restore/keep any
validateDistributionUrl hardening settings so the wrapper uses the patched
Gradle release.
| public static void validateJsonObject(JsonObject jsonObj) throws IOException { | ||
| if (jsonObj == null) { | ||
| if (!MultiResponseEntity.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null | ||
| throw new IllegalArgumentException(String.format("The required field(s) %s in MultiResponseEntity is not found in the empty JSON string", MultiResponseEntity.openapiRequiredFields.toString())); | ||
| } | ||
| } | ||
|
|
||
| Set<Entry<String, JsonElement>> entries = jsonObj.entrySet(); | ||
| // check to see if the JSON string contains additional fields | ||
| for (Entry<String, JsonElement> entry : entries) { | ||
| if (!MultiResponseEntity.openapiFields.contains(entry.getKey())) { | ||
| throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MultiResponseEntity` properties. JSON: %s", entry.getKey(), jsonObj.toString())); | ||
| } | ||
| } | ||
|
|
||
| // check to make sure all required properties/fields are present in the JSON string | ||
| for (String requiredField : MultiResponseEntity.openapiRequiredFields) { | ||
| if (jsonObj.get(requiredField) == null) { | ||
| throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); | ||
| } | ||
| } | ||
| // ensure the json data is an array | ||
| if (!jsonObj.get("entities").isJsonArray()) { | ||
| throw new IllegalArgumentException(String.format("Expected the field `entities` to be an array in the JSON string but got `%s`", jsonObj.get("entities").toString())); | ||
| } | ||
|
|
||
| JsonArray jsonArrayentities = jsonObj.getAsJsonArray("entities"); | ||
| // validate the required field `entities` (array) | ||
| for (int i = 0; i < jsonArrayentities.size(); i++) { | ||
| RichResponseEntity.validateJsonObject(jsonArrayentities.get(i).getAsJsonObject()); | ||
| }; | ||
| } |
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.
Handle null JSON payloads safely.
When jsonObj is null, we still fall through to jsonObj.entrySet() and throw a NullPointerException. Return right after the null guard unless you’re throwing.
if (jsonObj == null) {
if (!MultiResponseEntity.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null
throw new IllegalArgumentException(String.format("The required field(s) %s in MultiResponseEntity is not found in the empty JSON string", MultiResponseEntity.openapiRequiredFields.toString()));
}
+ return;
}🤖 Prompt for AI Agents
In
java-client/src/main/java/org/openapitools/client/model/MultiResponseEntity.java
around lines 181 to 212, the method validateJsonObject() falls through after
detecting jsonObj == null and then calls jsonObj.entrySet(), causing an NPE;
update the null-check branch to either throw (if required fields exist) or
immediately return when jsonObj is null and there are no required fields so
subsequent code does not execute; keep the existing IllegalArgumentException
when required fields are missing and add a plain early return after that guard
to stop further processing.
| package org.openapitools.client.model; | ||
|
|
||
| import java.util.Objects; | ||
| import java.util.Arrays; |
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.
Remove unused and duplicate imports.
The following imports appear to be unused or duplicated:
- Line 17:
java.util.Arraysis no longer used since static initialization now uses explicitadd()calls instead ofArrays.asList() - Line 40:
java.lang.reflect.Typeis not used anywhere in the file - Lines 35-38:
TypeAdapter,JsonReader, andJsonWriterare duplicated (already imported at lines 18, 21, 22)
Apply this diff to clean up the imports:
import java.util.Objects;
-import java.util.Arrays;
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.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;Also applies to: 35-38, 40-40
🤖 Prompt for AI Agents
In
java-client/src/main/java/org/openapitools/client/model/NamespaceReleaseDTO.java
around line 17 (and also lines 35-38 and 40), there are unused and duplicate
imports: remove the unused import "java.util.Arrays" at line 17, remove
duplicate imports of "TypeAdapter", "JsonReader", and "JsonWriter" (lines 35-38)
that are already imported earlier, and remove the unused
"java.lang.reflect.Type" import at line 40; update the import block so only one
set of required JSON/GSON imports remain and ensure there are no blank-line
regressions.
| package org.openapitools.client.model; | ||
|
|
||
| import java.util.Objects; | ||
| import java.util.Arrays; |
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.
Remove unused import.
The java.util.Arrays import is no longer used after the openapiFields initialization was changed from Arrays.asList() to incremental add() calls (lines 262-268).
Apply this diff:
-import java.util.Arrays;📝 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.
| import java.util.Arrays; |
🤖 Prompt for AI Agents
In java-client/src/main/java/org/openapitools/client/model/OpenClusterDTO.java
around line 17 the import java.util.Arrays is unused; remove that import line so
only necessary imports remain and reformat imports if required by the project
style.
| public OpenClusterDTO dataChangeCreatedBy(String dataChangeCreatedBy) { | ||
|
|
||
| this.dataChangeCreatedBy = dataChangeCreatedBy; | ||
| return this; | ||
| } | ||
|
|
||
| /** | ||
| /** | ||
| * 集群创建者用户名,记录是谁创建了这个集群 | ||
| * @return dataChangeCreatedBy | ||
| */ | ||
| **/ | ||
| @javax.annotation.Nullable | ||
| public String getDataChangeCreatedBy() { | ||
| return dataChangeCreatedBy; | ||
| } | ||
|
|
||
| public void setDataChangeCreatedBy(@javax.annotation.Nullable String dataChangeCreatedBy) { | ||
|
|
||
| public void setDataChangeCreatedBy(String dataChangeCreatedBy) { | ||
| this.dataChangeCreatedBy = dataChangeCreatedBy; | ||
| } |
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.
Critical: Setter parameter nullability inconsistent with field nullability.
All setter methods now accept non-nullable String parameters, but the corresponding fields are marked as @javax.annotation.Nullable (lines 92, 113, 134, 155, 176, 197). This creates an API contract violation:
- Getters: Return
@Nullable String(fields can be null) - Setters: Accept non-nullable
String(cannot pass null) - Validation: Allows null values (lines 294-311 check
!= null)
This inconsistency will cause runtime failures if client code passes null to these setters, which should be allowed given the fields are nullable.
Apply this diff to all six setter methods to accept nullable parameters:
- public void setDataChangeCreatedBy(String dataChangeCreatedBy) {
+ public void setDataChangeCreatedBy(@javax.annotation.Nullable String dataChangeCreatedBy) {
this.dataChangeCreatedBy = dataChangeCreatedBy;
}
- public void setDataChangeLastModifiedBy(String dataChangeLastModifiedBy) {
+ public void setDataChangeLastModifiedBy(@javax.annotation.Nullable String dataChangeLastModifiedBy) {
this.dataChangeLastModifiedBy = dataChangeLastModifiedBy;
}
- public void setDataChangeCreatedTime(String dataChangeCreatedTime) {
+ public void setDataChangeCreatedTime(@javax.annotation.Nullable String dataChangeCreatedTime) {
this.dataChangeCreatedTime = dataChangeCreatedTime;
}
- public void setDataChangeLastModifiedTime(String dataChangeLastModifiedTime) {
+ public void setDataChangeLastModifiedTime(@javax.annotation.Nullable String dataChangeLastModifiedTime) {
this.dataChangeLastModifiedTime = dataChangeLastModifiedTime;
}
- public void setName(String name) {
+ public void setName(@javax.annotation.Nullable String name) {
this.name = name;
}
- public void setAppId(String appId) {
+ public void setAppId(@javax.annotation.Nullable String appId) {
this.appId = appId;
}Also applies to: 103-121, 124-142, 145-163, 166-184, 187-205
🤖 Prompt for AI Agents
In java-client/src/main/java/org/openapitools/client/model/OpenClusterDTO.java
around lines 82-100 (and similarly for the other setter blocks at 103-121,
124-142, 145-163, 166-184, 187-205), the setter methods currently declare
non-nullable String parameters while the fields/getters are annotated
@javax.annotation.Nullable; change each setter signature to accept a nullable
parameter by annotating the parameter with @javax.annotation.Nullable (e.g.,
setX(@javax.annotation.Nullable String x)) so callers may pass null, and keep
the existing internal assignment and validation logic unchanged.
43f1c6f to
049402e
Compare
Summary by CodeRabbit