The PR ships completely parsed DangerDSLJSONType structure from the JSON schema.
Unfortunately, I was unable to parse the schema with any code-generation tool for Python (it failed either on missing top-level definition, circular references or some validation error due to the types). So I decided to roll my own generation code for the sake of the project. It does a couple of cool things:
it provides full type hints on the structure
it patches some reserved Python keywords in the structure (like from or self),
it fixes all the casing in the JSON schema (it handles snake-case modified_files, camel-case updatedDate and camel-case with shortcuts thisPR
it builds nested objects outside of the regular schema definitions
Since this part of the code relies on Jinja templates, it can be potentially reused for other projects, too 👍
EDIT: The PR is huge because it ships the schema with the project and also the generated model file, sorry 🙇
The PR ships completely parsed
DangerDSLJSONType
structure from the JSON schema.Unfortunately, I was unable to parse the schema with any code-generation tool for Python (it failed either on missing top-level definition, circular references or some validation error due to the types). So I decided to roll my own generation code for the sake of the project. It does a couple of cool things:
from
orself
),modified_files
, camel-caseupdatedDate
and camel-case with shortcutsthisPR
Since this part of the code relies on Jinja templates, it can be potentially reused for other projects, too 👍
EDIT: The PR is huge because it ships the schema with the project and also the generated model file, sorry 🙇