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

Update built-in template to incorporate emitter selections #5658

Open
allenjzhang opened this issue Jan 17, 2025 · 1 comment
Open

Update built-in template to incorporate emitter selections #5658

allenjzhang opened this issue Jan 17, 2025 · 1 comment
Assignees

Comments

@allenjzhang
Copy link
Member

A couple of items for a better user experience in getting started with TypeSpec:

  • Update built-in template to incorporate emitter selections
  • Decide where the standard catalog of emitters are kept
  • Consolidate the schemas
  • Add initial simple schema instead of just three import.
@timotheeguerin
Copy link
Member

timotheeguerin commented Jan 21, 2025

Proposing something like that

In the same way we have the built in template, we define this built in catalog which can be hosted in the compiler

interface BuiltInCatalog {
  libraries: Library[];
  /** List of known emitters */
  emitters: Emitter[];
}

interface LibraryBase {
  name: string; // e.g. @typespec/openapi3
  description: string; // Generate OpenAPI 3 or 3.1 document
  owner: string; // e.g Microsoft .. this is so we can add 3rd party emitters in the future
  homepage: string; // doc url
}

interface Library extends LibraryBase {
  recommendedEmitters?: string[]; // e.g. ['@typespec/openapi3']
}

interface Emitter extends LibraryBase {
  tags: string[]; // e.g. ['openapi3', 'http', 'client', 'server']
  language?: string; // Language emitted by the emitter
}

Difference with current schema

  • Rename some properties

    • sourceRepo -> homepage
    • package -> name
  • Replace properties with a generic tag: The one layer category is to arbitrary. Some emitter could also technically have multiple categories

    • language
    • category
  • Removed requisite and replaced with more generic description for now. This is mostly because this is isn';t anything but documentation for now and if we wanted a more solid prerequisite validation we might want to have it be a more specific format

  • Added libraries vs emitters with a way for a library to recommend certain emitters so the init phase can figure it out

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

No branches or pull requests

2 participants