scalapb.options

Type members

Classlikes

@SerialVersionUID(0L)
final case class Collection(`type`: Option[String], nonEmpty: Option[Boolean], adapter: Option[String], unknownFields: UnknownFieldSet) extends GeneratedMessage with Updatable[Collection]

Represents a custom Collection type in Scala. This allows ScalaPB to integrate with collection types that are different enough from the ones in the standard library.

Represents a custom Collection type in Scala. This allows ScalaPB to integrate with collection types that are different enough from the ones in the standard library.

Value Params
adapter

An Adapter is a Scala object available at runtime that provides certain static methods that can operate on this collection type.

nonEmpty

Set to true if this collection type is not allowed to be empty, for example cats.data.NonEmptyList. When true, ScalaPB will not generate clearX for the repeated field and not provide a default argument in the constructor.

type

Type of the collection

Companion
object
@SerialVersionUID(0L)
final case class EnumOptions(`extends`: Seq[String], companionExtends: Seq[String], `type`: Option[String], baseAnnotations: Seq[String], recognizedAnnotations: Seq[String], unrecognizedAnnotations: Seq[String], unknownFields: UnknownFieldSet) extends GeneratedMessage with Updatable[EnumOptions] with ExtendableMessage[EnumOptions]
Value Params
baseAnnotations

Custom annotations to add to the generated enum's base class.

companionExtends

Additional classes and traits to mix in to the companion object.

extends

Additional classes and traits to mix in to the base trait

recognizedAnnotations

Custom annotations to add to the generated trait.

type

All instances of this enum will be converted to this type. An implicit TypeMapper must be present.

unrecognizedAnnotations

Custom annotations to add to the generated Unrecognized case class.

Companion
object
@SerialVersionUID(0L)
final case class EnumValueOptions(`extends`: Seq[String], scalaName: Option[String], annotations: Seq[String], unknownFields: UnknownFieldSet) extends GeneratedMessage with Updatable[EnumValueOptions] with ExtendableMessage[EnumValueOptions]
Value Params
annotations

Custom annotations to add to the generated case object for this enum value.

extends

Additional classes and traits to mix in to an individual enum value.

scalaName

Name in Scala to use for this enum value.

Companion
object
@SerialVersionUID(0L)
final case class FieldOptions(`type`: Option[String], scalaName: Option[String], collectionType: Option[String], collection: Option[Collection], keyType: Option[String], valueType: Option[String], annotations: Seq[String], mapType: Option[String], noDefaultValueInConstructor: Option[Boolean], noBox: Option[Boolean], required: Option[Boolean], unknownFields: UnknownFieldSet) extends GeneratedMessage with Updatable[FieldOptions] with ExtendableMessage[FieldOptions]
Value Params
annotations

Custom annotations to add to the field.

collectionType

Can be specified only if this field is repeated. If unspecified, it falls back to the file option named collection_type, which defaults to scala.collection.Seq.

keyType

If the field is a map, you can specify custom Scala types for the key or value.

mapType

Can be specified only if this field is a map. If unspecified, it falls back to the file option named map_type which defaults to scala.collection.immutable.Map

noBox

Do not box this value in Option[T]. If set, this overrides MessageOptions.no_box

noDefaultValueInConstructor

If true, no default value will be generated for this field in the message constructor. If this field is set, it has the highest precedence and overrides the values at the message-level and file-level.

required

Like no_box it does not box a value in Option[T], but also fails parsing when a value is not provided. This enables to emulate required fields in proto3.

Companion
object
@SerialVersionUID(0L)
final case class FieldTransformation(when: Option[FieldDescriptorProto], matchType: Option[MatchType], set: Option[FieldOptions], unknownFields: UnknownFieldSet) extends GeneratedMessage with Updatable[FieldTransformation]
Companion
object
sealed abstract class MatchType(val value: Int) extends GeneratedEnum
Companion
object
@SerialVersionUID(0L)
final case class MessageOptions(`extends`: Seq[String], companionExtends: Seq[String], annotations: Seq[String], `type`: Option[String], companionAnnotations: Seq[String], sealedOneofExtends: Seq[String], noBox: Option[Boolean], unknownFieldsAnnotations: Seq[String], noDefaultValuesInConstructor: Option[Boolean], unknownFields: UnknownFieldSet) extends GeneratedMessage with Updatable[MessageOptions] with ExtendableMessage[MessageOptions]
Value Params
annotations

Custom annotations to add to the generated case class.

companionAnnotations

Custom annotations to add to the companion object of the generated class.

companionExtends

Additional classes and traits to mix in to the companion object.

extends

Additional classes and traits to mix in to the case class.

noBox

If true, when this message is used as an optional field, do not wrap it in an Option. This is equivalent of setting (field).no_box to true on each field with the message type.

noDefaultValuesInConstructor

If true, no default values will be generated in message constructors. If set (to true or false), the message-level setting overrides the file-level value, and can be overridden by the field-level setting.

