Eric Blake <[email protected]> writes: > A future patch will enable deferred error detection in the > various QAPISchema*.check() methods (rather than the current > ad hoc parse checks).
What's "deferred" about them? Perhaps simply: A future patch will move error checking into the various QAPISchema*.check() methods. > But that means the user can request > a QAPI entity that will only fail validation after it has > been initialized. I'm not sure I get this sentence. > Since all errors have to have an > associated 'info' location, we need a location to be > associated with all user-triggered implicit types. The > intuitive info to use is the location of the enclosing > entity that caused the creation of the implicit type. Yes. > Note that we do not anticipate builtin types being used in > an error message (as they are not part of the user's QAPI > input, the user can't cause a semantic error in their > behavior), so we exempt those types from requiring info, Yes, no errors should be reported for built-in entities. Sometimes, an error message for one entity wants to refer to some other entity. We'll have to take care not to blindly use info then. > by > setting a flag to track the completion of _def_predefineds(). Explaining the implementation here seems premature. > No change to the generated code. > > RFC: I used a class-level static flag to track whether we expected > 'info is None' when creating a QAPISchemaEntity. This is gross, > because the flag will only be set on the first QAPISchema() instance > (it works because none of our client scripts ever instantiate more > than one schema). But the only other thing I could think of would > be passing the QAPISchema instance into the constructor for each > QAPISchemaEntity, which is a lot of churn. Any better ideas on how > best to do the assertion, or should I just drop it? > > Signed-off-by: Eric Blake <[email protected]> I'd check in QAPISchema._def_entity(). Patch looks good otherwise.
