Skip to content

Types that reference JSONSchema are currently unusable #111

Open
@brendanhay

Description

@brendanhay

As a concrete example, I'm attempting to convert various helm charts such as cert-manager into Dhall and there are various errors in the CustomResourceDefinition and related CustomResourceValidation types that are supposed to use JSONSchema:

  • JSONSchemaProps
    • externalDocumentation is required but has its fields marked as optional. The property is actually optional.
    • properties has a Text value. It should be of type JSONSchema, whatever that might be.
  • JSONSchemaPropsOrBool, JSONSchemaPropsOrArray, JSONSchemaPropsOrStringArray
    • All of these types are generated as {}. They should reference a recursive JSONSchema type similarly to JSONSchemaProps.properties.
  • JSON
    • Is generated as {}. Probably it should point to either Prelude.JSON.Type or Text. (I personally find the former untenable outside of automated conversion.)

Some thoughts/observations:

  • I've currently 'solved' this by inlining entire CustomResourceDefinition's YAML as Text and post-processing this to decode the Text into a JSON Value and reinsert it into the YAML/JSON AST when converting Dhall to YAML.
  • Probably the JSONSchema related types should not be generated and there should be a separate JSONSchema Dhall package that is pulled in as a dependency, since the spec is versioned and won't be subject to change on dhall-kubernetes regeneration.
  • Prelude.JSON.Type could be used as a shorter-term solution - but it's absolutely horrendous to work with when trying to represent ad-hoc JSON by hand.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions