To answer my own question - remove optional from each choice, and put it
after choice section:
"name": "getX",
"type": "function",
"description": "Get X.",
"parameters": [
{ "type": "string", "name": "message_name"},
{
"choices": [
{ "type": "string"},
{
"type": "array",
"items": {"type": "string"},
"minItems": 1
},
],
"optional": true,
"description": "One or more substitution parameters, if the
message requires any."
}
]
}
Cira
On Mon, Sep 21, 2009 at 5:33 PM, Nebojša Ćirić <[email protected]> wrote:
> I am adding a method that should be able to handle 4 kinds of invocations:
>
> 1. getX("name")
> 2. getX("name", "one param")
> 3. getX("name", ["one param"])
> 4. getX("name", ["more", "than", "one", "param")
>
> I've defined getX in extension_api.json as:
>
> "name": "getX",
> "type": "function",
> "description": "Get X.",
> "parameters": [
> { "type": "string", "name": "message_name"},
> {
> "choices": [
> { "type": "string", "optional": true},
> {
> "type": "array",
> "items": {"type": "string"},
> "optional": true,
> "minItems": 1
> },
> ],
> "description": "One or more substitution parameters, if the
> message requires any."
> }
> ]
> }
>
> All cases, but 1st work (work = browser code gets called).
>
> Is there a way to keep choices section, but mark whole as optional (both
> params in choices are already marked as optional but it doesn't help)?
>
> If I remove choices and go orthodox way of having only an array, as
> optional parameter, then 1, 3, and 4 work.
>
>
> Cira
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Chromium-extensions" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/chromium-extensions?hl=en
-~----------~----~----~----~------~----~------~--~---