sagrawal1993 commented on PR #14221: URL: https://github.com/apache/apisix/pull/14221#issuecomment-7015729575
Thanks for the review, and for reproducing it. **Conversion paths.** The order now travels with the decoded objects, as you suggested: before a protocol converter runs, `json_order.attach` marks each object of the body with its own shape (in a metatable, under a private key). `core.table.deepcopy` keeps metatables, so both cases are covered with no change to the converter: - a tool's `input_schema` moved by reference to `tools[].function.parameters`; - `output_format.schema` / `output_config.format.schema` deep-copied and normalized into `response_format.json_schema.schema` — `properties` keep the client's order at every level, with the converter's `additionalProperties` / `required` after. `encode` uses an object's own shape before the shape of its path. For a converted body the path shape isn't used at all, since its paths don't correspond to the client's: objects the converter builds (the root, messages, the tool wrapper) are written with sorted keys as today. `child()` and the `shapes` argument are gone. Requests without a converter don't pay for `attach`. **Tests.** Sorry about the description/diff mismatch — I had pushed an older revision. The PR now has every test it lists, plus end-to-end assertions for both converted schema paths (`t/plugin/ai-proxy-key-order.t` TEST 9–11: nested objects and `items` in a tool schema, and the beta and GA output-schema fields). TEST 9–11 fail on the previous revision with `properties` sorted, and pass now. Unit tests for `attach` (moved by reference, deep-copied, foreign metatables left alone, `deep_merge` still treating marked objects as objects) are in `t/utils/json-order.t`. One thing I left alone: `normalize_strict_schema` still writes `required` sorted. The model follows `properties`, which is now kept; I can make `required` follow `properties` in a follow-up if you'd like. -- 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]
