Documentation
¶
Overview ¶
Package swift provides a code generator for Swift.
Index ¶
- func Generate(ctx context.Context, model *api.API, outdir string, cfg *parser.ModelConfig, ...) error
- func GenerateConversions(ctx context.Context, model *api.API, outdir string, cfg *parser.ModelConfig, ...) error
- func GenerateVersion(ctx context.Context, outDir string, library *config.Library) error
- func PackageName(api *api.API) string
- func ProtoPackagePrefix(packageName string) string
- type DecodingStyle
- type Dependency
- type EncodingStyle
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Generate ¶
func Generate(ctx context.Context, model *api.API, outdir string, cfg *parser.ModelConfig, swiftCfg *config.SwiftPackage) error
Generate generates code from the model.
func GenerateConversions ¶ added in v0.27.0
func GenerateConversions(ctx context.Context, model *api.API, outdir string, cfg *parser.ModelConfig, swiftCfg *config.SwiftPackage) error
GenerateConversions generates the user-facing clean types and conversion mappings.
func GenerateVersion ¶ added in v0.27.0
GenerateVersion generates a version file for core and veneers.
Swift does not provide programmatic access to the version of a package. The version information is in `git`, not in any manifest file. In GAPICs and core libraries we need the version to populate telemetry headers.
This function generates a small "version file" based on the information in librarian.
func PackageName ¶
PackageName returns the package name for the API.
func ProtoPackagePrefix ¶ added in v0.27.0
ProtoPackagePrefix returns the SwiftProtobuf prefix for a given protobuf package name. E.g., google.storage.control.v2 -> Google_Storage_Control_V2_.
Types ¶
type DecodingStyle ¶ added in v0.21.0
type DecodingStyle int
DecodingStyle defines an enumeration for decoding fields.
const ( // DecodingSimple means that the field is decoded using a simple `.decode()` // call. DecodingSimple DecodingStyle = iota // DecodingOptional means that the field is decoded using a // `.decodeIfPresent()` call. DecodingOptional // DecodingMapCustomKey means that the field is a map, with non-string keys // and requires mapping through a string-keyed temporary. DecodingMapCustomKey )
type Dependency ¶ added in v0.10.1
type Dependency struct {
config.SwiftDependency
}
Dependency wraps config.SwiftDependency to add helper methods.
func (*Dependency) LocalName ¶ added in v0.10.1
func (dep *Dependency) LocalName() string
LocalName returns the name of the dependency when used in a `Package.swift` file.
For local dependencies this is the last directory in the path. For external dependencies this is the last directory of the URL path.
type EncodingStyle ¶ added in v0.21.0
type EncodingStyle int
EncodingStyle defines an enumeration for encoding fields.
const ( // EncodingSimple means that the field is encoded using a simple `.encode()` call. EncodingSimple EncodingStyle = iota // EncodingMapCustomKey means that the field is a map, with non-string keys // and requires mapping through a string-keyed temporary. EncodingMapCustomKey )
Source Files
¶
- annotate_enum.go
- annotate_enum_value.go
- annotate_field.go
- annotate_message.go
- annotate_method.go
- annotate_model.go
- annotate_oneof.go
- annotate_sample_info.go
- annotate_service.go
- codec.go
- convert_proto_names.go
- dependency.go
- doc_link.go
- field_type_name.go
- format_documentation.go
- format_path.go
- generate.go
- generate_conversions.go
- generate_version.go
- lookup.go
- map.go
- names.go
- package_name.go