Skip to content

Create converters for all types, not just top level #1235

Description

@benquarmby

Unless --just-types is specified, a handy Convert utility is created to cast raw JSON to well typed data models. However, these are only created for the top level types.

Support creating conversion routines for all types described in a schema.

This will support the common scenario where REST APIs return nested resources. As a fabricated example:

  • The JSON schema car.json describes the top level Car type and a nested CarManufacturer type.
  • The API provides a top level car/:carId resource. This maps to the quicktype Convert.toCar helper ✅
  • The API provides a nested car/:carId/manufacturer resource. While quicktype created the type for us, there is no matching converter ❌

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