TextFormatDecodingOptions.swift 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Sources/SwiftProtobuf/TextFormatDecodingOptions.swift - Text format decoding options
  2. //
  3. // Copyright (c) 2014 - 2021 Apple Inc. and the project authors
  4. // Licensed under Apache License v2.0 with Runtime Library Exception
  5. //
  6. // See LICENSE.txt for license information:
  7. // https://github.com/apple/swift-protobuf/blob/main/LICENSE.txt
  8. //
  9. // -----------------------------------------------------------------------------
  10. ///
  11. /// Text format decoding options
  12. ///
  13. // -----------------------------------------------------------------------------
  14. /// Options for TextFormatDecoding.
  15. public struct TextFormatDecodingOptions: Sendable {
  16. /// The maximum nesting of message with messages. The default is 100.
  17. ///
  18. /// To prevent corrupt or malicious messages from causing stack overflows,
  19. /// this controls how deep messages can be nested within other messages
  20. /// while parsing.
  21. public var messageDepthLimit: Int = 100
  22. /// If unknown fields in the TextFormat should be ignored. If they aren't
  23. /// ignored, an error will be raised if one is encountered.
  24. ///
  25. /// Note: This is a lossy option, enabling it means part of the TextFormat
  26. /// is silently skipped.
  27. public var ignoreUnknownFields: Bool = false
  28. /// If unknown extension fields in the TextFormat should be ignored. If they
  29. /// aren't ignored, an error will be raised if one is encountered.
  30. ///
  31. /// Note: This is a lossy option, enabling it means part of the TextFormat
  32. /// is silently skipped.
  33. public var ignoreUnknownExtensionFields: Bool = false
  34. public init() {}
  35. }