|
|
@@ -1,4 +1,4 @@
|
|
|
-# `protoc` Swift gRPC plugin
|
|
|
+# `protoc` gRPC Swift plugin
|
|
|
|
|
|
gRPC Swift provides a plugin for the [protocol buffer][protocol-buffers]
|
|
|
compiler `protoc` to generate classes for clients and services.
|
|
|
@@ -23,18 +23,69 @@ when invoking `protoc`.
|
|
|
|
|
|
## Plugin Options
|
|
|
|
|
|
-The table below lists the options available to the `protoc-gen-grpc-swift`
|
|
|
-plugin:
|
|
|
+### Visibility
|
|
|
|
|
|
-| Flag | Values | Default | Description
|
|
|
-|:--------------------------|:------------------------------------------|:-----------|:----------------------------------------------------------------------------------------------------------------------
|
|
|
-| `Visibility` | `Internal`/`Public` | `Internal` | ACL of generated code
|
|
|
-| `Server` | `true`/`false` | `true` | Whether to generate server code
|
|
|
-| `Client` | `true`/`false` | `true` | Whether to generate client code
|
|
|
-| `TestClient` | `true`/`false` | `false` | Whether to generate test client code. Ignored if `Client` is `false`.
|
|
|
-| `FileNaming` | `FullPath`/`PathToUnderscores`/`DropPath` | `FullPath` | How to handle the naming of generated sources, see [documentation][swift-protobuf-filenaming]
|
|
|
-| `ExtraModuleImports` | `String` | | Extra module to import in generated code. This parameter may be included multiple times to import more than one module
|
|
|
-| `ProtoPathModuleMappings` | `String` | | The path of the file that contains the module mappings for the generated code, see [swift-protobuf documentation](https://github.com/apple/swift-protobuf/blob/master/Documentation/PLUGIN.md#generation-option-protopathmodulemappings---swift-module-names-for-proto-paths)
|
|
|
+The **Visibility** option determines the access control for generated code.
|
|
|
+
|
|
|
+- **Possible values:** Public, Internal
|
|
|
+- **Default value:** Internal
|
|
|
+
|
|
|
+### Server
|
|
|
+
|
|
|
+The **Server** option determines whether server code is generated. The
|
|
|
+generated server code includes a `protocol` which users must implement
|
|
|
+to provide the logic for their service.
|
|
|
+
|
|
|
+- **Possible values:** true, false
|
|
|
+- **Default value:** true
|
|
|
+
|
|
|
+### Client
|
|
|
+
|
|
|
+The **Client** option determines whether client code is generated. The
|
|
|
+generated client code includes a `protocol` and a `class` conforming to that
|
|
|
+protocol.
|
|
|
+
|
|
|
+- **Possible values:** true, false
|
|
|
+- **Default value:** true
|
|
|
+
|
|
|
+### TestClient
|
|
|
+
|
|
|
+The **TestClient** option determines whether test client code is generated.
|
|
|
+This does *not* include the `protocol` generated by the **Client** option.
|
|
|
+
|
|
|
+- **Possible values:** true, false
|
|
|
+- **Default value:** false
|
|
|
+
|
|
|
+### PayloadConformance
|
|
|
+
|
|
|
+The **PayloadConformance** option determines whether conformance to
|
|
|
+`GRPCProtobufPayload` is generated for message definitions. Conformance to
|
|
|
+`GRPCPayload` indicates that gRPC can serialize and deserialize the payload.
|
|
|
+`GRPCProtobufPayload` protives a default implementation to this `GRPCPayload`
|
|
|
+for `SwiftProtobuf.Message`s.
|
|
|
+
|
|
|
+- **Possible values:** true, false
|
|
|
+- **Default value:** true
|
|
|
+
|
|
|
+### FileNaming
|
|
|
+
|
|
|
+The **FileNaming** option determines how generated source files should be named.
|
|
|
+
|
|
|
+- **Possible values:**
|
|
|
+ - **FullPath**: The full path of the input file will be used;
|
|
|
+ `foo/bar/baz.proto` will generate `foo/bar/baz.grpc.proto`
|
|
|
+ - **PathToUnderscores**: Directories structures are flattened;
|
|
|
+ `foo/bar/baz.proto` will generate `foo_bar_baz.grpc.proto`
|
|
|
+ - **DropPath**: The path is dropped and only the name of the file is kept;
|
|
|
+ `foo/bar/baz.proto` will generate `baz.grpc.proto`
|
|
|
+- **Default value:** FullPath
|
|
|
+
|
|
|
+### ProtoPathModuleMappings
|
|
|
+
|
|
|
+The **ProtoPathModuleMappings** option allows module mappings to be specified.
|
|
|
+See the [SwiftProtobuf documentation][swift-protobuf-module-mappings].
|
|
|
+
|
|
|
+## Specifying Options
|
|
|
|
|
|
To pass extra parameters to the plugin, use a comma-separated parameter list
|
|
|
separated from the output directory by a colon. Alternatively use the
|
|
|
@@ -54,3 +105,4 @@ protoc <your proto> --grpc-swift_opt=Client=true,Server=false --grpc-swift_out=.
|
|
|
|
|
|
[protocol-buffers]: https://developers.google.com/protocol-buffers/docs/overview
|
|
|
[swift-protobuf-filenaming]: https://github.com/apple/swift-protobuf/blob/master/Documentation/PLUGIN.md#generation-option-filenaming---naming-of-generated-sources
|
|
|
+[swift-protobuf-module-mappings]: https://github.com/apple/swift-protobuf/blob/master/Documentation/PLUGIN.md#generation-option-protopathmodulemappings---swift-module-names-for-proto-paths
|