Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing description parameters in external_value constructor all #860

Merged
merged 5 commits into from
Jan 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 33 additions & 7 deletions docs/apis/subsystems/external/writing-a-service.md
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,23 @@ Because some web service protocols are strict about the number and types of argu
```php
public static function get_biscuit_parameters() {
return new external_function_parameters([
'chocolatechips' => new external_value(PARAM_BOOL, PARAM_REQUIRED),
'glutenfree' => new external_value(PARAM_BOOL, PARAM_DEFAULT, false),
'chocolatechips' => new external_value(
PARAM_BOOL,
'if biscuit contains chocolate chips',
VALUE_REQUIRED
),
'glutenfree' => new external_value(
type: PARAM_BOOL,
required: VALUE_DEFAULT,
default: false,
allownull: false
),
// ERROR! top level optional parameter!!!
'icingsugar' => new external_value(PARAM_BOOL, VALUE_OPTIONAL),
'icingsugar' => new external_value(
PARAM_BOOL,
'if biscuit has icing sugar on top',
VALUE_OPTIONAL
),
]);
}
```
Expand All @@ -332,10 +345,23 @@ public static function get_biscuit_parameters() {
public static function get_biscuit_parameters() {
return new external_function_parameters([
'ifeellike' => new external_single_structure([
'chocolatechips' => new external_value(PARAM_BOOL, VALUE_REQUIRED),
'glutenfree' => new external_value(PARAM_BOOL, PARAM_DEFAULT, false),
// ALL GOOD!! We have nested the params in a external_single_structure.
'icingsugar' => new external_value(PARAM_BOOL, VALUE_OPTIONAL),
'chocolatechips' => new external_value(
PARAM_BOOL,
'if biscuit contains chocolate chips',
VALUE_REQUIRED
),
'glutenfree' => new external_value(
type: PARAM_BOOL,
required: VALUE_DEFAULT,
default: false,
allownull: false
),
// ALL GOOD!! We have nested the params in an external_single_structure.
'icingsugar' => new external_value(
PARAM_BOOL,
'if biscuit has icing sugar on top',
VALUE_OPTIONAL
),
]),
]);
}
Expand Down
Loading