Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .chronus/changes/docs-events-2026-8-11.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: internal
packages:
- "@typespec/events"
---

Add missing documentation on public declarations and members
7 changes: 7 additions & 0 deletions .chronus/changes/docs-graphql-2026-8-11.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: internal
packages:
- "@typespec/graphql"
---

Add missing documentation on public declarations and members
7 changes: 7 additions & 0 deletions .chronus/changes/docs-http-client-2026-8-11.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: internal
packages:
- "@typespec/http-client"
---

Add missing documentation on public declarations and members
7 changes: 7 additions & 0 deletions .chronus/changes/docs-protobuf-2026-8-11.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: internal
packages:
- "@typespec/protobuf"
---

Add missing documentation on public declarations and members
6 changes: 3 additions & 3 deletions packages/events/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ decorator.

##### Parameters

| Name | Type | Description |
| ----------- | ---------------- | ----------- |
| contentType | `valueof string` | |
| Name | Type | Description |
| ----------- | ---------------- | ----------------------------------------------- |
| contentType | `valueof string` | The content type of the event or event payload. |

##### Examples

Expand Down
1 change: 1 addition & 0 deletions packages/events/generated-defs/TypeSpec.Events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export type EventsDecorator = (
* { done: false, @data @contentType("text/plain") value: string,}
* }
* ```
* @param contentType The content type of the event or event payload.
*/
export type ContentTypeDecorator = (
context: DecoratorContext,
Expand Down
2 changes: 2 additions & 0 deletions packages/events/lib/decorators.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ extern dec events(target: Union);
* { done: false, @data @contentType("text/plain") value: string,}
* }
* ```
*
* @param contentType The content type of the event or event payload.
*/
extern dec contentType(target: UnionVariant | ModelProperty, contentType: valueof string);

Expand Down
18 changes: 9 additions & 9 deletions packages/graphql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ and all of the interfaces' properties must be present and compatible.

##### Parameters

| Name | Type | Description |
| ---------- | --------- | ----------- |
| interfaces | `Model[]` | |
| Name | Type | Description |
| ---------- | --------- | --------------------------------------------------------------------------- |
| interfaces | `Model[]` | The models to compose into the target, each emitted as a GraphQL interface. |

##### Examples

Expand Down Expand Up @@ -199,9 +199,9 @@ The operations become fields on the GraphQL type with their parameters as argume

##### Parameters

| Name | Type | Description |
| ---------- | -------------------------- | ----------- |
| operations | `Operation \| Interface[]` | |
| Name | Type | Description |
| ---------- | -------------------------- | ---------------------------------------------------------------------------- |
| operations | `Operation \| Interface[]` | The operations, or interfaces of operations, to add to the target as fields. |

##### Examples

Expand Down Expand Up @@ -252,9 +252,9 @@ All types and operations within the namespace will be emitted to a single GraphQ

##### Parameters

