Squashed 'third_party/flatbuffers/' changes from d6a8dbd26..338393f85

338393f85 Documentation updates for Optional Scalars (#6014) (#6270)
c27bc2d76 [C++] Add ParseJson(), Parser(Parser&&), update fuzzers (#6284)
bc518a512 Fixed FlexBufferBuilder asserting on duplicate keys
100c59054 Added a few more paths for auto labeler (#6281)
e58c18244 Add --require-explicit-ids to require explicit ids (#6277)
69a8b2a57 idl_gen_json_schema.cpp: Changed generation of array element types (#6253)
25eba6f35 fix typo (#6280)
e1f0f75ba Updated Ms build Action to fix build issue (#6279)
faeb04fbe Add type annotation to unspecified array (#6264)
537212afe [Swift] Adds a format file and reformats the swift project (#6250)
6764f25d9 Adds a fix for enum generation (#6263)

Change-Id: I716bd4d2521fb0a673e50a699cef761e042052b2
git-subtree-dir: third_party/flatbuffers
git-subtree-split: 338393f854eb5ba24761a22cd9316ff5cee4eab0
diff --git a/grpc/src/compiler/swift_generator.cc b/grpc/src/compiler/swift_generator.cc
index bb731d5..95e8858 100644
--- a/grpc/src/compiler/swift_generator.cc
+++ b/grpc/src/compiler/swift_generator.cc
@@ -100,7 +100,7 @@
     vars["Output"] = GenerateMessage(method->get_output_namespace_parts(), method->get_output_type_name());
     vars["MethodName"] = method->name();
     vars["isNil"] = "";
-    printer->Print("\t");
+    printer->Print("  ");
     auto func = GenerateClientFuncName(method.get());
     printer->Print(vars, func.c_str());
     printer->Print("\n");
@@ -115,15 +115,15 @@
   printer->Print(vars,
                  "$ACCESS$ final class $ServiceQualifiedName$ServiceClient: GRPCClient, "
                  "$ServiceQualifiedName$Service {\n");
-  printer->Print(vars, "\t$ACCESS$ let channel: GRPCChannel\n");
-  printer->Print(vars, "\t$ACCESS$ var defaultCallOptions: CallOptions\n");
+  printer->Print(vars, "  $ACCESS$ let channel: GRPCChannel\n");
+  printer->Print(vars, "  $ACCESS$ var defaultCallOptions: CallOptions\n");
   printer->Print("\n");
   printer->Print(vars,
-                 "\t$ACCESS$ init(channel: GRPCChannel, "
+                 "  $ACCESS$ init(channel: GRPCChannel, "
                  "defaultCallOptions: CallOptions = CallOptions()) {\n");
-  printer->Print("\t\tself.channel = channel\n");
-  printer->Print("\t\tself.defaultCallOptions = defaultCallOptions\n");
-  printer->Print("\t}");
+  printer->Print("    self.channel = channel\n");
+  printer->Print("    self.defaultCallOptions = defaultCallOptions\n");
+  printer->Print("  }");
   printer->Print("\n");
   vars["GenAccess"] = service->is_internal() ? "internal" : "public";
   for (auto it = 0; it < service->method_count(); it++) {
@@ -132,14 +132,14 @@
     vars["Output"] = GenerateMessage(method->get_output_namespace_parts(), method->get_output_type_name());
     vars["MethodName"] = method->name();
     vars["isNil"] = " = nil";
-    printer->Print("\n\t");
+    printer->Print("\n  ");
     auto func = GenerateClientFuncName(method.get());
     printer->Print(vars, func.c_str());
     printer->Print(" {\n");
     auto body = GenerateClientFuncBody(method.get());
-    printer->Print("\t\t");
+    printer->Print("    ");
     printer->Print(vars, body.c_str());
-    printer->Print("\n\t}\n");
+    printer->Print("\n  }\n");
   }
   printer->Print("}\n");
 }
@@ -168,44 +168,44 @@
 }
 
 grpc::string GenerateServerExtensionBody(const grpc_generator::Method *method) {
-  grpc::string start = "\t\tcase \"$MethodName$\":\n\t\t";
+  grpc::string start = "    case \"$MethodName$\":\n    ";
   if (method->NoStreaming()) {
     return start +
            "return CallHandlerFactory.makeUnary(callHandlerContext: callHandlerContext) { "
            "context in"
-           "\n\t\t\t"
+           "\n      "
            "return { request in"
-           "\n\t\t\t\t"
+           "\n        "
            "self.$MethodName$(request, context: context)"
-           "\n\t\t\t}"
-           "\n\t\t}";
+           "\n      }"
+           "\n    }";
   }
   if (method->ClientStreaming()) {
     return start +
            "return CallHandlerFactory.makeClientStreaming(callHandlerContext: "
            "callHandlerContext) { context in"
-           "\n\t\t\t"
+           "\n      "
            "self.$MethodName$(context: context)"
-           "\n\t\t}";
+           "\n    }";
   }
   if (method->ServerStreaming()) {
     return start +
            "return CallHandlerFactory.makeServerStreaming(callHandlerContext: "
            "callHandlerContext) { context in"
-           "\n\t\t\t"
+           "\n      "
            "return { request in"
-           "\n\t\t\t\t"
+           "\n        "
            "self.$MethodName$(request: request, context: context)"
-           "\n\t\t\t}"
-           "\n\t\t}";
+           "\n      }"
+           "\n    }";
   }
   if (method->BidiStreaming()) {
     return start +
            "return CallHandlerFactory.makeBidirectionalStreaming(callHandlerContext: "
            "callHandlerContext) { context in"
-           "\n\t\t\t"
+           "\n      "
            "self.$MethodName$(context: context)"
-           "\n\t\t}";
+           "\n    }";
   }
   return "";
 }
@@ -221,7 +221,7 @@
     vars["Input"] = GenerateMessage(method->get_input_namespace_parts(), method->get_input_type_name());
     vars["Output"] = GenerateMessage(method->get_output_namespace_parts(), method->get_output_type_name());
     vars["MethodName"] = method->name();
-    printer->Print("\t");
+    printer->Print("  ");
     auto func = GenerateServerFuncName(method.get());
     printer->Print(vars, func.c_str());
     printer->Print("\n");
@@ -231,13 +231,13 @@
   printer->Print(vars, "$ACCESS$ extension $ServiceQualifiedName$Provider {\n");
   printer->Print("\n");
   printer->Print(vars,
-                 "\tvar serviceName: Substring { return "
+                 "  var serviceName: Substring { return "
                  "\"$PATH$$ServiceName$\" }\n");
   printer->Print("\n");
   printer->Print(
-      "\tfunc handleMethod(_ methodName: Substring, callHandlerContext: "
+      "  func handleMethod(_ methodName: Substring, callHandlerContext: "
       "CallHandlerContext) -> GRPCCallHandler? {\n");
-  printer->Print("\t\tswitch methodName {\n");
+  printer->Print("    switch methodName {\n");
   for (auto it = 0; it < service->method_count(); it++) {
     auto method = service->method(it);
     vars["Input"] = GenerateMessage(method->get_input_namespace_parts(), method->get_input_type_name());
@@ -247,10 +247,10 @@
     printer->Print(vars, body.c_str());
     printer->Print("\n");
   }
-  printer->Print("\t\tdefault: return nil;\n");
-  printer->Print("\t\t}\n");
-  printer->Print("\t}\n\n");
-  printer->Print("}\n\n");
+  printer->Print("    default: return nil;\n");
+  printer->Print("    }\n");
+  printer->Print("  }\n\n");
+  printer->Print("}");
 }
 
 grpc::string Generate(grpc_generator::File *file,
@@ -281,6 +281,10 @@
   code +=
       "/// in case of an issue please open github issue, though it would be "
       "maintained\n";
+  code += "\n";
+  code += "// swiftlint:disable all\n";
+  code += "// swiftformat:disable all\n";
+  code += "\n";
   code += "import Foundation\n";
   code += "import GRPC\n";
   code += "import NIO\n";
@@ -292,19 +296,19 @@
       "{}\n";
 
   code += "public extension GRPCFlatBufPayload {\n";
-  code += "    init(serializedByteBuffer: inout NIO.ByteBuffer) throws {\n";
+  code += "  init(serializedByteBuffer: inout NIO.ByteBuffer) throws {\n";
   code +=
-      "        self.init(byteBuffer: FlatBuffers.ByteBuffer(contiguousBytes: "
+      "    self.init(byteBuffer: FlatBuffers.ByteBuffer(contiguousBytes: "
       "serializedByteBuffer.readableBytesView, count: "
       "serializedByteBuffer.readableBytes))\n";
-  code += "    }\n";
+  code += "  }\n";
 
-  code += "    func serialize(into buffer: inout NIO.ByteBuffer) throws {\n";
+  code += "  func serialize(into buffer: inout NIO.ByteBuffer) throws {\n";
   code +=
-      "        let buf = UnsafeRawBufferPointer(start: self.rawPointer, count: "
+      "    let buf = UnsafeRawBufferPointer(start: self.rawPointer, count: "
       "Int(self.size))\n";
-  code += "        buffer.writeBytes(buf)\n";
-  code += "    }\n";
+  code += "    buffer.writeBytes(buf)\n";
+  code += "  }\n";
   code += "}\n";
   code += "extension Message: GRPCFlatBufPayload {}\n";
   return code;