Skip to content

Commit

Permalink
Fixed some stragglers that weren't included in the first commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
willmtemple committed Nov 30, 2023
1 parent 1c8de01 commit 5112c70
Show file tree
Hide file tree
Showing 12 changed files with 52 additions and 49 deletions.
9 changes: 5 additions & 4 deletions docs/libraries/http/reference/data-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,19 +201,20 @@ model TypeSpec.Http.NotModifiedResponse
### `OAuth2Auth` {#TypeSpec.Http.OAuth2Auth}

OAuth 2.0 is an authorization protocol that gives an API client limited access to user data on a web server.

OAuth relies on authentication scenarios called flows, which allow the resource owner (user) to share the protected content from the resource server without sharing their credentials.
For that purpose, an OAuth 2.0 server issues access tokens that the client applications can use to access protected resources on behalf of the resource owner.
For more information about OAuth 2.0, see oauth.net and RFC 6749.

```typespec
model TypeSpec.Http.OAuth2Auth<TFlows>
model TypeSpec.Http.OAuth2Auth<Flows>
```

#### Template Parameters

| Name | Description |
| ------ | ---------------------------------- |
| TFlows | The list of supported OAuth2 flows |
| Name | Description |
| ----- | ---------------------------------- |
| Flows | The list of supported OAuth2 flows |

### `OkResponse` {#TypeSpec.Http.OkResponse}

Expand Down
4 changes: 2 additions & 2 deletions docs/libraries/json-schema/reference/data-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ Specify that the provided template argument should be emitted as raw JSON or YAM
as opposed to a schema. Use in combination with the

```typespec
model TypeSpec.JsonSchema.Json<T>
model TypeSpec.JsonSchema.Json<Data>
```

#### Template Parameters

| Name | Description |
| ---- | ------------------------------- |
| T | the type to convert to raw JSON |
| Data | the type to convert to raw JSON |

### `Format` {#TypeSpec.JsonSchema.Format}

Expand Down
10 changes: 5 additions & 5 deletions docs/libraries/json-schema/reference/decorators.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ media type and encoding.

Specify a custom property to add to the emitted schema. Useful for adding custom keywords
and other vendor-specific extensions. The value will be converted to a schema unless the parameter
is wrapped in the `Json<T>` template. For example, `@extension("x-schema", { x: "value" })` will
is wrapped in the `Json<Data>` template. For example, `@extension("x-schema", { x: "value" })` will
emit a JSON schema value for `x-schema`, whereas `@extension("x-schema", Json<{x: "value"}>)` will
emit the raw JSON code `{x: "value"}`.

Expand All @@ -118,10 +118,10 @@ emit the raw JSON code `{x: "value"}`.

#### Parameters

| Name | Type | Description |
| ----- | ----------------------- | ------------------------------------------------------------------------------------ |
| key | `valueof scalar string` | the name of the keyword of vendor extension, e.g. `x-custom`. |
| value | `(intrinsic) unknown` | the value of the keyword. Will be converted to a schema unless wrapped in `Json<T>`. |
| Name | Type | Description |
| ----- | ----------------------- | --------------------------------------------------------------------------------------- |
| key | `valueof scalar string` | the name of the keyword of vendor extension, e.g. `x-custom`. |
| value | `(intrinsic) unknown` | the value of the keyword. Will be converted to a schema unless wrapped in `Json<Data>`. |

### `@id` {#@TypeSpec.JsonSchema.id}

Expand Down
4 changes: 2 additions & 2 deletions docs/libraries/rest/reference/data-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ This only provides the model structure and not actual pagination support. See
https://github.com/microsoft/typespec/issues/705 for general paging support.

```typespec
model TypeSpec.Rest.Resource.CollectionWithNextLink<T>
model TypeSpec.Rest.Resource.CollectionWithNextLink<Item>
```

#### Template Parameters

| Name | Description |
| ---- | ------------------------------------ |
| T | The resource type of the collection. |
| Item | The resource type of the collection. |

### `KeysOf` {#TypeSpec.Rest.Resource.KeysOf}