| Name | Type | Description |
| ------- | ----------------------------------------- | ----------- |
| options | [valueof `SchemaOptions`](#schemaoptions) | |
| Name | Type | Description |
| ------- | ----------------------------------------- | ----------------------------------------- |
| options | [valueof `SchemaOptions`](#schemaoptions) | Options for the schema, such as its name. |

##### Examples

Expand Down
3 changes: 3 additions & 0 deletions packages/graphql/generated-defs/TypeSpec.GraphQL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export type GraphqlInterfaceDecorator = (
* name: string;
* }
* ```
* @param interfaces The models to compose into the target, each emitted as a GraphQL interface.
*/
export type ComposeDecorator = (
context: DecoratorContext,
Expand All @@ -87,6 +88,7 @@ export type ComposeDecorator = (
* }
* // Emits: type Person { name: String!; followers(query: String!): [Person!]! }
* ```
* @param operations The operations, or interfaces of operations, to add to the target as fields.
*/
export type OperationFieldsDecorator = (
context: DecoratorContext,
Expand Down Expand Up @@ -146,6 +148,7 @@ export type SubscriptionDecorator = (
* }
* // Emits: MyAPI.graphql
* ```
* @param options Options for the schema, such as its name.
*/
export type SchemaDecorator = (
context: DecoratorContext,
Expand Down
2 changes: 2 additions & 0 deletions packages/graphql/lib/interface.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,7 @@ extern dec graphqlInterface(
* name: string;
* }
* ```
*
* @param interfaces The models to compose into the target, each emitted as a GraphQL interface.
*/
extern dec compose(target: Model, ...interfaces: Model[]);
2 changes: 2 additions & 0 deletions packages/graphql/lib/operation-fields.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@ alias OperationOrInterface = Operation | Interface;
* }
* // Emits: type Person { name: String!; followers(query: String!): [Person!]! }
* ```
*
* @param operations The operations, or interfaces of operations, to add to the target as fields.
*/
extern dec operationFields(target: Model, ...operations: OperationOrInterface[]);
2 changes: 2 additions & 0 deletions packages/graphql/lib/schema.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,7 @@ namespace Schema {
* }
* // Emits: MyAPI.graphql
* ```
*
* @param options Options for the schema, such as its name.
*/
extern dec schema(target: Namespace, options?: valueof Schema.SchemaOptions);
4 changes: 3 additions & 1 deletion packages/graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
},
"scripts": {
"clean": "rimraf ./dist ./temp",
"build": "pnpm gen-extern-signature && alloy build",
"build": "pnpm gen-extern-signature && alloy build && pnpm lint-typespec-library",
"lint-typespec-library": "tsp compile . --warn-as-error --import @typespec/library-linter --no-emit",
"watch": "alloy build --watch",
"gen-extern-signature": "tspd --enable-experimental gen-extern-signature .",
"test": "vitest run",
Expand Down Expand Up @@ -66,6 +67,7 @@
"@typespec/compiler": "workspace:~",
"@typespec/emitter-framework": "workspace:~",
"@typespec/http": "workspace:~",
"@typespec/library-linter": "workspace:^",
"@typespec/mutator-framework": "workspace:~",
"@typespec/tspd": "workspace:~",
"rimraf": "catalog:",
Expand Down
5 changes: 5 additions & 0 deletions packages/http-client/generated-defs/TypeSpec.HttpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ export interface FeatureLifecycleOptions {
readonly emitterScope?: string;
}

/**
* Mark a type or member as experimental, so generated clients can surface it as such.
*
* @param options Options for this decorator, such as the emitters it applies to.
*/
export type ExperimentalDecorator = (
context: DecoratorContext,
target: Type,
Expand Down
1 change: 1 addition & 0 deletions packages/http-client/lib/common.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ namespace TypeSpec.HttpClient;
* You can use ”!” to exclude specific emitters, for example: `!@typespec/http-client-js, !@typespec/http-client-csharp`
*/
model ClientDecoratorOptions {
/** Comma separated list of emitter names the decorator applies to. */
emitterScope?: string;
}
8 changes: 8 additions & 0 deletions packages/http-client/lib/decorators.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@ import "../dist/src/tsp-index.js";

namespace TypeSpec.HttpClient;

/**
* Options describing where a feature lifecycle decorator such as `@experimental` applies.
*/
model FeatureLifecycleOptions {
...ClientDecoratorOptions;
}

/**
* Mark a type or member as experimental, so generated clients can surface it as such.
*
* @param options Options for this decorator, such as the emitters it applies to.
*/
extern dec experimental(target: unknown, options?: valueof FeatureLifecycleOptions);
12 changes: 11 additions & 1 deletion packages/protobuf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,17 @@ The field index of a Protobuf message must:

- fall between 1 and 2<sup>29</sup> - 1, inclusive.
- not fall within the implementation reserved range of 19000 to 19999, inclusive.
- not fall within any range that was [marked reserved](#
- not fall within any range that was [marked reserved](#%40TypeSpec.Protobuf.reserve).

#### API Compatibility Note

Fields are accessed by index, so changing the index of a field is an API breaking change.

#### Encoding

Field indices between 1 and 15 are encoded using a single byte, while field indices from 16 through 2047 require two
bytes, so those indices between 1 and 15 should be preferred and reserved for elements that are frequently or always
set in the message. See the [Protobuf binary format](https://protobuf.dev/programming-guides/encoding/).

```typespec
@TypeSpec.Protobuf.field(index: valueof uint32)
Expand Down
5 changes: 2 additions & 3 deletions packages/protobuf/generated-defs/TypeSpec.Protobuf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ export type MessageDecorator = (
* The field index of a Protobuf message must:
* - fall between 1 and 2<sup>29</sup> - 1, inclusive.
* - not fall within the implementation reserved range of 19000 to 19999, inclusive.
* - not fall within any range that was [marked reserved](#
*
* @TypeSpec .Protobuf.reserve).
* - not fall within any range that was [marked reserved](#%40TypeSpec.Protobuf.reserve).
*
* #### API Compatibility Note
*
Expand All @@ -43,6 +41,7 @@ export type MessageDecorator = (
* Field indices between 1 and 15 are encoded using a single byte, while field indices from 16 through 2047 require two
* bytes, so those indices between 1 and 15 should be preferred and reserved for elements that are frequently or always
* set in the message. See the [Protobuf binary format](https://protobuf.dev/programming-guides/encoding/).
*
* @param index The whole-number index of the field.
* @example
* ```typespec
Expand Down
14 changes: 8 additions & 6 deletions packages/protobuf/lib/proto.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ namespace TypeSpec.Protobuf;
*/
@Private.externRef(Path, Name)
model Extern<Path extends string, Name extends string> {
// This _extern property is needed so that getEffectiveModelType will have something to look up. Without it, if an
// Extern model is spread into the parameter of an operation, the resulting model is empty and carries no information
// that can relate it back to its original definition.
/**
* Never present. This property exists only so that `getEffectiveModelType` has something to look
* up: without it, an `Extern` model spread into an operation parameter yields an empty model that
* cannot be related back to its original definition.
*/
_extern: never;
}

Expand Down Expand Up @@ -157,7 +159,7 @@ extern dec message(target: {});
* The field index of a Protobuf message must:
* - fall between 1 and 2<sup>29</sup> - 1, inclusive.
* - not fall within the implementation reserved range of 19000 to 19999, inclusive.
* - not fall within any range that was [marked reserved](#@TypeSpec.Protobuf.reserve).
* - not fall within any range that was [marked reserved](#%40TypeSpec.Protobuf.reserve).
*
* #### API Compatibility Note
*
Expand Down Expand Up @@ -226,7 +228,7 @@ extern dec service(target: TypeSpec.Reflection.Interface);

// FIXME: cannot link to the package decorator directly because it is detected as a broken link.
/**
* Details applied to a package definition by the [`@package`](./decorators#@TypeSpec.Protobuf.package) decorator.
* Details applied to a package definition by the [`@package`](./decorators#%40TypeSpec.Protobuf.package) decorator.
*/
model PackageDetails {
/**
Expand Down Expand Up @@ -262,7 +264,7 @@ extern dec `package`(target: TypeSpec.Reflection.Namespace, details?: PackageDet
* - `Out`: the output of the operation is streaming.
* - `None`: neither the input nor the output are streaming.
*
* See the [`@stream`](./decorators#@TypeSpec.Protobuf.stream) decorator.
* See the [`@stream`](./decorators#%40TypeSpec.Protobuf.stream) decorator.
*/
enum StreamMode {
/**
Expand Down
4 changes: 3 additions & 1 deletion packages/protobuf/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"tspMain": "lib/proto.tsp",
"scripts": {
"clean": "rimraf ./dist ./temp",
"build": "pnpm gen-extern-signature && tsc -p tsconfig.build.json",
"build": "pnpm gen-extern-signature && tsc -p tsconfig.build.json && pnpm lint-typespec-library",
"lint-typespec-library": "tsp compile . --warn-as-error --import @typespec/library-linter --no-emit",
"watch": "tsc -p tsconfig.build.json --watch",
"gen-extern-signature": "tspd --enable-experimental gen-extern-signature .",
"test": "vitest run",
Expand All @@ -47,6 +48,7 @@
"@types/micromatch": "catalog:",
"@types/node": "catalog:",
"@typespec/compiler": "workspace:^",
"@typespec/library-linter": "workspace:^",
"@typespec/tspd": "workspace:^",
"@vitest/coverage-v8": "catalog:",
"@vitest/ui": "catalog:",
Expand Down
6 changes: 6 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ and all of the interfaces' properties must be present and compatible.

#### Parameters

| Name | Type | Description |
| ---------- | --------- | ----------- |
| interfaces | `Model[]` | |
| Name | Type | Description |
| ---------- | --------- | --------------------------------------------------------------------------- |
| interfaces | `Model[]` | The models to compose into the target, each emitted as a GraphQL interface. |

#### Examples

Expand Down Expand Up @@ -115,9 +115,9 @@ The operations become fields on the GraphQL type with their parameters as argume

#### Parameters

| Name | Type | Description |
| ---------- | -------------------------- | ----------- |
| operations | `Operation \| Interface[]` | |
| Name | Type | Description |
| ---------- | -------------------------- | ---------------------------------------------------------------------------- |
| operations | `Operation \| Interface[]` | The operations, or interfaces of operations, to add to the target as fields. |

#### Examples

Expand Down Expand Up @@ -168,9 +168,9 @@ All types and operations within the namespace will be emitted to a single GraphQ

#### Parameters

| Name | Type | Description |
| ------- | -------------------------------------------------------------------------------- | ----------- |
| options | [valueof `SchemaOptions`](./data-types.md#TypeSpec.GraphQL.Schema.SchemaOptions) | |
| Name | Type | Description |
| ------- | -------------------------------------------------------------------------------- | ----------------------------------------- |
| options | [valueof `SchemaOptions`](./data-types.md#TypeSpec.GraphQL.Schema.SchemaOptions) | Options for the schema, such as its name. |

#### Examples

Expand Down
Loading
Loading