dereference method

Response dereference({
  1. required Map<String, Response>? components,
})

Implementation

Response dereference({
  required Map<String, Response>? components,
}) {
  if (ref == null) {
    return this;
  }
  final rRef = components?[ref?.split('/').last];
  if (rRef == null) {
    throw Exception(
      "\n\n'$ref' is not a valid component response reference\n",
    );
  }

  _checkReferenceTypes(ref, rRef, this);

  return rRef.copyWith(
    ref: ref,
    description: description.isEmpty ? rRef.description : description,
  );
}