[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: cleanups with long-term benefits (was Re: [PATCH] schemas: Add vim m
From: |
Paolo Bonzini |
Subject: |
Re: cleanups with long-term benefits (was Re: [PATCH] schemas: Add vim modeline) |
Date: |
Mon, 3 Aug 2020 20:16:21 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 |
On 03/08/20 20:10, John Snow wrote:
> Heresy:
>
> Docstrings could become part of the data format so they can be parsed,
> analyzed and validated. Parsers largely treat comments like non-semantic
> information and discard it. Round-trip parsers that preserve comments in
> any language are extremely rare.
>
> If the docstrings are relevant to the generator and aren't discardable,
> they should be fully-fledged data members.
>
> In a prototype I had for a YAML format, I just promoted docstrings
> directly to fields, so I could allow clients to query help text for
> individual commands.
This would be actually a good idea, but somebody has to write the code.
Each field's docstring should be attached to the field, however---no
parsing needed only looking at the tree. Take a look at what Nir posted:
> Here is the patch adding schema convertor from qemu "json" format to
> standard yaml:
> https://github.com/oVirt/vdsm/commit/e57b69e72987c0929b20306c454835b52b5eb7ee
>
> The current version of the new yaml based schema:
> https://github.com/oVirt/vdsm/blob/master/lib/vdsm/api/vdsm-api.yml
VmDiskDevice: &VmDiskDevice
added: '3.1'
description: Properties of a VM disk device.
name: VmDiskDevice
properties:
- description: Indicates if writes are prohibited for the
device
name: readonly
type: boolean
- description: The size of the disk (in bytes)
name: apparentsize
type: uint
etc.
Paolo
- Re: cleanups with long-term benefits, (continued)
- Re: cleanups with long-term benefits, Cornelia Huck, 2020/08/05
- Re: cleanups with long-term benefits (was Re: [PATCH] schemas: Add vim modeline), Markus Armbruster, 2020/08/05
- Re: cleanups with long-term benefits (was Re: [PATCH] schemas: Add vim modeline), Alex Bennée, 2020/08/05
- Re: cleanups with long-term benefits (was Re: [PATCH] schemas: Add vim modeline), John Snow, 2020/08/05
- Re: cleanups with long-term benefits (was Re: [PATCH] schemas: Add vim modeline), Markus Armbruster, 2020/08/06
- Re: cleanups with long-term benefits (was Re: [PATCH] schemas: Add vim modeline), Markus Armbruster, 2020/08/05
- Re: cleanups with long-term benefits (was Re: [PATCH] schemas: Add vim modeline), John Snow, 2020/08/03
- Re: cleanups with long-term benefits (was Re: [PATCH] schemas: Add vim modeline),
Paolo Bonzini <=
- Re: cleanups with long-term benefits (was Re: [PATCH] schemas: Add vim modeline), John Snow, 2020/08/03
- Re: cleanups with long-term benefits (was Re: [PATCH] schemas: Add vim modeline), Nir Soffer, 2020/08/03
- Re: cleanups with long-term benefits (was Re: [PATCH] schemas: Add vim modeline), John Snow, 2020/08/03
Re: cleanups with long-term benefits (was Re: [PATCH] schemas: Add vim modeline), Daniel P . Berrangé, 2020/08/03
Re: cleanups with long-term benefits (was Re: [PATCH] schemas: Add vim modeline), Daniel P . Berrangé, 2020/08/03