Skip to content

Commit

Permalink
Merge compiler 0.59.1 hotfix back into main (#4176)
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheeguerin authored Aug 13, 2024
1 parent b9e465b commit a279784
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 30 deletions.
7 changes: 7 additions & 0 deletions packages/compiler/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change Log - @typespec/compiler

## 0.59.1

### Bug Fixes

- [#4173](https://github.com/microsoft/typespec/pull/4173) Fix: Revert `unix-style` warning that was preventing windows path via the CLI as well


## 0.59.0

### Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@typespec/compiler",
"version": "0.59.0",
"version": "0.59.1",
"description": "TypeSpec Compiler Preview",
"author": "Microsoft Corporation",
"license": "MIT",
Expand Down
14 changes: 7 additions & 7 deletions packages/compiler/src/config/config-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,13 +260,13 @@ function validatePathAbsolute(
target: target === NoTarget ? target : getLocationInYamlScript(target.file, target.path),
});
}
if (path.includes("\\")) {
return createDiagnostic({
code: "path-unix-style",
format: { path },
target: target === NoTarget ? target : getLocationInYamlScript(target.file, target.path),
});
}
// if (path.includes("\\")) {
// return createDiagnostic({
// code: "path-unix-style",
// format: { path },
// target: target === NoTarget ? target : getLocationInYamlScript(target.file, target.path),
// });
// }

return undefined;
}
25 changes: 8 additions & 17 deletions packages/compiler/src/core/schema-validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ function absolutePathStatus(path: string): "valid" | "not-absolute" | "windows-s
if (path.startsWith(".") || !isPathAbsolute(path)) {
return "not-absolute";
}
if (path.includes("\\")) {
return "windows-style";
}
// if (path.includes("\\")) {
// return "windows-style";
// }
return "valid";
}

Expand Down Expand Up @@ -75,20 +75,11 @@ function ajvErrorToDiagnostic(
const tspTarget = resolveTarget(error, target);
if (error.params.format === "absolute-path") {
const value = getErrorValue(obj, error) as any;
const status = absolutePathStatus(value);
if (status === "windows-style") {
return createDiagnostic({
code: "path-unix-style",
format: { path: value },
target: tspTarget,
});
} else {
return createDiagnostic({
code: "config-path-absolute",
format: { path: value },
target: tspTarget,
});
}
return createDiagnostic({
code: "config-path-absolute",
format: { path: value },
target: tspTarget,
});
}

const messageLines = [`Schema violation: ${error.message} (${error.instancePath || "/"})`];
Expand Down
8 changes: 4 additions & 4 deletions packages/compiler/templates/scaffolding.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"title": "Empty project",
"description": "Create an empty project.",
"libraries": [],
"compilerVersion": "0.59.0"
"compilerVersion": "0.59.1"
},
"rest": {
"title": "Generic REST API",
"description": "Create a project representing a generic REST API",
"compilerVersion": "0.59.0",
"compilerVersion": "0.59.1",
"libraries": [
"@typespec/http",
"@typespec/rest",
Expand All @@ -23,7 +23,7 @@
"library-ts": {
"title": "TypeSpec Library (With TypeScript)",
"description": "Create a new package to add decorators or linters to typespec.",
"compilerVersion": "0.59.0",
"compilerVersion": "0.59.1",
"libraries": [],
"files": [
{
Expand Down Expand Up @@ -99,7 +99,7 @@
"emitter-ts": {
"title": "TypeSpec Emitter (With TypeScript)",
"description": "Create a new package that will be emitting typespec",
"compilerVersion": "0.59.0",
"compilerVersion": "0.59.1",
"libraries": [],
"files": [
{
Expand Down
3 changes: 2 additions & 1 deletion packages/compiler/test/core/emitter-options.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ describe("compiler: emitter options", () => {
});
});

it("emit diagnostic if passing windows style path", async () => {
// This was disabled due to making it impossible to use windows path via the cli https://github.com/microsoft/typespec/pull/4173
it.skip("emit diagnostic if passing windows style path", async () => {
const diagnostics = await diagnoseEmitterOptions({
"asset-dir": "C:\\abc\\def",
});
Expand Down

0 comments on commit a279784

Please sign in to comment.