Open seiltingcr opened 3 years ago
I upvote! :) a fix would make me very happy! :)
I took a look at the python renderer to see if this is a super easy fix, and it looks like the base class it uses is not quite flexible enough to allow this: It calls the same method (emitDescription
) for both class descriptions and attribute descriptions, with no more data about what type of thing the description is for. It would be nice if someone who knows the codebase a little bit better could give a quick yes/no on the feasibility of this.
There is also the fact that it produces quite antiquated-looking code. Even in this tiny example, it uses Optional[str]
, for instance, which I would not accept in a pull request in 2023. I am a bit wary of wasting time on a project that looks like 2 people have used it since March 2021.
@seiltingcr I think this may have been fixed 2 months ago in a recent PR. --> https://github.com/glideapps/quicktype/pull/2443
I will be checking shortly.
The python code generator for 3.6 and 3.7 puts the property descriptions as docstrings before the respective properties in the classes. This is incorrect because the first docstring after the class name is applied to the class, and all others disappear at runtime.
This causes the classes to be documented with the
description
s of their first properties; the properties to not have theirdescription
s; and the top-level object'sdescription
not to be generated at all.Code to reproduce:
This produces the following class for python 3.6 and 3.7:
What I would have expected: