fix(JSONInput): toObject logic#3117
Merged
SkyeYoung merged 3 commits intoapache:masterfrom Jun 13, 2025
Merged
Conversation
5 tasks
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes data processing logic for stream_routes components by making schema fields optional, updating displayed columns, applying upstream removal logic when service_id is present, and enhancing the JSON input component to correctly handle object defaults.
- Mark
confandloggeras optional in theStreamRouteProtocolschema. - Replace the “name” column with
server_addrandserver_portin the stream routes list. - Apply
produceRmUpstreamWhenHas('service_id')viapipeProducein add/detail forms. - Extend
FormItemJsonInputwith atoObjectmode and customizableobjValue.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/types/schema/apisix/stream_routes.ts | Made conf and logger fields optional |
| src/routes/stream_routes/index.tsx | Updated table columns to show server_addr and server_port |
| src/routes/stream_routes/detail.$id.tsx | Integrated produceRmUpstreamWhenHas into the update mutation |
| src/routes/stream_routes/add.tsx | Integrated produceRmUpstreamWhenHas into the create mutation |
| src/components/form/JsonInput.tsx | Added toObject/objValue support and omitted prop from rest |
| src/components/form-slice/FormPartStreamRoute/index.tsx | Passed toObject and objValue to JSON inputs |
Comments suppressed due to low confidence (2)
src/components/form/JsonInput.tsx:28
- [nitpick] Add a clear JSDoc comment for the new
objValueprop inFormItemJsonInputProps, specifying its intended use and expected structure to improve maintainability.
export type FormItemJsonInputProps<T extends FieldValues> = UseControllerProps<T> &
src/components/form/JsonInput.tsx:52
- Introduce unit tests for
FormItemJsonInputcovering scenarios wheretoObjectis true/false and whenobjValuedefaults are applied, ensuring JSON parsing and default-value logic behave as expected.
}, [rawVal, toObject, objValue]);
This reverts commit 3495126.
4 tasks
LiteSun
approved these changes
Jun 13, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please answer these questions before submitting a pull request, or your PR will get closed.
Why submit this pull request?
What changes will this PR take into?
Fixed data processing logic for stream_routes-related components to ensure that data can be correctly echoed or submitted.
These problems are found in PR #3113
JSONInput toObject logic