Support `default` field in MQL spec code generator, ignored when `optional: true`

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Builder
    • None
    • None
    • PHP Drivers
    • None
    • None
    • None
    • None
    • None
    • None

      The MQL specifications support a default field on arguments to document server-side default values. Currently, the PHP code generator ignores this field entirely — the only exception is $function, where args and lang have defaults that are always serialized.

      The goal is to use default more broadly in the spec (e.g. exact: false in vectorSearch), with the following rule for the PHP generator:

      • If optional: true → document the default in the spec but do not include it in PHP method signatures or serialized output (PHP does not send default values to the server)
      • If optional: false (required argument with a default, like $function.lang) → always serialize the default value

      Tasks:

      1. Update the spec to add default values on optional arguments where applicable (starting with vectorSearch.exact)
      2. Update the PHP code generator to respect this rule

      Reference: https://github.com/mongodb/mql-specifications/pull/45#discussion_r3309792110

            Assignee:
            Jérôme Tamarelle
            Reporter:
            Jérôme Tamarelle
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: