containsPathParameters method

bool containsPathParameters(
  1. List<String> parameterNames
)

Returns true if this path has path parameters parameterNames.

Returns true if parameters contains path parameters with names that match parameterNames and both lists have the same number of elements.

Implementation

bool containsPathParameters(List<String> parameterNames) {
  final pathParams = parameters
          ?.where((p) => p.location == APIParameterLocation.path)
          .map((p) => p.name)
          .toList() ??
      [];
  if (pathParams.length != parameterNames.length) {
    return false;
  }

  return parameterNames.every((check) => pathParams.contains(check));
}