Skip to content
This repository was archived by the owner on Apr 15, 2022. It is now read-only.
This repository was archived by the owner on Apr 15, 2022. It is now read-only.

Support directly describing named types #10

@randomPoison

Description

@randomPoison

Right now describing a type always results in a unified representation of the type, e.g. when using the built-in functionality you'll always get a Schema value. Being able to unify all types under one schema representation is necessary in order to fully represent a type tree, however it's also useful in some cases to be able to directly get the specialized representation of the type being described.

It would be helpful to add specialized alternatives to the Describe trait that can return more direct information in contexts where the type of type is known, e.g. DescribeStruct, DescribeEnum, etc. We could provide a blanket impl of Describe for these types for consistency. These traits would also be useful as trait bounds, since it would allow users to write generic code that only accepts a type that can be described as a struct (for example).

It's not clear how specific we should get with these specialized traits. DescribeStruct and DescribeEnum seem reasonable, are there any others that make sense? Would we want something like DescribeSequence or DescribeMap? DescribeTuple? DescribePrimitive?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions