Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1108 support display type name #277

Merged
merged 3 commits into from
Nov 10, 2023

Conversation

zmstone
Copy link
Member

@zmstone zmstone commented Nov 8, 2023

feat: add display_name to union type

With typerefl:alias/2, the primitive can be quite descriptive.
Other types are quite self-descriptive too.

Unions however, can get quite big and ugly when:

1. Some old types added for backward compatibility
   e.g. we want to document something like "ArrayOf(String)",
   but we also support comma separated strings which
   can be described in docs but not necessarily show in
   the type.
2. When the union is very big, we may want to provide a shorter
   name for it.
   For example, if all union members are enumerated for a
   5-member union, it may look like OneOf(t1,t2,t3,t4,t5).
   When using display name, we can do:
   "Object (see all possible values below)"

@zmstone zmstone force-pushed the 1108-support-display-type-name branch 4 times, most recently from 26fb760 to 9510003 Compare November 9, 2023 09:05
becasue 'maybe' is a key word in Erlang starting from OTP 25
With typerefl:alias/2, the primitive can be quite descriptive.
Other types are quite self-descriptive too.

Unions however, can get quite big and ugly when:

1. Some old types added for backward compatibility
   e.g. we want to document something like "ArrayOf(String)",
   but we also support comma separated strings which
   can be described in docs but not necessarily show in
   the type.
2. When the union is very big, we may want to provide a shorter
   name for it.
   For example, if all union members are enumerated for a
   5-member union, it may look like OneOf(t1,t2,t3,t4,t5).
   When using display name, we can do:
   "Object (see all possible values below)"
@zmstone zmstone force-pushed the 1108-support-display-type-name branch from 9510003 to faa7c18 Compare November 9, 2023 09:32
@zmstone zmstone merged commit 3bb4831 into emqx:master Nov 10, 2023
3 checks passed
@zmstone zmstone deleted the 1108-support-display-type-name branch November 10, 2023 05:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants