Skip to content

Commit b4586c5

Browse files
Uptake cleanup of http library (#2381)
Uptake change required by this pr microsoft/typespec#6433 There is a few spec that use the includePayload decorator but they are all marked as a pattern you shoul;dn't do already using internal apis so we'll just add `Private.` in front and we'll have to figure out how to solve this so we can completely remove the decorator
1 parent b6bd7c3 commit b4586c5

File tree

6 files changed

+19
-13
lines changed

6 files changed

+19
-13
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
# Change versionKind to one of: internal, fix, dependencies, feature, deprecation, breaking
3+
changeKind: internal
4+
packages:
5+
- "@azure-tools/typespec-azure-core"
6+
- "@azure-tools/typespec-azure-resource-manager"
7+
---
8+
9+
Uptake cleanup of http library

packages/typespec-azure-core/test/test-host.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
HttpOperation,
77
HttpOperationParameter,
88
HttpVerb,
9-
RouteResolutionOptions,
109
} from "@typespec/http";
1110
import { HttpTestLibrary } from "@typespec/http/testing";
1211
import { OpenAPITestLibrary } from "@typespec/openapi/testing";
@@ -61,11 +60,10 @@ export async function createAzureCoreTestRunner(
6160

6261
export async function getOperations(
6362
code: string,
64-
routeOptions?: RouteResolutionOptions,
6563
): Promise<[HttpOperation[], readonly Diagnostic[], BasicTestRunner]> {
6664
const runner = await createAzureCoreTestRunner();
6765
await runner.compileAndDiagnose(code, { noEmit: true });
68-
const [services] = getAllHttpServices(runner.program, routeOptions);
66+
const [services] = getAllHttpServices(runner.program);
6967
return [services[0].operations, runner.program.diagnostics, runner];
7068
}
7169

@@ -85,9 +83,8 @@ export interface SimpleHttpOperation {
8583

8684
export async function getSimplifiedOperations(
8785
code: string,
88-
routeOptions?: RouteResolutionOptions,
8986
): Promise<[SimpleHttpOperation[], readonly Diagnostic[]]> {
90-
const [routes, diagnostics] = await getOperations(code, routeOptions);
87+
const [routes, diagnostics] = await getOperations(code);
9188

9289
const details = routes.map((r) => {
9390
return {

packages/typespec-azure-resource-manager/lib/models.tsp

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ model ResourceNameParameter<
4444
*/
4545
@doc("Concrete tracked resource types can be created by aliasing this type using a specific property type.")
4646
@armResourceInternal(Properties)
47-
@includeInapplicableMetadataInPayload(false)
47+
@Http.Private.includeInapplicableMetadataInPayload(false)
4848
model TrackedResource<Properties extends {}, PropertiesOptional extends valueof boolean = true>
4949
extends Foundations.TrackedResource {
5050
@doc("The resource-specific properties for this resource.")
@@ -62,7 +62,7 @@ model TrackedResource<Properties extends {}, PropertiesOptional extends valueof
6262
*/
6363
@doc("Concrete proxy resource types can be created by aliasing this type using a specific property type.")
6464
@armResourceInternal(Properties)
65-
@includeInapplicableMetadataInPayload(false)
65+
@Http.Private.includeInapplicableMetadataInPayload(false)
6666
model ProxyResource<Properties extends {}, PropertiesOptional extends valueof boolean = true>
6767
extends Foundations.ProxyResource {
6868
@doc("The resource-specific properties for this resource.")
@@ -81,7 +81,7 @@ model ProxyResource<Properties extends {}, PropertiesOptional extends valueof bo
8181
@extensionResource
8282
@doc("Concrete extension resource types can be created by aliasing this type using a specific property type.")
8383
@armResourceInternal(Properties)
84-
@includeInapplicableMetadataInPayload(false)
84+
@Http.Private.includeInapplicableMetadataInPayload(false)
8585
model ExtensionResource<Properties extends {}, PropertiesOptional extends valueof boolean = true>
8686
extends Foundations.ExtensionResource {
8787
@doc("The resource-specific properties for this resource.")

packages/typespec-azure-resource-manager/src/namespace.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import {
1313
} from "@typespec/compiler";
1414
import { unsafe_Realm } from "@typespec/compiler/experimental";
1515
import * as http from "@typespec/http";
16-
import { getAuthentication, setAuthentication, setRouteOptionsForNamespace } from "@typespec/http";
16+
import { getAuthentication, setAuthentication } from "@typespec/http";
17+
import { unsafe_setRouteOptionsForNamespace as setRouteOptionsForNamespace } from "@typespec/http/experimental";
1718
import { getResourceTypeForKeyParam } from "@typespec/rest";
1819
import {
1920
ArmLibraryNamespaceDecorator,

packages/typespec-azure-resource-manager/test/lro-metadata.test.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
import { LroMetadata, getLroMetadata } from "@azure-tools/typespec-azure-core";
22
import { Diagnostic, Model } from "@typespec/compiler";
33
import { BasicTestRunner, expectDiagnosticEmpty } from "@typespec/compiler/testing";
4-
import { HttpOperation, RouteResolutionOptions, getAllHttpServices } from "@typespec/http";
4+
import { HttpOperation, getAllHttpServices } from "@typespec/http";
55
import { deepStrictEqual, ok } from "assert";
66
import { describe, it } from "vitest";
77
import { createAzureResourceManagerTestRunner } from "./test-host.js";
88

99
async function getOperations(
1010
code: string,
11-
routeOptions?: RouteResolutionOptions,
1211
): Promise<[HttpOperation[], readonly Diagnostic[], BasicTestRunner]> {
1312
const runner = await createAzureResourceManagerTestRunner();
1413
await runner.compileAndDiagnose(code, { noEmit: true });
15-
const [services] = getAllHttpServices(runner.program, routeOptions);
14+
const [services] = getAllHttpServices(runner.program);
1615
return [services[0].operations, runner.program.diagnostics, runner];
1716
}
1817

0 commit comments

Comments
 (0)