microsoft / microsoft/vscode-powerquery-sdk
Add Method for Getting Type's Subtype Claim
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 92
- Forks
- 23
- PR merge metrics
- No merged PRs in 30d
Description
Preflight Checklist
- I have installed the latest version of Power Query SDK.
- I have checked existing resources, including the common issues and the release notes.
- I have searched for similar issues.
Problem
The standard library does not seem to provide an easy or accurate way to read a type's subtype claim.
Why is this important?
When a Table.View's OnAddColumns handler is invoked, it is passed a list of records describing the column(s) to add. One of the fields provided in these records is Type, which corresponds to Table.AddColumn's optional fourth columnType argument. (This fourth argument can be a basic M type [e.g. type number or type text] or one that is decorated with a subtype claim [like Int64.Type or Uri.Type].)
A connector's OnAddColumns handler may want to factor in type's subtype claim (for example, perhaps writing a different native query when an integer output is expected vs. when just a number back is the desire).
Desired Solution
An easy and accurate way to read (or check) a type's subtype claim.
Ideas:
- Add method
Type.SubTypeClaim(Int64.Type)// returns the string "Int64.Type" - Add a
SubTypeClaimfield to the record output byType.Facets.
Alternatives and Workarounds
A single-column table type can be made that uses the expected "add column" type as its column type. This table type can then be passed to Type.TableSchema, which outputs a schema details table. In that table, the TypeName column (which should contain the subtype claim name) can be read.
Unfortunately, while this column is supposed to contain the subtype claim's name, it does not always report out the correct value (like for claims Guid.Type or Uri.Type).
Additional Context
No response
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the Type.Facets and Type.TableSchema behaviors in the standard library, along with the Type value passed to Table.View's OnAddColumns handler. Done means providing an easy and accurate way to retrieve or check subtype claims, including Int64.Type, Guid.Type, and Uri.Type.
Written by the indexing model from the issue text.
Assessment
- Domain
- api, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100