Skip to content
Merged
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-rest-2026-8-11.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: internal
packages:
- "@typespec/rest"
---

Remove doc comment `@template` tags that referenced the enclosing interface, and document the remaining operation body parameters
53 changes: 30 additions & 23 deletions packages/rest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ Specify this operation is a collection action. (Scopped to a resource, /pets/my-

| Name | Type | Description |
| ------------ | ---------------- | ----------------------------------------------------------------------------- |
| resourceType | `Model` | Resource marked with |
| resourceType | `Model` | Resource marked with `@resource` |
| name | `valueof string` | Name of the action. If not specified, the name of the operation will be used. |

#### `@copyResourceKeyParameters`
Expand Down Expand Up @@ -145,9 +145,9 @@ Specify that this is a CreateOrReplace operation for a given resource.

##### Parameters

| Name | Type | Description |
| ------------ | ------- | -------------------- |
| resourceType | `Model` | Resource marked with |
| Name | Type | Description |
| ------------ | ------- | -------------------------------- |
| resourceType | `Model` | Resource marked with `@resource` |

#### `@createsOrUpdatesResource`

Expand All @@ -163,9 +163,9 @@ Specify that this is a CreatesOrUpdate operation for a given resource.

##### Parameters

| Name | Type | Description |
| ------------ | ------- | -------------------- |
| resourceType | `Model` | Resource marked with |
| Name | Type | Description |
| ------------ | ------- | -------------------------------- |
| resourceType | `Model` | Resource marked with `@resource` |

#### `@createsResource`

Expand All @@ -181,9 +181,9 @@ Specify that this is a Create operation for a given resource.

##### Parameters

| Name | Type | Description |
| ------------ | ------- | -------------------- |
| resourceType | `Model` | Resource marked with |
| Name | Type | Description |
| ------------ | ------- | -------------------------------- |
| resourceType | `Model` | Resource marked with `@resource` |

#### `@deletesResource`

Expand All @@ -199,9 +199,9 @@ Specify that this is a Delete operation for a given resource.

##### Parameters

| Name | Type | Description |
| ------------ | ------- | -------------------- |
| resourceType | `Model` | Resource marked with |
| Name | Type | Description |
| ------------ | ------- | -------------------------------- |
| resourceType | `Model` | Resource marked with `@resource` |

#### `@listsResource`

Expand All @@ -217,9 +217,9 @@ Specify that this is a List operation for a given resource.

##### Parameters

| Name | Type | Description |
| ------------ | ------- | -------------------- |
| resourceType | `Model` | Resource marked with |
| Name | Type | Description |
| ------------ | ------- | -------------------------------- |
| resourceType | `Model` | Resource marked with `@resource` |

#### `@parentResource`

Expand Down Expand Up @@ -253,9 +253,9 @@ Specify that this is a Read operation for a given resource.

##### Parameters

| Name | Type | Description |
| ------------ | ------- | -------------------- |
| resourceType | `Model` | Resource marked with |
| Name | Type | Description |
| ------------ | ------- | -------------------------------- |
| resourceType | `Model` | Resource marked with `@resource` |

#### `@resource`

Expand All @@ -277,7 +277,7 @@ Mark this model as a resource type with a name.

#### `@segment`

Defines the preceding path segment for a
Defines the preceding path segment for a `@path` parameter in auto-generated routes.

```typespec
@TypeSpec.Rest.segment(name: valueof string)
Expand All @@ -295,6 +295,13 @@ Defines the preceding path segment for a

##### Examples

```typespec
@autoRoute
interface Pets {
get(@segment("pets") @path id: string): void; //-> route: /pets/{id}
}
```

#### `@segmentOf`

Returns the URL segment of a given model if it has `@segment` and `@key` decorator.
Expand Down Expand Up @@ -327,6 +334,6 @@ Specify that this is a Update operation for a given resource.

##### Parameters

| Name | Type | Description |
| ------------ | ------- | -------------------- |
| resourceType | `Model` | Resource marked with |
| Name | Type | Description |
| ------------ | ------- | -------------------------------- |
| resourceType | `Model` | Resource marked with `@resource` |
51 changes: 12 additions & 39 deletions packages/rest/generated-defs/TypeSpec.Rest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,16 @@ export type AutoRouteDecorator = (
) => DecoratorValidatorCallbacks | void;

/**
* Defines the preceding path segment for a
* Defines the preceding path segment for a `@path` parameter in auto-generated routes.
*
* @path parameter in auto-generated routes.
* @param name Segment that will be inserted into the operation route before the path parameter's name field.
* @example
*
*
* ```typespec
* @autoRoute
* interface Pets {
* get(
* @segment ("pets")
* @path id: string): void; //-> route: /pets/{id}
* get(@segment("pets") @path id: string): void; //-> route: /pets/{id}
* }
* ```
*/
export type SegmentDecorator = (
context: DecoratorContext,
Expand Down Expand Up @@ -96,10 +93,7 @@ export type ParentResourceDecorator = (
/**
* Specify that this is a Read operation for a given resource.
*
* @param resourceType Resource marked with
* @resource
*
*
* @param resourceType Resource marked with `@resource`
*/
export type ReadsResourceDecorator = (
context: DecoratorContext,
Expand All @@ -110,10 +104,7 @@ export type ReadsResourceDecorator = (
/**
* Specify that this is a Create operation for a given resource.
*
* @param resourceType Resource marked with
* @resource
*
*
* @param resourceType Resource marked with `@resource`
*/
export type CreatesResourceDecorator = (
context: DecoratorContext,
Expand All @@ -124,10 +115,7 @@ export type CreatesResourceDecorator = (
/**
* Specify that this is a CreateOrReplace operation for a given resource.
*
* @param resourceType Resource marked with
* @resource
*
*
* @param resourceType Resource marked with `@resource`
*/
export type CreatesOrReplacesResourceDecorator = (
context: DecoratorContext,
Expand All @@ -138,10 +126,7 @@ export type CreatesOrReplacesResourceDecorator = (
/**
* Specify that this is a CreatesOrUpdate operation for a given resource.
*
* @param resourceType Resource marked with
* @resource
*
*
* @param resourceType Resource marked with `@resource`
*/
export type CreatesOrUpdatesResourceDecorator = (
context: DecoratorContext,
Expand All @@ -152,10 +137,7 @@ export type CreatesOrUpdatesResourceDecorator = (
/**
* Specify that this is a Update operation for a given resource.
*
* @param resourceType Resource marked with
* @resource
*
*
* @param resourceType Resource marked with `@resource`
*/
export type UpdatesResourceDecorator = (
context: DecoratorContext,
Expand All @@ -166,10 +148,7 @@ export type UpdatesResourceDecorator = (
/**
* Specify that this is a Delete operation for a given resource.
*
* @param resourceType Resource marked with
* @resource
*
*
* @param resourceType Resource marked with `@resource`
*/
export type DeletesResourceDecorator = (
context: DecoratorContext,
Expand All @@ -180,10 +159,7 @@ export type DeletesResourceDecorator = (
/**
* Specify that this is a List operation for a given resource.
*
* @param resourceType Resource marked with
* @resource
*
*
* @param resourceType Resource marked with `@resource`
*/
export type ListsResourceDecorator = (
context: DecoratorContext,
Expand All @@ -205,10 +181,7 @@ export type ActionDecorator = (
/**
* Specify this operation is a collection action. (Scopped to a resource, /pets/my-action)
*
* @param resourceType Resource marked with
* @resource
*
*
* @param resourceType Resource marked with `@resource`
* @param name Name of the action. If not specified, the name of the operation will be used.
*/
export type CollectionActionDecorator = (
Expand Down
Loading
Loading