• Karan Bhatia's avatar
    Reland "JsonSchemaCompiler: Raise error on parse failures of optional properties." · 0d55d3bb
    Karan Bhatia authored
    This reverts commit 89891098.
    
    Reason for revert: The original test failures were caused due to crbug.com/gn/215 which caused spurious failures in 
    incremental rebuilds. The corresponding GN roll has now been reverted.
    
    Original change's description:
    > Revert "JsonSchemaCompiler: Raise error on parse failures of optional properties."
    >
    > This reverts commit eec7bff8.
    >
    > Reason for revert:
    > After this change, JsonSchemaCompilerErrorTest.* are failing on
    > several linux bots:
    > https://ci.chromium.org/p/chromium/builders/ci/Linux%20Tests/95122
    > https://ci.chromium.org/p/chromium/builders/ci/Linux%20Tests%20%28dbg%29%281%29/92709
    > https://ci.chromium.org/p/chromium/builders/ci/Linux%20ChromiumOS%20MSan%20Tests/21165
    >
    > Original change's description:
    > > 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}
    >
    > TBR=rdevlin.cronin@chromium.org,karandeepb@chromium.org
    >
    > Change-Id: I3b26905381996192b377f79abcde757efaf08f31
    > No-Presubmit: true
    > No-Tree-Checks: true
    > No-Try: true
    > Bug: 1113513
    > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2519330
    > Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org>
    > Commit-Queue: Hiroki Nakagawa <nhiroki@chromium.org>
    > Cr-Commit-Position: refs/heads/master@{#823902}
    
    TBR=rdevlin.cronin@chromium.org,nhiroki@chromium.org,karandeepb@chromium.org
    
    # Not skipping CQ checks because this is a reland.
    
    Bug: 1113513
    Change-Id: I57d4725126af7c019518cd2bff000403a8b749b7
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2519173Reviewed-by: default avatarKaran Bhatia <karandeepb@chromium.org>
    Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
    Commit-Queue: Karan Bhatia <karandeepb@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#824187}
    0d55d3bb
cc_generator.py 49.1 KB