/**
 * Autogenerated by Thrift for thrift/compiler/test/fixtures/exceptions/src/module.thrift
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated @nocommit
 */
#include <thrift/lib/cpp2/gen/module_metadata_cpp.h>
#include "thrift/compiler/test/fixtures/exceptions/gen-cpp2/module_metadata.h"

// some of these functions can be so large that the compiler gives up optimizing
// them - and issues a warning which may be treated as an error!
//
// these functions are so rarely called that it is probably okay for them not to
// be optimized in practice
FOLLY_CLANG_DISABLE_WARNING("-Wignored-optimization-argument")

namespace apache {
namespace thrift {
namespace detail {
namespace md {
using ThriftMetadata = ::apache::thrift::metadata::ThriftMetadata;
using ThriftPrimitiveType = ::apache::thrift::metadata::ThriftPrimitiveType;
using ThriftType = ::apache::thrift::metadata::ThriftType;
using ThriftService = ::apache::thrift::metadata::ThriftService;
using ThriftServiceContext = ::apache::thrift::metadata::ThriftServiceContext;
using ThriftFunctionGenerator = void (*)(ThriftMetadata&, ThriftService&);


const ::apache::thrift::metadata::ThriftStruct&
StructMetadata<::cpp2::Fiery>::gen(ThriftMetadata& metadata) {
  auto res = metadata.structs()->emplace("module.Fiery", ::apache::thrift::metadata::ThriftStruct{});
  if (!res.second) {
    return res.first->second;
  }
  ::apache::thrift::metadata::ThriftStruct& module_Fiery = res.first->second;
  module_Fiery.name() = "module.Fiery";
  module_Fiery.is_union() = false;
  static const auto* const
  module_Fiery_fields = new std::array<EncodedThriftField, 1>{ {
    { 1, "message", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector<ThriftConstStruct>{ *cvStruct("thrift.ExceptionMessage", {  }).cv_struct_ref(), }},  }};
  for (const auto& f : *module_Fiery_fields) {
    ::apache::thrift::metadata::ThriftField field;
    field.id() = f.id;
    field.name() = f.name;
    field.is_optional() = f.is_optional;
    f.metadata_type_interface->writeAndGenType(*field.type(), metadata);
    field.structured_annotations() = f.structured_annotations;
    module_Fiery.fields()->push_back(std::move(field));
  }
  return res.first->second;
}
const ::apache::thrift::metadata::ThriftStruct&
StructMetadata<::cpp2::Serious>::gen(ThriftMetadata& metadata) {
  auto res = metadata.structs()->emplace("module.Serious", ::apache::thrift::metadata::ThriftStruct{});
  if (!res.second) {
    return res.first->second;
  }
  ::apache::thrift::metadata::ThriftStruct& module_Serious = res.first->second;
  module_Serious.name() = "module.Serious";
  module_Serious.is_union() = false;
  static const auto* const
  module_Serious_fields = new std::array<EncodedThriftField, 1>{ {
    { 1, "sonnet", true, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector<ThriftConstStruct>{ *cvStruct("thrift.ExceptionMessage", {  }).cv_struct_ref(), *cvStruct("python.Name", { {"name", cvString("not_sonnet") } }).cv_struct_ref(), }},  }};
  for (const auto& f : *module_Serious_fields) {
    ::apache::thrift::metadata::ThriftField field;
    field.id() = f.id;
    field.name() = f.name;
    field.is_optional() = f.is_optional;
    f.metadata_type_interface->writeAndGenType(*field.type(), metadata);
    field.structured_annotations() = f.structured_annotations;
    module_Serious.fields()->push_back(std::move(field));
  }
  return res.first->second;
}
const ::apache::thrift::metadata::ThriftStruct&
StructMetadata<::cpp2::ComplexFieldNames>::gen(ThriftMetadata& metadata) {
  auto res = metadata.structs()->emplace("module.ComplexFieldNames", ::apache::thrift::metadata::ThriftStruct{});
  if (!res.second) {
    return res.first->second;
  }
  ::apache::thrift::metadata::ThriftStruct& module_ComplexFieldNames = res.first->second;
  module_ComplexFieldNames.name() = "module.ComplexFieldNames";
  module_ComplexFieldNames.is_union() = false;
  static const auto* const
  module_ComplexFieldNames_fields = new std::array<EncodedThriftField, 2>{ {
    { 1, "error_message", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector<ThriftConstStruct>{ }},    { 2, "internal_error_message", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector<ThriftConstStruct>{ *cvStruct("thrift.ExceptionMessage", {  }).cv_struct_ref(), }},  }};
  for (const auto& f : *module_ComplexFieldNames_fields) {
    ::apache::thrift::metadata::ThriftField field;
    field.id() = f.id;
    field.name() = f.name;
    field.is_optional() = f.is_optional;
    f.metadata_type_interface->writeAndGenType(*field.type(), metadata);
    field.structured_annotations() = f.structured_annotations;
    module_ComplexFieldNames.fields()->push_back(std::move(field));
  }
  return res.first->second;
}
const ::apache::thrift::metadata::ThriftStruct&
StructMetadata<::cpp2::CustomFieldNames>::gen(ThriftMetadata& metadata) {
  auto res = metadata.structs()->emplace("module.CustomFieldNames", ::apache::thrift::metadata::ThriftStruct{});
  if (!res.second) {
    return res.first->second;
  }
  ::apache::thrift::metadata::ThriftStruct& module_CustomFieldNames = res.first->second;
  module_CustomFieldNames.name() = "module.CustomFieldNames";
  module_CustomFieldNames.is_union() = false;
  static const auto* const
  module_CustomFieldNames_fields = new std::array<EncodedThriftField, 2>{ {
    { 1, "error_message", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector<ThriftConstStruct>{ }},    { 2, "internal_error_message", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector<ThriftConstStruct>{ *cvStruct("thrift.ExceptionMessage", {  }).cv_struct_ref(), }},  }};
  for (const auto& f : *module_CustomFieldNames_fields) {
    ::apache::thrift::metadata::ThriftField field;
    field.id() = f.id;
    field.name() = f.name;
    field.is_optional() = f.is_optional;
    f.metadata_type_interface->writeAndGenType(*field.type(), metadata);
    field.structured_annotations() = f.structured_annotations;
    module_CustomFieldNames.fields()->push_back(std::move(field));
  }
  return res.first->second;
}
const ::apache::thrift::metadata::ThriftStruct&
StructMetadata<::cpp2::ExceptionWithPrimitiveField>::gen(ThriftMetadata& metadata) {
  auto res = metadata.structs()->emplace("module.ExceptionWithPrimitiveField", ::apache::thrift::metadata::ThriftStruct{});
  if (!res.second) {
    return res.first->second;
  }
  ::apache::thrift::metadata::ThriftStruct& module_ExceptionWithPrimitiveField = res.first->second;
  module_ExceptionWithPrimitiveField.name() = "module.ExceptionWithPrimitiveField";
  module_ExceptionWithPrimitiveField.is_union() = false;
  static const auto* const
  module_ExceptionWithPrimitiveField_fields = new std::array<EncodedThriftField, 2>{ {
    { 1, "message", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector<ThriftConstStruct>{ *cvStruct("thrift.ExceptionMessage", {  }).cv_struct_ref(), }},    { 2, "error_code", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector<ThriftConstStruct>{ }},  }};
  for (const auto& f : *module_ExceptionWithPrimitiveField_fields) {
    ::apache::thrift::metadata::ThriftField field;
    field.id() = f.id;
    field.name() = f.name;
    field.is_optional() = f.is_optional;
    f.metadata_type_interface->writeAndGenType(*field.type(), metadata);
    field.structured_annotations() = f.structured_annotations;
    module_ExceptionWithPrimitiveField.fields()->push_back(std::move(field));
  }
  return res.first->second;
}
const ::apache::thrift::metadata::ThriftStruct&
StructMetadata<::cpp2::ExceptionWithStructuredAnnotation>::gen(ThriftMetadata& metadata) {
  auto res = metadata.structs()->emplace("module.ExceptionWithStructuredAnnotation", ::apache::thrift::metadata::ThriftStruct{});
  if (!res.second) {
    return res.first->second;
  }
  ::apache::thrift::metadata::ThriftStruct& module_ExceptionWithStructuredAnnotation = res.first->second;
  module_ExceptionWithStructuredAnnotation.name() = "module.ExceptionWithStructuredAnnotation";
  module_ExceptionWithStructuredAnnotation.is_union() = false;
  static const auto* const
  module_ExceptionWithStructuredAnnotation_fields = new std::array<EncodedThriftField, 2>{ {
    { 1, "message_field", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector<ThriftConstStruct>{ *cvStruct("thrift.ExceptionMessage", {  }).cv_struct_ref(), }},    { 2, "error_code", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector<ThriftConstStruct>{ }},  }};
  for (const auto& f : *module_ExceptionWithStructuredAnnotation_fields) {
    ::apache::thrift::metadata::ThriftField field;
    field.id() = f.id;
    field.name() = f.name;
    field.is_optional() = f.is_optional;
    f.metadata_type_interface->writeAndGenType(*field.type(), metadata);
    field.structured_annotations() = f.structured_annotations;
    module_ExceptionWithStructuredAnnotation.fields()->push_back(std::move(field));
  }
  return res.first->second;
}
const ::apache::thrift::metadata::ThriftStruct&
StructMetadata<::cpp2::Banal>::gen(ThriftMetadata& metadata) {
  auto res = metadata.structs()->emplace("module.Banal", ::apache::thrift::metadata::ThriftStruct{});
  if (!res.second) {
    return res.first->second;
  }
  ::apache::thrift::metadata::ThriftStruct& module_Banal = res.first->second;
  module_Banal.name() = "module.Banal";
  module_Banal.is_union() = false;
  return res.first->second;
}

void ExceptionMetadata<::cpp2::Fiery>::gen(ThriftMetadata& metadata) {
  auto res = metadata.exceptions()->emplace("module.Fiery", ::apache::thrift::metadata::ThriftException{});
  if (!res.second) {
    return;
  }
  ::apache::thrift::metadata::ThriftException& module_Fiery = res.first->second;
  module_Fiery.name() = "module.Fiery";
  static const auto* const
  module_Fiery_fields = new std::array<EncodedThriftField, 1>{ {
    { 1, "message", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector<ThriftConstStruct>{ *cvStruct("thrift.ExceptionMessage", {  }).cv_struct_ref(), }},  }};
  for (const auto& f : *module_Fiery_fields) {
    ::apache::thrift::metadata::ThriftField field;
    field.id() = f.id;
    field.name() = f.name;
    field.is_optional() = f.is_optional;
    f.metadata_type_interface->writeAndGenType(*field.type(), metadata);
    module_Fiery.fields()->push_back(std::move(field));
  }
}
void ExceptionMetadata<::cpp2::Serious>::gen(ThriftMetadata& metadata) {
  auto res = metadata.exceptions()->emplace("module.Serious", ::apache::thrift::metadata::ThriftException{});
  if (!res.second) {
    return;
  }
  ::apache::thrift::metadata::ThriftException& module_Serious = res.first->second;
  module_Serious.name() = "module.Serious";
  static const auto* const
  module_Serious_fields = new std::array<EncodedThriftField, 1>{ {
    { 1, "sonnet", true, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector<ThriftConstStruct>{ *cvStruct("thrift.ExceptionMessage", {  }).cv_struct_ref(), *cvStruct("python.Name", { {"name", cvString("not_sonnet") } }).cv_struct_ref(), }},  }};
  for (const auto& f : *module_Serious_fields) {
    ::apache::thrift::metadata::ThriftField field;
    field.id() = f.id;
    field.name() = f.name;
    field.is_optional() = f.is_optional;
    f.metadata_type_interface->writeAndGenType(*field.type(), metadata);
    module_Serious.fields()->push_back(std::move(field));
  }
}
void ExceptionMetadata<::cpp2::ComplexFieldNames>::gen(ThriftMetadata& metadata) {
  auto res = metadata.exceptions()->emplace("module.ComplexFieldNames", ::apache::thrift::metadata::ThriftException{});
  if (!res.second) {
    return;
  }
  ::apache::thrift::metadata::ThriftException& module_ComplexFieldNames = res.first->second;
  module_ComplexFieldNames.name() = "module.ComplexFieldNames";
  static const auto* const
  module_ComplexFieldNames_fields = new std::array<EncodedThriftField, 2>{ {
    { 1, "error_message", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector<ThriftConstStruct>{ }},    { 2, "internal_error_message", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector<ThriftConstStruct>{ *cvStruct("thrift.ExceptionMessage", {  }).cv_struct_ref(), }},  }};
  for (const auto& f : *module_ComplexFieldNames_fields) {
    ::apache::thrift::metadata::ThriftField field;
    field.id() = f.id;
    field.name() = f.name;
    field.is_optional() = f.is_optional;
    f.metadata_type_interface->writeAndGenType(*field.type(), metadata);
    module_ComplexFieldNames.fields()->push_back(std::move(field));
  }
}
void ExceptionMetadata<::cpp2::CustomFieldNames>::gen(ThriftMetadata& metadata) {
  auto res = metadata.exceptions()->emplace("module.CustomFieldNames", ::apache::thrift::metadata::ThriftException{});
  if (!res.second) {
    return;
  }
  ::apache::thrift::metadata::ThriftException& module_CustomFieldNames = res.first->second;
  module_CustomFieldNames.name() = "module.CustomFieldNames";
  static const auto* const
  module_CustomFieldNames_fields = new std::array<EncodedThriftField, 2>{ {
    { 1, "error_message", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector<ThriftConstStruct>{ }},    { 2, "internal_error_message", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector<ThriftConstStruct>{ *cvStruct("thrift.ExceptionMessage", {  }).cv_struct_ref(), }},  }};
  for (const auto& f : *module_CustomFieldNames_fields) {
    ::apache::thrift::metadata::ThriftField field;
    field.id() = f.id;
    field.name() = f.name;
    field.is_optional() = f.is_optional;
    f.metadata_type_interface->writeAndGenType(*field.type(), metadata);
    module_CustomFieldNames.fields()->push_back(std::move(field));
  }
}
void ExceptionMetadata<::cpp2::ExceptionWithPrimitiveField>::gen(ThriftMetadata& metadata) {
  auto res = metadata.exceptions()->emplace("module.ExceptionWithPrimitiveField", ::apache::thrift::metadata::ThriftException{});
  if (!res.second) {
    return;
  }
  ::apache::thrift::metadata::ThriftException& module_ExceptionWithPrimitiveField = res.first->second;
  module_ExceptionWithPrimitiveField.name() = "module.ExceptionWithPrimitiveField";
  static const auto* const
  module_ExceptionWithPrimitiveField_fields = new std::array<EncodedThriftField, 2>{ {
    { 1, "message", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector<ThriftConstStruct>{ *cvStruct("thrift.ExceptionMessage", {  }).cv_struct_ref(), }},    { 2, "error_code", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector<ThriftConstStruct>{ }},  }};
  for (const auto& f : *module_ExceptionWithPrimitiveField_fields) {
    ::apache::thrift::metadata::ThriftField field;
    field.id() = f.id;
    field.name() = f.name;
    field.is_optional() = f.is_optional;
    f.metadata_type_interface->writeAndGenType(*field.type(), metadata);
    module_ExceptionWithPrimitiveField.fields()->push_back(std::move(field));
  }
}
void ExceptionMetadata<::cpp2::ExceptionWithStructuredAnnotation>::gen(ThriftMetadata& metadata) {
  auto res = metadata.exceptions()->emplace("module.ExceptionWithStructuredAnnotation", ::apache::thrift::metadata::ThriftException{});
  if (!res.second) {
    return;
  }
  ::apache::thrift::metadata::ThriftException& module_ExceptionWithStructuredAnnotation = res.first->second;
  module_ExceptionWithStructuredAnnotation.name() = "module.ExceptionWithStructuredAnnotation";
  static const auto* const
  module_ExceptionWithStructuredAnnotation_fields = new std::array<EncodedThriftField, 2>{ {
    { 1, "message_field", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_STRING_TYPE), std::vector<ThriftConstStruct>{ *cvStruct("thrift.ExceptionMessage", {  }).cv_struct_ref(), }},    { 2, "error_code", false, std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_I32_TYPE), std::vector<ThriftConstStruct>{ }},  }};
  for (const auto& f : *module_ExceptionWithStructuredAnnotation_fields) {
    ::apache::thrift::metadata::ThriftField field;
    field.id() = f.id;
    field.name() = f.name;
    field.is_optional() = f.is_optional;
    f.metadata_type_interface->writeAndGenType(*field.type(), metadata);
    module_ExceptionWithStructuredAnnotation.fields()->push_back(std::move(field));
  }
}
void ExceptionMetadata<::cpp2::Banal>::gen(ThriftMetadata& metadata) {
  auto res = metadata.exceptions()->emplace("module.Banal", ::apache::thrift::metadata::ThriftException{});
  if (!res.second) {
    return;
  }
  ::apache::thrift::metadata::ThriftException& module_Banal = res.first->second;
  module_Banal.name() = "module.Banal";
}
void ServiceMetadata<::apache::thrift::ServiceHandler<::cpp2::Raiser>>::gen_doBland([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) {
  ::apache::thrift::metadata::ThriftFunction func;
  func.name() = "doBland";
  auto func_ret_type = std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_VOID_TYPE);
  func_ret_type->writeAndGenType(*func.return_type(), metadata);
  func.is_oneway() = false;
  service.functions()->push_back(std::move(func));
}
void ServiceMetadata<::apache::thrift::ServiceHandler<::cpp2::Raiser>>::gen_doRaise([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) {
  ::apache::thrift::metadata::ThriftFunction func;
  func.name() = "doRaise";
  auto func_ret_type = std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_VOID_TYPE);
  func_ret_type->writeAndGenType(*func.return_type(), metadata);
  ::apache::thrift::metadata::ThriftField module_Raiser_doRaise_b_1;
  module_Raiser_doRaise_b_1.id() = 1;
  module_Raiser_doRaise_b_1.name() = "b";
  module_Raiser_doRaise_b_1.is_optional() = false;
  auto module_Raiser_doRaise_b_1_type = std::make_unique<Struct<::cpp2::Banal>>("module.Banal");
  module_Raiser_doRaise_b_1_type->writeAndGenType(*module_Raiser_doRaise_b_1.type(), metadata);
  func.exceptions()->push_back(std::move(module_Raiser_doRaise_b_1));
  ExceptionMetadata<::cpp2::Banal>::gen(metadata);
  ::apache::thrift::metadata::ThriftField module_Raiser_doRaise_f_2;
  module_Raiser_doRaise_f_2.id() = 2;
  module_Raiser_doRaise_f_2.name() = "f";
  module_Raiser_doRaise_f_2.is_optional() = false;
  auto module_Raiser_doRaise_f_2_type = std::make_unique<Struct<::cpp2::Fiery>>("module.Fiery");
  module_Raiser_doRaise_f_2_type->writeAndGenType(*module_Raiser_doRaise_f_2.type(), metadata);
  func.exceptions()->push_back(std::move(module_Raiser_doRaise_f_2));
  ExceptionMetadata<::cpp2::Fiery>::gen(metadata);
  ::apache::thrift::metadata::ThriftField module_Raiser_doRaise_s_3;
  module_Raiser_doRaise_s_3.id() = 3;
  module_Raiser_doRaise_s_3.name() = "s";
  module_Raiser_doRaise_s_3.is_optional() = false;
  auto module_Raiser_doRaise_s_3_type = std::make_unique<Struct<::cpp2::Serious>>("module.Serious");
  module_Raiser_doRaise_s_3_type->writeAndGenType(*module_Raiser_doRaise_s_3.type(), metadata);
  func.exceptions()->push_back(std::move(module_Raiser_doRaise_s_3));
  ExceptionMetadata<::cpp2::Serious>::gen(metadata);
  func.is_oneway() = false;
  service.functions()->push_back(std::move(func));
}
void ServiceMetadata<::apache::thrift::ServiceHandler<::cpp2::Raiser>>::gen_get200([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) {
  ::apache::thrift::metadata::ThriftFunction func;
  func.name() = "get200";
  auto func_ret_type = std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_STRING_TYPE);
  func_ret_type->writeAndGenType(*func.return_type(), metadata);
  func.is_oneway() = false;
  service.functions()->push_back(std::move(func));
}
void ServiceMetadata<::apache::thrift::ServiceHandler<::cpp2::Raiser>>::gen_get500([[maybe_unused]] ThriftMetadata& metadata, ThriftService& service) {
  ::apache::thrift::metadata::ThriftFunction func;
  func.name() = "get500";
  auto func_ret_type = std::make_unique<Primitive>(ThriftPrimitiveType::THRIFT_STRING_TYPE);
  func_ret_type->writeAndGenType(*func.return_type(), metadata);
  ::apache::thrift::metadata::ThriftField module_Raiser_get500_f_1;
  module_Raiser_get500_f_1.id() = 1;
  module_Raiser_get500_f_1.name() = "f";
  module_Raiser_get500_f_1.is_optional() = false;
  auto module_Raiser_get500_f_1_type = std::make_unique<Struct<::cpp2::Fiery>>("module.Fiery");
  module_Raiser_get500_f_1_type->writeAndGenType(*module_Raiser_get500_f_1.type(), metadata);
  func.exceptions()->push_back(std::move(module_Raiser_get500_f_1));
  ExceptionMetadata<::cpp2::Fiery>::gen(metadata);
  ::apache::thrift::metadata::ThriftField module_Raiser_get500_b_2;
  module_Raiser_get500_b_2.id() = 2;
  module_Raiser_get500_b_2.name() = "b";
  module_Raiser_get500_b_2.is_optional() = false;
  auto module_Raiser_get500_b_2_type = std::make_unique<Struct<::cpp2::Banal>>("module.Banal");
  module_Raiser_get500_b_2_type->writeAndGenType(*module_Raiser_get500_b_2.type(), metadata);
  func.exceptions()->push_back(std::move(module_Raiser_get500_b_2));
  ExceptionMetadata<::cpp2::Banal>::gen(metadata);
  ::apache::thrift::metadata::ThriftField module_Raiser_get500_s_3;
  module_Raiser_get500_s_3.id() = 3;
  module_Raiser_get500_s_3.name() = "s";
  module_Raiser_get500_s_3.is_optional() = false;
  auto module_Raiser_get500_s_3_type = std::make_unique<Struct<::cpp2::Serious>>("module.Serious");
  module_Raiser_get500_s_3_type->writeAndGenType(*module_Raiser_get500_s_3.type(), metadata);
  func.exceptions()->push_back(std::move(module_Raiser_get500_s_3));
  ExceptionMetadata<::cpp2::Serious>::gen(metadata);
  func.is_oneway() = false;
  service.functions()->push_back(std::move(func));
}

void ServiceMetadata<::apache::thrift::ServiceHandler<::cpp2::Raiser>>::gen(::apache::thrift::metadata::ThriftServiceMetadataResponse& response) {
  const ::apache::thrift::metadata::ThriftServiceContextRef* self = genRecurse(*response.metadata(), *response.services());
  DCHECK(self != nullptr);
  // TODO(praihan): Remove ThriftServiceContext from response. But in the meantime, we need to fill the field with the result of looking up in ThriftMetadata.
  ::apache::thrift::metadata::ThriftServiceContext context;
  context.module() = *self->module();
  context.service_info() = response.metadata()->services()->at(*self->service_name());
  response.context() = std::move(context);
}

const ThriftServiceContextRef* ServiceMetadata<::apache::thrift::ServiceHandler<::cpp2::Raiser>>::genRecurse([[maybe_unused]] ThriftMetadata& metadata, std::vector<ThriftServiceContextRef>& services) {
  ::apache::thrift::metadata::ThriftService module_Raiser;
  module_Raiser.name() = "module.Raiser";
  static const ThriftFunctionGenerator functions[] = {
    ServiceMetadata<::apache::thrift::ServiceHandler<::cpp2::Raiser>>::gen_doBland,
    ServiceMetadata<::apache::thrift::ServiceHandler<::cpp2::Raiser>>::gen_doRaise,
    ServiceMetadata<::apache::thrift::ServiceHandler<::cpp2::Raiser>>::gen_get200,
    ServiceMetadata<::apache::thrift::ServiceHandler<::cpp2::Raiser>>::gen_get500,
  };
  for (auto& function_gen : functions) {
    function_gen(metadata, module_Raiser);
  }
  // We need to keep the index around because a reference or iterator could be invalidated.
  auto selfIndex = services.size();
  services.emplace_back();
  ThriftServiceContextRef& context = services[selfIndex];
  metadata.services()->emplace("module.Raiser", std::move(module_Raiser));
  context.service_name() = "module.Raiser";
  ::apache::thrift::metadata::ThriftModuleContext module;
  module.name() = "module";
  context.module() = std::move(module);
  return &context;
}
} // namespace md
} // namespace detail
} // namespace thrift
} // namespace apache