sealedOneofExtends

Additional classes and traits to mix in to generated sealed_oneof base trait.

type

All instances of this message will be converted to this type. An implicit TypeMapper must be present.

unknownFieldsAnnotations

Custom annotations to add to the generated unknownFields case class field.

Companion
object
@SerialVersionUID(0L)
final case class OneofOptions(`extends`: Seq[String], scalaName: Option[String], unknownFields: UnknownFieldSet) extends GeneratedMessage with Updatable[OneofOptions] with ExtendableMessage[OneofOptions]
Value Params
extends

Additional traits to mix in to a oneof.

scalaName

Name in Scala to use for this oneof field.

Companion
object
@SerialVersionUID(0L)
final case class PreprocessorOutput(optionsByFile: Map[String, ScalaPbOptions], unknownFields: UnknownFieldSet) extends GeneratedMessage with Updatable[PreprocessorOutput]
Companion
object
@SerialVersionUID(0L)
final case class ScalaPbOptions(packageName: Option[String], flatPackage: Option[Boolean], `import`: Seq[String], preamble: Seq[String], singleFile: Option[Boolean], noPrimitiveWrappers: Option[Boolean], primitiveWrappers: Option[Boolean], collectionType: Option[String], preserveUnknownFields: Option[Boolean], objectName: Option[String], scope: Option[OptionsScope], lenses: Option[Boolean], retainSourceCodeInfo: Option[Boolean], mapType: Option[String], noDefaultValuesInConstructor: Option[Boolean], enumValueNaming: Option[EnumValueNaming], enumStripPrefix: Option[Boolean], bytesType: Option[String], javaConversions: Option[Boolean], auxMessageOptions: Seq[AuxMessageOptions], auxFieldOptions: Seq[AuxFieldOptions], auxEnumOptions: Seq[AuxEnumOptions], auxEnumValueOptions: Seq[AuxEnumValueOptions], preprocessors: Seq[String], fieldTransformations: Seq[FieldTransformation], ignoreAllTransformations: Option[Boolean], getters: Option[Boolean], testOnlyNoJavaConversions: Option[Boolean], unknownFields: UnknownFieldSet) extends GeneratedMessage with Updatable[ScalaPbOptions] with ExtendableMessage[ScalaPbOptions]
Value Params
auxEnumOptions

List of message options to apply to some enums.

auxEnumValueOptions

List of enum value options to apply to some enum values.

auxFieldOptions

List of message options to apply to some fields.

auxMessageOptions

List of message options to apply to some messages.

bytesType

Scala type to use for bytes fields.

collectionType

Scala type to be used for repeated fields. If unspecified, scala.collection.Seq will be used.

enumStripPrefix

Indicate if prefix (enum name + optional underscore) should be removed in scala code Strip is applied before enum value naming changes.

flatPackage

If true, the compiler does not append the proto base file name into the generated package name. If false (the default), the generated scala package name is the package_name.basename where basename is the proto file name without the .proto extension.

getters

If true, getters will be generated.

ignoreAllTransformations

Ignores all transformations for this file. This is meant to allow specific files to opt out from transformations inherited through package-scoped options.

import

Adds the following imports at the top of the file (this is meant to provide implicit TypeMappers)

javaConversions

Enable java conversions for this file.

lenses

If true, lenses will be generated.

mapType

Scala type to be used for maps. If unspecified, scala.collection.immutable.Map will be used.

noDefaultValuesInConstructor

If true, no default values will be generated in message constructors. This setting can be overridden at the message-level and for individual fields.

noPrimitiveWrappers

By default, wrappers defined at https://github.com/google/protobuf/blob/master/src/google/protobuf/wrappers.proto, are mapped to an Option[T] where T is a primitive type. When this field is set to true, we do not perform this transformation.

objectName

If defined, sets the name of the file-level object that would be generated. This object extends GeneratedFileObject and contains descriptors, and list of message and enum companions.

packageName

If set then it overrides the java_package and package.

preamble

Text to add to the generated scala file. This can be used only when single_file is true.

preprocessors

List of preprocessors to apply.

preserveUnknownFields

If set to true, all generated messages in this file will preserve unknown fields.

primitiveWrappers

DEPRECATED. In ScalaPB <= 0.5.47, it was necessary to explicitly enable primitive_wrappers. This field remains here for backwards compatibility, but it has no effect on generated code. It is an error to set both primitive_wrappers and no_primitive_wrappers.

retainSourceCodeInfo

If true, then source-code info information will be included in the generated code - normally the source code info is cleared out to reduce code size. The source code info is useful for extracting source code location from the descriptors as well as comments.

scope

Experimental: scope to apply the given options.

singleFile

If true, all messages and enums (but not services) will be written to a single Scala file.

testOnlyNoJavaConversions

For use in tests only. Inhibit Java conversions even when when generator parameters request for it.

Companion
object