Skip to content

Add component category field to template manifest #97

@nick-pape

Description

@nick-pape

Summary

The dev design says the template manifest should include "Component category (webpart, ACE, etc)". The current template.json schema (ISPFxTemplateJson) has no category field. This is needed for filtering, grouping, and display in the list-templates command.

Requirements

Schema addition

Add a category field to template.json:

{
  "name": "webpart-minimal",
  "description": "A minimal SPFx web part",
  "version": "1.0.0",
  "spfxVersion": "1.22.2",
  "category": "webpart"
}

Allowed categories

Category Description Templates
webpart Web Parts webpart-minimal, webpart-noframework, webpart-react
extension Extensions All extension-* templates
ace Adaptive Card Extensions All ace-* templates
library Libraries library

Behavior

  • Field should be required in the schema
  • Used by list-templates to group/filter output
  • Could be used by create to show relevant templates based on user intent
  • Validated by Zod schema in SPFxTemplateJsonFile

Implementation notes

  • Update ISPFxTemplateJson interface in api/spfx-template-api/src/templating/SPFxTemplateJsonFile.ts
  • Update Zod schema SPFxTemplateDefinitionSchema to include category as an enum
  • Add category getter to SPFxTemplateJsonFile and SPFxTemplate
  • Update all 18 template.json files to include the appropriate category
  • Update toString() methods to display category

Acceptance criteria

  • category field added to template.json schema
  • All 18 templates have correct category values
  • SPFxTemplate exposes category property
  • Schema validation rejects invalid categories
  • list-templates can group/filter by category

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions