documentOperationParameters method Null safety

  1. @override
List<APIParameter?> documentOperationParameters(
  1. APIDocumentContext context,
  2. Operation? operation
)
override

Returns a documented list of APIParameter for operation.

This method will automatically create APIParameters for any bound properties and operation method arguments. If an operation method requires additional parameters that cannot be bound using Bind annotations, override this method. When overriding this method, call the superclass' implementation and add the additional parameters to the returned list before returning the combined list.

Implementation

@override
List<APIParameter?> documentOperationParameters(
  APIDocumentContext context,
  Operation? operation,
) {
  final params = super.documentOperationParameters(context, operation)!;
  params.where((p) => p!.name != "scope").forEach((p) {
    p!.isRequired = true;
  });
  return params;
}