Skip to content
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
# Change versionKind to one of: internal, fix, dependencies, feature, deprecation, breaking
changeKind: fix
packages:
- "@azure-tools/typespec-azure-core"
---

Remove unused `RequestParameter` and `ResponseProperty` models
38 changes: 0 additions & 38 deletions packages/typespec-azure-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,6 @@ Overrides the final state value for an operation
### Azure.Core.Foundations

- [`@omitKeyProperties`](#@omitkeyproperties)
- [`@requestParameter`](#@requestparameter)
- [`@responseProperty`](#@responseproperty)

#### `@omitKeyProperties`

Expand All @@ -398,42 +396,6 @@ Deletes any key properties from the model.

None

#### `@requestParameter`

Identifies a property on a request model that serves as a linked operation parameter.

```typespec
@Azure.Core.Foundations.requestParameter(name: valueof string)
```

##### Target

`Model`

##### Parameters

| Name | Type | Description |
| ---- | ---------------- | --------------------------- |
| name | `valueof string` | Property name on the target |

#### `@responseProperty`

Identifies a property on _all_ non-error response models that serve as a linked operation parameter.

```typespec
@Azure.Core.Foundations.responseProperty(name: valueof string)
```

##### Target

`Model`

##### Parameters

| Name | Type | Description |
| ---- | ---------------- | --------------------------- |
| name | `valueof string` | Property name on the target |

### Azure.Core.Traits

- [`@trait`](#@trait)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,6 @@ export type OmitKeyPropertiesDecorator = (
entity: Model,
) => DecoratorValidatorCallbacks | void;

/**
* Identifies a property on a request model that serves as a linked operation parameter.
*
* @param name Property name on the target
*/
export type RequestParameterDecorator = (
context: DecoratorContext,
entity: Model,
name: string,
) => DecoratorValidatorCallbacks | void;

/**
* Identifies a property on *all* non-error response models that serve as a linked operation parameter.
*
* @param name Property name on the target
*/
export type ResponsePropertyDecorator = (
context: DecoratorContext,
entity: Model,
name: string,
) => DecoratorValidatorCallbacks | void;

export type AzureCoreFoundationsDecorators = {
omitKeyProperties: OmitKeyPropertiesDecorator;
requestParameter: RequestParameterDecorator;
responseProperty: ResponsePropertyDecorator;
};
12 changes: 0 additions & 12 deletions packages/typespec-azure-core/lib/decorators.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -139,18 +139,6 @@ namespace Azure.Core.Foundations {
* Deletes any key properties from the model.
*/
extern dec omitKeyProperties(entity: Model);

/**
* Identifies a property on a request model that serves as a linked operation parameter.
* @param name Property name on the target
*/
extern dec requestParameter(entity: Model, name: valueof string);

/**
* Identifies a property on *all* non-error response models that serve as a linked operation parameter.
* @param name Property name on the target
*/
extern dec responseProperty(entity: Model, name: valueof string);
}

namespace Azure.Core.Foundations.Private {
Expand Down
14 changes: 0 additions & 14 deletions packages/typespec-azure-core/lib/models.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,6 @@ model Page<Resource extends TypeSpec.Reflection.Model> {
nextLink?: ResourceLocation<Resource>;
}

/**
* Defines a property as a request parameter.
* @template Name The parameter name.
*/
@Foundations.requestParameter(Name)
model RequestParameter<Name extends valueof string> {}

/**
* Defines a property as a response header.
* @template Name The header name.
*/
@Foundations.responseProperty(Name)
model ResponseProperty<Name extends valueof string> {}

/**
* @dev Provides the status of a resource operation.
* @template Resource The resource type.
Expand Down
26 changes: 2 additions & 24 deletions packages/typespec-azure-core/src/decorators.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,12 @@
import { AzureCoreStateKeys } from "./lib.js";

Check warning on line 1 in packages/typespec-azure-core/src/decorators.ts

View workflow job for this annotation

GitHub Actions / Lint

'AzureCoreStateKeys' is defined but never used. Allowed unused vars must match /^_/u

import { DecoratorContext, Model, ModelProperty, Program, Type } from "@typespec/compiler";

Check warning on line 3 in packages/typespec-azure-core/src/decorators.ts

View workflow job for this annotation

GitHub Actions / Lint

'ModelProperty' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 3 in packages/typespec-azure-core/src/decorators.ts

View workflow job for this annotation

GitHub Actions / Lint

'Model' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 3 in packages/typespec-azure-core/src/decorators.ts

View workflow job for this annotation

GitHub Actions / Lint

'DecoratorContext' is defined but never used. Allowed unused vars must match /^_/u
import { getUniqueItems } from "./decorators/unique-items.js";

export const $requestParameter = (context: DecoratorContext, entity: Model, name: string) => {
context.program.stateMap(AzureCoreStateKeys.requestParameter).set(entity, name);
};

export function getRequestParameter(program: Program, entity: ModelProperty): string | undefined {
if (entity.type.kind !== "Model") return undefined;
const parameterName: string | undefined = program
.stateMap(AzureCoreStateKeys.requestParameter)
.get(entity.type);
return parameterName;
}

export const $responseProperty = (context: DecoratorContext, entity: Model, name: string) => {
context.program.stateMap(AzureCoreStateKeys.responseParameter).set(entity, name);
};

export function getResponseProperty(program: Program, entity: ModelProperty): string | undefined {
if (entity.type.kind !== "Model") return undefined;
const parameterName: string | undefined = program
.stateMap(AzureCoreStateKeys.responseParameter)
.get(entity.type);
return parameterName;
}

/**
* Checks if an array model or array-valued model property has unique items.
* Checks if an array model or array-valued model property has
e items.
* @param program The program context.
* @param type The model or model property to check.
* @returns True if the model or model property has unique items, false otherwise.
Expand Down
3 changes: 0 additions & 3 deletions packages/typespec-azure-core/src/tsp-index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import type { AzureCoreFoundationsPrivateDecorators } from "../generated-defs/Az
import type { AzureCoreDecorators } from "../generated-defs/Azure.Core.js";
import type { AzureCoreTraitsDecorators } from "../generated-defs/Azure.Core.Traits.js";
import type { AzureCoreTraitsPrivateDecorators } from "../generated-defs/Azure.Core.Traits.Private.js";
import { $requestParameter, $responseProperty } from "./decorators.js";
import { $finalLocation } from "./decorators/final-location.js";
import { $finalOperation } from "./decorators/final-operation.js";
import { $omitKeyProperties } from "./decorators/foundations/omit-key-properties.js";
Expand Down Expand Up @@ -67,8 +66,6 @@ export const $decorators = {

"Azure.Core.Foundations": {
omitKeyProperties: $omitKeyProperties,
requestParameter: $requestParameter,
responseProperty: $responseProperty,
} satisfies AzureCoreFoundationsDecorators,
"Azure.Core.Foundations.Private": {
spreadCustomParameters: $spreadCustomParameters,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,24 +312,6 @@ model Azure.Core.RequestIdResponseHeader
| ---------- | -------------------------- | ------------------------------------------------------------------------------- |
| requestId? | [`uuid`](#Azure.Core.uuid) | An opaque, globally-unique, server-generated string identifier for the request. |

### `RequestParameter` {#Azure.Core.RequestParameter}

Defines a property as a request parameter.

```typespec
model Azure.Core.RequestParameter<Name>
```

#### Template Parameters

| Name | Description |
| ---- | ------------------- |
| Name | The parameter name. |

#### Properties

None

### `ResourceOperationStatus` {#Azure.Core.ResourceOperationStatus}

```typespec
Expand All @@ -353,24 +335,6 @@ model Azure.Core.ResourceOperationStatus<Resource, StatusResult, StatusError>
| error? | `StatusError` | |
| result? | `StatusResult` | |

### `ResponseProperty` {#Azure.Core.ResponseProperty}

Defines a property as a response header.

```typespec
model Azure.Core.ResponseProperty<Name>
```

#### Template Parameters

| Name | Description |
| ---- | ---------------- |
| Name | The header name. |

#### Properties

None

### `SelectQueryParameter` {#Azure.Core.SelectQueryParameter}

Provides the standard 'select' query parameter for list operations.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,42 +311,6 @@ Deletes any key properties from the model.

None

### `@requestParameter` {#@Azure.Core.Foundations.requestParameter}

Identifies a property on a request model that serves as a linked operation parameter.

```typespec
@Azure.Core.Foundations.requestParameter(name: valueof string)
```

#### Target

`Model`

#### Parameters

| Name | Type | Description |
| ---- | ---------------- | --------------------------- |
| name | `valueof string` | Property name on the target |

### `@responseProperty` {#@Azure.Core.Foundations.responseProperty}

Identifies a property on _all_ non-error response models that serve as a linked operation parameter.

```typespec
@Azure.Core.Foundations.responseProperty(name: valueof string)
```

#### Target

`Model`

#### Parameters

| Name | Type | Description |
| ---- | ---------------- | --------------------------- |
| name | `valueof string` | Property name on the target |

## Azure.Core.Traits

### `@trait` {#@Azure.Core.Traits.trait}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,7 @@ npm install --save-peer @azure-tools/typespec-azure-core
- [`RepeatabilityRequestHeaders`](./data-types.md#Azure.Core.RepeatabilityRequestHeaders)
- [`RepeatabilityResponseHeaders`](./data-types.md#Azure.Core.RepeatabilityResponseHeaders)
- [`RequestIdResponseHeader`](./data-types.md#Azure.Core.RequestIdResponseHeader)
- [`RequestParameter`](./data-types.md#Azure.Core.RequestParameter)
- [`ResourceOperationStatus`](./data-types.md#Azure.Core.ResourceOperationStatus)
- [`ResponseProperty`](./data-types.md#Azure.Core.ResponseProperty)
- [`SelectQueryParameter`](./data-types.md#Azure.Core.SelectQueryParameter)
- [`SkipQueryParameter`](./data-types.md#Azure.Core.SkipQueryParameter)
- [`StandardListQueryParameters`](./data-types.md#Azure.Core.StandardListQueryParameters)
Expand All @@ -109,8 +107,6 @@ npm install --save-peer @azure-tools/typespec-azure-core
### Decorators

- [`@omitKeyProperties`](./decorators.md#@Azure.Core.Foundations.omitKeyProperties)
- [`@requestParameter`](./decorators.md#@Azure.Core.Foundations.requestParameter)
- [`@responseProperty`](./decorators.md#@Azure.Core.Foundations.responseProperty)

### Operations

Expand Down
Loading