Hi

On Tue, Oct 13, 2026 at 5:56 PM Markus Armbruster <[email protected]> wrote:
>
> Marc-André Lureau <[email protected]> writes:
>
> > Integer built-in types are currently canonicalized to "int" in
> > query-qmp-schema. Consequently, clients cannot distinguish types such
> > as int8, uint64, and size, even though they accept different ranges.
>
> This is by design.
>
> Width and signedness are an implementation detail.  We can change them
> freely without affecting syntactic compatibility of the wire protocol.
>
> If we expose them, we can't anymore, and docs/devel/qapi-code-gen.rst
> section "Compatibility considerations" needs an update.
>
> Why would this be useful?  Knowing width and signedness narrows down the
> possible values some, but it need not be tight.

Well, this was just a first step toward a better introspection support
for constaints. I understand the wire format is just json int, but we
may want to express ranges, enumeration of valid values, alignment,
string format etc.. Exposing signdness and width is the basics, and
establishes a pattern for carrying type-level metadata beyond just
"json-type". This enable clients to do proper validation and UI
generation without knowledge of commands and internals.

>
> > Preserve the individual integer types during schema analysis and add an
> > optional "integer" member to SchemaInfoBuiltin. It reports whether the
> > type is signed and its width in bits. This also preserves the actual
> > element type for arrays of integers.
> >
> > Teach the introspection generator to emit integer values and update the
> > documentation to describe the extended schema information.
> >
> > For example for introspection, for all kind of int, before:
> > {"name": "int", "json-type": "int", "meta-type": "builtin"}
> >
> > After, there are various int types such as:
> > {"name": "int64", "integer": {"bits": 64, "signed": true}, "json-type":
> > "int", "meta-type": "builtin"}
> >
> > Signed-off-by: Marc-André Lureau <[email protected]>
>


Reply via email to