-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from palantir/ssanjay/addSharedTestLegacy
Trying to add shared testing infra for legacy client
- Loading branch information
Showing
9 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,5 @@ tsconfig.tsbuildinfo | |
/tmp/ | ||
|
||
packages/client/src/generatedNoCheck | ||
packages/legacy-client/src/generatedNoCheck | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
type: improvement | ||
improvement: | ||
description: Trying to add shared testing infra for legacy client | ||
links: | ||
- https://github.com/palantir/osdk-ts/pull/34 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
type: improvement | ||
improvement: | ||
description: Trying to add shared testing infra for legacy client | ||
links: | ||
- https://github.com/palantir/osdk-ts/pull/34 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
type: improvement | ||
improvement: | ||
description: Trying to add shared testing infra for legacy client | ||
links: | ||
- https://github.com/palantir/osdk-ts/pull/34 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Copyright 2023 Palantir Technologies, Inc. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
// @ts-check | ||
|
||
import { generateClientSdkVersionOneDotOne } from "@osdk/generator"; | ||
import { stubData } from "@osdk/shared.test"; | ||
import { rmSync } from "node:fs"; | ||
import { mkdir, readdir, writeFile } from "node:fs/promises"; | ||
import { dirname, join } from "node:path"; | ||
import { fileURLToPath } from "url"; | ||
|
||
const __dirname = dirname(fileURLToPath(import.meta.url)); | ||
const outDir = join(__dirname, "src", "generatedNoCheck"); | ||
|
||
try { | ||
rmSync(outDir, { recursive: true, force: true }); | ||
} catch (e) { | ||
// ignored, only needed for regeneration | ||
} | ||
|
||
const ontologyWithoutUnsupportedAction = { | ||
...stubData.fullOntology, | ||
actionTypes: { | ||
...stubData.fullOntology.actionTypes, | ||
}, | ||
}; | ||
|
||
// the generator does not correctly handle actions that point to object types outside of the ontology | ||
// this step is typically handled by code upstream of the actual generator | ||
delete ontologyWithoutUnsupportedAction.actionTypes["unsupported-action"]; | ||
|
||
await generateClientSdkVersionOneDotOne( | ||
ontologyWithoutUnsupportedAction, | ||
"typescript-sdk/dev osdk-cli/dev", | ||
{ | ||
writeFile: (path, contents) => { | ||
return writeFile(path, contents, "utf-8"); | ||
}, | ||
mkdir: async (path, options) => { | ||
await mkdir(path, options); | ||
}, | ||
readdir: async (path) => readdir(path), | ||
}, | ||
outDir, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,9 @@ | |
{ | ||
"path": "../shared.net" | ||
}, | ||
{ | ||
"path": "../generator" | ||
}, | ||
{ | ||
"path": "../shared.test" | ||
} | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.