Add TypeSpec representation for the facets pattern#587
Open
J-Mumo wants to merge 1 commit into
Open
Conversation
Documents how the facets API design pattern is authored in TypeSpec using the @facet decorator from @microsoft/typespec-msgraph (issue microsoftgraph/typespec-msgraph#1061, Phase 6): - facets.md: new "Facets in TypeSpec" section with a driveItem example (audio/file/folder/image/video as @facet nullable @complex properties), the linter rules, and the compiled CSDL (a standard nullable complex property -- @facet is authoring/lint-only and emits no CSDL annotation). - GuidelinesGraph.md: add a "TypeSpec representation" column to the modeling-variants comparison table and a pointer to the new section.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the TypeSpec representation of the facets API design pattern, completing the documentation deliverable (Phase 6) of microsoftgraph/typespec-msgraph#1061. The @facet decorator has shipped in
@microsoft/typespec-msgraphv1.1.0; this PR documents how to author the pattern.Changes
graph/patterns/facets.md— new Facets in TypeSpec section that models the existingdriveItemCSDL example in TypeSpec (audio/file/folder/image/videoas@facetnullable@complexproperties), lists the linter rules, and shows the compiled CSDL.graph/GuidelinesGraph.md— adds a TypeSpec representation column to the modeling-variants comparison table and a pointer to the new section.Note on CSDL output
@facetis an authoring/lint-only marker: it emits no CSDL annotation, so a facet property compiles to a standard nullable complex-typed<Property>— identical to a hand-authored facet. This was verified by compiling the example with the TypeSpec compiler (v1.9.0) +@microsoft/typespec-msgraph.