/src/swift-protobuf/Sources/SwiftProtobuf/JSONDecodingOptions.swift
Line | Count | Source |
1 | | // Sources/SwiftProtobuf/JSONDecodingOptions.swift - JSON decoding options |
2 | | // |
3 | | // Copyright (c) 2014 - 2017 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 | | /// JSON decoding options |
12 | | /// |
13 | | // ----------------------------------------------------------------------------- |
14 | | |
15 | | /// Options for JSONDecoding. |
16 | | public struct JSONDecodingOptions: Sendable { |
17 | | /// The maximum nesting of message with messages. The default is 100. |
18 | | /// |
19 | | /// To prevent corrupt or malicious messages from causing stack overflows, |
20 | | /// this controls how deep messages can be nested within other messages |
21 | | /// while parsing. |
22 | 231k | public var messageDepthLimit: Int = 100 |
23 | | |
24 | | /// If unknown fields in the JSON should be ignored. If they aren't |
25 | | /// ignored, an error will be raised if one is encountered. This also |
26 | | /// causes unknown enum values (especially string values) to be silently |
27 | | /// ignored. |
28 | 231k | public var ignoreUnknownFields: Bool = false |
29 | | |
30 | 111k | public init() {} |
31 | | } |