janiussyafiq opened a new pull request, #3472: URL: https://github.com/apache/apisix-dashboard/pull/3472
Please answer these questions before submitting a pull request, **or your PR will get closed**. **Why submit this pull request?** - [x] Bugfix - [ ] New feature provided - [ ] Improve performance - [ ] Backport patches **What changes will this PR take into?** The gateway's `id_schema` is `anyOf [string, integer]` and it stores the JSON type the writer sent, so a route created by another client with `"plugin_config_id": 10001` reads back with a number in that field. Since #3459, `ResourceRef` calls `.trim()` on that value and every detail page that renders a reference field (routes, services, consumers) crashes to "Something went wrong"; before #3459 the page rendered but Save failed with "Expected string, received number". - Add `APISIXCommon.RefId` (string or positive integer, normalized to a string) and use it for every reference field: `upstream_id`, `service_id`, `plugin_config_id`, `script_id`, `group_id`, `client_cert_id`, `superior_id`. - `ResourceRef` reads the id through `toRefId`, so the raw number the form holds before validation no longer throws. - Tests: a gateway-contract check that every `anyOf [string, integer]` field accepts the integer form, unit tests for `RefId` and `toRefId`, and an e2e spec that seeds numeric references through the Admin API and verifies render, resolved link and save for a route, a service and a consumer. **Related issues** fix #3471, close #3470 **Checklist:** - [x] Did you explain what problem does this PR solve? Or what new features have been added? - [x] Have you added corresponding test cases? - [ ] Have you modified the corresponding document? - [x] Is this PR backward compatible? If it is not backward compatible, please discuss on the mailing list first -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
