lxbme commented on PR #13078:
URL: https://github.com/apache/apisix/pull/13078#issuecomment-4067622762

   Hi @moonming. Thanks for the suggestion! I've updated the fix to use a more 
targeted approach.
   
   Instead of disabling type conversion entirely for apisix.yaml, I added a 
exceeds_lua_precision() helper that checks whether a string is a pure integer 
longer than 15 digits (the safe limit for Lua's double). If so, tonumber() is 
skipped and the value is kept as a string. All other values, such as small 
integers, floats, booleans,  are still converted as before.
   
   This also **removes the enable_type_conversion parameter** from 
resolve_conf_var, so config.yaml and apisix.yaml now share identical conversion 
logic.
   
   This should get the job done while minimizing changes to the existing logic.
   
   Updated tests cover:
   
   - Large integers (>15 digits) preserved as string in apisix.yaml
   - Small integers (status_code, upstream weight/retries) correctly converted 
to number in apisix.yaml
   - Boolean env vars correctly converted to boolean in apisix.yaml (verified 
via redirect plugin returning 301)
   - Numeric and boolean env vars still converted correctly in config.yaml 
(backward compatibility)
   
   Does this fix address the issue appropriately? Once confirmed, I will 
proceed with updating the relevant documentation.


-- 
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]

Reply via email to