Skip to content

Commit

Permalink
Regen samples and update tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
tjprescott committed Sep 19, 2023
1 parent fca9e00 commit 457572a
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@typespec/openapi",
"comment": "Changed namespace from `OpenAPI` to `TypeSpec.OpenAPI`.",
"type": "none"
}
],
"packageName": "@typespec/openapi"
}
2 changes: 1 addition & 1 deletion packages/openapi/lib/decorators.tsp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using TypeSpec.Reflection;

namespace OpenAPI;
namespace TypeSpec.OpenAPI;

/**
* Specify the OpenAPI `operationId` property for this operation.
Expand Down
2 changes: 1 addition & 1 deletion packages/openapi/src/decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { setStatusCode } from "@typespec/http";
import { createStateSymbol, reportDiagnostic } from "./lib.js";
import { AdditionalInfo, ExtensionKey } from "./types.js";

export const namespace = "OpenAPI";
export const namespace = "TypeSpec.OpenAPI";

const operationIdsKey = createStateSymbol("operationIds");
/**
Expand Down
3 changes: 2 additions & 1 deletion packages/openapi/test/decorators.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ describe("openapi: decorators", () => {

expectDiagnostics(diagnostics, {
code: "invalid-argument",
message: "Argument '123' is not assignable to parameter of type 'OpenAPI.AdditionalInfo'",
message:
"Argument '123' is not assignable to parameter of type 'TypeSpec.OpenAPI.AdditionalInfo'",
});
});

Expand Down
2 changes: 1 addition & 1 deletion packages/openapi/test/test-host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ export async function createOpenAPITestHost() {
}
export async function createOpenAPITestRunner() {
const host = await createOpenAPITestHost();
return createTestWrapper(host, { autoUsings: ["OpenAPI"] });
return createTestWrapper(host, { autoUsings: ["TypeSpec.OpenAPI"] });
}
4 changes: 2 additions & 2 deletions packages/openapi3/test/test-host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export async function createOpenAPITestRunner({
${withVersioning ? `import "@typespec/versioning"` : ""};
using TypeSpec.Rest;
using TypeSpec.Http;
using OpenAPI;
using TypeSpec.OpenAPI;
${withVersioning ? "using TypeSpec.Versioning;" : ""}
`;
return createTestWrapper(host, {
Expand Down Expand Up @@ -67,7 +67,7 @@ export async function openApiFor(
"./main.tsp",
`import "@typespec/http"; import "@typespec/rest"; import "@typespec/openapi"; import "@typespec/openapi3"; ${
versions ? `import "@typespec/versioning"; using TypeSpec.Versioning;` : ""
}using TypeSpec.Rest;using TypeSpec.Http;using OpenAPI;${code}`
}using TypeSpec.Rest;using TypeSpec.Http;using TypeSpec.OpenAPI;${code}`
);
const diagnostics = await host.diagnose("./main.tsp", {
noEmit: false,
Expand Down
2 changes: 1 addition & 1 deletion packages/openapi3/test/versioning.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ describe("openapi3: versioning", () => {

const runner = createTestWrapper(host, {
autoImports: [...host.libraries.map((x) => x.name), "./test.js"],
autoUsings: ["TypeSpec.Rest", "TypeSpec.Http", "OpenAPI", "TypeSpec.Versioning"],
autoUsings: ["TypeSpec.Rest", "TypeSpec.Http", "TypeSpec.OpenAPI", "TypeSpec.Versioning"],
compilerOptions: { emit: ["@typespec/openapi3"] },
});

Expand Down
2 changes: 1 addition & 1 deletion packages/playground-website/samples/unions.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import "@typespec/openapi3";
namespace DemoService;
using TypeSpec.Rest;
using TypeSpec.Http;
using OpenAPI;
using TypeSpec.OpenAPI;

model WidgetBase {
@key id: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import "@typespec/rest";
import "@typespec/openapi";

using OpenAPI;
using TypeSpec.OpenAPI;

model MyConfig {
name: "Foo";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import "@typespec/rest";
import "@typespec/openapi";

using TypeSpec.Http;
using OpenAPI;
using TypeSpec.OpenAPI;

@service({
title: "sample",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import "@typespec/rest";
import "@typespec/openapi";

using TypeSpec.Http;
using OpenAPI;
using TypeSpec.OpenAPI;

@service({
title: "sample",
Expand Down

0 comments on commit 457572a

Please sign in to comment.