Skip to content

Commit

Permalink
Rename ignore_field_transformations to ignore_all_transformations
Browse files Browse the repository at this point in the history
  • Loading branch information
thesamet committed Jan 16, 2021
1 parent e6e698e commit fbd8b59
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 74 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ object FileOptionsCache {
fileOptions.map {
case (f, opts) =>
f ->
(if (opts.getIgnoreFieldTransformations) opts
(if (opts.getIgnoreAllTransformations) opts
else
opts.toBuilder
.addAllAuxFieldOptions(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class FieldTransformationsSpec extends AnyFlatSpec with Matchers with ProtocInvo
|import "myvalidate.proto";
|import "scalapb/scalapb.proto";
|option (scalapb.options) = {
| ignore_field_transformations: true
| ignore_all_transformations: true
|};
|message I {
| int32 x = 1 [(opts.rules).int32 = {gt: 12}];
Expand Down
6 changes: 3 additions & 3 deletions protobuf/scalapb/scalapb.proto
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ message ScalaPbOptions {

repeated FieldTransformation field_transformations = 25;

// Ignores field transformations for this file. This is meant to allow specific files to
// opt out from field transformations inherited through package-scoped options.
optional bool ignore_field_transformations = 26;
// Ignores all transformations for this file. This is meant to allow specific files to
// opt out from transformations inherited through package-scoped options.
optional bool ignore_all_transformations = 26;

// For use in tests only. Inhibit Java conversions even when when generator parameters
// request for it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ package scalapb.options
* List of message options to apply to some enums.
* @param bytesType
* Scala type to use for bytes fields.
* @param ignoreFieldTransformations
* Ignores field transformations for this file. This is meant to allow specific files to
* opt out from field transformations inherited through package-scoped options.
* @param ignoreAllTransformations
* Ignores all transformations for this file. This is meant to allow specific files to
* opt out from transformations inherited through package-scoped options.
* @param testOnlyNoJavaConversions
* For use in tests only. Inhibit Java conversions even when when generator parameters
* request for it.
Expand Down Expand Up @@ -98,7 +98,7 @@ final case class ScalaPbOptions(
bytesType: _root_.scala.Option[_root_.scala.Predef.String] = _root_.scala.None,
preprocessors: _root_.scala.Seq[_root_.scala.Predef.String] = _root_.scala.Seq.empty,
fieldTransformations: _root_.scala.Seq[scalapb.options.FieldTransformation] = _root_.scala.Seq.empty,
ignoreFieldTransformations: _root_.scala.Option[_root_.scala.Boolean] = _root_.scala.None,
ignoreAllTransformations: _root_.scala.Option[_root_.scala.Boolean] = _root_.scala.None,
testOnlyNoJavaConversions: _root_.scala.Option[_root_.scala.Boolean] = _root_.scala.None,
unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[ScalaPbOptions] with _root_.scalapb.ExtendableMessage[ScalaPbOptions] {
Expand Down Expand Up @@ -198,8 +198,8 @@ final case class ScalaPbOptions(
val __value = __item
__size += 2 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
}
if (ignoreFieldTransformations.isDefined) {
val __value = ignoreFieldTransformations.get
if (ignoreAllTransformations.isDefined) {
val __value = ignoreAllTransformations.get
__size += _root_.com.google.protobuf.CodedOutputStream.computeBoolSize(26, __value)
};
if (testOnlyNoJavaConversions.isDefined) {
Expand Down Expand Up @@ -318,7 +318,7 @@ final case class ScalaPbOptions(
_output__.writeUInt32NoTag(__m.serializedSize)
__m.writeTo(_output__)
};
ignoreFieldTransformations.foreach { __v =>
ignoreAllTransformations.foreach { __v =>
val __m = __v
_output__.writeBool(26, __m)
};
Expand Down Expand Up @@ -404,9 +404,9 @@ final case class ScalaPbOptions(
def addFieldTransformations(__vs: scalapb.options.FieldTransformation*): ScalaPbOptions = addAllFieldTransformations(__vs)
def addAllFieldTransformations(__vs: Iterable[scalapb.options.FieldTransformation]): ScalaPbOptions = copy(fieldTransformations = fieldTransformations ++ __vs)
def withFieldTransformations(__v: _root_.scala.Seq[scalapb.options.FieldTransformation]): ScalaPbOptions = copy(fieldTransformations = __v)
def getIgnoreFieldTransformations: _root_.scala.Boolean = ignoreFieldTransformations.getOrElse(false)
def clearIgnoreFieldTransformations: ScalaPbOptions = copy(ignoreFieldTransformations = _root_.scala.None)
def withIgnoreFieldTransformations(__v: _root_.scala.Boolean): ScalaPbOptions = copy(ignoreFieldTransformations = Option(__v))
def getIgnoreAllTransformations: _root_.scala.Boolean = ignoreAllTransformations.getOrElse(false)
def clearIgnoreAllTransformations: ScalaPbOptions = copy(ignoreAllTransformations = _root_.scala.None)
def withIgnoreAllTransformations(__v: _root_.scala.Boolean): ScalaPbOptions = copy(ignoreAllTransformations = Option(__v))
def getTestOnlyNoJavaConversions: _root_.scala.Boolean = testOnlyNoJavaConversions.getOrElse(false)
def clearTestOnlyNoJavaConversions: ScalaPbOptions = copy(testOnlyNoJavaConversions = _root_.scala.None)
def withTestOnlyNoJavaConversions(__v: _root_.scala.Boolean): ScalaPbOptions = copy(testOnlyNoJavaConversions = Option(__v))
Expand Down Expand Up @@ -437,7 +437,7 @@ final case class ScalaPbOptions(
case 21 => bytesType.orNull
case 24 => preprocessors
case 25 => fieldTransformations
case 26 => ignoreFieldTransformations.orNull
case 26 => ignoreAllTransformations.orNull
case 999 => testOnlyNoJavaConversions.orNull
}
}
Expand Down Expand Up @@ -467,7 +467,7 @@ final case class ScalaPbOptions(
case 21 => bytesType.map(_root_.scalapb.descriptors.PString(_)).getOrElse(_root_.scalapb.descriptors.PEmpty)
case 24 => _root_.scalapb.descriptors.PRepeated(preprocessors.iterator.map(_root_.scalapb.descriptors.PString(_)).toVector)
case 25 => _root_.scalapb.descriptors.PRepeated(fieldTransformations.iterator.map(_.toPMessage).toVector)
case 26 => ignoreFieldTransformations.map(_root_.scalapb.descriptors.PBoolean(_)).getOrElse(_root_.scalapb.descriptors.PEmpty)
case 26 => ignoreAllTransformations.map(_root_.scalapb.descriptors.PBoolean(_)).getOrElse(_root_.scalapb.descriptors.PEmpty)
case 999 => testOnlyNoJavaConversions.map(_root_.scalapb.descriptors.PBoolean(_)).getOrElse(_root_.scalapb.descriptors.PEmpty)
}
}
Expand Down Expand Up @@ -506,7 +506,7 @@ object ScalaPbOptions extends scalapb.GeneratedMessageCompanion[scalapb.options.
bytesType = __fieldsMap.get(scalaDescriptor.findFieldByNumber(21).get).flatMap(_.as[_root_.scala.Option[_root_.scala.Predef.String]]),
preprocessors = __fieldsMap.get(scalaDescriptor.findFieldByNumber(24).get).map(_.as[_root_.scala.Seq[_root_.scala.Predef.String]]).getOrElse(_root_.scala.Seq.empty),
fieldTransformations = __fieldsMap.get(scalaDescriptor.findFieldByNumber(25).get).map(_.as[_root_.scala.Seq[scalapb.options.FieldTransformation]]).getOrElse(_root_.scala.Seq.empty),
ignoreFieldTransformations = __fieldsMap.get(scalaDescriptor.findFieldByNumber(26).get).flatMap(_.as[_root_.scala.Option[_root_.scala.Boolean]]),
ignoreAllTransformations = __fieldsMap.get(scalaDescriptor.findFieldByNumber(26).get).flatMap(_.as[_root_.scala.Option[_root_.scala.Boolean]]),
testOnlyNoJavaConversions = __fieldsMap.get(scalaDescriptor.findFieldByNumber(999).get).flatMap(_.as[_root_.scala.Option[_root_.scala.Boolean]])
)
case _ => throw new RuntimeException("Expected PMessage")
Expand Down Expand Up @@ -559,7 +559,7 @@ object ScalaPbOptions extends scalapb.GeneratedMessageCompanion[scalapb.options.
bytesType = _root_.scala.None,
preprocessors = _root_.scala.Seq.empty,
fieldTransformations = _root_.scala.Seq.empty,
ignoreFieldTransformations = _root_.scala.None,
ignoreAllTransformations = _root_.scala.None,
testOnlyNoJavaConversions = _root_.scala.None
)
final class Builder private (
Expand All @@ -586,7 +586,7 @@ object ScalaPbOptions extends scalapb.GeneratedMessageCompanion[scalapb.options.
private var __bytesType: _root_.scala.Option[_root_.scala.Predef.String],
private val __preprocessors: _root_.scala.collection.immutable.VectorBuilder[_root_.scala.Predef.String],
private val __fieldTransformations: _root_.scala.collection.immutable.VectorBuilder[scalapb.options.FieldTransformation],
private var __ignoreFieldTransformations: _root_.scala.Option[_root_.scala.Boolean],
private var __ignoreAllTransformations: _root_.scala.Option[_root_.scala.Boolean],
private var __testOnlyNoJavaConversions: _root_.scala.Option[_root_.scala.Boolean],
private var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder
) extends _root_.scalapb.MessageBuilder[scalapb.options.ScalaPbOptions] {
Expand Down Expand Up @@ -643,7 +643,7 @@ object ScalaPbOptions extends scalapb.GeneratedMessageCompanion[scalapb.options.
case 202 =>
__fieldTransformations += _root_.scalapb.LiteParser.readMessage[scalapb.options.FieldTransformation](_input__)
case 208 =>
__ignoreFieldTransformations = Option(_input__.readBool())
__ignoreAllTransformations = Option(_input__.readBool())
case 7992 =>
__testOnlyNoJavaConversions = Option(_input__.readBool())
case tag =>
Expand Down Expand Up @@ -680,7 +680,7 @@ object ScalaPbOptions extends scalapb.GeneratedMessageCompanion[scalapb.options.
bytesType = __bytesType,
preprocessors = __preprocessors.result(),
fieldTransformations = __fieldTransformations.result(),
ignoreFieldTransformations = __ignoreFieldTransformations,
ignoreAllTransformations = __ignoreAllTransformations,
testOnlyNoJavaConversions = __testOnlyNoJavaConversions,
unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
)
Expand Down Expand Up @@ -711,7 +711,7 @@ object ScalaPbOptions extends scalapb.GeneratedMessageCompanion[scalapb.options.
__bytesType = _root_.scala.None,
__preprocessors = new _root_.scala.collection.immutable.VectorBuilder[_root_.scala.Predef.String],
__fieldTransformations = new _root_.scala.collection.immutable.VectorBuilder[scalapb.options.FieldTransformation],
__ignoreFieldTransformations = _root_.scala.None,
__ignoreAllTransformations = _root_.scala.None,
__testOnlyNoJavaConversions = _root_.scala.None,
`_unknownFields__` = null
)
Expand Down Expand Up @@ -739,7 +739,7 @@ object ScalaPbOptions extends scalapb.GeneratedMessageCompanion[scalapb.options.
__bytesType = _message__.bytesType,
__preprocessors = new _root_.scala.collection.immutable.VectorBuilder[_root_.scala.Predef.String] ++= _message__.preprocessors,
__fieldTransformations = new _root_.scala.collection.immutable.VectorBuilder[scalapb.options.FieldTransformation] ++= _message__.fieldTransformations,
__ignoreFieldTransformations = _message__.ignoreFieldTransformations,
__ignoreAllTransformations = _message__.ignoreAllTransformations,
__testOnlyNoJavaConversions = _message__.testOnlyNoJavaConversions,
`_unknownFields__` = new _root_.scalapb.UnknownFieldSet.Builder(_message__.unknownFields)
)
Expand Down Expand Up @@ -1379,8 +1379,8 @@ object ScalaPbOptions extends scalapb.GeneratedMessageCompanion[scalapb.options.
def optionalBytesType: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[_root_.scala.Predef.String]] = field(_.bytesType)((c_, f_) => c_.copy(bytesType = f_))
def preprocessors: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[_root_.scala.Predef.String]] = field(_.preprocessors)((c_, f_) => c_.copy(preprocessors = f_))
def fieldTransformations: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[scalapb.options.FieldTransformation]] = field(_.fieldTransformations)((c_, f_) => c_.copy(fieldTransformations = f_))
def ignoreFieldTransformations: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.getIgnoreFieldTransformations)((c_, f_) => c_.copy(ignoreFieldTransformations = Option(f_)))
def optionalIgnoreFieldTransformations: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[_root_.scala.Boolean]] = field(_.ignoreFieldTransformations)((c_, f_) => c_.copy(ignoreFieldTransformations = f_))
def ignoreAllTransformations: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.getIgnoreAllTransformations)((c_, f_) => c_.copy(ignoreAllTransformations = Option(f_)))
def optionalIgnoreAllTransformations: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[_root_.scala.Boolean]] = field(_.ignoreAllTransformations)((c_, f_) => c_.copy(ignoreAllTransformations = f_))
def testOnlyNoJavaConversions: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.getTestOnlyNoJavaConversions)((c_, f_) => c_.copy(testOnlyNoJavaConversions = Option(f_)))
def optionalTestOnlyNoJavaConversions: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[_root_.scala.Boolean]] = field(_.testOnlyNoJavaConversions)((c_, f_) => c_.copy(testOnlyNoJavaConversions = f_))
}
Expand All @@ -1407,7 +1407,7 @@ object ScalaPbOptions extends scalapb.GeneratedMessageCompanion[scalapb.options.
final val BYTES_TYPE_FIELD_NUMBER = 21
final val PREPROCESSORS_FIELD_NUMBER = 24
final val FIELD_TRANSFORMATIONS_FIELD_NUMBER = 25
final val IGNORE_FIELD_TRANSFORMATIONS_FIELD_NUMBER = 26
final val IGNORE_ALL_TRANSFORMATIONS_FIELD_NUMBER = 26
final val TEST_ONLY_NO_JAVA_CONVERSIONS_FIELD_NUMBER = 999
def of(
packageName: _root_.scala.Option[_root_.scala.Predef.String],
Expand All @@ -1433,7 +1433,7 @@ object ScalaPbOptions extends scalapb.GeneratedMessageCompanion[scalapb.options.
bytesType: _root_.scala.Option[_root_.scala.Predef.String],
preprocessors: _root_.scala.Seq[_root_.scala.Predef.String],
fieldTransformations: _root_.scala.Seq[scalapb.options.FieldTransformation],
ignoreFieldTransformations: _root_.scala.Option[_root_.scala.Boolean],
ignoreAllTransformations: _root_.scala.Option[_root_.scala.Boolean],
testOnlyNoJavaConversions: _root_.scala.Option[_root_.scala.Boolean]
): _root_.scalapb.options.ScalaPbOptions = _root_.scalapb.options.ScalaPbOptions(
packageName,
Expand All @@ -1459,7 +1459,7 @@ object ScalaPbOptions extends scalapb.GeneratedMessageCompanion[scalapb.options.
bytesType,
preprocessors,
fieldTransformations,
ignoreFieldTransformations,
ignoreAllTransformations,
testOnlyNoJavaConversions
)
// @@protoc_insertion_point(GeneratedMessageCompanion[scalapb.ScalaPbOptions])
Expand Down
Loading

0 comments on commit fbd8b59

Please sign in to comment.