extractMethodResponseInnerDataType function

Future<Map<String, dynamic>> extractMethodResponseInnerDataType(
  1. String filePath,
  2. String methodName
)

Extracts the type of the 'data' field from a method's response type.

Implementation

Future<Map<String, dynamic>> extractMethodResponseInnerDataType(
  String filePath,
  String methodName,
) async {
  if (filePath.endsWith('.proto')) {
    final responseType = extractProtoMethodResponseType(filePath, methodName);
    return {
      "responseDataType": responseType,
      "hitField": "", // Proto responses don't usually have a 'data' field like openapi
    };
  }
  return await extractMethodResponseTypeWithField(
    filePath,
    methodName,
    "data,body",
  );
}