Baoyuantop commented on PR #13178:
URL: https://github.com/apache/apisix/pull/13178#issuecomment-4294161441

   The updated approach aligns well with our earlier discussion — clean schema 
with explicit `name`/`path`/`lifetime` plus `additionalProperties` 
pass-through. Tests are comprehensive. Thank you for the iteration.
   
   One concern about **key conflict in `build_session_opts`**: if a user sets 
both `lifetime` and `absolute_timeout` (or `name`/`cookie_name`, 
`path`/`cookie_path`) under `session.cookie`, the `pairs()` iteration order is 
non-deterministic, so the final value of `opts.absolute_timeout` depends on the 
internal Lua hash table traversal order.
   
   Suggestion — add a conflict warning or precedence rule, e.g.:
   
   ```lua
   local cookie = session_conf.cookie
   if cookie then
       for k, v in pairs(cookie) do
           local mapped = cookie_key_map[k]
           local target_key = mapped or k
           if mapped and cookie[target_key] then
               core.log.warn("session.cookie: both '", k, "' and '", target_key,
                             "' are set; using '", k, "' (mapped to '", 
target_key, "')")
           end
           opts[target_key] = v
       end
   end
   ```
   
   Alternatively, document clearly that users should not set both a mapped 
alias and its corresponding flat key simultaneously.


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