Expand Down
12 changes: 6 additions & 6 deletions docs/libraries/rest/reference/interfaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ op TypeSpec.Rest.Resource.ExtensionResourceCollectionOperations.create(resource:
Lists all instances of the extension resource.

```typespec
op TypeSpec.Rest.Resource.ExtensionResourceCollectionOperations.list(): TypeSpec.Rest.Resource.CollectionWithNextLink<T> | Error
op TypeSpec.Rest.Resource.ExtensionResourceCollectionOperations.list(): TypeSpec.Rest.Resource.CollectionWithNextLink<Item> | Error
```

### `ExtensionResourceCreate` {#TypeSpec.Rest.Resource.ExtensionResourceCreate}
Expand Down Expand Up @@ -173,7 +173,7 @@ interface TypeSpec.Rest.Resource.ExtensionResourceList<Extension, Resource, Erro
Lists all instances of the extension resource.

```typespec
op TypeSpec.Rest.Resource.ExtensionResourceList.list(): TypeSpec.Rest.Resource.CollectionWithNextLink<T> | Error
op TypeSpec.Rest.Resource.ExtensionResourceList.list(): TypeSpec.Rest.Resource.CollectionWithNextLink<Item> | Error
```

### `ExtensionResourceOperations` {#TypeSpec.Rest.Resource.ExtensionResourceOperations}
Expand Down Expand Up @@ -229,7 +229,7 @@ op TypeSpec.Rest.Resource.ExtensionResourceOperations.create(resource: TypeSpec.
Lists all instances of the extension resource.

```typespec
op TypeSpec.Rest.Resource.ExtensionResourceOperations.list(): TypeSpec.Rest.Resource.CollectionWithNextLink<T> | Error
op TypeSpec.Rest.Resource.ExtensionResourceOperations.list(): TypeSpec.Rest.Resource.CollectionWithNextLink<Item> | Error
```

### `ExtensionResourceRead` {#TypeSpec.Rest.Resource.ExtensionResourceRead}
Expand Down Expand Up @@ -308,7 +308,7 @@ op TypeSpec.Rest.Resource.ResourceCollectionOperations.create(resource: TypeSpec
Lists all instances of the resource.

```typespec
op TypeSpec.Rest.Resource.ResourceCollectionOperations.list(): TypeSpec.Rest.Resource.CollectionWithNextLink<T> | Error
op TypeSpec.Rest.Resource.ResourceCollectionOperations.list(): TypeSpec.Rest.Resource.CollectionWithNextLink<Item> | Error
```

### `ResourceCreate` {#TypeSpec.Rest.Resource.ResourceCreate}
Expand Down Expand Up @@ -462,7 +462,7 @@ interface TypeSpec.Rest.Resource.ResourceList<Resource, Error>
Lists all instances of the resource.

```typespec
op TypeSpec.Rest.Resource.ResourceList.list(): TypeSpec.Rest.Resource.CollectionWithNextLink<T> | Error
op TypeSpec.Rest.Resource.ResourceList.list(): TypeSpec.Rest.Resource.CollectionWithNextLink<Item> | Error
```

### `ResourceOperations` {#TypeSpec.Rest.Resource.ResourceOperations}
Expand Down Expand Up @@ -517,7 +517,7 @@ op TypeSpec.Rest.Resource.ResourceOperations.create(resource: TypeSpec.Rest.Reso
Lists all instances of the resource.

```typespec
op TypeSpec.Rest.Resource.ResourceOperations.list(): TypeSpec.Rest.Resource.CollectionWithNextLink<T> | Error
op TypeSpec.Rest.Resource.ResourceOperations.list(): TypeSpec.Rest.Resource.CollectionWithNextLink<Item> | Error
```

### `ResourceRead` {#TypeSpec.Rest.Resource.ResourceRead}
Expand Down
6 changes: 3 additions & 3 deletions docs/standard-library/built-in-decorators.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Use the `#deprecated` directive instead:

```typespec
#deprecated "Use ActionV2"
op Action<T>(): T;
op Action<Result>(): Result;
```


Expand Down Expand Up @@ -233,8 +233,8 @@ Specifies how a templated type should name their instances.

```typespec
@friendlyName("{name}List", T)
model List<T> {
value: T[];
model List<Item> {
value: Item[];
nextLink: string;
}
```
Expand Down
6 changes: 3 additions & 3 deletions packages/compiler/lib/decorators.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ extern dec errorsDoc(target: Operation, doc: valueof string);
*
* ```typespec
* #deprecated "Use ActionV2"
* op Action<T>(): T;
* op Action<Result>(): Result;
* ```
*/
#deprecated "@deprecated decorator is deprecated. Use the `#deprecated` directive instead."
Expand Down Expand Up @@ -288,8 +288,8 @@ extern dec tag(target: Namespace | Interface | Operation, tag: valueof string);
* @example
* ```typespec
* @friendlyName("{name}List", T)
* model List<T> {
* value: T[];
* model List<Item> {
* value: Item[];
* nextLink: string;
* }
* ```
Expand Down
8 changes: 5 additions & 3 deletions packages/http/lib/auth.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,20 @@ model ApiKeyAuth<Location extends ApiKeyLocation, Name extends string> {

/**
* OAuth 2.0 is an authorization protocol that gives an API client limited access to user data on a web server.
*
* OAuth relies on authentication scenarios called flows, which allow the resource owner (user) to share the protected content from the resource server without sharing their credentials.
* For that purpose, an OAuth 2.0 server issues access tokens that the client applications can use to access protected resources on behalf of the resource owner.
* For more information about OAuth 2.0, see oauth.net and RFC 6749.
* @template TFlows The list of supported OAuth2 flows
*
* @template Flows The list of supported OAuth2 flows
*/
@doc("")
model OAuth2Auth<TFlows extends OAuth2Flow[]> {
model OAuth2Auth<Flows extends OAuth2Flow[]> {
@doc("OAuth2 authentication")
type: AuthType.oauth2;

@doc("Supported OAuth2 flows")
flows: TFlows;
flows: Flows;
}

@doc("Describes the OAuth2 flow type")
Expand Down
10 changes: 5 additions & 5 deletions packages/json-schema/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ media type and encoding.

Specify a custom property to add to the emitted schema. Useful for adding custom keywords
and other vendor-specific extensions. The value will be converted to a schema unless the parameter
is wrapped in the `Json<T>` template. For example, `@extension("x-schema", { x: "value" })` will
is wrapped in the `Json<Data>` template. For example, `@extension("x-schema", { x: "value" })` will
emit a JSON schema value for `x-schema`, whereas `@extension("x-schema", Json<{x: "value"}>)` will
emit the raw JSON code `{x: "value"}`.

Expand All @@ -208,10 +208,10 @@ emit the raw JSON code `{x: "value"}`.

##### Parameters

| Name | Type | Description |
| ----- | ----------------------- | ------------------------------------------------------------------------------------ |
| key | `valueof scalar string` | the name of the keyword of vendor extension, e.g. `x-custom`. |
| value | `(intrinsic) unknown` | the value of the keyword. Will be converted to a schema unless wrapped in `Json<T>`. |
| Name | Type | Description |
| ----- | ----------------------- | --------------------------------------------------------------------------------------- |
| key | `valueof scalar string` | the name of the keyword of vendor extension, e.g. `x-custom`. |
| value | `(intrinsic) unknown` | the value of the keyword. Will be converted to a schema unless wrapped in `Json<Data>`. |

#### `@id`

Expand Down
12 changes: 6 additions & 6 deletions packages/json-schema/lib/main.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ extern dec contentSchema(target: string | Reflection.ModelProperty, value: unkno
/**
* Specify a custom property to add to the emitted schema. Useful for adding custom keywords
* and other vendor-specific extensions. The value will be converted to a schema unless the parameter
* is wrapped in the `Json<T>` template. For example, `@extension("x-schema", { x: "value" })` will
* is wrapped in the `Json<Data>` template. For example, `@extension("x-schema", { x: "value" })` will
* emit a JSON schema value for `x-schema`, whereas `@extension("x-schema", Json<{x: "value"}>)` will
* emit the raw JSON code `{x: "value"}`.
*
* @param key the name of the keyword of vendor extension, e.g. `x-custom`.
* @param value the value of the keyword. Will be converted to a schema unless wrapped in `Json<T>`.
* @param value the value of the keyword. Will be converted to a schema unless wrapped in `Json<Data>`.
*/
extern dec extension(target: unknown, key: valueof string, value: unknown);

Expand Down Expand Up @@ -152,11 +152,11 @@ enum Format {
* whereas `@extension("x-schema", Json<{x: "value"}>)` will emit the raw JSON code
* `{x: "value"}`.
*
* @template T the type to convert to raw JSON
* @template Data the type to convert to raw JSON
*/
@Private.validatesRawJson(T)
model Json<T> {
value: T;
@Private.validatesRawJson(Data)
model Json<Data> {
value: Data;
}

namespace Private {
Expand Down
12 changes: 6 additions & 6 deletions packages/rest/lib/resource.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -228,16 +228,16 @@ interface ResourceDelete<Resource extends {}, Error> {
* This only provides the model structure and not actual pagination support. See
* https://github.com/microsoft/typespec/issues/705 for general paging support.
*
* @template T The resource type of the collection.
* @template Item The resource type of the collection.
*/
@doc("Paged response of {name} items", T)
@friendlyName("{name}CollectionWithNextLink", T)
model CollectionWithNextLink<T extends {}> {
@doc("Paged response of {name} items", Item)
@friendlyName("{name}CollectionWithNextLink", Item)
model CollectionWithNextLink<Item extends {}> {
@doc("The items on this page")
value: T[];
value: Item[];

@doc("The link to the next page of items")
nextLink?: ResourceLocation<T>;
nextLink?: ResourceLocation<Item>;
}

/**
Expand Down
8 changes: 4 additions & 4 deletions packages/rest/lib/rest.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ namespace TypeSpec.Rest;

/**
* A URL that points to a resource.
* @template TResource The type of resource that the URL points to.
* @template Resource The type of resource that the URL points to.
*/
@doc("The location of an instance of {name}", TResource)
@Private.resourceLocation(TResource)
scalar ResourceLocation<TResource extends {}> extends url;
@doc("The location of an instance of {name}", Resource)
@Private.resourceLocation(Resource)
scalar ResourceLocation<Resource extends {}> extends url;

0 comments on commit 5112c70

Please sign in to comment.