Skip to content

Add TypeSpec representation for the facets pattern#587

Open
J-Mumo wants to merge 1 commit into
microsoft:vNextfrom
J-Mumo:graph-facets-typespec-example
Open

Add TypeSpec representation for the facets pattern#587
J-Mumo wants to merge 1 commit into
microsoft:vNextfrom
J-Mumo:graph-facets-typespec-example

Conversation

@J-Mumo

@J-Mumo J-Mumo commented Jun 22, 2026

Copy link
Copy Markdown

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-msgraph v1.1.0; this PR documents how to author the pattern.

Changes

  • graph/patterns/facets.md — new Facets in TypeSpec section that models the existing driveItem CSDL example in TypeSpec (audio/file/folder/image/video as @facet nullable @complex properties), 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

@facet is 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.

🤖 AI-assisted authoring (GitHub Copilot).

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.
@J-Mumo J-Mumo requested a review from a team as a code owner June 22, 2026 16:47
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.

1 participant