JsonSchemaCompiler: Raise error on parse failures of optional properties.
Currently when an optional property fails to parse and error generation is enabled for the schema, the auto-generated Populate function continues parsing the type but still populates error. This CL changes the code to ensure that we raise an error in these cases. We also don't raise an error on unrecognized keys any longer since we shouldn't be raising an error while returning a parse success: Most consumers currently don't distinguish between the two cases and this can lead to the returned error being a concatenation of unrelated errors, which is not ideal. We now enforce the constraint that Populate only returns an error iff there is a parse failure. We DCHECK the same in the auto-generated FromValue function. This also brings the code more in-line with what we do for auto-generated manifest parsing. Currently only 3 schemas use error generation: - declarative_net_request.idl - extensions_manifest_types.json - manifest_types.json The latter two may be affected by the change. In particular, parsing manifest types declared by them may lead to a hard error when an optional property can't be parsed now. BUG=1113513 Change-Id: I63966389e25f7591b4425815d32d9da59d35c3fb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2500425 Commit-Queue: Karan Bhatia <karandeepb@chromium.org> Reviewed-by:Devlin <rdevlin.cronin@chromium.org> Cr-Commit-Position: refs/heads/master@{#823545}
Showing
Please register or sign in to comment