From e9d197f919a2f6b1fd13959f7d274818aa161868 Mon Sep 17 00:00:00 2001 From: dsinghvi Date: Sun, 31 Mar 2024 09:51:41 -0400 Subject: [PATCH 01/12] (feat): local build mode --- packages/seed/fern/definition/config.yml | 27 +++++++++++++++++ .../seed/src/commands/test/GeneratorRunner.ts | 29 +++++++++++++++++++ .../resources/config/types/LocalBuildInfo.ts | 16 ++++++++++ .../types/SeedWorkspaceConfiguration.ts | 1 + .../api/resources/config/types/index.ts | 1 + 5 files changed, 74 insertions(+) create mode 100644 packages/seed/src/commands/test/GeneratorRunner.ts create mode 100644 packages/seed/src/config/api/resources/config/types/LocalBuildInfo.ts diff --git a/packages/seed/fern/definition/config.yml b/packages/seed/fern/definition/config.yml index 474c8b887a7..dbfd31aee02 100644 --- a/packages/seed/fern/definition/config.yml +++ b/packages/seed/fern/definition/config.yml @@ -9,6 +9,7 @@ types: generatorType: GeneratorType docker: string dockerCommand: optional + local: optional customFixtureConfig: type: optional docs: | @@ -22,6 +23,32 @@ types: List any fixtures that are okay to fail. For normal fixtures just list the fixture name. For configured fixture list {fixture}:{outputFolder}. features: optional + + LocalBuildInfo: + properties: + buildCommand: + type: string + docs: | + The command to build the generator locally. + `yarn workspace @fern-api/openapi-generator build` for example. + runCommand: + type: string + docs: | + The command to run the generator locally. + `node generators/openapi/dist/cli.cjs` for example. + + DockerBuildInfo: + properties: + buildCommand: + type: string + docs: | + The command to build the generator locally. + `yarn workspace @fern-api/openapi-generator build` for example. + runCommand: + type: string + docs: | + The command to run the generator locally. + `node generators/openapi/dist/cli.cjs` for example. DockerCommand: discriminated: false diff --git a/packages/seed/src/commands/test/GeneratorRunner.ts b/packages/seed/src/commands/test/GeneratorRunner.ts new file mode 100644 index 00000000000..5d354a57c08 --- /dev/null +++ b/packages/seed/src/commands/test/GeneratorRunner.ts @@ -0,0 +1,29 @@ +import { LocalBuildInfo } from "../../config/api"; + +export interface GeneratorRunner { + /** + * Builds the generator. + */ + build(): Promise; + + /** + * Runs the generator. + */ + run(): Promise; +} + +export class LocalGeneratorRunner implements GeneratorRunner { + constructor(private readonly generator: LocalBuildInfo) {} + + async build(): Promise {} + + async run(): Promise {} +} + +export class DockerGeneratorRunner implements GeneratorRunner { + constructor(private readonly generator: string) {} + + async build(): Promise {} + + async run(): Promise {} +} diff --git a/packages/seed/src/config/api/resources/config/types/LocalBuildInfo.ts b/packages/seed/src/config/api/resources/config/types/LocalBuildInfo.ts new file mode 100644 index 00000000000..f8ae91f2ba5 --- /dev/null +++ b/packages/seed/src/config/api/resources/config/types/LocalBuildInfo.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface LocalBuildInfo { + /** + * The command to build the generator locally. + * `yarn workspace @fern-api/openapi-generator build` for example. + */ + buildCommand: string; + /** + * The command to run the generator locally. + * `node generators/openapi/dist/cli.cjs` for example. + */ + runCommand: string; +} diff --git a/packages/seed/src/config/api/resources/config/types/SeedWorkspaceConfiguration.ts b/packages/seed/src/config/api/resources/config/types/SeedWorkspaceConfiguration.ts index ac24d74b99d..575e1abaaae 100644 --- a/packages/seed/src/config/api/resources/config/types/SeedWorkspaceConfiguration.ts +++ b/packages/seed/src/config/api/resources/config/types/SeedWorkspaceConfiguration.ts @@ -11,6 +11,7 @@ export interface SeedWorkspaceConfiguration { generatorType: FernSeedConfig.GeneratorType; docker: string; dockerCommand?: FernSeedConfig.DockerCommand; + local?: FernSeedConfig.LocalBuildInfo; /** Configuration that will be used for any custom fixture specified by --custom-fixture */ customFixtureConfig?: FernSeedConfig.FixtureConfigurations; fixtures?: Record; diff --git a/packages/seed/src/config/api/resources/config/types/index.ts b/packages/seed/src/config/api/resources/config/types/index.ts index edbfddb74a9..8fc391997ad 100644 --- a/packages/seed/src/config/api/resources/config/types/index.ts +++ b/packages/seed/src/config/api/resources/config/types/index.ts @@ -1,4 +1,5 @@ export * from "./SeedWorkspaceConfiguration"; +export * from "./LocalBuildInfo"; export * from "./DockerCommand"; export * from "./ScriptConfig"; export * from "./Language"; From 2f10e61d1b3b197e9c1f3c50851370cd7044dcf5 Mon Sep 17 00:00:00 2001 From: dsinghvi Date: Sun, 21 Apr 2024 16:14:31 -0400 Subject: [PATCH 02/12] (internal): rewrite seed --- .github/workflows/seed.yml | 30 +- packages/seed/src/cli.ts | 167 ++++--- .../rewriteInputsForWorkspace.ts | 34 +- .../src/commands/run/runWithCustomFixture.ts | 72 +++ .../seed/src/commands/test/GeneratorRunner.ts | 29 -- .../seed/src/commands/test/ScriptRunner.ts | 157 ++++++ .../seed/src/commands/test/printTestCases.ts | 4 +- .../commands/test/runDockerForWorkspace.ts | 90 ---- .../test/test-runner/DockerTestRunner.ts | 96 ++++ .../test/test-runner/LocalTestRunner.ts | 9 + .../commands/test/test-runner/TestRunner.ts | 210 ++++++++ .../src/commands/test/test-runner/index.ts | 3 + .../src/commands/test/testCustomFixture.ts | 67 --- .../commands/test/testWorkspaceFixtures.ts | 459 ++---------------- .../resources/config/types/DockerBuildInfo.ts | 16 + .../api/resources/config/types/index.ts | 1 + ...rkspaces.ts => loadGeneratorWorkspaces.ts} | 6 +- .../convertSeedWorkspaceToFernWorkspace.ts | 2 +- 18 files changed, 728 insertions(+), 724 deletions(-) create mode 100644 packages/seed/src/commands/run/runWithCustomFixture.ts delete mode 100644 packages/seed/src/commands/test/GeneratorRunner.ts create mode 100644 packages/seed/src/commands/test/ScriptRunner.ts delete mode 100644 packages/seed/src/commands/test/runDockerForWorkspace.ts create mode 100644 packages/seed/src/commands/test/test-runner/DockerTestRunner.ts create mode 100644 packages/seed/src/commands/test/test-runner/LocalTestRunner.ts create mode 100644 packages/seed/src/commands/test/test-runner/TestRunner.ts create mode 100644 packages/seed/src/commands/test/test-runner/index.ts delete mode 100644 packages/seed/src/commands/test/testCustomFixture.ts create mode 100644 packages/seed/src/config/api/resources/config/types/DockerBuildInfo.ts rename packages/seed/src/{loadSeedWorkspaces.ts => loadGeneratorWorkspaces.ts} (91%) diff --git a/.github/workflows/seed.yml b/.github/workflows/seed.yml index 07487cfca8a..1629b2cee39 100644 --- a/.github/workflows/seed.yml +++ b/.github/workflows/seed.yml @@ -94,7 +94,7 @@ jobs: - name: Seed Test run: | - yarn seed:local test --workspace ruby-model + yarn seed:local test --generator ruby-model - name: Ensure no changes to git-tracked files run: git --no-pager diff --exit-code @@ -122,7 +122,7 @@ jobs: env: FORCE_COLOR: "2" run: | - yarn seed:local test --workspace ruby-sdk + yarn seed:local test --generator ruby-sdk - name: Ensure no changes to git-tracked files run: git --no-pager diff --exit-code @@ -154,7 +154,7 @@ jobs: env: FORCE_COLOR: "2" run: | - yarn seed:local test --workspace pydantic + yarn seed:local test --generator pydantic - name: Ensure no changes to git-tracked files run: git --no-pager diff --exit-code @@ -186,7 +186,7 @@ jobs: env: FORCE_COLOR: "2" run: | - yarn seed:local test --workspace python-sdk --parallel 10 + yarn seed:local test --generator python-sdk --parallel 10 - name: Ensure no changes to git-tracked files run: git --no-pager diff --exit-code @@ -218,7 +218,7 @@ jobs: env: FORCE_COLOR: "2" run: | - yarn seed:local test --workspace fastapi + yarn seed:local test --generator fastapi - name: Ensure no changes to git-tracked files run: git --no-pager diff --exit-code @@ -243,7 +243,7 @@ jobs: env: FORCE_COLOR: "2" run: | - yarn seed:local test --workspace openapi + yarn seed:local test --generator openapi - name: Ensure no changes to git-tracked files run: git --no-pager diff --exit-code @@ -268,7 +268,7 @@ jobs: env: FORCE_COLOR: "2" run: | - yarn seed:local test --workspace postman + yarn seed:local test --generator postman - name: Ensure no changes to git-tracked files run: git --no-pager diff --exit-code @@ -293,7 +293,7 @@ jobs: env: FORCE_COLOR: "2" run: | - yarn seed:local test --workspace java-sdk --parallel 10 + yarn seed:local test --generator java-sdk --parallel 10 - name: Ensure no changes to git-tracked files run: git --no-pager diff --exit-code @@ -318,7 +318,7 @@ jobs: env: FORCE_COLOR: "2" run: | - yarn seed:local test --workspace java-model --parallel 10 + yarn seed:local test --generator java-model --parallel 10 - name: Ensure no changes to git-tracked files run: git --no-pager diff --exit-code @@ -343,7 +343,7 @@ jobs: env: FORCE_COLOR: "2" run: | - yarn seed:local test --workspace java-spring + yarn seed:local test --generator java-spring - name: Ensure no changes to git-tracked files run: git --no-pager diff --exit-code @@ -368,7 +368,7 @@ jobs: env: FORCE_COLOR: "2" run: | - yarn seed:local test --workspace ts-sdk + yarn seed:local test --generator ts-sdk - name: Ensure no changes to git-tracked files run: git --no-pager diff --exit-code @@ -393,7 +393,7 @@ jobs: env: FORCE_COLOR: "2" run: | - yarn seed:local test --workspace ts-express --parallel 1 + yarn seed:local test --generator ts-express --parallel 1 - name: Ensure no changes to git-tracked files run: git --no-pager diff --exit-code @@ -418,7 +418,7 @@ jobs: env: FORCE_COLOR: "2" run: | - yarn seed:local test --workspace go-fiber --parallel 16 + yarn seed:local test --generator go-fiber --parallel 16 - name: Ensure no changes to git-tracked files run: git --no-pager diff --exit-code @@ -443,7 +443,7 @@ jobs: env: FORCE_COLOR: "2" run: | - yarn seed:local test --workspace go-model --parallel 16 + yarn seed:local test --generator go-model --parallel 16 - name: Ensure no changes to git-tracked files run: git --no-pager diff --exit-code @@ -468,7 +468,7 @@ jobs: env: FORCE_COLOR: "2" run: | - yarn seed:local test --workspace go-sdk --parallel 16 + yarn seed:local test --generator go-sdk --parallel 16 - name: Ensure no changes to git-tracked files run: git --no-pager diff --exit-code diff --git a/packages/seed/src/cli.ts b/packages/seed/src/cli.ts index ff0478cb47f..0c288c2daf0 100644 --- a/packages/seed/src/cli.ts +++ b/packages/seed/src/cli.ts @@ -1,15 +1,15 @@ -import { AbsoluteFilePath, join, RelativeFilePath } from "@fern-api/fs-utils"; +import { AbsoluteFilePath } from "@fern-api/fs-utils"; import { CONSOLE_LOGGER, LogLevel, LOG_LEVELS } from "@fern-api/logger"; -import path from "path"; import yargs, { Argv } from "yargs"; import { hideBin } from "yargs/helpers"; import { rewriteInputsForWorkspace } from "./commands/rewrite-inputs/rewriteInputsForWorkspace"; +import { runWithCustomFixture } from "./commands/run/runWithCustomFixture"; +import { ScriptRunner } from "./commands/test/ScriptRunner"; import { TaskContextFactory } from "./commands/test/TaskContextFactory"; -import { testCustomFixture } from "./commands/test/testCustomFixture"; -import { FIXTURES, testWorkspaceFixtures } from "./commands/test/testWorkspaceFixtures"; -import { loadSeedWorkspaces } from "./loadSeedWorkspaces"; -import { runScript } from "./runScript"; -import { parseDockerOrThrow } from "./utils/parseDockerOrThrow"; +import { DockerTestRunner } from "./commands/test/test-runner"; +import { FIXTURES, testGenerator } from "./commands/test/testWorkspaceFixtures"; +import { loadGeneratorWorkspaces } from "./loadGeneratorWorkspaces"; +import { Semaphore } from "./Semaphore"; void tryRunCli(); @@ -17,6 +17,7 @@ export async function tryRunCli(): Promise { const cli: Argv = yargs(hideBin(process.argv)); addTestCommand(cli); + addRunCommand(cli); addWriteInputsCommand(cli); await cli.parse(); @@ -27,23 +28,20 @@ export async function tryRunCli(): Promise { function addTestCommand(cli: Argv) { cli.command( "test", - "Run all snapshot tests", + "Run all snapshot tests for the generators", (yargs) => yargs - .option("workspace", { + .option("generator", { type: "array", string: true, demandOption: false, - description: "The workspace to run tests on" + alias: "g", + description: "The generators to run tests for" }) .option("parallel", { type: "number", - default: 4 - }) - .option("custom-fixture", { - type: "string", - demandOption: false, - description: "Path to the API directory" + default: 4, + alias: "p" }) .option("fixture", { type: "array", @@ -53,22 +51,11 @@ function addTestCommand(cli: Argv) { demandOption: false, description: "Runs on all fixtures if not provided" }) - .option("outputFolder", { - type: "string", - demandOption: false, - description: "A specific output folder to test against" - }) .option("keepDocker", { type: "boolean", demandOption: false, description: "Keeps the docker container after the tests are finished" }) - .option("update", { - type: "boolean", - alias: "u", - description: "Determines whether or not snapshots are written to disk", - default: false - }) .option("skip-scripts", { type: "boolean", demandOption: false, @@ -79,63 +66,37 @@ function addTestCommand(cli: Argv) { choices: LOG_LEVELS }), async (argv) => { - const workspaces = await loadSeedWorkspaces(); + const generators = await loadGeneratorWorkspaces(); - let failurePresent = false; - for (const workspace of workspaces) { - if (argv.workspace != null && !argv.workspace.includes(workspace.workspaceName)) { - continue; - } + const taskContextFactory = new TaskContextFactory(argv["log-level"]); + const lock = new Semaphore(argv.parallel); + const tests: Promise[] = []; - const parsedDockerImage = parseDockerOrThrow(workspace.workspaceConfig.docker); - - const taskContextFactory = new TaskContextFactory(argv["log-level"]); - if (workspace.workspaceConfig.dockerCommand != null) { - const workspaceTaskContext = taskContextFactory.create(workspace.workspaceName); - await runScript({ - commands: - typeof workspace.workspaceConfig.dockerCommand === "string" - ? [workspace.workspaceConfig.dockerCommand] - : workspace.workspaceConfig.dockerCommand, - logger: workspaceTaskContext.logger, - workingDir: path.dirname(path.dirname(workspace.absolutePathToWorkspace)), - doNotPipeOutput: false - }); + for (const generator of generators) { + if (argv.workspace != null && !argv.generator?.includes(generator.workspaceName)) { + continue; } + const testRunner = new DockerTestRunner({ + generator, + lock, + taskContextFactory, + skipScripts: argv.skipScripts, + keepDocker: argv.keepDocker ?? false, + scriptRunner: new ScriptRunner(generator) + }); - if (argv.customFixture != null) { - await testCustomFixture({ - pathToFixture: argv.customFixture.startsWith("/") - ? AbsoluteFilePath.of(argv.customFixture) - : join(AbsoluteFilePath.of(__dirname), RelativeFilePath.of(argv.customFixture)), - workspace, - language: workspace.workspaceConfig.language, - docker: parsedDockerImage, - logLevel: argv["log-level"], - numDockers: argv.parallel, - keepDocker: argv.keepDocker, - skipScripts: argv.skipScripts - }); - } else { - const passed = await testWorkspaceFixtures({ - workspace, - fixtures: argv.fixture, - irVersion: workspace.workspaceConfig.irVersion, - language: workspace.workspaceConfig.language, - docker: parsedDockerImage, - scripts: workspace.workspaceConfig.scripts, - logLevel: argv["log-level"], - numDockers: argv.parallel, - taskContextFactory, - keepDocker: argv.keepDocker, - skipScripts: argv.skipScripts, - outputFolder: argv.outputFolder - }); - failurePresent = failurePresent || !passed; - } + tests.push( + testGenerator({ + generator, + runner: testRunner, + fixtures: argv.fixture + }) + ); } + const results = await Promise.all(tests); - if (failurePresent) { + // If any of the tests failed, exit with a non-zero status code + if (results.includes(false)) { process.exit(1); } } @@ -148,11 +109,11 @@ function addWriteInputsCommand(cli: Argv) { "Rewrites the .inputs directory for each workspace", (yargs) => yargs - .option("workspace", { + .option("generator", { type: "array", string: true, demandOption: false, - description: "Workspaces to write inputs for" + description: "Generator to write inputs for" }) .option("fixture", { type: "array", @@ -167,14 +128,14 @@ function addWriteInputsCommand(cli: Argv) { choices: LOG_LEVELS }), async (argv) => { - const workspaces = await loadSeedWorkspaces(); + const generators = await loadGeneratorWorkspaces(); const promises: Promise[] = []; - for (const workspace of workspaces) { - if (argv.workspace != null && !argv.workspace.includes(workspace.workspaceName)) { + for (const generator of generators) { + if (argv.workspace != null && !argv.generator?.includes(generator.workspaceName)) { continue; } const promise = rewriteInputsForWorkspace({ - workspace, + generator, fixtures: argv.fixture, taskContextFactory: new TaskContextFactory(argv["log-level"]) }); @@ -184,3 +145,41 @@ function addWriteInputsCommand(cli: Argv) { } ); } + +function addRunCommand(cli: Argv) { + cli.command( + "run", + "Runs the generator on the given input", + (yargs) => + yargs + .option("generator", { + string: true, + demandOption: true, + description: "Generator to run" + }) + .option("path", { + type: "string", + string: true, + demandOption: true, + description: "Path to the fern definition" + }) + .option("log-level", { + default: LogLevel.Info, + choices: LOG_LEVELS + }), + async (argv) => { + const generators = await loadGeneratorWorkspaces(); + const generator = generators.find((g) => g.workspaceName === argv.generator); + if (generator == null) { + throw new Error( + `Generator ${argv.generator} not found. Please make sure that there is a folder with the name ${argv.generator} in the seed directory.` + ); + } + await runWithCustomFixture({ + pathToFixture: AbsoluteFilePath.of(argv.path), + workspace: generator, + logLevel: argv["log-level"] + }); + } + ); +} diff --git a/packages/seed/src/commands/rewrite-inputs/rewriteInputsForWorkspace.ts b/packages/seed/src/commands/rewrite-inputs/rewriteInputsForWorkspace.ts index d352156f4e9..e7e209a36f2 100644 --- a/packages/seed/src/commands/rewrite-inputs/rewriteInputsForWorkspace.ts +++ b/packages/seed/src/commands/rewrite-inputs/rewriteInputsForWorkspace.ts @@ -7,40 +7,40 @@ import { FernGeneratorExec } from "@fern-fern/generator-exec-sdk"; import { mkdir, writeFile } from "fs/promises"; import path from "path"; import { OutputMode } from "../../config/api"; -import { SeedWorkspace } from "../../loadSeedWorkspaces"; +import { GeneratorWorkspace } from "../../loadGeneratorWorkspaces"; import { DUMMY_ORGANIZATION, INPUTS_DIRECTORY_NAME, INPUT_CONFIG_FILENAME, INPUT_IR_FILENAME } from "../../utils/constants"; -import { convertSeedWorkspaceToFernWorkspace } from "../../utils/convertSeedWorkspaceToFernWorkspace"; +import { convertGeneratorWorkspaceToFernWorkspace } from "../../utils/convertSeedWorkspaceToFernWorkspace"; import { getGeneratorInvocation } from "../../utils/getGeneratorInvocation"; import { ParsedDockerName, parseDockerOrThrow } from "../../utils/parseDockerOrThrow"; import { TaskContextFactory } from "../test/TaskContextFactory"; export async function rewriteInputsForWorkspace({ - workspace, + generator, fixtures, taskContextFactory }: { - workspace: SeedWorkspace; + generator: GeneratorWorkspace; fixtures: string[]; taskContextFactory: TaskContextFactory; }): Promise { for (const fixture of fixtures) { - const fixtureConfig = workspace.workspaceConfig.fixtures?.[fixture]; - const docker = parseDockerOrThrow(workspace.workspaceConfig.docker); + const fixtureConfig = generator.workspaceConfig.fixtures?.[fixture]; + const docker = parseDockerOrThrow(generator.workspaceConfig.docker); const absolutePathToFernDefinition = AbsoluteFilePath.of( path.join(__dirname, FERN_DIRECTORY, APIS_DIRECTORY, fixture) ); - const absolutePathToOutput = join(workspace.absolutePathToWorkspace, RelativeFilePath.of(fixture)); + const absolutePathToOutput = join(generator.absolutePathToWorkspace, RelativeFilePath.of(fixture)); if (fixtureConfig != null) { for (const fixtureConfigInstance of fixtureConfig) { const taskContext = taskContextFactory.create( - `${workspace.workspaceName}:${fixture} - ${fixtureConfigInstance.outputFolder}` + `${generator.workspaceName}:${fixture} - ${fixtureConfigInstance.outputFolder}` ); - const fernWorkspace = await convertSeedWorkspaceToFernWorkspace({ + const fernWorkspace = await convertGeneratorWorkspaceToFernWorkspace({ absolutePathToWorkspace: absolutePathToFernDefinition, taskContext, fixture @@ -57,20 +57,20 @@ export async function rewriteInputsForWorkspace({ fernWorkspace, taskContext, docker, - language: workspace.workspaceConfig.language, + language: generator.workspaceConfig.language, customConfig: fixtureConfigInstance.customConfig, publishConfig: fixtureConfigInstance.publishConfig, - outputMode: fixtureConfigInstance.outputMode ?? workspace.workspaceConfig.defaultOutputMode, + outputMode: fixtureConfigInstance.outputMode ?? generator.workspaceConfig.defaultOutputMode, fixtureName: fixture, - irVersion: workspace.workspaceConfig.irVersion, + irVersion: generator.workspaceConfig.irVersion, publishMetadata: fixtureConfigInstance.publishMetadata, workspaceName: fernWorkspace.name, context: taskContext }); } } else { - const taskContext = taskContextFactory.create(`${workspace.workspaceName}:${fixture}`); - const fernWorkspace = await convertSeedWorkspaceToFernWorkspace({ + const taskContext = taskContextFactory.create(`${generator.workspaceName}:${fixture}`); + const fernWorkspace = await convertGeneratorWorkspaceToFernWorkspace({ absolutePathToWorkspace: absolutePathToFernDefinition, taskContext, fixture @@ -84,12 +84,12 @@ export async function rewriteInputsForWorkspace({ fernWorkspace, taskContext, docker, - language: workspace.workspaceConfig.language, + language: generator.workspaceConfig.language, customConfig: undefined, publishConfig: undefined, - outputMode: workspace.workspaceConfig.defaultOutputMode, + outputMode: generator.workspaceConfig.defaultOutputMode, fixtureName: fixture, - irVersion: workspace.workspaceConfig.irVersion, + irVersion: generator.workspaceConfig.irVersion, publishMetadata: undefined, workspaceName: fernWorkspace.name, context: taskContext diff --git a/packages/seed/src/commands/run/runWithCustomFixture.ts b/packages/seed/src/commands/run/runWithCustomFixture.ts new file mode 100644 index 00000000000..bff87878995 --- /dev/null +++ b/packages/seed/src/commands/run/runWithCustomFixture.ts @@ -0,0 +1,72 @@ +import { AbsoluteFilePath, join } from "@fern-api/fs-utils"; +import { LogLevel } from "@fern-api/logger"; +import tmp from "tmp-promise"; +import { GeneratorWorkspace } from "../../loadGeneratorWorkspaces"; +import { Semaphore } from "../../Semaphore"; +import { convertGeneratorWorkspaceToFernWorkspace } from "../../utils/convertSeedWorkspaceToFernWorkspace"; +import { ScriptRunner } from "../test/ScriptRunner"; +import { TaskContextFactory } from "../test/TaskContextFactory"; +import { DockerTestRunner } from "../test/test-runner"; + +export async function runWithCustomFixture({ + pathToFixture, + workspace, + logLevel +}: { + pathToFixture: AbsoluteFilePath; + workspace: GeneratorWorkspace; + logLevel: LogLevel; +}): Promise { + const lock = new Semaphore(1); + const outputDir = await tmp.dir(); + const absolutePathToOutput = AbsoluteFilePath.of(outputDir.path); + const taskContextFactory = new TaskContextFactory(logLevel); + const customFixtureConfig = workspace.workspaceConfig.customFixtureConfig; + + const taskContext = taskContextFactory.create( + `${workspace.workspaceName}:${"custom"} - ${customFixtureConfig?.outputFolder ?? ""}` + ); + + const dockerGeneratorRunner = new DockerTestRunner({ + generator: workspace, + lock, + taskContextFactory, + skipScripts: true, + keepDocker: true, + scriptRunner: new ScriptRunner(workspace) + }); + + const fernWorkspace = await convertGeneratorWorkspaceToFernWorkspace({ + absolutePathToWorkspace: pathToFixture, + taskContext, + fixture: "custom" + }); + if (fernWorkspace == null) { + taskContext.logger.error("Failed to load API definition."); + return; + } + + try { + await dockerGeneratorRunner.runGenerator({ + fernWorkspace, + absolutePathToWorkspace: join(pathToFixture), + irVersion: workspace.workspaceConfig.irVersion, + outputVersion: customFixtureConfig?.outputVersion, + language: workspace.workspaceConfig.language, + fixture: "custom", + customConfig: customFixtureConfig?.customConfig, + publishConfig: customFixtureConfig?.publishConfig, + publishMetadata: customFixtureConfig?.publishMetadata, + selectAudiences: customFixtureConfig?.audiences, + taskContext, + outputDir: absolutePathToOutput, + outputMode: customFixtureConfig?.outputMode ?? workspace.workspaceConfig.defaultOutputMode, + outputFolder: customFixtureConfig?.outputFolder ?? "custom", + id: "custom", + keepDocker: true + }); + taskContext.logger.info(`Wrote files to ${absolutePathToOutput}`); + } catch (error) { + taskContext.logger.error(`Encountered error while running generator. ${(error as Error)?.message}`); + } +} diff --git a/packages/seed/src/commands/test/GeneratorRunner.ts b/packages/seed/src/commands/test/GeneratorRunner.ts deleted file mode 100644 index 5d354a57c08..00000000000 --- a/packages/seed/src/commands/test/GeneratorRunner.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { LocalBuildInfo } from "../../config/api"; - -export interface GeneratorRunner { - /** - * Builds the generator. - */ - build(): Promise; - - /** - * Runs the generator. - */ - run(): Promise; -} - -export class LocalGeneratorRunner implements GeneratorRunner { - constructor(private readonly generator: LocalBuildInfo) {} - - async build(): Promise {} - - async run(): Promise {} -} - -export class DockerGeneratorRunner implements GeneratorRunner { - constructor(private readonly generator: string) {} - - async build(): Promise {} - - async run(): Promise {} -} diff --git a/packages/seed/src/commands/test/ScriptRunner.ts b/packages/seed/src/commands/test/ScriptRunner.ts new file mode 100644 index 00000000000..2abfa7dbcf3 --- /dev/null +++ b/packages/seed/src/commands/test/ScriptRunner.ts @@ -0,0 +1,157 @@ +import { AbsoluteFilePath } from "@fern-api/fs-utils"; +import { loggingExeca } from "@fern-api/logging-execa"; +import { TaskContext } from "@fern-api/task-context"; +import { writeFile } from "fs/promises"; +import tmp from "tmp-promise"; +import { ScriptConfig } from "../../config/api"; +import { SeedWorkspace } from "../../loadSeedWorkspaces"; + +export declare namespace ScriptRunner { + interface RunArgs { + taskContext: TaskContext; + fixture: string; + outputFolder: string; + } + + type RunResponse = ScriptSuccessResponse | ScriptFailureResponse; + + interface ScriptSuccessResponse { + type: "success"; + } + + interface ScriptFailureResponse { + type: "failure"; + message: string; + } +} + +interface RunningScriptConfig extends ScriptConfig { + containerId: string; +} + +/** + * Runs scripts on the generated code to verify the output. + */ +export class ScriptRunner { + private started: boolean = false; + private scripts: RunningScriptConfig[] = []; + + constructor(private readonly workspace: SeedWorkspace) {} + + public async run({ taskContext, fixture }: ScriptRunner.RunArgs): Promise { + await this.startContainers(); + for (const script of this.scripts) { + const result = await this.runScript({ + taskContext, + containerId: script.containerId, + outputDirectory: this.workspace.absolutePathToWorkspace, + script, + fixture, + outputFolder: "generated" + }); + if (result.type === "failure") { + return result; + } + } + return { type: "success" }; + } + + private async runScript({ + taskContext, + containerId, + outputDirectory, + script, + fixture, + outputFolder + }: { + fixture: string; + outputDirectory: AbsoluteFilePath; + outputFolder: string; + taskContext: TaskContext; + containerId: string; + script: ScriptConfig; + }): Promise { + const workDir = `${fixture}_${outputFolder}`; + const scriptFile = await tmp.file(); + await writeFile(scriptFile.path, [`cd /${workDir}/generated`, ...script.commands].join("\n")); + // Move scripts and generated files into the container + const mkdirCommand = await loggingExeca( + taskContext.logger, + "docker", + ["exec", containerId, "mkdir", `/${workDir}`], + { + doNotPipeOutput: true, + reject: false + } + ); + if (mkdirCommand.failed) { + taskContext.logger.error("Failed to mkdir for scripts. See ouptut below"); + taskContext.logger.error(mkdirCommand.stdout); + taskContext.logger.error(mkdirCommand.stderr); + return { type: "failure", message: mkdirCommand.stdout }; + } + const copyScriptCommand = await loggingExeca( + undefined, + "docker", + ["cp", scriptFile.path, `${containerId}:/${workDir}/test.sh`], + { + doNotPipeOutput: true, + reject: false + } + ); + if (copyScriptCommand.failed) { + taskContext.logger.error("Failed to copy script. See ouptut below"); + taskContext.logger.error(copyScriptCommand.stdout); + taskContext.logger.error(copyScriptCommand.stderr); + return { type: "failure", message: copyScriptCommand.stdout }; + } + const copyCommand = await loggingExeca( + taskContext.logger, + "docker", + ["cp", `${outputDirectory}/.`, `${containerId}:/${workDir}/generated/`], + { + doNotPipeOutput: true, + reject: false + } + ); + if (copyCommand.failed) { + taskContext.logger.error("Failed to copy generated files. See ouptut below"); + taskContext.logger.error(copyCommand.stdout); + taskContext.logger.error(copyCommand.stderr); + return { type: "failure", message: copyCommand.stdout }; + } + + // Now actually run the test script + const command = await loggingExeca( + taskContext.logger, + "docker", + ["exec", containerId, "/bin/sh", "-c", `chmod +x /${workDir}/test.sh && /${workDir}/test.sh`], + { + doNotPipeOutput: true, + reject: false + } + ); + + if (command.failed) { + taskContext.logger.error("Failed to run script. See ouptut below"); + taskContext.logger.error(command.stdout); + taskContext.logger.error(command.stderr); + return { type: "failure", message: command.stdout }; + } else { + return { type: "success" }; + } + } + + private async startContainers(): Promise { + if (this.started) { + return; + } + // Start running a docker container for each script instance + for (const script of this.workspace.workspaceConfig.scripts ?? []) { + const startSeedCommand = await loggingExeca(undefined, "docker", ["run", "-dit", script.docker, "/bin/sh"]); + const containerId = startSeedCommand.stdout; + this.scripts.push({ ...script, containerId }); + } + this.started = true; + } +} diff --git a/packages/seed/src/commands/test/printTestCases.ts b/packages/seed/src/commands/test/printTestCases.ts index 1dd2ede9e23..4f2d03d4c35 100644 --- a/packages/seed/src/commands/test/printTestCases.ts +++ b/packages/seed/src/commands/test/printTestCases.ts @@ -1,7 +1,7 @@ import { printTable } from "console-table-printer"; -import { TestResult } from "./testWorkspaceFixtures"; +import { TestRunner } from "./test-runner"; -export function printTestCases(result: TestResult[]): void { +export function printTestCases(result: TestRunner.TestResult[]): void { const items = result.map((r) => { return { Name: r.id, diff --git a/packages/seed/src/commands/test/runDockerForWorkspace.ts b/packages/seed/src/commands/test/runDockerForWorkspace.ts deleted file mode 100644 index d67429f91c3..00000000000 --- a/packages/seed/src/commands/test/runDockerForWorkspace.ts +++ /dev/null @@ -1,90 +0,0 @@ -import { generatorsYml } from "@fern-api/configuration"; -import { AbsoluteFilePath } from "@fern-api/fs-utils"; -import { runLocalGenerationForSeed } from "@fern-api/local-workspace-runner"; -import { TaskContext } from "@fern-api/task-context"; -import { FernWorkspace } from "@fern-api/workspace-loader"; -import { writeInputs } from "../../commands/rewrite-inputs/rewriteInputsForWorkspace"; -import { OutputMode } from "../../config/api"; -import { ALL_AUDIENCES, DUMMY_ORGANIZATION } from "../../utils/constants"; -import { getGeneratorInvocation } from "../../utils/getGeneratorInvocation"; -import { ParsedDockerName } from "../../utils/parseDockerOrThrow"; - -export async function runDockerForWorkspace({ - absolutePathToOutput, - docker, - language, - workspace, - taskContext, - customConfig, - publishConfig, - selectAudiences, - irVersion, - outputVersion, - outputMode, - fixtureName, - keepDocker, - publishMetadata -}: { - absolutePathToOutput: AbsoluteFilePath; - docker: ParsedDockerName; - language: generatorsYml.GenerationLanguage | undefined; - workspace: FernWorkspace; - taskContext: TaskContext; - customConfig: unknown; - publishConfig: unknown; - selectAudiences?: string[]; - irVersion: string; - outputVersion?: string; - outputMode: OutputMode; - fixtureName: string; - keepDocker: boolean | undefined; - publishMetadata: unknown; -}): Promise { - try { - const generatorGroup: generatorsYml.GeneratorGroup = { - groupName: "test", - audiences: selectAudiences != null ? { type: "select", audiences: selectAudiences } : ALL_AUDIENCES, - generators: [ - getGeneratorInvocation({ - absolutePathToOutput, - docker, - language, - customConfig, - publishConfig, - outputMode, - fixtureName, - irVersion, - publishMetadata - }) - ] - }; - await runLocalGenerationForSeed({ - organization: DUMMY_ORGANIZATION, - absolutePathToFernConfig: undefined, - workspace, - generatorGroup, - keepDocker: keepDocker ?? false, - context: taskContext, - irVersionOverride: irVersion, - outputVersionOverride: outputVersion - }); - } catch (e) { - throw e; - } finally { - writeInputs({ - absolutePathToOutput, - fernWorkspace: workspace, - taskContext, - docker, - language, - customConfig, - publishConfig, - outputMode, - fixtureName, - irVersion, - publishMetadata, - workspaceName: workspace.name, - context: taskContext - }); - } -} diff --git a/packages/seed/src/commands/test/test-runner/DockerTestRunner.ts b/packages/seed/src/commands/test/test-runner/DockerTestRunner.ts new file mode 100644 index 00000000000..e6f3746a2b4 --- /dev/null +++ b/packages/seed/src/commands/test/test-runner/DockerTestRunner.ts @@ -0,0 +1,96 @@ +import { generatorsYml } from "@fern-api/configuration"; +import { runLocalGenerationForSeed } from "@fern-api/local-workspace-runner"; +import { CONSOLE_LOGGER } from "@fern-api/logger"; +import path from "path"; +import { writeInputs } from "../../../commands/rewrite-inputs/rewriteInputsForWorkspace"; +import { runScript } from "../../../runScript"; +import { ALL_AUDIENCES, DUMMY_ORGANIZATION } from "../../../utils/constants"; +import { getGeneratorInvocation } from "../../../utils/getGeneratorInvocation"; +import { ParsedDockerName, parseDockerOrThrow } from "../../../utils/parseDockerOrThrow"; +import { TestRunner } from "./TestRunner"; + +export class DockerTestRunner extends TestRunner { + async build(): Promise { + const dockerCommands = + typeof this.generator.workspaceConfig.dockerCommand === "string" + ? [this.generator.workspaceConfig.dockerCommand] + : this.generator.workspaceConfig.dockerCommand; + if (dockerCommands == null) { + throw new Error(`Failed. No docker command for ${this.generator.workspaceName}`); + } + await runScript({ + commands: dockerCommands, + logger: CONSOLE_LOGGER, + workingDir: path.dirname(path.dirname(this.generator.absolutePathToWorkspace)), + doNotPipeOutput: false + }); + } + + async runGenerator({ + fernWorkspace, + outputDir, + fixture, + taskContext, + selectAudiences, + outputVersion, + keepDocker, + language, + customConfig, + publishConfig, + outputMode, + irVersion, + publishMetadata + }: TestRunner.DoRunArgs): Promise { + try { + const generatorGroup: generatorsYml.GeneratorGroup = { + groupName: "test", + audiences: selectAudiences != null ? { type: "select", audiences: selectAudiences } : ALL_AUDIENCES, + generators: [ + getGeneratorInvocation({ + absolutePathToOutput: outputDir, + docker: this.getParsedDockerName(), + language, + customConfig, + publishConfig, + outputMode, + fixtureName: fixture, + irVersion, + publishMetadata + }) + ] + }; + await runLocalGenerationForSeed({ + organization: DUMMY_ORGANIZATION, + absolutePathToFernConfig: undefined, + workspace: fernWorkspace, + generatorGroup, + keepDocker: keepDocker ?? false, + context: taskContext, + irVersionOverride: irVersion, + outputVersionOverride: outputVersion + }); + } catch (e) { + throw e; + } finally { + writeInputs({ + absolutePathToOutput: outputDir, + fernWorkspace, + taskContext, + docker: this.getParsedDockerName(), + language, + customConfig, + publishConfig, + outputMode, + fixtureName: fixture, + irVersion, + publishMetadata, + workspaceName: this.generator.workspaceName, + context: taskContext + }); + } + } + + private getParsedDockerName(): ParsedDockerName { + return parseDockerOrThrow(this.generator.workspaceConfig.docker); + } +} diff --git a/packages/seed/src/commands/test/test-runner/LocalTestRunner.ts b/packages/seed/src/commands/test/test-runner/LocalTestRunner.ts new file mode 100644 index 00000000000..22913a9640c --- /dev/null +++ b/packages/seed/src/commands/test/test-runner/LocalTestRunner.ts @@ -0,0 +1,9 @@ +import { TestRunner } from "./TestRunner"; + +export class LocalTestRunner extends TestRunner { + async build(): Promise { + return; // no need to build + } + + async runGenerator({}: TestRunner.DoRunArgs): Promise {} +} diff --git a/packages/seed/src/commands/test/test-runner/TestRunner.ts b/packages/seed/src/commands/test/test-runner/TestRunner.ts new file mode 100644 index 00000000000..e6384756ce1 --- /dev/null +++ b/packages/seed/src/commands/test/test-runner/TestRunner.ts @@ -0,0 +1,210 @@ +import { APIS_DIRECTORY, FERN_DIRECTORY, generatorsYml } from "@fern-api/configuration"; +import { AbsoluteFilePath, join, RelativeFilePath } from "@fern-api/fs-utils"; +import { TaskContext } from "@fern-api/task-context"; +import { FernWorkspace } from "@fern-api/workspace-loader"; +import path from "path"; +import { FixtureConfigurations, OutputMode } from "../../../config/api"; +import { GeneratorWorkspace } from "../../../loadGeneratorWorkspaces"; +import { Semaphore } from "../../../Semaphore"; +import { Stopwatch } from "../../../Stopwatch"; +import { convertGeneratorWorkspaceToFernWorkspace } from "../../../utils/convertSeedWorkspaceToFernWorkspace"; +import { ScriptRunner } from "../ScriptRunner"; +import { TaskContextFactory } from "../TaskContextFactory"; + +export declare namespace TestRunner { + interface Args { + generator: GeneratorWorkspace; + lock: Semaphore; + taskContextFactory: TaskContextFactory; + skipScripts: boolean; + scriptRunner: ScriptRunner; + keepDocker: boolean; + } + + interface RunArgs { + /** The fixture to run the generator on **/ + fixture: string; + /** Configuration specific to the fixture **/ + configuration: FixtureConfigurations | undefined; + } + + interface DoRunArgs { + id: string; + fernWorkspace: FernWorkspace; + fixture: string; + irVersion: string; + outputVersion: string | undefined; + language: generatorsYml.GenerationLanguage | undefined; + customConfig: unknown; + publishConfig: unknown; + selectAudiences?: string[]; + taskContext: TaskContext; + outputDir: AbsoluteFilePath; + absolutePathToWorkspace: AbsoluteFilePath; + outputMode: OutputMode; + outputFolder: string; + keepDocker: boolean | undefined; + publishMetadata: unknown; + } + + type TestResult = TestSuccess | TestFailure; + + interface TestSuccess { + type: "success"; + id: string; + metrics: TestCaseMetrics; + } + + interface TestFailure { + type: "failure"; + cause: "invalid-fixture" | "generation" | "compile"; + message?: string; + id: string; + metrics: TestCaseMetrics; + } + + interface TestCaseMetrics { + /** The time it takes to generate code via the generator */ + generationTime?: string; + /** The time it takes to verify/compile the code */ + compileTime?: string; + } +} + +export abstract class TestRunner { + protected readonly generator: GeneratorWorkspace; + protected readonly lock: Semaphore; + protected readonly taskContextFactory: TaskContextFactory; + private readonly skipScripts: boolean; + private readonly keepDocker: boolean; + private scriptRunner: ScriptRunner; + + constructor({ generator, lock, taskContextFactory, skipScripts, keepDocker, scriptRunner }: TestRunner.Args) { + this.generator = generator; + this.lock = lock; + this.taskContextFactory = taskContextFactory; + this.skipScripts = skipScripts; + this.keepDocker = keepDocker; + this.scriptRunner = scriptRunner; + } + + /** + * Builds the generator. + */ + public abstract build(): Promise; + + /** + * Runs the generator. + */ + public async run({ fixture, configuration }: TestRunner.RunArgs): Promise { + const metrics: TestRunner.TestCaseMetrics = {}; + + const fixtureConfig = this.generator.workspaceConfig.fixtures?.[fixture]; + if (fixtureConfig == null) { + return { + type: "failure", + cause: "invalid-fixture", + message: `Fixture ${fixture} not found.`, + id: fixture, + metrics + }; + } + + const absolutePathToWorkspace = AbsoluteFilePath.of( + path.join(__dirname, FERN_DIRECTORY, APIS_DIRECTORY, fixture) + ); + const taskContext = this.taskContextFactory.create(`${this.generator.workspaceName}:${fixture}`); + const outputFolder = configuration?.outputFolder ?? fixture; + const fernWorkspace = await convertGeneratorWorkspaceToFernWorkspace({ + absolutePathToWorkspace, + taskContext, + fixture + }); + if (fernWorkspace == null) { + return { + type: "failure", + cause: "invalid-fixture", + message: `Failed to validate fixture ${fixture}`, + id: fixture, + metrics + }; + } + + taskContext.logger.debug("Acquiring lock..."); + await this.lock.acquire(); + taskContext.logger.info("Running generator..."); + try { + const generationStopwatch = new Stopwatch(); + generationStopwatch.start(); + await this.runGenerator({ + id: configuration != null ? `${fixture}:${configuration.outputFolder}` : `${fixture}`, + fernWorkspace, + absolutePathToWorkspace, + irVersion: this.generator.workspaceConfig.irVersion, + outputVersion: configuration?.outputVersion, + language: this.generator.workspaceConfig.language, + selectAudiences: configuration?.audiences, + fixture, + customConfig: configuration?.customConfig, + publishConfig: configuration?.publishConfig ?? undefined, + taskContext, + outputDir: + configuration == null + ? join(this.generator.absolutePathToWorkspace, RelativeFilePath.of(fixture)) + : join( + this.generator.absolutePathToWorkspace, + RelativeFilePath.of(fixture), + RelativeFilePath.of(configuration.outputFolder) + ), + outputMode: configuration?.outputMode ?? this.generator.workspaceConfig.defaultOutputMode, + outputFolder, + keepDocker: this.keepDocker, + publishMetadata: configuration?.publishMetadata ?? undefined + }); + generationStopwatch.stop(); + metrics.generationTime = generationStopwatch.duration(); + } catch (error) { + return { + type: "failure", + cause: "generation", + id: fixture, + metrics + }; + } + + if (this.skipScripts) { + return { + type: "success", + id: fixture, + metrics + }; + } + + const scriptStopwatch = new Stopwatch(); + scriptStopwatch.start(); + + const scriptResponse = await this.scriptRunner.run({ taskContext, fixture, outputFolder }); + + scriptStopwatch.stop(); + metrics.compileTime = scriptStopwatch.duration(); + + if (scriptResponse.type === "failure") { + return { + type: "failure", + cause: "compile", + id: fixture, + metrics + }; + } + return { + type: "success", + id: fixture, + metrics + }; + } + + /** + * + */ + public abstract runGenerator({}: TestRunner.DoRunArgs): Promise; +} diff --git a/packages/seed/src/commands/test/test-runner/index.ts b/packages/seed/src/commands/test/test-runner/index.ts new file mode 100644 index 00000000000..c132e81ed63 --- /dev/null +++ b/packages/seed/src/commands/test/test-runner/index.ts @@ -0,0 +1,3 @@ +export { DockerTestRunner } from "./DockerTestRunner"; +export { LocalTestRunner } from "./LocalTestRunner"; +export { TestRunner } from "./TestRunner"; diff --git a/packages/seed/src/commands/test/testCustomFixture.ts b/packages/seed/src/commands/test/testCustomFixture.ts deleted file mode 100644 index 2c0e1c61d45..00000000000 --- a/packages/seed/src/commands/test/testCustomFixture.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { generatorsYml } from "@fern-api/configuration"; -import { AbsoluteFilePath, join } from "@fern-api/fs-utils"; -import { LogLevel } from "@fern-api/logger"; -import tmp from "tmp-promise"; -import { SeedWorkspace } from "../../loadSeedWorkspaces"; -import { Semaphore } from "../../Semaphore"; -import { ParsedDockerName } from "../../utils/parseDockerOrThrow"; -import { TaskContextFactory } from "./TaskContextFactory"; -import { acquireLocksAndRunTest } from "./testWorkspaceFixtures"; - -export async function testCustomFixture({ - pathToFixture, - workspace, - language, - docker, - logLevel, - numDockers, - keepDocker, - skipScripts -}: { - pathToFixture: AbsoluteFilePath; - workspace: SeedWorkspace; - language: generatorsYml.GenerationLanguage | undefined; - docker: ParsedDockerName; - logLevel: LogLevel; - numDockers: number; - keepDocker: boolean | undefined; - skipScripts: boolean; -}): Promise { - const lock = new Semaphore(numDockers); - const outputDir = await tmp.dir(); - const absolutePathToOutput = AbsoluteFilePath.of(outputDir.path); - const taskContextFactory = new TaskContextFactory(logLevel); - const customFixtureConfig = workspace.workspaceConfig.customFixtureConfig; - - const taskContext = taskContextFactory.create( - `${workspace.workspaceName}:${"custom"} - ${customFixtureConfig?.outputFolder ?? ""}` - ); - - const result = await acquireLocksAndRunTest({ - absolutePathToWorkspace: join(pathToFixture), - lock, - irVersion: workspace.workspaceConfig.irVersion, - outputVersion: customFixtureConfig?.outputVersion, - language, - fixture: "custom", - docker, - scripts: undefined, - customConfig: customFixtureConfig?.customConfig, - publishConfig: customFixtureConfig?.publishConfig, - publishMetadata: customFixtureConfig?.publishMetadata, - selectAudiences: customFixtureConfig?.audiences, - taskContext, - outputDir: absolutePathToOutput, - outputMode: customFixtureConfig?.outputMode ?? workspace.workspaceConfig.defaultOutputMode, - outputFolder: customFixtureConfig?.outputFolder ?? "custom", - id: "custom", - keepDocker, - skipScripts - }); - - if (result.type === "failure") { - taskContext.logger.error(`Encountered error with ${result.cause}`); - } else { - taskContext.logger.info(`Wrote files to ${absolutePathToOutput}`); - } -} diff --git a/packages/seed/src/commands/test/testWorkspaceFixtures.ts b/packages/seed/src/commands/test/testWorkspaceFixtures.ts index 5d78a58f6af..33f1dcab39d 100644 --- a/packages/seed/src/commands/test/testWorkspaceFixtures.ts +++ b/packages/seed/src/commands/test/testWorkspaceFixtures.ts @@ -1,22 +1,11 @@ -import { APIS_DIRECTORY, FERN_DIRECTORY, generatorsYml } from "@fern-api/configuration"; -import { AbsoluteFilePath, join, RelativeFilePath } from "@fern-api/fs-utils"; -import { CONSOLE_LOGGER, LogLevel } from "@fern-api/logger"; -import { loggingExeca } from "@fern-api/logging-execa"; -import { TaskContext } from "@fern-api/task-context"; +import { APIS_DIRECTORY, FERN_DIRECTORY } from "@fern-api/configuration"; +import { CONSOLE_LOGGER } from "@fern-api/logger"; import fs from "fs"; -import { writeFile } from "fs/promises"; import { difference } from "lodash-es"; import path from "path"; -import tmp from "tmp-promise"; -import { OutputMode, ScriptConfig } from "../../config/api"; -import { SeedWorkspace } from "../../loadSeedWorkspaces"; -import { Semaphore } from "../../Semaphore"; -import { Stopwatch } from "../../Stopwatch"; -import { convertSeedWorkspaceToFernWorkspace } from "../../utils/convertSeedWorkspaceToFernWorkspace"; -import { ParsedDockerName } from "../../utils/parseDockerOrThrow"; +import { GeneratorWorkspace } from "../../loadGeneratorWorkspaces"; import { printTestCases } from "./printTestCases"; -import { runDockerForWorkspace } from "./runDockerForWorkspace"; -import { TaskContextFactory } from "./TaskContextFactory"; +import { TestRunner } from "./test-runner"; export const FIXTURES_TO_IGNORE = [""]; @@ -24,421 +13,59 @@ export const FIXTURES = readDirectories(path.join(__dirname, FERN_DIRECTORY, API (fixture) => !FIXTURES_TO_IGNORE.includes(fixture) ); -export type TestResult = TestSuccess | TestFailure; - -export interface TestSuccess { - type: "success"; - id: string; - metrics: TestCaseMetrics; -} - -export interface TestFailure { - type: "failure"; - cause: "invalid-fixture" | "generation" | "compile"; - message?: string; - id: string; - metrics: TestCaseMetrics; -} - -export interface TestCaseMetrics { - /** The time it takes to generate code via the generator */ - generationTime?: string; - /** The time it takes to verify/compile the code */ - compileTime?: string; -} - -interface RunningScriptConfig extends ScriptConfig { - containerId: string; -} - -export async function testWorkspaceFixtures({ - workspace, - irVersion, - language, - fixtures, - docker, - scripts, - taskContextFactory, - numDockers, - keepDocker, - skipScripts, - outputFolder +export async function testGenerator({ + runner, + generator, + fixtures }: { - workspace: SeedWorkspace; - irVersion: string; - language: generatorsYml.GenerationLanguage | undefined; + runner: TestRunner; + generator: GeneratorWorkspace; fixtures: string[]; - docker: ParsedDockerName; - scripts: ScriptConfig[] | undefined; - logLevel: LogLevel; - taskContextFactory: TaskContextFactory; - numDockers: number; - keepDocker: boolean | undefined; - skipScripts: boolean; - outputFolder: string | undefined; }): Promise { - const lock = new Semaphore(numDockers); - - const testCases = []; - const runningScripts: RunningScriptConfig[] = []; - - const containerIdsToShutdown: string[] = []; - try { - if (!skipScripts) { - // Start running a docker container for each script instance - for (const script of scripts ?? []) { - // Start script runner - const startSeedCommand = await loggingExeca(undefined, "docker", [ - "run", - "-dit", - script.docker, - "/bin/sh" - ]); - const containerId = startSeedCommand.stdout; - containerIdsToShutdown.push(containerId); - runningScripts.push({ ...script, containerId }); - } - } - - for (const fixture of fixtures) { - const fixtureConfig = workspace.workspaceConfig.fixtures?.[fixture]; - const absolutePathToWorkspace = AbsoluteFilePath.of( - path.join(__dirname, FERN_DIRECTORY, APIS_DIRECTORY, fixture) - ); - if (fixtureConfig != null) { - for (const fixtureConfigInstance of fixtureConfig) { - if (outputFolder != null && fixtureConfigInstance.outputFolder !== outputFolder) { - continue; - } - testCases.push( - acquireLocksAndRunTest({ - id: `${fixture}:${fixtureConfigInstance.outputFolder}`, - absolutePathToWorkspace, - lock, - irVersion, - outputVersion: fixtureConfigInstance.outputVersion, - language, - fixture, - docker, - scripts: runningScripts, - customConfig: fixtureConfigInstance.customConfig, - publishConfig: fixtureConfigInstance.publishConfig, - selectAudiences: fixtureConfigInstance.audiences, - taskContext: taskContextFactory.create( - `${workspace.workspaceName}:${fixture} - ${fixtureConfigInstance.outputFolder}` - ), - outputDir: join( - workspace.absolutePathToWorkspace, - RelativeFilePath.of(fixture), - RelativeFilePath.of(fixtureConfigInstance.outputFolder) - ), - outputMode: fixtureConfigInstance.outputMode ?? workspace.workspaceConfig.defaultOutputMode, - outputFolder: fixtureConfigInstance.outputFolder, - keepDocker, - skipScripts, - publishMetadata: fixtureConfigInstance.publishMetadata - }) - ); - } - } else { + const testCases: Promise[] = []; + for (const fixture of fixtures) { + const config = generator.workspaceConfig.fixtures?.[fixture]; + if (config != null) { + for (const instance of config) { testCases.push( - acquireLocksAndRunTest({ - id: `${fixture}`, - absolutePathToWorkspace, - lock, - irVersion, - outputVersion: undefined, - language, + runner.run({ fixture, - docker, - scripts: runningScripts, - customConfig: undefined, - publishConfig: undefined, - taskContext: taskContextFactory.create(`${workspace.workspaceName}:${fixture}`), - outputDir: join(workspace.absolutePathToWorkspace, RelativeFilePath.of(fixture)), - outputMode: workspace.workspaceConfig.defaultOutputMode, - outputFolder: fixture, - keepDocker, - skipScripts, - publishMetadata: undefined + configuration: instance }) ); } - } - const results = await Promise.all(testCases); - - printTestCases(results); - - const failedFixtures = results.filter((res) => res.type === "failure").map((res) => res.id); - const unexpectedFixtures = difference(failedFixtures, workspace.workspaceConfig.allowedFailures ?? []); - - if (failedFixtures.length === 0) { - CONSOLE_LOGGER.info(`${results.length}/${results.length} test cases passed :white_check_mark:`); } else { - CONSOLE_LOGGER.info( - `${failedFixtures.length}/${ - results.length - } test cases failed. The failed fixtures include ${failedFixtures.join(", ")}.` + testCases.push( + runner.run({ + fixture, + configuration: undefined + }) ); - if (unexpectedFixtures.length > 0) { - CONSOLE_LOGGER.info(`Unexpected fixtures include ${unexpectedFixtures.join(", ")}.`); - return false; - } else { - CONSOLE_LOGGER.info(`All failures were expected.`); - } - } - return true; - } finally { - for (const containerId of containerIdsToShutdown) { - await loggingExeca(undefined, "docker", ["stop", containerId]); } } -} - -export async function acquireLocksAndRunTest({ - id, - lock, - irVersion, - outputVersion, - language, - fixture, - docker, - customConfig, - publishConfig, - selectAudiences, - scripts, - taskContext, - outputDir, - absolutePathToWorkspace, - outputMode, - outputFolder, - keepDocker, - skipScripts, - publishMetadata -}: { - id: string; - lock: Semaphore; - irVersion: string; - outputVersion: string | undefined; - language: generatorsYml.GenerationLanguage | undefined; - fixture: string; - docker: ParsedDockerName; - customConfig: unknown; - publishConfig: unknown; - selectAudiences?: string[]; - scripts: RunningScriptConfig[] | undefined; - taskContext: TaskContext; - outputDir: AbsoluteFilePath; - absolutePathToWorkspace: AbsoluteFilePath; - outputMode: OutputMode; - outputFolder: string; - keepDocker: boolean | undefined; - skipScripts: boolean; - publishMetadata: unknown; -}): Promise { - taskContext.logger.debug("Acquiring lock..."); - await lock.acquire(); - taskContext.logger.info("Running test..."); - const result = await testWithWriteToDisk({ - id, - fixture, - irVersion, - outputVersion, - language, - docker, - customConfig, - publishConfig, - selectAudiences, - scripts, - taskContext, - outputDir, - absolutePathToWorkspace, - outputMode, - outputFolder, - keepDocker, - skipScripts, - publishMetadata - }); - taskContext.logger.debug("Releasing lock..."); - lock.release(); - return result; -} - -async function testWithWriteToDisk({ - id, - fixture, - irVersion, - outputVersion, - language, - docker, - customConfig, - publishConfig, - selectAudiences, - scripts, - taskContext, - outputDir, - absolutePathToWorkspace, - outputMode, - outputFolder, - keepDocker, - skipScripts, - publishMetadata -}: { - id: string; - fixture: string; - irVersion: string; - outputVersion: string | undefined; - language: generatorsYml.GenerationLanguage | undefined; - docker: ParsedDockerName; - customConfig: unknown; - publishConfig: unknown; - selectAudiences?: string[]; - scripts: RunningScriptConfig[] | undefined; - taskContext: TaskContext; - outputDir: AbsoluteFilePath; - absolutePathToWorkspace: AbsoluteFilePath; - outputMode: OutputMode; - outputFolder: string; - keepDocker: boolean | undefined; - skipScripts: boolean; - publishMetadata: unknown; -}): Promise { - const metrics: TestCaseMetrics = {}; - try { - const fernWorkspace = await convertSeedWorkspaceToFernWorkspace({ - absolutePathToWorkspace, - taskContext, - fixture - }); - if (fernWorkspace == null) { - return { - type: "failure", - cause: "invalid-fixture", - message: "Failed to load workspace", - id, - metrics - }; - } - const generationStopwatch = new Stopwatch(); - generationStopwatch.start(); - await runDockerForWorkspace({ - absolutePathToOutput: outputDir, - docker, - workspace: fernWorkspace, - language, - customConfig, - publishConfig, - selectAudiences, - taskContext, - irVersion, - outputVersion, - outputMode, - fixtureName: fixture, - keepDocker, - publishMetadata - }); - generationStopwatch.stop(); - metrics.generationTime = generationStopwatch.duration(); - if (skipScripts) { - return { type: "success", id, metrics }; - } - } catch (err) { - return { - type: "failure", - cause: "generation", - message: (err as Error).message, - id, - metrics - }; - } - const scriptStopwatch = new Stopwatch(); - scriptStopwatch.start(); - try { - for (const script of scripts ?? []) { - taskContext.logger.info(`Running script ${script.commands[0] ?? ""} on ${fixture}`); - - const workDir = `${fixture}_${outputFolder}`; - const scriptFile = await tmp.file(); - await writeFile(scriptFile.path, [`cd /${workDir}/generated`, ...script.commands].join("\n")); - - // Move scripts and generated files into the container - const mkdirCommand = await loggingExeca( - taskContext.logger, - "docker", - ["exec", script.containerId, "mkdir", `/${workDir}`], - { - doNotPipeOutput: true, - reject: false - } - ); - if (mkdirCommand.failed) { - taskContext.logger.error("Failed to mkdir for scripts. See ouptut below"); - taskContext.logger.error(mkdirCommand.stdout); - taskContext.logger.error(mkdirCommand.stderr); - return { type: "failure", cause: "compile", message: mkdirCommand.stdout, id, metrics }; - } - const copyScriptCommand = await loggingExeca( - undefined, - "docker", - ["cp", scriptFile.path, `${script.containerId}:/${workDir}/test.sh`], - { - doNotPipeOutput: true, - reject: false - } - ); - if (copyScriptCommand.failed) { - taskContext.logger.error("Failed to copy script. See ouptut below"); - taskContext.logger.error(copyScriptCommand.stdout); - taskContext.logger.error(copyScriptCommand.stderr); - return { type: "failure", cause: "compile", message: copyScriptCommand.stdout, id, metrics }; - } - const copyCommand = await loggingExeca( - taskContext.logger, - "docker", - ["cp", `${outputDir}/.`, `${script.containerId}:/${workDir}/generated/`], - { - doNotPipeOutput: true, - reject: false - } - ); - if (copyCommand.failed) { - taskContext.logger.error("Failed to copy generated files. See ouptut below"); - taskContext.logger.error(copyCommand.stdout); - taskContext.logger.error(copyCommand.stderr); - return { type: "failure", cause: "compile", message: copyCommand.stdout, id, metrics }; - } - - // Now actually run the test script - const command = await loggingExeca( - taskContext.logger, - "docker", - ["exec", script.containerId, "/bin/sh", "-c", `chmod +x /${workDir}/test.sh && /${workDir}/test.sh`], - { - doNotPipeOutput: true, - reject: false - } - ); - scriptStopwatch.stop(); - metrics.compileTime = scriptStopwatch.duration(); - if (command.failed) { - taskContext.logger.error("Failed to run script. See ouptut below"); - taskContext.logger.error(command.stdout); - taskContext.logger.error(command.stderr); - return { type: "failure", cause: "compile", message: command.stdout, id, metrics }; - } + const results = await Promise.all(testCases); + + printTestCases(results); + + const failedFixtures = results.filter((res) => res.type === "failure").map((res) => res.id); + const unexpectedFixtures = difference(failedFixtures, generator.workspaceConfig.allowedFailures ?? []); + + if (failedFixtures.length === 0) { + CONSOLE_LOGGER.info(`${results.length}/${results.length} test cases passed :white_check_mark:`); + } else { + CONSOLE_LOGGER.info( + `${failedFixtures.length}/${ + results.length + } test cases failed. The failed fixtures include ${failedFixtures.join(", ")}.` + ); + if (unexpectedFixtures.length > 0) { + CONSOLE_LOGGER.info(`Unexpected fixtures include ${unexpectedFixtures.join(", ")}.`); + return false; + } else { + CONSOLE_LOGGER.info(`All failures were expected.`); } - return { type: "success", id, metrics }; - } catch (err) { - scriptStopwatch.stop(); - metrics.compileTime = scriptStopwatch.duration(); - return { - type: "failure", - cause: "compile", - message: (err as Error).message, - id, - metrics - }; } + return true; } function readDirectories(filepath: string): string[] { diff --git a/packages/seed/src/config/api/resources/config/types/DockerBuildInfo.ts b/packages/seed/src/config/api/resources/config/types/DockerBuildInfo.ts new file mode 100644 index 00000000000..40f186a8da6 --- /dev/null +++ b/packages/seed/src/config/api/resources/config/types/DockerBuildInfo.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface DockerBuildInfo { + /** + * The command to build the generator locally. + * `yarn workspace @fern-api/openapi-generator build` for example. + */ + buildCommand: string; + /** + * The command to run the generator locally. + * `node generators/openapi/dist/cli.cjs` for example. + */ + runCommand: string; +} diff --git a/packages/seed/src/config/api/resources/config/types/index.ts b/packages/seed/src/config/api/resources/config/types/index.ts index 8fc391997ad..3306deb83ec 100644 --- a/packages/seed/src/config/api/resources/config/types/index.ts +++ b/packages/seed/src/config/api/resources/config/types/index.ts @@ -1,5 +1,6 @@ export * from "./SeedWorkspaceConfiguration"; export * from "./LocalBuildInfo"; +export * from "./DockerBuildInfo"; export * from "./DockerCommand"; export * from "./ScriptConfig"; export * from "./Language"; diff --git a/packages/seed/src/loadSeedWorkspaces.ts b/packages/seed/src/loadGeneratorWorkspaces.ts similarity index 91% rename from packages/seed/src/loadSeedWorkspaces.ts rename to packages/seed/src/loadGeneratorWorkspaces.ts index f4fa7f14152..63b85ee57d2 100644 --- a/packages/seed/src/loadSeedWorkspaces.ts +++ b/packages/seed/src/loadGeneratorWorkspaces.ts @@ -4,7 +4,7 @@ import { readdir, readFile } from "fs/promises"; import yaml from "js-yaml"; import { FernSeedConfig } from "./config"; -export interface SeedWorkspace { +export interface GeneratorWorkspace { workspaceName: string; absolutePathToWorkspace: AbsoluteFilePath; workspaceConfig: FernSeedConfig.SeedWorkspaceConfiguration; @@ -13,7 +13,7 @@ export interface SeedWorkspace { export const SEED_DIRECTORY = "seed"; export const SEED_CONFIG_FILENAME = "seed.yml"; -export async function loadSeedWorkspaces(): Promise { +export async function loadGeneratorWorkspaces(): Promise { const seedDirectory = await getSeedDirectory(); if (seedDirectory == null) { @@ -29,7 +29,7 @@ export async function loadSeedWorkspaces(): Promise { return all; }, []); - const workspaces: SeedWorkspace[] = []; + const workspaces: GeneratorWorkspace[] = []; for (const workspace of workspaceDirectoryNames) { const absolutePathToWorkspace = join(seedDirectory, RelativeFilePath.of(workspace)); diff --git a/packages/seed/src/utils/convertSeedWorkspaceToFernWorkspace.ts b/packages/seed/src/utils/convertSeedWorkspaceToFernWorkspace.ts index e2819c4a3e9..dce47ac7bc0 100644 --- a/packages/seed/src/utils/convertSeedWorkspaceToFernWorkspace.ts +++ b/packages/seed/src/utils/convertSeedWorkspaceToFernWorkspace.ts @@ -2,7 +2,7 @@ import { AbsoluteFilePath } from "@fern-api/fs-utils"; import { TaskContext } from "@fern-api/task-context"; import { convertOpenApiWorkspaceToFernWorkspace, FernWorkspace, loadAPIWorkspace } from "@fern-api/workspace-loader"; -export async function convertSeedWorkspaceToFernWorkspace({ +export async function convertGeneratorWorkspaceToFernWorkspace({ fixture, absolutePathToWorkspace, taskContext From 98d5da60b2c37cb36bfe3772abaddb771d0a800c Mon Sep 17 00:00:00 2001 From: dsinghvi Date: Sun, 21 Apr 2024 16:19:03 -0400 Subject: [PATCH 03/12] fix --- packages/seed/src/commands/test/ScriptRunner.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/seed/src/commands/test/ScriptRunner.ts b/packages/seed/src/commands/test/ScriptRunner.ts index 2abfa7dbcf3..393dcd8c31e 100644 --- a/packages/seed/src/commands/test/ScriptRunner.ts +++ b/packages/seed/src/commands/test/ScriptRunner.ts @@ -4,7 +4,7 @@ import { TaskContext } from "@fern-api/task-context"; import { writeFile } from "fs/promises"; import tmp from "tmp-promise"; import { ScriptConfig } from "../../config/api"; -import { SeedWorkspace } from "../../loadSeedWorkspaces"; +import { GeneratorWorkspace } from "../../loadGeneratorWorkspaces"; export declare namespace ScriptRunner { interface RunArgs { @@ -36,7 +36,7 @@ export class ScriptRunner { private started: boolean = false; private scripts: RunningScriptConfig[] = []; - constructor(private readonly workspace: SeedWorkspace) {} + constructor(private readonly workspace: GeneratorWorkspace) {} public async run({ taskContext, fixture }: ScriptRunner.RunArgs): Promise { await this.startContainers(); From 19460e678d07564bdf237b12621a83f9d2ba39f7 Mon Sep 17 00:00:00 2001 From: dsinghvi Date: Sun, 21 Apr 2024 16:24:33 -0400 Subject: [PATCH 04/12] fix inputs --- packages/seed/src/commands/test/test-runner/DockerTestRunner.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/seed/src/commands/test/test-runner/DockerTestRunner.ts b/packages/seed/src/commands/test/test-runner/DockerTestRunner.ts index e6f3746a2b4..475f4297eeb 100644 --- a/packages/seed/src/commands/test/test-runner/DockerTestRunner.ts +++ b/packages/seed/src/commands/test/test-runner/DockerTestRunner.ts @@ -84,7 +84,7 @@ export class DockerTestRunner extends TestRunner { fixtureName: fixture, irVersion, publishMetadata, - workspaceName: this.generator.workspaceName, + workspaceName: fixture, context: taskContext }); } From c2e7bbf12b9563f6b7cfd867b3299e02cb80a492 Mon Sep 17 00:00:00 2001 From: dsinghvi Date: Sun, 21 Apr 2024 16:53:23 -0400 Subject: [PATCH 05/12] try again --- packages/seed/src/cli.ts | 2 +- .../rewrite-inputs/rewriteInputsForWorkspace.ts | 6 +++--- .../src/commands/run/runWithCustomFixture.ts | 2 +- .../seed/src/commands/test/printTestCases.ts | 3 ++- .../src/commands/test/test-runner/TestRunner.ts | 17 ++++++++++++----- .../convertSeedWorkspaceToFernWorkspace.ts | 6 +++--- .../imdb/custom-overrides/.inputs/config.json | 2 +- .../imdb/json-format/.inputs/config.json | 2 +- .../imdb/no-custom-config/.inputs/config.json | 2 +- 9 files changed, 25 insertions(+), 17 deletions(-) diff --git a/packages/seed/src/cli.ts b/packages/seed/src/cli.ts index 0c288c2daf0..ae3b24c632d 100644 --- a/packages/seed/src/cli.ts +++ b/packages/seed/src/cli.ts @@ -73,7 +73,7 @@ function addTestCommand(cli: Argv) { const tests: Promise[] = []; for (const generator of generators) { - if (argv.workspace != null && !argv.generator?.includes(generator.workspaceName)) { + if (argv.generator != null && !argv.generator.includes(generator.workspaceName)) { continue; } const testRunner = new DockerTestRunner({ diff --git a/packages/seed/src/commands/rewrite-inputs/rewriteInputsForWorkspace.ts b/packages/seed/src/commands/rewrite-inputs/rewriteInputsForWorkspace.ts index e7e209a36f2..92268baac5b 100644 --- a/packages/seed/src/commands/rewrite-inputs/rewriteInputsForWorkspace.ts +++ b/packages/seed/src/commands/rewrite-inputs/rewriteInputsForWorkspace.ts @@ -31,7 +31,7 @@ export async function rewriteInputsForWorkspace({ for (const fixture of fixtures) { const fixtureConfig = generator.workspaceConfig.fixtures?.[fixture]; const docker = parseDockerOrThrow(generator.workspaceConfig.docker); - const absolutePathToFernDefinition = AbsoluteFilePath.of( + const absolutePathToAPIDefinition = AbsoluteFilePath.of( path.join(__dirname, FERN_DIRECTORY, APIS_DIRECTORY, fixture) ); const absolutePathToOutput = join(generator.absolutePathToWorkspace, RelativeFilePath.of(fixture)); @@ -41,7 +41,7 @@ export async function rewriteInputsForWorkspace({ `${generator.workspaceName}:${fixture} - ${fixtureConfigInstance.outputFolder}` ); const fernWorkspace = await convertGeneratorWorkspaceToFernWorkspace({ - absolutePathToWorkspace: absolutePathToFernDefinition, + absolutePathToAPIDefinition, taskContext, fixture }); @@ -71,7 +71,7 @@ export async function rewriteInputsForWorkspace({ } else { const taskContext = taskContextFactory.create(`${generator.workspaceName}:${fixture}`); const fernWorkspace = await convertGeneratorWorkspaceToFernWorkspace({ - absolutePathToWorkspace: absolutePathToFernDefinition, + absolutePathToAPIDefinition, taskContext, fixture }); diff --git a/packages/seed/src/commands/run/runWithCustomFixture.ts b/packages/seed/src/commands/run/runWithCustomFixture.ts index bff87878995..9253229c7de 100644 --- a/packages/seed/src/commands/run/runWithCustomFixture.ts +++ b/packages/seed/src/commands/run/runWithCustomFixture.ts @@ -37,7 +37,7 @@ export async function runWithCustomFixture({ }); const fernWorkspace = await convertGeneratorWorkspaceToFernWorkspace({ - absolutePathToWorkspace: pathToFixture, + absolutePathToAPIDefinition: pathToFixture, taskContext, fixture: "custom" }); diff --git a/packages/seed/src/commands/test/printTestCases.ts b/packages/seed/src/commands/test/printTestCases.ts index 4f2d03d4c35..4169fd9f4b6 100644 --- a/packages/seed/src/commands/test/printTestCases.ts +++ b/packages/seed/src/commands/test/printTestCases.ts @@ -8,7 +8,8 @@ export function printTestCases(result: TestRunner.TestResult[]): void { Result: r.type, "Generation Time": r.metrics.generationTime, "Compile Time": r.metrics.compileTime, - "Failure Type": r.type === "failure" ? r.cause : "" + "Failure Type": r.type === "failure" ? r.cause : "", + "Failure Message": r.type === "failure" ? r.message : "" }; }); printTable(items); diff --git a/packages/seed/src/commands/test/test-runner/TestRunner.ts b/packages/seed/src/commands/test/test-runner/TestRunner.ts index e6384756ce1..8e3c55eb669 100644 --- a/packages/seed/src/commands/test/test-runner/TestRunner.ts +++ b/packages/seed/src/commands/test/test-runner/TestRunner.ts @@ -72,6 +72,7 @@ export declare namespace TestRunner { } export abstract class TestRunner { + private built: boolean = false; protected readonly generator: GeneratorWorkspace; protected readonly lock: Semaphore; protected readonly taskContextFactory: TaskContextFactory; @@ -97,6 +98,11 @@ export abstract class TestRunner { * Runs the generator. */ public async run({ fixture, configuration }: TestRunner.RunArgs): Promise { + if (!this.built) { + await this.build(); + this.built = true; + } + const metrics: TestRunner.TestCaseMetrics = {}; const fixtureConfig = this.generator.workspaceConfig.fixtures?.[fixture]; @@ -110,13 +116,14 @@ export abstract class TestRunner { }; } - const absolutePathToWorkspace = AbsoluteFilePath.of( + const id = configuration != null ? `${fixture}:${configuration.outputFolder}` : `${fixture}`; + const absolutePathToAPIDefinition = AbsoluteFilePath.of( path.join(__dirname, FERN_DIRECTORY, APIS_DIRECTORY, fixture) ); - const taskContext = this.taskContextFactory.create(`${this.generator.workspaceName}:${fixture}`); + const taskContext = this.taskContextFactory.create(`${this.generator.workspaceName}:${id}`); const outputFolder = configuration?.outputFolder ?? fixture; const fernWorkspace = await convertGeneratorWorkspaceToFernWorkspace({ - absolutePathToWorkspace, + absolutePathToAPIDefinition, taskContext, fixture }); @@ -137,9 +144,9 @@ export abstract class TestRunner { const generationStopwatch = new Stopwatch(); generationStopwatch.start(); await this.runGenerator({ - id: configuration != null ? `${fixture}:${configuration.outputFolder}` : `${fixture}`, + id, fernWorkspace, - absolutePathToWorkspace, + absolutePathToWorkspace: this.generator.absolutePathToWorkspace, irVersion: this.generator.workspaceConfig.irVersion, outputVersion: configuration?.outputVersion, language: this.generator.workspaceConfig.language, diff --git a/packages/seed/src/utils/convertSeedWorkspaceToFernWorkspace.ts b/packages/seed/src/utils/convertSeedWorkspaceToFernWorkspace.ts index dce47ac7bc0..4ac1bb10c42 100644 --- a/packages/seed/src/utils/convertSeedWorkspaceToFernWorkspace.ts +++ b/packages/seed/src/utils/convertSeedWorkspaceToFernWorkspace.ts @@ -4,15 +4,15 @@ import { convertOpenApiWorkspaceToFernWorkspace, FernWorkspace, loadAPIWorkspace export async function convertGeneratorWorkspaceToFernWorkspace({ fixture, - absolutePathToWorkspace, + absolutePathToAPIDefinition, taskContext }: { fixture: string; - absolutePathToWorkspace: AbsoluteFilePath; + absolutePathToAPIDefinition: AbsoluteFilePath; taskContext: TaskContext; }): Promise { const workspace = await loadAPIWorkspace({ - absolutePathToWorkspace, + absolutePathToWorkspace: absolutePathToAPIDefinition, context: taskContext, cliVersion: "DUMMY", workspaceName: fixture diff --git a/seed/openapi/imdb/custom-overrides/.inputs/config.json b/seed/openapi/imdb/custom-overrides/.inputs/config.json index bda5b7cf80d..eb45a4a77b3 100644 --- a/seed/openapi/imdb/custom-overrides/.inputs/config.json +++ b/seed/openapi/imdb/custom-overrides/.inputs/config.json @@ -13,7 +13,7 @@ } } }, - "workspaceName": "api", + "workspaceName": "imdb", "organization": "seed", "environment": { "type": "local" diff --git a/seed/openapi/imdb/json-format/.inputs/config.json b/seed/openapi/imdb/json-format/.inputs/config.json index 4ee6412abd1..3663a993b49 100644 --- a/seed/openapi/imdb/json-format/.inputs/config.json +++ b/seed/openapi/imdb/json-format/.inputs/config.json @@ -9,7 +9,7 @@ "customConfig": { "format": "json" }, - "workspaceName": "api", + "workspaceName": "imdb", "organization": "seed", "environment": { "type": "local" diff --git a/seed/openapi/imdb/no-custom-config/.inputs/config.json b/seed/openapi/imdb/no-custom-config/.inputs/config.json index b17a96d8a8c..5182727f96a 100644 --- a/seed/openapi/imdb/no-custom-config/.inputs/config.json +++ b/seed/openapi/imdb/no-custom-config/.inputs/config.json @@ -7,7 +7,7 @@ "path": "../" }, "customConfig": null, - "workspaceName": "api", + "workspaceName": "imdb", "organization": "seed", "environment": { "type": "local" From aab965d3d03cfab471b5311a43dcd48472cfe41a Mon Sep 17 00:00:00 2001 From: dsinghvi Date: Sun, 21 Apr 2024 17:10:50 -0400 Subject: [PATCH 06/12] fix --- .../commands/test/test-runner/TestRunner.ts | 149 +++++++++--------- .../basicauth/client.go | 6 + .../client/client.go | 6 + .../.inputs/config.json | 2 +- .../circular-references/.inputs/config.json | 2 +- seed/go-sdk/examples/snippet.json | 2 +- seed/go-sdk/folders/.inputs/config.json | 2 +- seed/go-sdk/imdb/.inputs/config.json | 2 +- seed/go-sdk/optional/.inputs/config.json | 2 +- .../reserved-keywords/.inputs/config.json | 2 +- seed/go-sdk/trace/.inputs/config.json | 19 --- seed/go-sdk/unknown/.inputs/config.json | 2 +- 12 files changed, 91 insertions(+), 105 deletions(-) diff --git a/packages/seed/src/commands/test/test-runner/TestRunner.ts b/packages/seed/src/commands/test/test-runner/TestRunner.ts index 8e3c55eb669..7d3fc7199ad 100644 --- a/packages/seed/src/commands/test/test-runner/TestRunner.ts +++ b/packages/seed/src/commands/test/test-runner/TestRunner.ts @@ -72,7 +72,7 @@ export declare namespace TestRunner { } export abstract class TestRunner { - private built: boolean = false; + private buildInvocation: Promise | undefined; protected readonly generator: GeneratorWorkspace; protected readonly lock: Semaphore; protected readonly taskContextFactory: TaskContextFactory; @@ -98,24 +98,13 @@ export abstract class TestRunner { * Runs the generator. */ public async run({ fixture, configuration }: TestRunner.RunArgs): Promise { - if (!this.built) { - await this.build(); - this.built = true; + if (this.buildInvocation == undefined) { + this.buildInvocation = this.build(); } + await this.buildInvocation; const metrics: TestRunner.TestCaseMetrics = {}; - const fixtureConfig = this.generator.workspaceConfig.fixtures?.[fixture]; - if (fixtureConfig == null) { - return { - type: "failure", - cause: "invalid-fixture", - message: `Fixture ${fixture} not found.`, - id: fixture, - metrics - }; - } - const id = configuration != null ? `${fixture}:${configuration.outputFolder}` : `${fixture}`; const absolutePathToAPIDefinition = AbsoluteFilePath.of( path.join(__dirname, FERN_DIRECTORY, APIS_DIRECTORY, fixture) @@ -138,76 +127,80 @@ export abstract class TestRunner { } taskContext.logger.debug("Acquiring lock..."); - await this.lock.acquire(); - taskContext.logger.info("Running generator..."); try { - const generationStopwatch = new Stopwatch(); - generationStopwatch.start(); - await this.runGenerator({ - id, - fernWorkspace, - absolutePathToWorkspace: this.generator.absolutePathToWorkspace, - irVersion: this.generator.workspaceConfig.irVersion, - outputVersion: configuration?.outputVersion, - language: this.generator.workspaceConfig.language, - selectAudiences: configuration?.audiences, - fixture, - customConfig: configuration?.customConfig, - publishConfig: configuration?.publishConfig ?? undefined, - taskContext, - outputDir: - configuration == null - ? join(this.generator.absolutePathToWorkspace, RelativeFilePath.of(fixture)) - : join( - this.generator.absolutePathToWorkspace, - RelativeFilePath.of(fixture), - RelativeFilePath.of(configuration.outputFolder) - ), - outputMode: configuration?.outputMode ?? this.generator.workspaceConfig.defaultOutputMode, - outputFolder, - keepDocker: this.keepDocker, - publishMetadata: configuration?.publishMetadata ?? undefined - }); - generationStopwatch.stop(); - metrics.generationTime = generationStopwatch.duration(); - } catch (error) { - return { - type: "failure", - cause: "generation", - id: fixture, - metrics - }; - } - - if (this.skipScripts) { + await this.lock.acquire(); + taskContext.logger.info("Running generator..."); + try { + const generationStopwatch = new Stopwatch(); + generationStopwatch.start(); + await this.runGenerator({ + id, + fernWorkspace, + absolutePathToWorkspace: this.generator.absolutePathToWorkspace, + irVersion: this.generator.workspaceConfig.irVersion, + outputVersion: configuration?.outputVersion, + language: this.generator.workspaceConfig.language, + selectAudiences: configuration?.audiences, + fixture, + customConfig: configuration?.customConfig, + publishConfig: configuration?.publishConfig ?? undefined, + taskContext, + outputDir: + configuration == null + ? join(this.generator.absolutePathToWorkspace, RelativeFilePath.of(fixture)) + : join( + this.generator.absolutePathToWorkspace, + RelativeFilePath.of(fixture), + RelativeFilePath.of(configuration.outputFolder) + ), + outputMode: configuration?.outputMode ?? this.generator.workspaceConfig.defaultOutputMode, + outputFolder, + keepDocker: this.keepDocker, + publishMetadata: configuration?.publishMetadata ?? undefined + }); + generationStopwatch.stop(); + metrics.generationTime = generationStopwatch.duration(); + } catch (error) { + return { + type: "failure", + cause: "generation", + id: fixture, + metrics + }; + } + + if (this.skipScripts) { + return { + type: "success", + id: fixture, + metrics + }; + } + + const scriptStopwatch = new Stopwatch(); + scriptStopwatch.start(); + + const scriptResponse = await this.scriptRunner.run({ taskContext, fixture, outputFolder }); + + scriptStopwatch.stop(); + metrics.compileTime = scriptStopwatch.duration(); + + if (scriptResponse.type === "failure") { + return { + type: "failure", + cause: "compile", + id: fixture, + metrics + }; + } return { type: "success", id: fixture, metrics }; + } finally { + this.lock.release(); } - - const scriptStopwatch = new Stopwatch(); - scriptStopwatch.start(); - - const scriptResponse = await this.scriptRunner.run({ taskContext, fixture, outputFolder }); - - scriptStopwatch.stop(); - metrics.compileTime = scriptStopwatch.duration(); - - if (scriptResponse.type === "failure") { - return { - type: "failure", - cause: "compile", - id: fixture, - metrics - }; - } - return { - type: "success", - id: fixture, - metrics - }; } /** diff --git a/seed/go-sdk/basic-auth-environment-variables/basicauth/client.go b/seed/go-sdk/basic-auth-environment-variables/basicauth/client.go index 062c72fac6b..c56a9f0952a 100644 --- a/seed/go-sdk/basic-auth-environment-variables/basicauth/client.go +++ b/seed/go-sdk/basic-auth-environment-variables/basicauth/client.go @@ -12,7 +12,10 @@ import ( option "github.com/basic-auth-environment-variables/fern/option" io "io" http "net/http" +<<<<<<< HEAD os "os" +======= +>>>>>>> 925464783 (fix) ) type Client struct { @@ -23,12 +26,15 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) +<<<<<<< HEAD if options.Username == "" { options.Username = os.Getenv("USERNAME") } if options.Password == "" { options.Password = os.Getenv("PASSWORD") } +======= +>>>>>>> 925464783 (fix) return &Client{ baseURL: options.BaseURL, caller: core.NewCaller( diff --git a/seed/go-sdk/basic-auth-environment-variables/client/client.go b/seed/go-sdk/basic-auth-environment-variables/client/client.go index 7db92b53328..6f01cee070e 100644 --- a/seed/go-sdk/basic-auth-environment-variables/client/client.go +++ b/seed/go-sdk/basic-auth-environment-variables/client/client.go @@ -7,7 +7,10 @@ import ( core "github.com/basic-auth-environment-variables/fern/core" option "github.com/basic-auth-environment-variables/fern/option" http "net/http" +<<<<<<< HEAD os "os" +======= +>>>>>>> 925464783 (fix) ) type Client struct { @@ -20,12 +23,15 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) +<<<<<<< HEAD if options.Username == "" { options.Username = os.Getenv("USERNAME") } if options.Password == "" { options.Password = os.Getenv("PASSWORD") } +======= +>>>>>>> 925464783 (fix) return &Client{ baseURL: options.BaseURL, caller: core.NewCaller( diff --git a/seed/go-sdk/circular-references-advanced/.inputs/config.json b/seed/go-sdk/circular-references-advanced/.inputs/config.json index 69e25227331..b06dd99cc6f 100644 --- a/seed/go-sdk/circular-references-advanced/.inputs/config.json +++ b/seed/go-sdk/circular-references-advanced/.inputs/config.json @@ -8,7 +8,7 @@ }, "path": "../" }, - "workspaceName": "api", + "workspaceName": "circular-references-advanced", "organization": "seed", "environment": { "type": "local" diff --git a/seed/go-sdk/circular-references/.inputs/config.json b/seed/go-sdk/circular-references/.inputs/config.json index a6bf0be9736..b08a9d937ab 100644 --- a/seed/go-sdk/circular-references/.inputs/config.json +++ b/seed/go-sdk/circular-references/.inputs/config.json @@ -8,7 +8,7 @@ }, "path": "../" }, - "workspaceName": "api", + "workspaceName": "circular-references", "organization": "seed", "environment": { "type": "local" diff --git a/seed/go-sdk/examples/snippet.json b/seed/go-sdk/examples/snippet.json index 58c2f2ec0f3..d97fbbd4a9c 100644 --- a/seed/go-sdk/examples/snippet.json +++ b/seed/go-sdk/examples/snippet.json @@ -57,7 +57,7 @@ }, "snippet": { "type": "go", - "client": "import (\n\tcontext \"context\"\n\tfern \"github.com/examples/fern\"\n\tfernclient \"github.com/examples/fern/client\"\n\toption \"github.com/examples/fern/option\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n\toption.WithBaseURL(\n\t\tfern.Environments.Production,\n\t),\n)\nresponse, err := client.Service.CreateMovie(\n\tcontext.TODO(),\n\t\u0026fern.Movie{\n\t\tId: \"movie-c06a4ad7\",\n\t\tPrequel: fern.String(\n\t\t\t\"movie-cv9b914f\",\n\t\t),\n\t\tTitle: \"The Boy and the Heron\",\n\t\tFrom: \"Hayao Miyazaki\",\n\t\tRating: 8,\n\t\tTag: \"tag-wf9as23d\",\n\t\tMetadata: map[string]interface{}{\n\t\t\t\"actors\": []interface{}{\n\t\t\t\t\"Christian Bale\",\n\t\t\t\t\"Florence Pugh\",\n\t\t\t\t\"Willem Dafoe\",\n\t\t\t},\n\t\t\t\"releaseDate\": \"2023-12-08\",\n\t\t\t\"ratings\": map[string]interface{}{\n\t\t\t\t\"rottenTomatoes\": 97,\n\t\t\t\t\"imdb\": 7.6,\n\t\t\t},\n\t\t},\n\t},\n)\n" + "client": "import (\n\tcontext \"context\"\n\tfern \"github.com/examples/fern\"\n\tfernclient \"github.com/examples/fern/client\"\n\toption \"github.com/examples/fern/option\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n\toption.WithBaseURL(\n\t\tfern.Environments.Production,\n\t),\n)\nresponse, err := client.Service.CreateMovie(\n\tcontext.TODO(),\n\t\u0026fern.Movie{\n\t\tId: \"movie-c06a4ad7\",\n\t\tPrequel: fern.String(\n\t\t\t\"movie-cv9b914f\",\n\t\t),\n\t\tTitle: \"The Boy and the Heron\",\n\t\tFrom: \"Hayao Miyazaki\",\n\t\tRating: 8,\n\t\tTag: \"tag-wf9as23d\",\n\t\tMetadata: map[string]interface{}{\n\t\t\t\"actors\": []interface{}{\n\t\t\t\t\"Christian Bale\",\n\t\t\t\t\"Florence Pugh\",\n\t\t\t\t\"Willem Dafoe\",\n\t\t\t},\n\t\t\t\"releaseDate\": \"2023-12-08\",\n\t\t\t\"ratings\": map[string]interface{}{\n\t\t\t\t\"imdb\": 7.6,\n\t\t\t\t\"rottenTomatoes\": 97,\n\t\t\t},\n\t\t},\n\t},\n)\n" } }, { diff --git a/seed/go-sdk/folders/.inputs/config.json b/seed/go-sdk/folders/.inputs/config.json index c8500069817..e5de4c2ef54 100644 --- a/seed/go-sdk/folders/.inputs/config.json +++ b/seed/go-sdk/folders/.inputs/config.json @@ -8,7 +8,7 @@ }, "path": "../" }, - "workspaceName": "api", + "workspaceName": "folders", "organization": "seed", "environment": { "type": "local" diff --git a/seed/go-sdk/imdb/.inputs/config.json b/seed/go-sdk/imdb/.inputs/config.json index c0043e64866..47d9ea9972f 100644 --- a/seed/go-sdk/imdb/.inputs/config.json +++ b/seed/go-sdk/imdb/.inputs/config.json @@ -8,7 +8,7 @@ }, "path": "../" }, - "workspaceName": "api", + "workspaceName": "imdb", "organization": "seed", "environment": { "type": "local" diff --git a/seed/go-sdk/optional/.inputs/config.json b/seed/go-sdk/optional/.inputs/config.json index d8877a9f781..7f99e4c900d 100644 --- a/seed/go-sdk/optional/.inputs/config.json +++ b/seed/go-sdk/optional/.inputs/config.json @@ -8,7 +8,7 @@ }, "path": "../" }, - "workspaceName": "objects-with-imports", + "workspaceName": "optional", "organization": "seed", "environment": { "type": "local" diff --git a/seed/go-sdk/reserved-keywords/.inputs/config.json b/seed/go-sdk/reserved-keywords/.inputs/config.json index 33ad83c3cfb..ca80a82f033 100644 --- a/seed/go-sdk/reserved-keywords/.inputs/config.json +++ b/seed/go-sdk/reserved-keywords/.inputs/config.json @@ -8,7 +8,7 @@ }, "path": "../" }, - "workspaceName": "nursery-api", + "workspaceName": "reserved-keywords", "organization": "seed", "environment": { "type": "local" diff --git a/seed/go-sdk/trace/.inputs/config.json b/seed/go-sdk/trace/.inputs/config.json index d54ee0cb1c4..e69de29bb2d 100644 --- a/seed/go-sdk/trace/.inputs/config.json +++ b/seed/go-sdk/trace/.inputs/config.json @@ -1,19 +0,0 @@ -{ - "irFilepath": "./ir.json", - "output": { - "mode": { - "repoUrl": "https://github.com/trace/fern", - "version": "0.0.1", - "type": "github" - }, - "path": "../" - }, - "workspaceName": "trace", - "organization": "seed", - "environment": { - "type": "local" - }, - "dryRun": false, - "whitelabel": false, - "writeUnitTests": true -} \ No newline at end of file diff --git a/seed/go-sdk/unknown/.inputs/config.json b/seed/go-sdk/unknown/.inputs/config.json index fd076bbcd6c..c92e2116f3a 100644 --- a/seed/go-sdk/unknown/.inputs/config.json +++ b/seed/go-sdk/unknown/.inputs/config.json @@ -8,7 +8,7 @@ }, "path": "../" }, - "workspaceName": "unknown-as-any", + "workspaceName": "unknown", "organization": "seed", "environment": { "type": "local" From bc759f78f5ebb367558509298d90c13435e4c7cc Mon Sep 17 00:00:00 2001 From: dsinghvi Date: Sun, 21 Apr 2024 17:44:21 -0400 Subject: [PATCH 07/12] make sure that scripts work --- .../seed/src/commands/test/ScriptRunner.ts | 15 +++++++++------ .../commands/test/test-runner/TestRunner.ts | 19 ++++++++++--------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/packages/seed/src/commands/test/ScriptRunner.ts b/packages/seed/src/commands/test/ScriptRunner.ts index 393dcd8c31e..e77873bae98 100644 --- a/packages/seed/src/commands/test/ScriptRunner.ts +++ b/packages/seed/src/commands/test/ScriptRunner.ts @@ -10,6 +10,7 @@ export declare namespace ScriptRunner { interface RunArgs { taskContext: TaskContext; fixture: string; + outputDir: AbsoluteFilePath; outputFolder: string; } @@ -38,13 +39,13 @@ export class ScriptRunner { constructor(private readonly workspace: GeneratorWorkspace) {} - public async run({ taskContext, fixture }: ScriptRunner.RunArgs): Promise { + public async run({ taskContext, fixture, outputDir }: ScriptRunner.RunArgs): Promise { await this.startContainers(); for (const script of this.scripts) { const result = await this.runScript({ taskContext, containerId: script.containerId, - outputDirectory: this.workspace.absolutePathToWorkspace, + outputDir, script, fixture, outputFolder: "generated" @@ -59,21 +60,24 @@ export class ScriptRunner { private async runScript({ taskContext, containerId, - outputDirectory, + outputDir, script, fixture, outputFolder }: { fixture: string; - outputDirectory: AbsoluteFilePath; + outputDir: AbsoluteFilePath; outputFolder: string; taskContext: TaskContext; containerId: string; script: ScriptConfig; }): Promise { + taskContext.logger.info(`Running script ${script.commands[0] ?? ""} on ${fixture}`); + const workDir = `${fixture}_${outputFolder}`; const scriptFile = await tmp.file(); await writeFile(scriptFile.path, [`cd /${workDir}/generated`, ...script.commands].join("\n")); + // Move scripts and generated files into the container const mkdirCommand = await loggingExeca( taskContext.logger, @@ -108,7 +112,7 @@ export class ScriptRunner { const copyCommand = await loggingExeca( taskContext.logger, "docker", - ["cp", `${outputDirectory}/.`, `${containerId}:/${workDir}/generated/`], + ["cp", `${outputDir}/.`, `${containerId}:/${workDir}/generated/`], { doNotPipeOutput: true, reject: false @@ -131,7 +135,6 @@ export class ScriptRunner { reject: false } ); - if (command.failed) { taskContext.logger.error("Failed to run script. See ouptut below"); taskContext.logger.error(command.stdout); diff --git a/packages/seed/src/commands/test/test-runner/TestRunner.ts b/packages/seed/src/commands/test/test-runner/TestRunner.ts index 7d3fc7199ad..a80ad007d22 100644 --- a/packages/seed/src/commands/test/test-runner/TestRunner.ts +++ b/packages/seed/src/commands/test/test-runner/TestRunner.ts @@ -111,6 +111,14 @@ export abstract class TestRunner { ); const taskContext = this.taskContextFactory.create(`${this.generator.workspaceName}:${id}`); const outputFolder = configuration?.outputFolder ?? fixture; + const outputDir = + configuration == null + ? join(this.generator.absolutePathToWorkspace, RelativeFilePath.of(fixture)) + : join( + this.generator.absolutePathToWorkspace, + RelativeFilePath.of(fixture), + RelativeFilePath.of(configuration.outputFolder) + ); const fernWorkspace = await convertGeneratorWorkspaceToFernWorkspace({ absolutePathToAPIDefinition, taskContext, @@ -145,14 +153,7 @@ export abstract class TestRunner { customConfig: configuration?.customConfig, publishConfig: configuration?.publishConfig ?? undefined, taskContext, - outputDir: - configuration == null - ? join(this.generator.absolutePathToWorkspace, RelativeFilePath.of(fixture)) - : join( - this.generator.absolutePathToWorkspace, - RelativeFilePath.of(fixture), - RelativeFilePath.of(configuration.outputFolder) - ), + outputDir, outputMode: configuration?.outputMode ?? this.generator.workspaceConfig.defaultOutputMode, outputFolder, keepDocker: this.keepDocker, @@ -180,7 +181,7 @@ export abstract class TestRunner { const scriptStopwatch = new Stopwatch(); scriptStopwatch.start(); - const scriptResponse = await this.scriptRunner.run({ taskContext, fixture, outputFolder }); + const scriptResponse = await this.scriptRunner.run({ taskContext, fixture, outputDir, outputFolder }); scriptStopwatch.stop(); metrics.compileTime = scriptStopwatch.duration(); From 34cd5c1d824d1062926d56f3702e55f1a2bfa244 Mon Sep 17 00:00:00 2001 From: dsinghvi Date: Sun, 21 Apr 2024 18:27:41 -0400 Subject: [PATCH 08/12] fix script runner directories and imports --- .../seed/src/commands/test/ScriptRunner.ts | 18 +- .../commands/test/test-runner/TestRunner.ts | 2 +- .../.inputs/config.json | 2 +- .../circular-references/.inputs/config.json | 2 +- seed/go-sdk/folders/.inputs/config.json | 2 +- seed/go-sdk/imdb/.inputs/config.json | 2 +- seed/go-sdk/optional/.inputs/config.json | 2 +- .../reserved-keywords/.inputs/config.json | 2 +- seed/go-sdk/trace/.inputs/config.json | 19 + seed/go-sdk/unknown/.inputs/config.json | 2 +- .../alias/.mock/definition/__package__.yml | 27 + seed/openapi/alias/.mock/definition/api.yml | 1 + seed/openapi/alias/.mock/fern.config.json | 1 + .../audiences/.mock/definition/api.yml | 4 + .../audiences/.mock/definition/commons.yml | 5 + .../.mock/definition/folder-a/service.yml | 20 + .../.mock/definition/folder-b/common.yml | 9 + .../.mock/definition/folder-c/common.yml | 6 + .../audiences/.mock/definition/foo.yml | 42 ++ seed/openapi/audiences/.mock/fern.config.json | 1 + .../.mock/definition/api.yml | 11 + .../.mock/definition/service.yml | 25 + .../.mock/fern.config.json | 1 + .../basic-auth/.mock/definition/api.yml | 4 + .../.mock/definition/basic-auth.yml | 35 ++ .../basic-auth/.mock/definition/errors.yml | 11 + .../openapi/basic-auth/.mock/fern.config.json | 1 + .../.mock/definition/api.yml | 8 + .../.mock/definition/service.yml | 12 + .../.mock/fern.config.json | 1 + seed/openapi/bytes/.mock/definition/api.yml | 1 + .../bytes/.mock/definition/service.yml | 10 + seed/openapi/bytes/.mock/fern.config.json | 1 + .../.mock/definition/__package__.yml | 13 + .../.mock/definition/a.yml | 8 + .../.mock/definition/api.yml | 1 + .../.mock/definition/ast.yml | 23 + .../.mock/fern.config.json | 1 + .../.mock/definition/__package__.yml | 13 + .../.mock/definition/a.yml | 8 + .../.mock/definition/api.yml | 1 + .../.mock/definition/ast.yml | 16 + .../.mock/fern.config.json | 1 + .../code-samples/.mock/definition/api.yml | 3 + .../code-samples/.mock/definition/service.yml | 43 ++ .../code-samples/.mock/fern.config.json | 1 + .../custom-auth/.mock/definition/api.yml | 8 + .../.mock/definition/custom-auth.yml | 30 ++ .../custom-auth/.mock/definition/errors.yml | 11 + .../custom-auth/.mock/fern.config.json | 1 + .../enum/.mock/definition/__package__.yml | 38 ++ seed/openapi/enum/.mock/definition/api.yml | 1 + .../enum/.mock/definition/inlined-request.yml | 24 + .../enum/.mock/definition/path-param.yml | 21 + .../enum/.mock/definition/query-param.yml | 40 ++ seed/openapi/enum/.mock/fern.config.json | 1 + .../error-property/.mock/definition/api.yml | 4 + .../.mock/definition/errors.yml | 9 + .../.mock/definition/property-based-error.yml | 18 + .../error-property/.mock/fern.config.json | 1 + .../examples/.mock/definition/__package__.yml | 13 + .../openapi/examples/.mock/definition/api.yml | 8 + .../.mock/definition/commons/types.yml | 43 ++ .../definition/file/notification/service.yml | 18 + .../.mock/definition/file/service.yml | 37 ++ .../.mock/definition/health/service.yml | 27 + .../examples/.mock/definition/service.yml | 50 ++ .../examples/.mock/definition/types.yml | 272 ++++++++++ seed/openapi/examples/.mock/fern.config.json | 1 + .../exhaustive/.mock/definition/api.yml | 4 + .../.mock/definition/endpoints/container.yml | 48 ++ .../.mock/definition/endpoints/enum.yml | 12 + .../definition/endpoints/http-methods.yml | 43 ++ .../.mock/definition/endpoints/object.yml | 42 ++ .../.mock/definition/endpoints/params.yml | 57 +++ .../.mock/definition/endpoints/primitive.yml | 60 +++ .../.mock/definition/endpoints/union.yml | 12 + .../.mock/definition/general-errors.yml | 9 + .../.mock/definition/inlined-requests.yml | 25 + .../exhaustive/.mock/definition/no-auth.yml | 20 + .../.mock/definition/no-req-body.yml | 16 + .../.mock/definition/req-with-headers.yml | 14 + .../.mock/definition/types/enum.yml | 12 + .../.mock/definition/types/object.yml | 50 ++ .../.mock/definition/types/union.yml | 21 + .../openapi/exhaustive/.mock/fern.config.json | 1 + .../extends/.mock/definition/__package__.yml | 39 ++ seed/openapi/extends/.mock/definition/api.yml | 1 + seed/openapi/extends/.mock/fern.config.json | 1 + .../file-download/.mock/definition/api.yml | 1 + .../.mock/definition/service.yml | 8 + .../file-download/.mock/fern.config.json | 1 + .../file-upload/.mock/definition/api.yml | 1 + .../file-upload/.mock/definition/service.yml | 54 ++ .../file-upload/.mock/fern.config.json | 1 + .../folders/.mock/definition/__package__.yml | 7 + .../.mock/definition/a/b/__package__.yml | 7 + .../.mock/definition/a/c/__package__.yml | 7 + .../folders/.mock/definition/a/d/types.yml | 2 + seed/openapi/folders/.mock/definition/api.yml | 4 + .../.mock/definition/folder/__package__.yml | 7 + .../.mock/definition/folder/service.yml | 17 + seed/openapi/folders/.mock/fern.config.json | 1 + .../.mock/definition/api.yml | 5 + .../.mock/definition/payment.yml | 27 + .../.mock/fern.config.json | 1 + .../imdb/custom-overrides/.inputs/config.json | 2 +- .../custom-overrides/.mock/definition/api.yml | 4 + .../.mock/definition/imdb.yml | 40 ++ .../custom-overrides/.mock/fern.config.json | 1 + .../imdb/json-format/.inputs/config.json | 2 +- .../imdb/json-format/.mock/definition/api.yml | 4 + .../json-format/.mock/definition/imdb.yml | 40 ++ .../imdb/json-format/.mock/fern.config.json | 1 + .../imdb/no-custom-config/.inputs/config.json | 2 +- .../no-custom-config/.mock/definition/api.yml | 4 + .../.mock/definition/imdb.yml | 40 ++ .../no-custom-config/.mock/fern.config.json | 1 + .../literal/.mock/definition/__package__.yml | 10 + seed/openapi/literal/.mock/definition/api.yml | 10 + .../literal/.mock/definition/headers.yml | 36 ++ .../literal/.mock/definition/inlined.yml | 31 ++ .../openapi/literal/.mock/definition/path.yml | 22 + .../literal/.mock/definition/query.yml | 28 ++ .../literal/.mock/definition/reference.yml | 30 ++ seed/openapi/literal/.mock/fern.config.json | 1 + .../mixed-case/.mock/definition/api.yml | 1 + .../mixed-case/.mock/definition/service.yml | 115 +++++ .../openapi/mixed-case/.mock/fern.config.json | 1 + .../.mock/definition/api.yml | 14 + .../.mock/definition/ec2.yml | 16 + .../.mock/definition/s3.yml | 17 + .../.mock/fern.config.json | 1 + .../no-environment/.mock/definition/api.yml | 4 + .../no-environment/.mock/definition/dummy.yml | 11 + .../no-environment/.mock/fern.config.json | 1 + .../object/.mock/definition/__package__.yml | 71 +++ seed/openapi/object/.mock/definition/api.yml | 1 + seed/openapi/object/.mock/fern.config.json | 1 + .../.mock/definition/__package__.yml | 37 ++ .../.mock/definition/api.yml | 1 + .../.mock/definition/commons/metadata.yml | 12 + .../.mock/definition/file.yml | 29 ++ .../.mock/definition/file/directory.yml | 18 + .../.mock/fern.config.json | 1 + .../openapi/optional/.mock/definition/api.yml | 1 + .../optional/.mock/definition/optional.yml | 11 + seed/openapi/optional/.mock/fern.config.json | 1 + .../.mock/definition/__package__.yml | 15 + .../package-yml/.mock/definition/api.yml | 4 + .../package-yml/.mock/definition/service.yml | 13 + .../package-yml/.mock/fern.config.json | 1 + .../plain-text/.mock/definition/api.yml | 1 + .../plain-text/.mock/definition/service.yml | 8 + .../openapi/plain-text/.mock/fern.config.json | 1 + .../query-parameters/.mock/definition/api.yml | 1 + .../.mock/definition/user.yml | 37 ++ .../query-parameters/.mock/fern.config.json | 1 + .../.mock/definition/api.yml | 5 + .../.mock/definition/package.yml | 20 + .../reserved-keywords/.mock/fern.config.json | 1 + .../.mock/definition/__package__.yml | 10 + .../.mock/definition/api.yml | 1 + .../.mock/definition/service.yml | 81 +++ .../response-property/.mock/fern.config.json | 1 + .../.mock/definition/api.yml | 8 + .../.mock/definition/dummy.yml | 11 + .../.mock/fern.config.json | 1 + .../.mock/definition/api.yml | 8 + .../.mock/definition/dummy.yml | 11 + .../.mock/fern.config.json | 1 + seed/openapi/trace/.mock/definition/admin.yml | 93 ++++ seed/openapi/trace/.mock/definition/api.yml | 11 + .../trace/.mock/definition/commons.yml | 131 +++++ .../trace/.mock/definition/homepage.yml | 18 + .../trace/.mock/definition/lang-server.yml | 7 + .../trace/.mock/definition/migration.yml | 25 + .../trace/.mock/definition/playlist.yml | 110 ++++ .../trace/.mock/definition/problem.yml | 115 +++++ .../trace/.mock/definition/submission.yml | 470 ++++++++++++++++++ .../trace/.mock/definition/sysprop.yml | 18 + .../trace/.mock/definition/v2/__package__.yml | 7 + .../trace/.mock/definition/v2/problem.yml | 218 ++++++++ .../trace/.mock/definition/v2/v3/problem.yml | 218 ++++++++ seed/openapi/trace/.mock/fern.config.json | 1 + .../.mock/definition/api.yml | 1 + .../.mock/definition/union.yml | 21 + .../.mock/fern.config.json | 1 + seed/openapi/unions/.mock/definition/api.yml | 1 + .../openapi/unions/.mock/definition/types.yml | 74 +++ .../openapi/unions/.mock/definition/union.yml | 36 ++ seed/openapi/unions/.mock/fern.config.json | 1 + seed/openapi/unknown/.mock/definition/api.yml | 1 + .../unknown/.mock/definition/unknown.yml | 15 + seed/openapi/unknown/.mock/fern.config.json | 1 + .../variables/.mock/definition/api.yml | 4 + .../variables/.mock/definition/service.yml | 9 + seed/openapi/variables/.mock/fern.config.json | 1 + .../websocket/.mock/definition/api.yml | 1 + .../websocket/.mock/definition/realtime.yml | 36 ++ seed/openapi/websocket/.mock/fern.config.json | 1 + .../alias/.mock/definition/__package__.yml | 27 + seed/postman/alias/.mock/definition/api.yml | 1 + seed/postman/alias/.mock/fern.config.json | 1 + .../audiences/.mock/definition/api.yml | 4 + .../audiences/.mock/definition/commons.yml | 5 + .../.mock/definition/folder-a/service.yml | 20 + .../.mock/definition/folder-b/common.yml | 9 + .../.mock/definition/folder-c/common.yml | 6 + .../audiences/.mock/definition/foo.yml | 42 ++ seed/postman/audiences/.mock/fern.config.json | 1 + .../.mock/definition/api.yml | 11 + .../.mock/definition/service.yml | 25 + .../.mock/fern.config.json | 1 + .../basic-auth/.mock/definition/api.yml | 4 + .../.mock/definition/basic-auth.yml | 35 ++ .../basic-auth/.mock/definition/errors.yml | 11 + .../postman/basic-auth/.mock/fern.config.json | 1 + .../.mock/definition/api.yml | 8 + .../.mock/definition/service.yml | 12 + .../.mock/fern.config.json | 1 + seed/postman/bytes/.mock/definition/api.yml | 1 + .../bytes/.mock/definition/service.yml | 10 + seed/postman/bytes/.mock/fern.config.json | 1 + .../.mock/definition/__package__.yml | 13 + .../.mock/definition/a.yml | 8 + .../.mock/definition/api.yml | 1 + .../.mock/definition/ast.yml | 23 + .../.mock/fern.config.json | 1 + .../.mock/definition/__package__.yml | 13 + .../.mock/definition/a.yml | 8 + .../.mock/definition/api.yml | 1 + .../.mock/definition/ast.yml | 16 + .../.mock/fern.config.json | 1 + .../code-samples/.mock/definition/api.yml | 3 + .../code-samples/.mock/definition/service.yml | 43 ++ .../code-samples/.mock/fern.config.json | 1 + .../custom-auth/.mock/definition/api.yml | 8 + .../.mock/definition/custom-auth.yml | 30 ++ .../custom-auth/.mock/definition/errors.yml | 11 + .../custom-auth/.mock/fern.config.json | 1 + .../enum/.mock/definition/__package__.yml | 38 ++ seed/postman/enum/.mock/definition/api.yml | 1 + .../enum/.mock/definition/inlined-request.yml | 24 + .../enum/.mock/definition/path-param.yml | 21 + .../enum/.mock/definition/query-param.yml | 40 ++ seed/postman/enum/.mock/fern.config.json | 1 + .../error-property/.mock/definition/api.yml | 4 + .../.mock/definition/errors.yml | 9 + .../.mock/definition/property-based-error.yml | 18 + .../error-property/.mock/fern.config.json | 1 + .../examples/.mock/definition/__package__.yml | 13 + .../postman/examples/.mock/definition/api.yml | 8 + .../.mock/definition/commons/types.yml | 43 ++ .../definition/file/notification/service.yml | 18 + .../.mock/definition/file/service.yml | 37 ++ .../.mock/definition/health/service.yml | 27 + .../examples/.mock/definition/service.yml | 50 ++ .../examples/.mock/definition/types.yml | 272 ++++++++++ seed/postman/examples/.mock/fern.config.json | 1 + .../exhaustive/.mock/definition/api.yml | 4 + .../.mock/definition/endpoints/container.yml | 48 ++ .../.mock/definition/endpoints/enum.yml | 12 + .../definition/endpoints/http-methods.yml | 43 ++ .../.mock/definition/endpoints/object.yml | 42 ++ .../.mock/definition/endpoints/params.yml | 57 +++ .../.mock/definition/endpoints/primitive.yml | 60 +++ .../.mock/definition/endpoints/union.yml | 12 + .../.mock/definition/general-errors.yml | 9 + .../.mock/definition/inlined-requests.yml | 25 + .../exhaustive/.mock/definition/no-auth.yml | 20 + .../.mock/definition/no-req-body.yml | 16 + .../.mock/definition/req-with-headers.yml | 14 + .../.mock/definition/types/enum.yml | 12 + .../.mock/definition/types/object.yml | 50 ++ .../.mock/definition/types/union.yml | 21 + .../postman/exhaustive/.mock/fern.config.json | 1 + .../extends/.mock/definition/__package__.yml | 39 ++ seed/postman/extends/.mock/definition/api.yml | 1 + seed/postman/extends/.mock/fern.config.json | 1 + .../file-download/.mock/definition/api.yml | 1 + .../.mock/definition/service.yml | 8 + .../file-download/.mock/fern.config.json | 1 + .../file-upload/.mock/definition/api.yml | 1 + .../file-upload/.mock/definition/service.yml | 54 ++ .../file-upload/.mock/fern.config.json | 1 + .../folders/.mock/definition/__package__.yml | 7 + .../.mock/definition/a/b/__package__.yml | 7 + .../.mock/definition/a/c/__package__.yml | 7 + .../folders/.mock/definition/a/d/types.yml | 2 + seed/postman/folders/.mock/definition/api.yml | 4 + .../.mock/definition/folder/__package__.yml | 7 + .../.mock/definition/folder/service.yml | 17 + seed/postman/folders/.mock/fern.config.json | 1 + .../.mock/definition/api.yml | 5 + .../.mock/definition/payment.yml | 27 + .../.mock/fern.config.json | 1 + seed/postman/imdb/.mock/definition/api.yml | 4 + seed/postman/imdb/.mock/definition/imdb.yml | 40 ++ seed/postman/imdb/.mock/fern.config.json | 1 + .../literal/.mock/definition/__package__.yml | 10 + seed/postman/literal/.mock/definition/api.yml | 10 + .../literal/.mock/definition/headers.yml | 36 ++ .../literal/.mock/definition/inlined.yml | 31 ++ .../postman/literal/.mock/definition/path.yml | 22 + .../literal/.mock/definition/query.yml | 28 ++ .../literal/.mock/definition/reference.yml | 30 ++ seed/postman/literal/.mock/fern.config.json | 1 + .../mixed-case/.mock/definition/api.yml | 1 + .../mixed-case/.mock/definition/service.yml | 115 +++++ .../postman/mixed-case/.mock/fern.config.json | 1 + .../.mock/definition/api.yml | 14 + .../.mock/definition/ec2.yml | 16 + .../.mock/definition/s3.yml | 17 + .../.mock/fern.config.json | 1 + .../no-environment/.mock/definition/api.yml | 4 + .../no-environment/.mock/definition/dummy.yml | 11 + .../no-environment/.mock/fern.config.json | 1 + .../object/.mock/definition/__package__.yml | 71 +++ seed/postman/object/.mock/definition/api.yml | 1 + seed/postman/object/.mock/fern.config.json | 1 + .../.mock/definition/__package__.yml | 37 ++ .../.mock/definition/api.yml | 1 + .../.mock/definition/commons/metadata.yml | 12 + .../.mock/definition/file.yml | 29 ++ .../.mock/definition/file/directory.yml | 18 + .../.mock/fern.config.json | 1 + .../postman/optional/.mock/definition/api.yml | 1 + .../optional/.mock/definition/optional.yml | 11 + seed/postman/optional/.mock/fern.config.json | 1 + .../.mock/definition/__package__.yml | 15 + .../package-yml/.mock/definition/api.yml | 4 + .../package-yml/.mock/definition/service.yml | 13 + .../package-yml/.mock/fern.config.json | 1 + .../plain-text/.mock/definition/api.yml | 1 + .../plain-text/.mock/definition/service.yml | 8 + .../postman/plain-text/.mock/fern.config.json | 1 + .../query-parameters/.mock/definition/api.yml | 1 + .../.mock/definition/user.yml | 37 ++ .../query-parameters/.mock/fern.config.json | 1 + .../.mock/definition/api.yml | 5 + .../.mock/definition/package.yml | 20 + .../reserved-keywords/.mock/fern.config.json | 1 + .../.mock/definition/__package__.yml | 10 + .../.mock/definition/api.yml | 1 + .../.mock/definition/service.yml | 81 +++ .../response-property/.mock/fern.config.json | 1 + .../.mock/definition/api.yml | 8 + .../.mock/definition/dummy.yml | 11 + .../.mock/fern.config.json | 1 + .../.mock/definition/api.yml | 8 + .../.mock/definition/dummy.yml | 11 + .../.mock/fern.config.json | 1 + seed/postman/trace/.mock/definition/admin.yml | 93 ++++ seed/postman/trace/.mock/definition/api.yml | 11 + .../trace/.mock/definition/commons.yml | 131 +++++ .../trace/.mock/definition/homepage.yml | 18 + .../trace/.mock/definition/lang-server.yml | 7 + .../trace/.mock/definition/migration.yml | 25 + .../trace/.mock/definition/playlist.yml | 110 ++++ .../trace/.mock/definition/problem.yml | 115 +++++ .../trace/.mock/definition/submission.yml | 470 ++++++++++++++++++ .../trace/.mock/definition/sysprop.yml | 18 + .../trace/.mock/definition/v2/__package__.yml | 7 + .../trace/.mock/definition/v2/problem.yml | 218 ++++++++ .../trace/.mock/definition/v2/v3/problem.yml | 218 ++++++++ seed/postman/trace/.mock/fern.config.json | 1 + .../.mock/definition/api.yml | 1 + .../.mock/definition/union.yml | 21 + .../.mock/fern.config.json | 1 + seed/postman/unions/.mock/definition/api.yml | 1 + .../postman/unions/.mock/definition/types.yml | 74 +++ .../postman/unions/.mock/definition/union.yml | 36 ++ seed/postman/unions/.mock/fern.config.json | 1 + seed/postman/unknown/.mock/definition/api.yml | 1 + .../unknown/.mock/definition/unknown.yml | 15 + seed/postman/unknown/.mock/fern.config.json | 1 + .../variables/.mock/definition/api.yml | 4 + .../variables/.mock/definition/service.yml | 9 + seed/postman/variables/.mock/fern.config.json | 1 + .../websocket/.mock/definition/api.yml | 1 + .../websocket/.mock/definition/realtime.yml | 36 ++ seed/postman/websocket/.mock/fern.config.json | 1 + seed/python-sdk/websocket/.inputs/config.json | 17 +- .../server-sent-events/.inputs/ir.json | 75 ++- seed/ts-express/streaming/.inputs/ir.json | 12 +- 386 files changed, 8510 insertions(+), 39 deletions(-) create mode 100644 seed/openapi/alias/.mock/definition/__package__.yml create mode 100644 seed/openapi/alias/.mock/definition/api.yml create mode 100644 seed/openapi/alias/.mock/fern.config.json create mode 100644 seed/openapi/audiences/.mock/definition/api.yml create mode 100644 seed/openapi/audiences/.mock/definition/commons.yml create mode 100644 seed/openapi/audiences/.mock/definition/folder-a/service.yml create mode 100644 seed/openapi/audiences/.mock/definition/folder-b/common.yml create mode 100644 seed/openapi/audiences/.mock/definition/folder-c/common.yml create mode 100644 seed/openapi/audiences/.mock/definition/foo.yml create mode 100644 seed/openapi/audiences/.mock/fern.config.json create mode 100644 seed/openapi/auth-environment-variables/.mock/definition/api.yml create mode 100644 seed/openapi/auth-environment-variables/.mock/definition/service.yml create mode 100644 seed/openapi/auth-environment-variables/.mock/fern.config.json create mode 100644 seed/openapi/basic-auth/.mock/definition/api.yml create mode 100644 seed/openapi/basic-auth/.mock/definition/basic-auth.yml create mode 100644 seed/openapi/basic-auth/.mock/definition/errors.yml create mode 100644 seed/openapi/basic-auth/.mock/fern.config.json create mode 100644 seed/openapi/bearer-token-environment-variable/.mock/definition/api.yml create mode 100644 seed/openapi/bearer-token-environment-variable/.mock/definition/service.yml create mode 100644 seed/openapi/bearer-token-environment-variable/.mock/fern.config.json create mode 100644 seed/openapi/bytes/.mock/definition/api.yml create mode 100644 seed/openapi/bytes/.mock/definition/service.yml create mode 100644 seed/openapi/bytes/.mock/fern.config.json create mode 100644 seed/openapi/circular-references-advanced/.mock/definition/__package__.yml create mode 100644 seed/openapi/circular-references-advanced/.mock/definition/a.yml create mode 100644 seed/openapi/circular-references-advanced/.mock/definition/api.yml create mode 100644 seed/openapi/circular-references-advanced/.mock/definition/ast.yml create mode 100644 seed/openapi/circular-references-advanced/.mock/fern.config.json create mode 100644 seed/openapi/circular-references/.mock/definition/__package__.yml create mode 100644 seed/openapi/circular-references/.mock/definition/a.yml create mode 100644 seed/openapi/circular-references/.mock/definition/api.yml create mode 100644 seed/openapi/circular-references/.mock/definition/ast.yml create mode 100644 seed/openapi/circular-references/.mock/fern.config.json create mode 100644 seed/openapi/code-samples/.mock/definition/api.yml create mode 100644 seed/openapi/code-samples/.mock/definition/service.yml create mode 100644 seed/openapi/code-samples/.mock/fern.config.json create mode 100644 seed/openapi/custom-auth/.mock/definition/api.yml create mode 100644 seed/openapi/custom-auth/.mock/definition/custom-auth.yml create mode 100644 seed/openapi/custom-auth/.mock/definition/errors.yml create mode 100644 seed/openapi/custom-auth/.mock/fern.config.json create mode 100644 seed/openapi/enum/.mock/definition/__package__.yml create mode 100644 seed/openapi/enum/.mock/definition/api.yml create mode 100644 seed/openapi/enum/.mock/definition/inlined-request.yml create mode 100644 seed/openapi/enum/.mock/definition/path-param.yml create mode 100644 seed/openapi/enum/.mock/definition/query-param.yml create mode 100644 seed/openapi/enum/.mock/fern.config.json create mode 100644 seed/openapi/error-property/.mock/definition/api.yml create mode 100644 seed/openapi/error-property/.mock/definition/errors.yml create mode 100644 seed/openapi/error-property/.mock/definition/property-based-error.yml create mode 100644 seed/openapi/error-property/.mock/fern.config.json create mode 100644 seed/openapi/examples/.mock/definition/__package__.yml create mode 100644 seed/openapi/examples/.mock/definition/api.yml create mode 100644 seed/openapi/examples/.mock/definition/commons/types.yml create mode 100644 seed/openapi/examples/.mock/definition/file/notification/service.yml create mode 100644 seed/openapi/examples/.mock/definition/file/service.yml create mode 100644 seed/openapi/examples/.mock/definition/health/service.yml create mode 100644 seed/openapi/examples/.mock/definition/service.yml create mode 100644 seed/openapi/examples/.mock/definition/types.yml create mode 100644 seed/openapi/examples/.mock/fern.config.json create mode 100644 seed/openapi/exhaustive/.mock/definition/api.yml create mode 100644 seed/openapi/exhaustive/.mock/definition/endpoints/container.yml create mode 100644 seed/openapi/exhaustive/.mock/definition/endpoints/enum.yml create mode 100644 seed/openapi/exhaustive/.mock/definition/endpoints/http-methods.yml create mode 100644 seed/openapi/exhaustive/.mock/definition/endpoints/object.yml create mode 100644 seed/openapi/exhaustive/.mock/definition/endpoints/params.yml create mode 100644 seed/openapi/exhaustive/.mock/definition/endpoints/primitive.yml create mode 100644 seed/openapi/exhaustive/.mock/definition/endpoints/union.yml create mode 100644 seed/openapi/exhaustive/.mock/definition/general-errors.yml create mode 100644 seed/openapi/exhaustive/.mock/definition/inlined-requests.yml create mode 100644 seed/openapi/exhaustive/.mock/definition/no-auth.yml create mode 100644 seed/openapi/exhaustive/.mock/definition/no-req-body.yml create mode 100644 seed/openapi/exhaustive/.mock/definition/req-with-headers.yml create mode 100644 seed/openapi/exhaustive/.mock/definition/types/enum.yml create mode 100644 seed/openapi/exhaustive/.mock/definition/types/object.yml create mode 100644 seed/openapi/exhaustive/.mock/definition/types/union.yml create mode 100644 seed/openapi/exhaustive/.mock/fern.config.json create mode 100644 seed/openapi/extends/.mock/definition/__package__.yml create mode 100644 seed/openapi/extends/.mock/definition/api.yml create mode 100644 seed/openapi/extends/.mock/fern.config.json create mode 100644 seed/openapi/file-download/.mock/definition/api.yml create mode 100644 seed/openapi/file-download/.mock/definition/service.yml create mode 100644 seed/openapi/file-download/.mock/fern.config.json create mode 100644 seed/openapi/file-upload/.mock/definition/api.yml create mode 100644 seed/openapi/file-upload/.mock/definition/service.yml create mode 100644 seed/openapi/file-upload/.mock/fern.config.json create mode 100644 seed/openapi/folders/.mock/definition/__package__.yml create mode 100644 seed/openapi/folders/.mock/definition/a/b/__package__.yml create mode 100644 seed/openapi/folders/.mock/definition/a/c/__package__.yml create mode 100644 seed/openapi/folders/.mock/definition/a/d/types.yml create mode 100644 seed/openapi/folders/.mock/definition/api.yml create mode 100644 seed/openapi/folders/.mock/definition/folder/__package__.yml create mode 100644 seed/openapi/folders/.mock/definition/folder/service.yml create mode 100644 seed/openapi/folders/.mock/fern.config.json create mode 100644 seed/openapi/idempotency-headers/.mock/definition/api.yml create mode 100644 seed/openapi/idempotency-headers/.mock/definition/payment.yml create mode 100644 seed/openapi/idempotency-headers/.mock/fern.config.json create mode 100644 seed/openapi/imdb/custom-overrides/.mock/definition/api.yml create mode 100644 seed/openapi/imdb/custom-overrides/.mock/definition/imdb.yml create mode 100644 seed/openapi/imdb/custom-overrides/.mock/fern.config.json create mode 100644 seed/openapi/imdb/json-format/.mock/definition/api.yml create mode 100644 seed/openapi/imdb/json-format/.mock/definition/imdb.yml create mode 100644 seed/openapi/imdb/json-format/.mock/fern.config.json create mode 100644 seed/openapi/imdb/no-custom-config/.mock/definition/api.yml create mode 100644 seed/openapi/imdb/no-custom-config/.mock/definition/imdb.yml create mode 100644 seed/openapi/imdb/no-custom-config/.mock/fern.config.json create mode 100644 seed/openapi/literal/.mock/definition/__package__.yml create mode 100644 seed/openapi/literal/.mock/definition/api.yml create mode 100644 seed/openapi/literal/.mock/definition/headers.yml create mode 100644 seed/openapi/literal/.mock/definition/inlined.yml create mode 100644 seed/openapi/literal/.mock/definition/path.yml create mode 100644 seed/openapi/literal/.mock/definition/query.yml create mode 100644 seed/openapi/literal/.mock/definition/reference.yml create mode 100644 seed/openapi/literal/.mock/fern.config.json create mode 100644 seed/openapi/mixed-case/.mock/definition/api.yml create mode 100644 seed/openapi/mixed-case/.mock/definition/service.yml create mode 100644 seed/openapi/mixed-case/.mock/fern.config.json create mode 100644 seed/openapi/multi-url-environment/.mock/definition/api.yml create mode 100644 seed/openapi/multi-url-environment/.mock/definition/ec2.yml create mode 100644 seed/openapi/multi-url-environment/.mock/definition/s3.yml create mode 100644 seed/openapi/multi-url-environment/.mock/fern.config.json create mode 100644 seed/openapi/no-environment/.mock/definition/api.yml create mode 100644 seed/openapi/no-environment/.mock/definition/dummy.yml create mode 100644 seed/openapi/no-environment/.mock/fern.config.json create mode 100644 seed/openapi/object/.mock/definition/__package__.yml create mode 100644 seed/openapi/object/.mock/definition/api.yml create mode 100644 seed/openapi/object/.mock/fern.config.json create mode 100644 seed/openapi/objects-with-imports/.mock/definition/__package__.yml create mode 100644 seed/openapi/objects-with-imports/.mock/definition/api.yml create mode 100644 seed/openapi/objects-with-imports/.mock/definition/commons/metadata.yml create mode 100644 seed/openapi/objects-with-imports/.mock/definition/file.yml create mode 100644 seed/openapi/objects-with-imports/.mock/definition/file/directory.yml create mode 100644 seed/openapi/objects-with-imports/.mock/fern.config.json create mode 100644 seed/openapi/optional/.mock/definition/api.yml create mode 100644 seed/openapi/optional/.mock/definition/optional.yml create mode 100644 seed/openapi/optional/.mock/fern.config.json create mode 100644 seed/openapi/package-yml/.mock/definition/__package__.yml create mode 100644 seed/openapi/package-yml/.mock/definition/api.yml create mode 100644 seed/openapi/package-yml/.mock/definition/service.yml create mode 100644 seed/openapi/package-yml/.mock/fern.config.json create mode 100644 seed/openapi/plain-text/.mock/definition/api.yml create mode 100644 seed/openapi/plain-text/.mock/definition/service.yml create mode 100644 seed/openapi/plain-text/.mock/fern.config.json create mode 100644 seed/openapi/query-parameters/.mock/definition/api.yml create mode 100644 seed/openapi/query-parameters/.mock/definition/user.yml create mode 100644 seed/openapi/query-parameters/.mock/fern.config.json create mode 100644 seed/openapi/reserved-keywords/.mock/definition/api.yml create mode 100644 seed/openapi/reserved-keywords/.mock/definition/package.yml create mode 100644 seed/openapi/reserved-keywords/.mock/fern.config.json create mode 100644 seed/openapi/response-property/.mock/definition/__package__.yml create mode 100644 seed/openapi/response-property/.mock/definition/api.yml create mode 100644 seed/openapi/response-property/.mock/definition/service.yml create mode 100644 seed/openapi/response-property/.mock/fern.config.json create mode 100644 seed/openapi/single-url-environment-default/.mock/definition/api.yml create mode 100644 seed/openapi/single-url-environment-default/.mock/definition/dummy.yml create mode 100644 seed/openapi/single-url-environment-default/.mock/fern.config.json create mode 100644 seed/openapi/single-url-environment-no-default/.mock/definition/api.yml create mode 100644 seed/openapi/single-url-environment-no-default/.mock/definition/dummy.yml create mode 100644 seed/openapi/single-url-environment-no-default/.mock/fern.config.json create mode 100644 seed/openapi/trace/.mock/definition/admin.yml create mode 100644 seed/openapi/trace/.mock/definition/api.yml create mode 100644 seed/openapi/trace/.mock/definition/commons.yml create mode 100644 seed/openapi/trace/.mock/definition/homepage.yml create mode 100644 seed/openapi/trace/.mock/definition/lang-server.yml create mode 100644 seed/openapi/trace/.mock/definition/migration.yml create mode 100644 seed/openapi/trace/.mock/definition/playlist.yml create mode 100644 seed/openapi/trace/.mock/definition/problem.yml create mode 100644 seed/openapi/trace/.mock/definition/submission.yml create mode 100644 seed/openapi/trace/.mock/definition/sysprop.yml create mode 100644 seed/openapi/trace/.mock/definition/v2/__package__.yml create mode 100644 seed/openapi/trace/.mock/definition/v2/problem.yml create mode 100644 seed/openapi/trace/.mock/definition/v2/v3/problem.yml create mode 100644 seed/openapi/trace/.mock/fern.config.json create mode 100644 seed/openapi/undiscriminated-unions/.mock/definition/api.yml create mode 100644 seed/openapi/undiscriminated-unions/.mock/definition/union.yml create mode 100644 seed/openapi/undiscriminated-unions/.mock/fern.config.json create mode 100644 seed/openapi/unions/.mock/definition/api.yml create mode 100644 seed/openapi/unions/.mock/definition/types.yml create mode 100644 seed/openapi/unions/.mock/definition/union.yml create mode 100644 seed/openapi/unions/.mock/fern.config.json create mode 100644 seed/openapi/unknown/.mock/definition/api.yml create mode 100644 seed/openapi/unknown/.mock/definition/unknown.yml create mode 100644 seed/openapi/unknown/.mock/fern.config.json create mode 100644 seed/openapi/variables/.mock/definition/api.yml create mode 100644 seed/openapi/variables/.mock/definition/service.yml create mode 100644 seed/openapi/variables/.mock/fern.config.json create mode 100644 seed/openapi/websocket/.mock/definition/api.yml create mode 100644 seed/openapi/websocket/.mock/definition/realtime.yml create mode 100644 seed/openapi/websocket/.mock/fern.config.json create mode 100644 seed/postman/alias/.mock/definition/__package__.yml create mode 100644 seed/postman/alias/.mock/definition/api.yml create mode 100644 seed/postman/alias/.mock/fern.config.json create mode 100644 seed/postman/audiences/.mock/definition/api.yml create mode 100644 seed/postman/audiences/.mock/definition/commons.yml create mode 100644 seed/postman/audiences/.mock/definition/folder-a/service.yml create mode 100644 seed/postman/audiences/.mock/definition/folder-b/common.yml create mode 100644 seed/postman/audiences/.mock/definition/folder-c/common.yml create mode 100644 seed/postman/audiences/.mock/definition/foo.yml create mode 100644 seed/postman/audiences/.mock/fern.config.json create mode 100644 seed/postman/auth-environment-variables/.mock/definition/api.yml create mode 100644 seed/postman/auth-environment-variables/.mock/definition/service.yml create mode 100644 seed/postman/auth-environment-variables/.mock/fern.config.json create mode 100644 seed/postman/basic-auth/.mock/definition/api.yml create mode 100644 seed/postman/basic-auth/.mock/definition/basic-auth.yml create mode 100644 seed/postman/basic-auth/.mock/definition/errors.yml create mode 100644 seed/postman/basic-auth/.mock/fern.config.json create mode 100644 seed/postman/bearer-token-environment-variable/.mock/definition/api.yml create mode 100644 seed/postman/bearer-token-environment-variable/.mock/definition/service.yml create mode 100644 seed/postman/bearer-token-environment-variable/.mock/fern.config.json create mode 100644 seed/postman/bytes/.mock/definition/api.yml create mode 100644 seed/postman/bytes/.mock/definition/service.yml create mode 100644 seed/postman/bytes/.mock/fern.config.json create mode 100644 seed/postman/circular-references-advanced/.mock/definition/__package__.yml create mode 100644 seed/postman/circular-references-advanced/.mock/definition/a.yml create mode 100644 seed/postman/circular-references-advanced/.mock/definition/api.yml create mode 100644 seed/postman/circular-references-advanced/.mock/definition/ast.yml create mode 100644 seed/postman/circular-references-advanced/.mock/fern.config.json create mode 100644 seed/postman/circular-references/.mock/definition/__package__.yml create mode 100644 seed/postman/circular-references/.mock/definition/a.yml create mode 100644 seed/postman/circular-references/.mock/definition/api.yml create mode 100644 seed/postman/circular-references/.mock/definition/ast.yml create mode 100644 seed/postman/circular-references/.mock/fern.config.json create mode 100644 seed/postman/code-samples/.mock/definition/api.yml create mode 100644 seed/postman/code-samples/.mock/definition/service.yml create mode 100644 seed/postman/code-samples/.mock/fern.config.json create mode 100644 seed/postman/custom-auth/.mock/definition/api.yml create mode 100644 seed/postman/custom-auth/.mock/definition/custom-auth.yml create mode 100644 seed/postman/custom-auth/.mock/definition/errors.yml create mode 100644 seed/postman/custom-auth/.mock/fern.config.json create mode 100644 seed/postman/enum/.mock/definition/__package__.yml create mode 100644 seed/postman/enum/.mock/definition/api.yml create mode 100644 seed/postman/enum/.mock/definition/inlined-request.yml create mode 100644 seed/postman/enum/.mock/definition/path-param.yml create mode 100644 seed/postman/enum/.mock/definition/query-param.yml create mode 100644 seed/postman/enum/.mock/fern.config.json create mode 100644 seed/postman/error-property/.mock/definition/api.yml create mode 100644 seed/postman/error-property/.mock/definition/errors.yml create mode 100644 seed/postman/error-property/.mock/definition/property-based-error.yml create mode 100644 seed/postman/error-property/.mock/fern.config.json create mode 100644 seed/postman/examples/.mock/definition/__package__.yml create mode 100644 seed/postman/examples/.mock/definition/api.yml create mode 100644 seed/postman/examples/.mock/definition/commons/types.yml create mode 100644 seed/postman/examples/.mock/definition/file/notification/service.yml create mode 100644 seed/postman/examples/.mock/definition/file/service.yml create mode 100644 seed/postman/examples/.mock/definition/health/service.yml create mode 100644 seed/postman/examples/.mock/definition/service.yml create mode 100644 seed/postman/examples/.mock/definition/types.yml create mode 100644 seed/postman/examples/.mock/fern.config.json create mode 100644 seed/postman/exhaustive/.mock/definition/api.yml create mode 100644 seed/postman/exhaustive/.mock/definition/endpoints/container.yml create mode 100644 seed/postman/exhaustive/.mock/definition/endpoints/enum.yml create mode 100644 seed/postman/exhaustive/.mock/definition/endpoints/http-methods.yml create mode 100644 seed/postman/exhaustive/.mock/definition/endpoints/object.yml create mode 100644 seed/postman/exhaustive/.mock/definition/endpoints/params.yml create mode 100644 seed/postman/exhaustive/.mock/definition/endpoints/primitive.yml create mode 100644 seed/postman/exhaustive/.mock/definition/endpoints/union.yml create mode 100644 seed/postman/exhaustive/.mock/definition/general-errors.yml create mode 100644 seed/postman/exhaustive/.mock/definition/inlined-requests.yml create mode 100644 seed/postman/exhaustive/.mock/definition/no-auth.yml create mode 100644 seed/postman/exhaustive/.mock/definition/no-req-body.yml create mode 100644 seed/postman/exhaustive/.mock/definition/req-with-headers.yml create mode 100644 seed/postman/exhaustive/.mock/definition/types/enum.yml create mode 100644 seed/postman/exhaustive/.mock/definition/types/object.yml create mode 100644 seed/postman/exhaustive/.mock/definition/types/union.yml create mode 100644 seed/postman/exhaustive/.mock/fern.config.json create mode 100644 seed/postman/extends/.mock/definition/__package__.yml create mode 100644 seed/postman/extends/.mock/definition/api.yml create mode 100644 seed/postman/extends/.mock/fern.config.json create mode 100644 seed/postman/file-download/.mock/definition/api.yml create mode 100644 seed/postman/file-download/.mock/definition/service.yml create mode 100644 seed/postman/file-download/.mock/fern.config.json create mode 100644 seed/postman/file-upload/.mock/definition/api.yml create mode 100644 seed/postman/file-upload/.mock/definition/service.yml create mode 100644 seed/postman/file-upload/.mock/fern.config.json create mode 100644 seed/postman/folders/.mock/definition/__package__.yml create mode 100644 seed/postman/folders/.mock/definition/a/b/__package__.yml create mode 100644 seed/postman/folders/.mock/definition/a/c/__package__.yml create mode 100644 seed/postman/folders/.mock/definition/a/d/types.yml create mode 100644 seed/postman/folders/.mock/definition/api.yml create mode 100644 seed/postman/folders/.mock/definition/folder/__package__.yml create mode 100644 seed/postman/folders/.mock/definition/folder/service.yml create mode 100644 seed/postman/folders/.mock/fern.config.json create mode 100644 seed/postman/idempotency-headers/.mock/definition/api.yml create mode 100644 seed/postman/idempotency-headers/.mock/definition/payment.yml create mode 100644 seed/postman/idempotency-headers/.mock/fern.config.json create mode 100644 seed/postman/imdb/.mock/definition/api.yml create mode 100644 seed/postman/imdb/.mock/definition/imdb.yml create mode 100644 seed/postman/imdb/.mock/fern.config.json create mode 100644 seed/postman/literal/.mock/definition/__package__.yml create mode 100644 seed/postman/literal/.mock/definition/api.yml create mode 100644 seed/postman/literal/.mock/definition/headers.yml create mode 100644 seed/postman/literal/.mock/definition/inlined.yml create mode 100644 seed/postman/literal/.mock/definition/path.yml create mode 100644 seed/postman/literal/.mock/definition/query.yml create mode 100644 seed/postman/literal/.mock/definition/reference.yml create mode 100644 seed/postman/literal/.mock/fern.config.json create mode 100644 seed/postman/mixed-case/.mock/definition/api.yml create mode 100644 seed/postman/mixed-case/.mock/definition/service.yml create mode 100644 seed/postman/mixed-case/.mock/fern.config.json create mode 100644 seed/postman/multi-url-environment/.mock/definition/api.yml create mode 100644 seed/postman/multi-url-environment/.mock/definition/ec2.yml create mode 100644 seed/postman/multi-url-environment/.mock/definition/s3.yml create mode 100644 seed/postman/multi-url-environment/.mock/fern.config.json create mode 100644 seed/postman/no-environment/.mock/definition/api.yml create mode 100644 seed/postman/no-environment/.mock/definition/dummy.yml create mode 100644 seed/postman/no-environment/.mock/fern.config.json create mode 100644 seed/postman/object/.mock/definition/__package__.yml create mode 100644 seed/postman/object/.mock/definition/api.yml create mode 100644 seed/postman/object/.mock/fern.config.json create mode 100644 seed/postman/objects-with-imports/.mock/definition/__package__.yml create mode 100644 seed/postman/objects-with-imports/.mock/definition/api.yml create mode 100644 seed/postman/objects-with-imports/.mock/definition/commons/metadata.yml create mode 100644 seed/postman/objects-with-imports/.mock/definition/file.yml create mode 100644 seed/postman/objects-with-imports/.mock/definition/file/directory.yml create mode 100644 seed/postman/objects-with-imports/.mock/fern.config.json create mode 100644 seed/postman/optional/.mock/definition/api.yml create mode 100644 seed/postman/optional/.mock/definition/optional.yml create mode 100644 seed/postman/optional/.mock/fern.config.json create mode 100644 seed/postman/package-yml/.mock/definition/__package__.yml create mode 100644 seed/postman/package-yml/.mock/definition/api.yml create mode 100644 seed/postman/package-yml/.mock/definition/service.yml create mode 100644 seed/postman/package-yml/.mock/fern.config.json create mode 100644 seed/postman/plain-text/.mock/definition/api.yml create mode 100644 seed/postman/plain-text/.mock/definition/service.yml create mode 100644 seed/postman/plain-text/.mock/fern.config.json create mode 100644 seed/postman/query-parameters/.mock/definition/api.yml create mode 100644 seed/postman/query-parameters/.mock/definition/user.yml create mode 100644 seed/postman/query-parameters/.mock/fern.config.json create mode 100644 seed/postman/reserved-keywords/.mock/definition/api.yml create mode 100644 seed/postman/reserved-keywords/.mock/definition/package.yml create mode 100644 seed/postman/reserved-keywords/.mock/fern.config.json create mode 100644 seed/postman/response-property/.mock/definition/__package__.yml create mode 100644 seed/postman/response-property/.mock/definition/api.yml create mode 100644 seed/postman/response-property/.mock/definition/service.yml create mode 100644 seed/postman/response-property/.mock/fern.config.json create mode 100644 seed/postman/single-url-environment-default/.mock/definition/api.yml create mode 100644 seed/postman/single-url-environment-default/.mock/definition/dummy.yml create mode 100644 seed/postman/single-url-environment-default/.mock/fern.config.json create mode 100644 seed/postman/single-url-environment-no-default/.mock/definition/api.yml create mode 100644 seed/postman/single-url-environment-no-default/.mock/definition/dummy.yml create mode 100644 seed/postman/single-url-environment-no-default/.mock/fern.config.json create mode 100644 seed/postman/trace/.mock/definition/admin.yml create mode 100644 seed/postman/trace/.mock/definition/api.yml create mode 100644 seed/postman/trace/.mock/definition/commons.yml create mode 100644 seed/postman/trace/.mock/definition/homepage.yml create mode 100644 seed/postman/trace/.mock/definition/lang-server.yml create mode 100644 seed/postman/trace/.mock/definition/migration.yml create mode 100644 seed/postman/trace/.mock/definition/playlist.yml create mode 100644 seed/postman/trace/.mock/definition/problem.yml create mode 100644 seed/postman/trace/.mock/definition/submission.yml create mode 100644 seed/postman/trace/.mock/definition/sysprop.yml create mode 100644 seed/postman/trace/.mock/definition/v2/__package__.yml create mode 100644 seed/postman/trace/.mock/definition/v2/problem.yml create mode 100644 seed/postman/trace/.mock/definition/v2/v3/problem.yml create mode 100644 seed/postman/trace/.mock/fern.config.json create mode 100644 seed/postman/undiscriminated-unions/.mock/definition/api.yml create mode 100644 seed/postman/undiscriminated-unions/.mock/definition/union.yml create mode 100644 seed/postman/undiscriminated-unions/.mock/fern.config.json create mode 100644 seed/postman/unions/.mock/definition/api.yml create mode 100644 seed/postman/unions/.mock/definition/types.yml create mode 100644 seed/postman/unions/.mock/definition/union.yml create mode 100644 seed/postman/unions/.mock/fern.config.json create mode 100644 seed/postman/unknown/.mock/definition/api.yml create mode 100644 seed/postman/unknown/.mock/definition/unknown.yml create mode 100644 seed/postman/unknown/.mock/fern.config.json create mode 100644 seed/postman/variables/.mock/definition/api.yml create mode 100644 seed/postman/variables/.mock/definition/service.yml create mode 100644 seed/postman/variables/.mock/fern.config.json create mode 100644 seed/postman/websocket/.mock/definition/api.yml create mode 100644 seed/postman/websocket/.mock/definition/realtime.yml create mode 100644 seed/postman/websocket/.mock/fern.config.json diff --git a/packages/seed/src/commands/test/ScriptRunner.ts b/packages/seed/src/commands/test/ScriptRunner.ts index e77873bae98..07845b87471 100644 --- a/packages/seed/src/commands/test/ScriptRunner.ts +++ b/packages/seed/src/commands/test/ScriptRunner.ts @@ -9,9 +9,8 @@ import { GeneratorWorkspace } from "../../loadGeneratorWorkspaces"; export declare namespace ScriptRunner { interface RunArgs { taskContext: TaskContext; - fixture: string; outputDir: AbsoluteFilePath; - outputFolder: string; + id: string; } type RunResponse = ScriptSuccessResponse | ScriptFailureResponse; @@ -39,7 +38,7 @@ export class ScriptRunner { constructor(private readonly workspace: GeneratorWorkspace) {} - public async run({ taskContext, fixture, outputDir }: ScriptRunner.RunArgs): Promise { + public async run({ taskContext, id, outputDir }: ScriptRunner.RunArgs): Promise { await this.startContainers(); for (const script of this.scripts) { const result = await this.runScript({ @@ -47,8 +46,7 @@ export class ScriptRunner { containerId: script.containerId, outputDir, script, - fixture, - outputFolder: "generated" + id, }); if (result.type === "failure") { return result; @@ -62,19 +60,17 @@ export class ScriptRunner { containerId, outputDir, script, - fixture, - outputFolder + id }: { - fixture: string; + id: string; outputDir: AbsoluteFilePath; - outputFolder: string; taskContext: TaskContext; containerId: string; script: ScriptConfig; }): Promise { - taskContext.logger.info(`Running script ${script.commands[0] ?? ""} on ${fixture}`); + taskContext.logger.info(`Running script ${script.commands[0] ?? ""} on ${id}`); - const workDir = `${fixture}_${outputFolder}`; + const workDir = id.replace(":", "_"); const scriptFile = await tmp.file(); await writeFile(scriptFile.path, [`cd /${workDir}/generated`, ...script.commands].join("\n")); diff --git a/packages/seed/src/commands/test/test-runner/TestRunner.ts b/packages/seed/src/commands/test/test-runner/TestRunner.ts index a80ad007d22..94cc4647492 100644 --- a/packages/seed/src/commands/test/test-runner/TestRunner.ts +++ b/packages/seed/src/commands/test/test-runner/TestRunner.ts @@ -181,7 +181,7 @@ export abstract class TestRunner { const scriptStopwatch = new Stopwatch(); scriptStopwatch.start(); - const scriptResponse = await this.scriptRunner.run({ taskContext, fixture, outputDir, outputFolder }); + const scriptResponse = await this.scriptRunner.run({ taskContext, outputDir, id }); scriptStopwatch.stop(); metrics.compileTime = scriptStopwatch.duration(); diff --git a/seed/go-sdk/circular-references-advanced/.inputs/config.json b/seed/go-sdk/circular-references-advanced/.inputs/config.json index b06dd99cc6f..69e25227331 100644 --- a/seed/go-sdk/circular-references-advanced/.inputs/config.json +++ b/seed/go-sdk/circular-references-advanced/.inputs/config.json @@ -8,7 +8,7 @@ }, "path": "../" }, - "workspaceName": "circular-references-advanced", + "workspaceName": "api", "organization": "seed", "environment": { "type": "local" diff --git a/seed/go-sdk/circular-references/.inputs/config.json b/seed/go-sdk/circular-references/.inputs/config.json index b08a9d937ab..a6bf0be9736 100644 --- a/seed/go-sdk/circular-references/.inputs/config.json +++ b/seed/go-sdk/circular-references/.inputs/config.json @@ -8,7 +8,7 @@ }, "path": "../" }, - "workspaceName": "circular-references", + "workspaceName": "api", "organization": "seed", "environment": { "type": "local" diff --git a/seed/go-sdk/folders/.inputs/config.json b/seed/go-sdk/folders/.inputs/config.json index e5de4c2ef54..c8500069817 100644 --- a/seed/go-sdk/folders/.inputs/config.json +++ b/seed/go-sdk/folders/.inputs/config.json @@ -8,7 +8,7 @@ }, "path": "../" }, - "workspaceName": "folders", + "workspaceName": "api", "organization": "seed", "environment": { "type": "local" diff --git a/seed/go-sdk/imdb/.inputs/config.json b/seed/go-sdk/imdb/.inputs/config.json index 47d9ea9972f..c0043e64866 100644 --- a/seed/go-sdk/imdb/.inputs/config.json +++ b/seed/go-sdk/imdb/.inputs/config.json @@ -8,7 +8,7 @@ }, "path": "../" }, - "workspaceName": "imdb", + "workspaceName": "api", "organization": "seed", "environment": { "type": "local" diff --git a/seed/go-sdk/optional/.inputs/config.json b/seed/go-sdk/optional/.inputs/config.json index 7f99e4c900d..d8877a9f781 100644 --- a/seed/go-sdk/optional/.inputs/config.json +++ b/seed/go-sdk/optional/.inputs/config.json @@ -8,7 +8,7 @@ }, "path": "../" }, - "workspaceName": "optional", + "workspaceName": "objects-with-imports", "organization": "seed", "environment": { "type": "local" diff --git a/seed/go-sdk/reserved-keywords/.inputs/config.json b/seed/go-sdk/reserved-keywords/.inputs/config.json index ca80a82f033..33ad83c3cfb 100644 --- a/seed/go-sdk/reserved-keywords/.inputs/config.json +++ b/seed/go-sdk/reserved-keywords/.inputs/config.json @@ -8,7 +8,7 @@ }, "path": "../" }, - "workspaceName": "reserved-keywords", + "workspaceName": "nursery-api", "organization": "seed", "environment": { "type": "local" diff --git a/seed/go-sdk/trace/.inputs/config.json b/seed/go-sdk/trace/.inputs/config.json index e69de29bb2d..d54ee0cb1c4 100644 --- a/seed/go-sdk/trace/.inputs/config.json +++ b/seed/go-sdk/trace/.inputs/config.json @@ -0,0 +1,19 @@ +{ + "irFilepath": "./ir.json", + "output": { + "mode": { + "repoUrl": "https://github.com/trace/fern", + "version": "0.0.1", + "type": "github" + }, + "path": "../" + }, + "workspaceName": "trace", + "organization": "seed", + "environment": { + "type": "local" + }, + "dryRun": false, + "whitelabel": false, + "writeUnitTests": true +} \ No newline at end of file diff --git a/seed/go-sdk/unknown/.inputs/config.json b/seed/go-sdk/unknown/.inputs/config.json index c92e2116f3a..fd076bbcd6c 100644 --- a/seed/go-sdk/unknown/.inputs/config.json +++ b/seed/go-sdk/unknown/.inputs/config.json @@ -8,7 +8,7 @@ }, "path": "../" }, - "workspaceName": "unknown", + "workspaceName": "unknown-as-any", "organization": "seed", "environment": { "type": "local" diff --git a/seed/openapi/alias/.mock/definition/__package__.yml b/seed/openapi/alias/.mock/definition/__package__.yml new file mode 100644 index 00000000000..4776fa6a51f --- /dev/null +++ b/seed/openapi/alias/.mock/definition/__package__.yml @@ -0,0 +1,27 @@ +types: + TypeId: + docs: An alias for type IDs. + type: string + examples: + - name: One + value: type-kaljhv87 + + Type: + docs: A simple type with just a name. + properties: + id: TypeId + name: string + examples: + - name: One + value: + id: type-df89sdg1 + name: foo + + Object: + docs: Object is an alias for a type. + type: Type + examples: + - name: One + value: + id: kljasc85 + name: bar diff --git a/seed/openapi/alias/.mock/definition/api.yml b/seed/openapi/alias/.mock/definition/api.yml new file mode 100644 index 00000000000..6ca90528fe0 --- /dev/null +++ b/seed/openapi/alias/.mock/definition/api.yml @@ -0,0 +1 @@ +name: alias diff --git a/seed/openapi/alias/.mock/fern.config.json b/seed/openapi/alias/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/alias/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/audiences/.mock/definition/api.yml b/seed/openapi/audiences/.mock/definition/api.yml new file mode 100644 index 00000000000..b3c06b39178 --- /dev/null +++ b/seed/openapi/audiences/.mock/definition/api.yml @@ -0,0 +1,4 @@ +name: audiences +display-name: Audiences API +audiences: + - public diff --git a/seed/openapi/audiences/.mock/definition/commons.yml b/seed/openapi/audiences/.mock/definition/commons.yml new file mode 100644 index 00000000000..0cdcfc9fb9b --- /dev/null +++ b/seed/openapi/audiences/.mock/definition/commons.yml @@ -0,0 +1,5 @@ +imports: + commons: commons.yml + +types: + Imported: string diff --git a/seed/openapi/audiences/.mock/definition/folder-a/service.yml b/seed/openapi/audiences/.mock/definition/folder-a/service.yml new file mode 100644 index 00000000000..11d499ee5db --- /dev/null +++ b/seed/openapi/audiences/.mock/definition/folder-a/service.yml @@ -0,0 +1,20 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +imports: + folderBCommons: ../folder-b/common.yml + +service: + auth: false + audiences: + - public + base-path: / + endpoints: + getDirectThread: + path: "" + method: GET + response: Response + +types: + Response: + properties: + foo: optional diff --git a/seed/openapi/audiences/.mock/definition/folder-b/common.yml b/seed/openapi/audiences/.mock/definition/folder-b/common.yml new file mode 100644 index 00000000000..fe77c996c07 --- /dev/null +++ b/seed/openapi/audiences/.mock/definition/folder-b/common.yml @@ -0,0 +1,9 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +imports: + folderCCommons: ../folder-c/common.yml + +types: + Foo: + properties: + foo: optional diff --git a/seed/openapi/audiences/.mock/definition/folder-c/common.yml b/seed/openapi/audiences/.mock/definition/folder-c/common.yml new file mode 100644 index 00000000000..5911f31e57f --- /dev/null +++ b/seed/openapi/audiences/.mock/definition/folder-c/common.yml @@ -0,0 +1,6 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +types: + Foo: + properties: + bar_property: uuid diff --git a/seed/openapi/audiences/.mock/definition/foo.yml b/seed/openapi/audiences/.mock/definition/foo.yml new file mode 100644 index 00000000000..3909327a897 --- /dev/null +++ b/seed/openapi/audiences/.mock/definition/foo.yml @@ -0,0 +1,42 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +imports: + commons: commons.yml + +service: + auth: false + base-path: / + endpoints: + find: + audiences: + - public + path: "" + method: POST + request: + name: FindRequest + query-parameters: + optionalString: OptionalString + body: + properties: + publicProperty: + type: optional + audiences: + - public + privateProperty: optional + response: ImportingType + +types: + ImportingType: + properties: + imported: commons.Imported + OptionalString: optional + + FilteredType: + audiences: + - public + properties: + public_property: + type: optional + audiences: + - public + private_property: integer diff --git a/seed/openapi/audiences/.mock/fern.config.json b/seed/openapi/audiences/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/audiences/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/auth-environment-variables/.mock/definition/api.yml b/seed/openapi/auth-environment-variables/.mock/definition/api.yml new file mode 100644 index 00000000000..2c6038ea261 --- /dev/null +++ b/seed/openapi/auth-environment-variables/.mock/definition/api.yml @@ -0,0 +1,11 @@ +name: auth-environment-variables +auth: APIKey +auth-schemes: + APIKey: + header: X-FERN-API-KEY + type: string + env: FERN_API_KEY +headers: + X-Another-Header: + type: string + env: ANOTHER_ENV_VAR diff --git a/seed/openapi/auth-environment-variables/.mock/definition/service.yml b/seed/openapi/auth-environment-variables/.mock/definition/service.yml new file mode 100644 index 00000000000..9e5d595f4a2 --- /dev/null +++ b/seed/openapi/auth-environment-variables/.mock/definition/service.yml @@ -0,0 +1,25 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +service: + auth: false + base-path: "" + endpoints: + getWithApiKey: + auth: true + docs: GET request with custom api key + path: /apiKey + method: GET + response: string + + getWithHeader: + docs: GET request with custom api key + path: /apiKeyInHeader + method: GET + request: + name: HeaderAuthRequest + headers: + X-Endpoint-Header: + docs: "Specifies the endpoint key." + type: string + env: MY_HEADER_ENV + response: string diff --git a/seed/openapi/auth-environment-variables/.mock/fern.config.json b/seed/openapi/auth-environment-variables/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/auth-environment-variables/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/basic-auth/.mock/definition/api.yml b/seed/openapi/basic-auth/.mock/definition/api.yml new file mode 100644 index 00000000000..2d6df22f2d1 --- /dev/null +++ b/seed/openapi/basic-auth/.mock/definition/api.yml @@ -0,0 +1,4 @@ +name: basic-auth +auth: basic +error-discrimination: + strategy: status-code diff --git a/seed/openapi/basic-auth/.mock/definition/basic-auth.yml b/seed/openapi/basic-auth/.mock/definition/basic-auth.yml new file mode 100644 index 00000000000..8a04bc9f070 --- /dev/null +++ b/seed/openapi/basic-auth/.mock/definition/basic-auth.yml @@ -0,0 +1,35 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +imports: + errors: ./errors.yml + +service: + auth: false + base-path: "" + endpoints: + getWithBasicAuth: + auth: true + docs: GET request with basic auth scheme + path: /basic-auth + method: GET + response: + boolean + # headers: + # WWW-Authenticate: optional # Specifies which auth scheme to use if CustomAuthScheme was not applied + # body: + # success: boolean + errors: + - errors.UnauthorizedRequest + + postWithBasicAuth: + auth: true + docs: POST request with basic auth scheme + path: /basic-auth + method: POST + request: + name: PostWithBasicAuth + body: unknown + response: boolean + errors: + - errors.UnauthorizedRequest + - errors.BadRequest diff --git a/seed/openapi/basic-auth/.mock/definition/errors.yml b/seed/openapi/basic-auth/.mock/definition/errors.yml new file mode 100644 index 00000000000..cdd6a966703 --- /dev/null +++ b/seed/openapi/basic-auth/.mock/definition/errors.yml @@ -0,0 +1,11 @@ +errors: + UnauthorizedRequest: + status-code: 401 + type: UnauthorizedRequestErrorBody + BadRequest: + status-code: 400 + +types: + UnauthorizedRequestErrorBody: + properties: + message: string diff --git a/seed/openapi/basic-auth/.mock/fern.config.json b/seed/openapi/basic-auth/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/basic-auth/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/bearer-token-environment-variable/.mock/definition/api.yml b/seed/openapi/bearer-token-environment-variable/.mock/definition/api.yml new file mode 100644 index 00000000000..819d8807966 --- /dev/null +++ b/seed/openapi/bearer-token-environment-variable/.mock/definition/api.yml @@ -0,0 +1,8 @@ +name: bearer-token-environment-variable +auth: Bearer +auth-schemes: + Bearer: + scheme: bearer + token: + name: apiKey + env: COURIER_API_KEY diff --git a/seed/openapi/bearer-token-environment-variable/.mock/definition/service.yml b/seed/openapi/bearer-token-environment-variable/.mock/definition/service.yml new file mode 100644 index 00000000000..d38a6ca2913 --- /dev/null +++ b/seed/openapi/bearer-token-environment-variable/.mock/definition/service.yml @@ -0,0 +1,12 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +service: + auth: false + base-path: "" + endpoints: + getWithBearerToken: + auth: true + docs: GET request with custom api key + path: /apiKey + method: GET + response: string diff --git a/seed/openapi/bearer-token-environment-variable/.mock/fern.config.json b/seed/openapi/bearer-token-environment-variable/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/bearer-token-environment-variable/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/bytes/.mock/definition/api.yml b/seed/openapi/bytes/.mock/definition/api.yml new file mode 100644 index 00000000000..cdfcf5be4a1 --- /dev/null +++ b/seed/openapi/bytes/.mock/definition/api.yml @@ -0,0 +1 @@ +name: bytes diff --git a/seed/openapi/bytes/.mock/definition/service.yml b/seed/openapi/bytes/.mock/definition/service.yml new file mode 100644 index 00000000000..b0610fa616c --- /dev/null +++ b/seed/openapi/bytes/.mock/definition/service.yml @@ -0,0 +1,10 @@ +service: + auth: false + base-path: "" + endpoints: + upload: + path: /upload-content + method: POST + request: + content-type: "application/octet-stream" + body: bytes diff --git a/seed/openapi/bytes/.mock/fern.config.json b/seed/openapi/bytes/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/bytes/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/circular-references-advanced/.mock/definition/__package__.yml b/seed/openapi/circular-references-advanced/.mock/definition/__package__.yml new file mode 100644 index 00000000000..35979beb883 --- /dev/null +++ b/seed/openapi/circular-references-advanced/.mock/definition/__package__.yml @@ -0,0 +1,13 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +imports: + a: a.yml + +types: + ImportingA: + properties: + a: optional + + RootType: + properties: + s: string diff --git a/seed/openapi/circular-references-advanced/.mock/definition/a.yml b/seed/openapi/circular-references-advanced/.mock/definition/a.yml new file mode 100644 index 00000000000..50553c25d2b --- /dev/null +++ b/seed/openapi/circular-references-advanced/.mock/definition/a.yml @@ -0,0 +1,8 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +imports: + root: __package__.yml + +types: + A: + extends: root.RootType diff --git a/seed/openapi/circular-references-advanced/.mock/definition/api.yml b/seed/openapi/circular-references-advanced/.mock/definition/api.yml new file mode 100644 index 00000000000..9a8ae7d166b --- /dev/null +++ b/seed/openapi/circular-references-advanced/.mock/definition/api.yml @@ -0,0 +1 @@ +name: api diff --git a/seed/openapi/circular-references-advanced/.mock/definition/ast.yml b/seed/openapi/circular-references-advanced/.mock/definition/ast.yml new file mode 100644 index 00000000000..c48c39070df --- /dev/null +++ b/seed/openapi/circular-references-advanced/.mock/definition/ast.yml @@ -0,0 +1,23 @@ +types: + ContainerValue: + union: + list: list + optional: optional + PrimitiveValue: + enum: + - STRING + - NUMBER + ObjectValue: + properties: {} + FieldName: string + FieldValue: + union: + primitive_value: PrimitiveValue + object_value: ObjectValue + container_value: ContainerValue + ObjectFieldValue: + docs: This type allows us to test a circular reference with a union type (see FieldValue). + properties: + name: FieldName + value: FieldValue + diff --git a/seed/openapi/circular-references-advanced/.mock/fern.config.json b/seed/openapi/circular-references-advanced/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/circular-references-advanced/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/circular-references/.mock/definition/__package__.yml b/seed/openapi/circular-references/.mock/definition/__package__.yml new file mode 100644 index 00000000000..35979beb883 --- /dev/null +++ b/seed/openapi/circular-references/.mock/definition/__package__.yml @@ -0,0 +1,13 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +imports: + a: a.yml + +types: + ImportingA: + properties: + a: optional + + RootType: + properties: + s: string diff --git a/seed/openapi/circular-references/.mock/definition/a.yml b/seed/openapi/circular-references/.mock/definition/a.yml new file mode 100644 index 00000000000..50553c25d2b --- /dev/null +++ b/seed/openapi/circular-references/.mock/definition/a.yml @@ -0,0 +1,8 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +imports: + root: __package__.yml + +types: + A: + extends: root.RootType diff --git a/seed/openapi/circular-references/.mock/definition/api.yml b/seed/openapi/circular-references/.mock/definition/api.yml new file mode 100644 index 00000000000..9a8ae7d166b --- /dev/null +++ b/seed/openapi/circular-references/.mock/definition/api.yml @@ -0,0 +1 @@ +name: api diff --git a/seed/openapi/circular-references/.mock/definition/ast.yml b/seed/openapi/circular-references/.mock/definition/ast.yml new file mode 100644 index 00000000000..b6711dc9d68 --- /dev/null +++ b/seed/openapi/circular-references/.mock/definition/ast.yml @@ -0,0 +1,16 @@ +types: + FieldValue: + union: + primitive_value: PrimitiveValue + object_value: ObjectValue + container_value: ContainerValue + ContainerValue: + union: + list: list + optional: optional + PrimitiveValue: + enum: + - STRING + - NUMBER + ObjectValue: + properties: {} diff --git a/seed/openapi/circular-references/.mock/fern.config.json b/seed/openapi/circular-references/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/circular-references/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/code-samples/.mock/definition/api.yml b/seed/openapi/code-samples/.mock/definition/api.yml new file mode 100644 index 00000000000..be7bbb0492a --- /dev/null +++ b/seed/openapi/code-samples/.mock/definition/api.yml @@ -0,0 +1,3 @@ +name: code-samples +error-discrimination: + strategy: status-code diff --git a/seed/openapi/code-samples/.mock/definition/service.yml b/seed/openapi/code-samples/.mock/definition/service.yml new file mode 100644 index 00000000000..a411feebe13 --- /dev/null +++ b/seed/openapi/code-samples/.mock/definition/service.yml @@ -0,0 +1,43 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +types: + MyResponse: + properties: + id: string + name: optional + +service: + auth: false + base-path: "" + endpoints: + hello: + path: /hello + method: POST + request: + name: MyRequest + body: + properties: + num_events: integer + response: + type: MyResponse + examples: + - request: + num_events: 5 + response: + body: + id: "123" + name: "hello" + code-samples: + - name: curl + sdk: curl + code: | + curl -X POST "http://localhost:8080/hello" + -H "Content-Type: application/json" + -d '{"num_events": 5}' + - name: python + sdk: python + code: | + import requests + response = requests.post("http://localhost:8080/hello", json={"num_events": 5}) + print(response.json()) + diff --git a/seed/openapi/code-samples/.mock/fern.config.json b/seed/openapi/code-samples/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/code-samples/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/custom-auth/.mock/definition/api.yml b/seed/openapi/custom-auth/.mock/definition/api.yml new file mode 100644 index 00000000000..1d61eeff283 --- /dev/null +++ b/seed/openapi/custom-auth/.mock/definition/api.yml @@ -0,0 +1,8 @@ +name: custom-auth +auth: CustomAuthScheme +auth-schemes: + CustomAuthScheme: + header: X-API-KEY + type: string +error-discrimination: + strategy: status-code diff --git a/seed/openapi/custom-auth/.mock/definition/custom-auth.yml b/seed/openapi/custom-auth/.mock/definition/custom-auth.yml new file mode 100644 index 00000000000..de23674da02 --- /dev/null +++ b/seed/openapi/custom-auth/.mock/definition/custom-auth.yml @@ -0,0 +1,30 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +imports: + errors: ./errors.yml + +service: + auth: false + base-path: "" + endpoints: + getWithCustomAuth: + auth: true + docs: GET request with custom auth scheme + path: /custom-auth + method: GET + response: boolean + errors: + - errors.UnauthorizedRequest + + postWithCustomAuth: + auth: true + docs: POST request with custom auth scheme + path: /custom-auth + method: POST + request: + name: PostWithCustomAuth + body: unknown + response: boolean + errors: + - errors.UnauthorizedRequest + - errors.BadRequest diff --git a/seed/openapi/custom-auth/.mock/definition/errors.yml b/seed/openapi/custom-auth/.mock/definition/errors.yml new file mode 100644 index 00000000000..cdd6a966703 --- /dev/null +++ b/seed/openapi/custom-auth/.mock/definition/errors.yml @@ -0,0 +1,11 @@ +errors: + UnauthorizedRequest: + status-code: 401 + type: UnauthorizedRequestErrorBody + BadRequest: + status-code: 400 + +types: + UnauthorizedRequestErrorBody: + properties: + message: string diff --git a/seed/openapi/custom-auth/.mock/fern.config.json b/seed/openapi/custom-auth/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/custom-auth/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/enum/.mock/definition/__package__.yml b/seed/openapi/enum/.mock/definition/__package__.yml new file mode 100644 index 00000000000..a72e076f94d --- /dev/null +++ b/seed/openapi/enum/.mock/definition/__package__.yml @@ -0,0 +1,38 @@ +types: + Operand: + docs: | + Tests enum name and value can be + different. + enum: + - value: ">" + name: GREATER_THAN + - value: "=" + name: EQUAL_TO + - value: "less_than" + docs: | + The name and value should be similar + are similar for less than. + examples: + - name: GreaterThan + value: ">" + - name: LessThan + value: "less_than" + + Color: + enum: + - value: "red" + name: RED + - value: "blue" + name: BLUE + examples: + - name: Red + value: "red" + + ColorOrOperand: + discriminated: false + union: + - Color + - Operand + examples: + - name: Red + value: "red" diff --git a/seed/openapi/enum/.mock/definition/api.yml b/seed/openapi/enum/.mock/definition/api.yml new file mode 100644 index 00000000000..3e2ce7d17a8 --- /dev/null +++ b/seed/openapi/enum/.mock/definition/api.yml @@ -0,0 +1 @@ +name: enum diff --git a/seed/openapi/enum/.mock/definition/inlined-request.yml b/seed/openapi/enum/.mock/definition/inlined-request.yml new file mode 100644 index 00000000000..f17deabdaaf --- /dev/null +++ b/seed/openapi/enum/.mock/definition/inlined-request.yml @@ -0,0 +1,24 @@ +imports: + root: __package__.yml + +service: + auth: false + base-path: "" + endpoints: + send: + path: /inlined + method: POST + request: + name: SendEnumInlinedRequest + body: + properties: + operand: + type: root.Operand + maybeOperand: optional + operandOrColor: root.ColorOrOperand + maybeOperandOrColor: optional + examples: + - request: + operand: $root.Operand.GreaterThan + operandOrColor: $root.ColorOrOperand.Red + \ No newline at end of file diff --git a/seed/openapi/enum/.mock/definition/path-param.yml b/seed/openapi/enum/.mock/definition/path-param.yml new file mode 100644 index 00000000000..7553551fdc2 --- /dev/null +++ b/seed/openapi/enum/.mock/definition/path-param.yml @@ -0,0 +1,21 @@ +imports: + root: __package__.yml + +service: + auth: false + base-path: "" + endpoints: + send: + path: /path/{operand}/{maybeOperand}/{operandOrColor}/{maybeOperandOrColor} + method: POST + path-parameters: + operand: root.Operand + maybeOperand: optional + operandOrColor: root.ColorOrOperand + maybeOperandOrColor: optional + examples: + - path-parameters: + operand: $root.Operand.GreaterThan + maybeOperand: $root.Operand.LessThan + operandOrColor: $root.ColorOrOperand.Red + maybeOperandOrColor: $root.ColorOrOperand.Red \ No newline at end of file diff --git a/seed/openapi/enum/.mock/definition/query-param.yml b/seed/openapi/enum/.mock/definition/query-param.yml new file mode 100644 index 00000000000..2b3724eba7e --- /dev/null +++ b/seed/openapi/enum/.mock/definition/query-param.yml @@ -0,0 +1,40 @@ +imports: + root: __package__.yml + +service: + auth: false + base-path: "" + endpoints: + send: + path: /query + method: POST + request: + name: SendEnumAsQueryParamRequest + query-parameters: + operand: root.Operand + maybeOperand: optional + operandOrColor: root.ColorOrOperand + maybeOperandOrColor: optional + examples: + - query-parameters: + operand: $root.Operand.GreaterThan + operandOrColor: $root.ColorOrOperand.Red + + sendList: + path: /query-list + method: POST + request: + name: SendEnumListAsQueryParamRequest + query-parameters: + operand: + type: root.Operand + allow-multiple: true + maybeOperand: + type: optional + allow-multiple: true + operandOrColor: + type: root.ColorOrOperand + allow-multiple: true + maybeOperandOrColor: + type: optional + allow-multiple: true diff --git a/seed/openapi/enum/.mock/fern.config.json b/seed/openapi/enum/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/enum/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/error-property/.mock/definition/api.yml b/seed/openapi/error-property/.mock/definition/api.yml new file mode 100644 index 00000000000..48a882c38b3 --- /dev/null +++ b/seed/openapi/error-property/.mock/definition/api.yml @@ -0,0 +1,4 @@ +name: error-property +error-discrimination: + strategy: property + property-name: errorName diff --git a/seed/openapi/error-property/.mock/definition/errors.yml b/seed/openapi/error-property/.mock/definition/errors.yml new file mode 100644 index 00000000000..b700adf4582 --- /dev/null +++ b/seed/openapi/error-property/.mock/definition/errors.yml @@ -0,0 +1,9 @@ +errors: + PropertyBasedErrorTest: #returns a JSON object with { ErrorName: PropertyBasedErrorTest, body: {PropertyBasedErrorTestBody}} + status-code: 400 + type: PropertyBasedErrorTestBody + +types: + PropertyBasedErrorTestBody: + properties: + message: string diff --git a/seed/openapi/error-property/.mock/definition/property-based-error.yml b/seed/openapi/error-property/.mock/definition/property-based-error.yml new file mode 100644 index 00000000000..dd93ae75fc0 --- /dev/null +++ b/seed/openapi/error-property/.mock/definition/property-based-error.yml @@ -0,0 +1,18 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +#return an error no matter what for this endpoint so that the errorName can be confirmed + +imports: + errors: ./errors.yml + +service: + auth: false + base-path: "" + endpoints: + ThrowError: + docs: GET request that always throws an error + path: /property-based-error + method: GET + response: string + errors: + - errors.PropertyBasedErrorTest diff --git a/seed/openapi/error-property/.mock/fern.config.json b/seed/openapi/error-property/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/error-property/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/examples/.mock/definition/__package__.yml b/seed/openapi/examples/.mock/definition/__package__.yml new file mode 100644 index 00000000000..4ae5b9fbd63 --- /dev/null +++ b/seed/openapi/examples/.mock/definition/__package__.yml @@ -0,0 +1,13 @@ +service: + auth: false + base-path: / + endpoints: + echo: + method: POST + path: "" + request: string + response: string + examples: + - request: Hello world!\n\nwith\n\tnewlines + response: + body: Hello world!\n\nwith\n\tnewlines diff --git a/seed/openapi/examples/.mock/definition/api.yml b/seed/openapi/examples/.mock/definition/api.yml new file mode 100644 index 00000000000..3f3cb4540de --- /dev/null +++ b/seed/openapi/examples/.mock/definition/api.yml @@ -0,0 +1,8 @@ +name: examples +auth: bearer +error-discrimination: + strategy: status-code +environments: + Production: https://production.com/api + Staging: https://staging.com/api +default-environment: null diff --git a/seed/openapi/examples/.mock/definition/commons/types.yml b/seed/openapi/examples/.mock/definition/commons/types.yml new file mode 100644 index 00000000000..33f95a4ab1b --- /dev/null +++ b/seed/openapi/examples/.mock/definition/commons/types.yml @@ -0,0 +1,43 @@ +types: + Tag: + type: string + examples: + - name: One + value: tag-wf9as23d + + Metadata: + properties: + id: string + data: optional> + jsonString: optional + examples: + - name: One + value: + id: metadata-js8dg24b + data: + foo: bar + baz: qux + jsonString: '{"foo": "bar", "baz": "qux"}' + + EventInfo: + union: + metadata: Metadata + tag: Tag + examples: + - name: Metadata + value: + type: metadata + id: metadata-alskjfg8 + data: + one: two + jsonString: '{"one": "two"}' + + Data: + union: + string: string + base64: base64 + examples: + - name: String + value: + type: string + value: data diff --git a/seed/openapi/examples/.mock/definition/file/notification/service.yml b/seed/openapi/examples/.mock/definition/file/notification/service.yml new file mode 100644 index 00000000000..7f518565dcf --- /dev/null +++ b/seed/openapi/examples/.mock/definition/file/notification/service.yml @@ -0,0 +1,18 @@ +imports: + types: ../../types.yml + +service: + auth: true + base-path: /file/notification/{notificationId} + path-parameters: + notificationId: string + endpoints: + getException: + method: GET + path: "" + response: types.Exception + examples: + - path-parameters: + notificationId: notification-hsy129x + response: + body: $types.Exception.One diff --git a/seed/openapi/examples/.mock/definition/file/service.yml b/seed/openapi/examples/.mock/definition/file/service.yml new file mode 100644 index 00000000000..349d80d6543 --- /dev/null +++ b/seed/openapi/examples/.mock/definition/file/service.yml @@ -0,0 +1,37 @@ +imports: + types: ../types.yml + +types: + Filename: + type: string + examples: + - name: Example0 + value: file.txt + +service: + auth: true + base-path: /file + headers: + X-File-API-Version: string + endpoints: + getFile: + docs: "This endpoint returns a file by its name." + method: GET + path: /{filename} + path-parameters: + filename: + type: string + docs: This is a filename + request: + name: GetFileRequest + response: types.File + errors: + - types.NotFoundError + examples: + - path-parameters: + filename: $Filename.Example0 + headers: + X-File-API-Version: 0.0.2 + response: + error: types.NotFoundError + body: A file with that name was not found! diff --git a/seed/openapi/examples/.mock/definition/health/service.yml b/seed/openapi/examples/.mock/definition/health/service.yml new file mode 100644 index 00000000000..a3827e965ed --- /dev/null +++ b/seed/openapi/examples/.mock/definition/health/service.yml @@ -0,0 +1,27 @@ +imports: + types: ../types.yml + +service: + auth: true + base-path: / + endpoints: + check: + docs: "This endpoint checks the health of a resource." + method: GET + path: /check/{id} + path-parameters: + id: + type: string + docs: The id to check + examples: + - path-parameters: + id: id-2sdx82h + + ping: + docs: "This endpoint checks the health of the service." + method: GET + path: /ping + response: boolean + examples: + - response: + body: true diff --git a/seed/openapi/examples/.mock/definition/service.yml b/seed/openapi/examples/.mock/definition/service.yml new file mode 100644 index 00000000000..0d7c67e4fcb --- /dev/null +++ b/seed/openapi/examples/.mock/definition/service.yml @@ -0,0 +1,50 @@ +imports: + types: types.yml + +service: + auth: false + base-path: / + endpoints: + getMovie: + method: GET + path: /movie/{movieId} + path-parameters: + movieId: types.MovieId + response: types.Movie + examples: + - path-parameters: + movieId: $types.MovieId.One + response: + body: $types.Movie.One + + createMovie: + method: POST + path: /movie + request: types.Movie + response: types.MovieId + examples: + - request: $types.Movie.One + response: + body: $types.MovieId.One + + getMetadata: + method: GET + path: /metadata + request: + name: GetMetadataRequest + query-parameters: + shallow: optional + tag: + type: optional + allow-multiple: true + headers: + X-API-Version: string + response: types.Metadata + examples: + - query-parameters: + shallow: false + tag: development + headers: + X-API-Version: 0.0.1 + response: + body: $types.Metadata.One diff --git a/seed/openapi/examples/.mock/definition/types.yml b/seed/openapi/examples/.mock/definition/types.yml new file mode 100644 index 00000000000..2ccbbdc1e80 --- /dev/null +++ b/seed/openapi/examples/.mock/definition/types.yml @@ -0,0 +1,272 @@ +imports: + commons: commons/types.yml + +errors: + NotFoundError: + status-code: 404 + type: string + +types: + MovieId: + type: string + examples: + - name: One + value: movie-c06a4ad7 + + Movie: + properties: + id: MovieId + prequel: optional + title: string + from: string + rating: + type: double + docs: The rating scale is one to five stars + type: literal<"movie"> + tag: commons.Tag + book: optional + metadata: map + examples: + - name: One + value: + id: $MovieId.One + prequel: "movie-cv9b914f" + title: The Boy and the Heron + from: Hayao Miyazaki + rating: 8.0 + type: movie + tag: $commons.Tag.One + metadata: + actors: + - Christian Bale + - Florence Pugh + - Willem Dafoe + releaseDate: "2023-12-08" + ratings: + rottenTomatoes: 97 + imdb: 7.6 + + CastMember: + discriminated: false + union: + - Actor + - Actress + - StuntDouble + examples: + - name: Example0 + value: + id: actor_123 + name: "Brad Pitt" + - name: Example1 + value: $Actress.Example0 + + Actor: + properties: + name: string + id: string + + Actress: + properties: + name: string + id: string + examples: + - name: Example0 + value: + name: Jennifer Lawrence + id: actor_456 + + StuntDouble: + properties: + name: string + actorOrActressId: string + + ExtendedMovie: + extends: Movie + properties: + cast: list + examples: + - value: + id: movie-sda231x + title: Pulp Fiction + from: Quentin Tarantino + rating: 8.5 + type: movie + tag: tag-12efs9dv + cast: + - John Travolta + - Samuel L. Jackson + - Uma Thurman + - Bruce Willis + metadata: + academyAward: true + releaseDate: "2023-12-08" + ratings: + rottenTomatoes: 97 + imdb: 7.6 + + Moment: + properties: + id: uuid + date: date + datetime: datetime + examples: + - value: + id: 656f12d6-f592-444c-a1d3-a3cfd46d5b39 + date: 1994-01-01 + datetime: 1994-01-01T01:01:01Z + + File: + properties: + name: string + contents: string + examples: + - name: One + value: + name: file.txt + contents: ... + - name: Two + value: + name: another_file.txt + contents: ... + + Directory: + properties: + name: string + files: optional> + directories: optional> + examples: + - name: One + value: + name: root + files: + - $File.One + directories: + - name: tmp + files: + - $File.Two + + Node: + properties: + name: string + nodes: optional> + trees: optional> + examples: + - name: Tree + value: + name: root + nodes: + - $Node.Left + - $Node.Right + trees: + - $Tree.Root + - name: Left + value: + name: left + - name: Right + value: + name: right + + Tree: + properties: + nodes: optional> + examples: + - name: Root + value: + nodes: + - $Node.Left + - $Node.Right + + Metadata: + base-properties: + extra: map + tags: set + union: + html: string + markdown: string + examples: + - name: One + value: + type: html + extra: + version: 0.0.1 + tenancy: test + tags: + - development + - public + value: ... + + Exception: + union: + generic: ExceptionInfo + timeout: {} + examples: + - name: One + value: + type: generic + exceptionType: Unavailable + exceptionMessage: This component is unavailable! + exceptionStacktrace: + + ExceptionInfo: + properties: + exceptionType: string + exceptionMessage: string + exceptionStacktrace: string + examples: + - name: One + value: + exceptionType: Unavailable + exceptionMessage: This component is unavailable! + exceptionStacktrace: + + MigrationStatus: + enum: + - value: RUNNING + docs: The migration is running. + - value: FAILED + docs: The migration failed. + - FINISHED + examples: + - name: Running + value: RUNNING + - name: Failed + value: FAILED + + Migration: + properties: + name: string + status: MigrationStatus + examples: + - value: + name: 001_init + status: $MigrationStatus.Running + + Request: + properties: + request: unknown + examples: + - name: Empty + value: + request: {} + + Response: + properties: + response: unknown + examples: + - name: String + value: + response: "Initializing..." + + Test: + union: + and: boolean + or: boolean + examples: + - name: And + value: + type: and + value: true + - name: Or + value: + type: or + value: true diff --git a/seed/openapi/examples/.mock/fern.config.json b/seed/openapi/examples/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/examples/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/exhaustive/.mock/definition/api.yml b/seed/openapi/exhaustive/.mock/definition/api.yml new file mode 100644 index 00000000000..dd65915538f --- /dev/null +++ b/seed/openapi/exhaustive/.mock/definition/api.yml @@ -0,0 +1,4 @@ +name: exhaustive +auth: bearer +error-discrimination: + strategy: status-code diff --git a/seed/openapi/exhaustive/.mock/definition/endpoints/container.yml b/seed/openapi/exhaustive/.mock/definition/endpoints/container.yml new file mode 100644 index 00000000000..165a039dc65 --- /dev/null +++ b/seed/openapi/exhaustive/.mock/definition/endpoints/container.yml @@ -0,0 +1,48 @@ +imports: + objects: ../types/object.yml + +service: + auth: true + base-path: /container + endpoints: + getAndReturnListOfPrimitives: + path: /list-of-primitives + method: POST + request: list + response: list + + getAndReturnListOfObjects: + path: /list-of-objects + method: POST + request: list + response: list + + getAndReturnSetOfPrimitives: + path: /set-of-primitives + method: POST + request: set + response: set + + getAndReturnSetOfObjects: + path: /set-of-objects + method: POST + request: set + response: set + + getAndReturnMapPrimToPrim: + path: /map-prim-to-prim + method: POST + request: map + response: map + + getAndReturnMapOfPrimToObject: + path: /map-prim-to-object + method: POST + request: map + response: map + + getAndReturnOptional: + path: /opt-objects + method: POST + request: optional + response: optional diff --git a/seed/openapi/exhaustive/.mock/definition/endpoints/enum.yml b/seed/openapi/exhaustive/.mock/definition/endpoints/enum.yml new file mode 100644 index 00000000000..335a0889cc7 --- /dev/null +++ b/seed/openapi/exhaustive/.mock/definition/endpoints/enum.yml @@ -0,0 +1,12 @@ +imports: + enums: ../types/enum.yml + +service: + auth: true + base-path: /enum + endpoints: + getAndReturnEnum: + method: POST + path: "" + request: enums.WeatherReport + response: enums.WeatherReport diff --git a/seed/openapi/exhaustive/.mock/definition/endpoints/http-methods.yml b/seed/openapi/exhaustive/.mock/definition/endpoints/http-methods.yml new file mode 100644 index 00000000000..51a54c0802c --- /dev/null +++ b/seed/openapi/exhaustive/.mock/definition/endpoints/http-methods.yml @@ -0,0 +1,43 @@ +imports: + objects: ../types/object.yml + +service: + auth: true + base-path: /http-methods + + endpoints: + testGet: + method: GET + path: /{id} + path-parameters: + id: string + response: string + + testPost: + method: POST + path: "" + request: objects.ObjectWithRequiredField + response: objects.ObjectWithOptionalField + + testPut: + method: PUT + path: /{id} + path-parameters: + id: string + request: objects.ObjectWithRequiredField + response: objects.ObjectWithOptionalField + + testPatch: + method: PATCH + path: /{id} + path-parameters: + id: string + request: objects.ObjectWithOptionalField + response: objects.ObjectWithOptionalField + + testDelete: + method: DELETE + path: /{id} + path-parameters: + id: string + response: boolean diff --git a/seed/openapi/exhaustive/.mock/definition/endpoints/object.yml b/seed/openapi/exhaustive/.mock/definition/endpoints/object.yml new file mode 100644 index 00000000000..313f08cede4 --- /dev/null +++ b/seed/openapi/exhaustive/.mock/definition/endpoints/object.yml @@ -0,0 +1,42 @@ +imports: + objects: ../types/object.yml + +service: + auth: true + base-path: /object + endpoints: + getAndReturnWithOptionalField: + path: /get-and-return-with-optional-field + method: POST + request: objects.ObjectWithOptionalField + response: objects.ObjectWithOptionalField + + getAndReturnWithRequiredField: + path: /get-and-return-with-required-field + method: POST + request: objects.ObjectWithRequiredField + response: objects.ObjectWithRequiredField + + getAndReturnWithMapOfMap: + path: /get-and-return-with-map-of-map + method: POST + request: objects.ObjectWithMapOfMap + response: objects.ObjectWithMapOfMap + + getAndReturnNestedWithOptionalField: + path: /get-and-return-nested-with-optional-field + method: POST + request: objects.NestedObjectWithOptionalField + response: objects.NestedObjectWithOptionalField + + getAndReturnNestedWithRequiredField: + path: /get-and-return-nested-with-required-field + method: POST + request: objects.NestedObjectWithRequiredField + response: objects.NestedObjectWithRequiredField + + getAndReturnNestedWithRequiredFieldAsList: + path: /get-and-return-nested-with-required-field-list + method: POST + request: list + response: objects.NestedObjectWithRequiredField diff --git a/seed/openapi/exhaustive/.mock/definition/endpoints/params.yml b/seed/openapi/exhaustive/.mock/definition/endpoints/params.yml new file mode 100644 index 00000000000..7766547ad79 --- /dev/null +++ b/seed/openapi/exhaustive/.mock/definition/endpoints/params.yml @@ -0,0 +1,57 @@ +service: + auth: true + base-path: /params + endpoints: + getWithPath: + docs: GET with path param + path: /path/{param} + path-parameters: + param: string + method: GET + response: string + + getWithQuery: + docs: GET with query param + path: "" + method: GET + request: + name: GetWithQuery + query-parameters: + query: string #mandatory for test + number: integer + + getWithAllowMultipleQuery: + docs: GET with multiple of same query param + path: "" + method: GET + request: + name: GetWithMultipleQuery + query-parameters: + query: + type: string + allow-multiple: true + numer: + type: integer + allow-multiple: true + + getWithPathAndQuery: + docs: GET with path and query params + path: /path-query/{param} + path-parameters: + param: string + method: GET + request: + name: GetWithPathAndQuery + query-parameters: + query: string #mandatory for test + + modifyWithPath: + docs: PUT to update with path param + path: /path/{param} + path-parameters: + param: string + method: PUT + request: + name: ModifyResourceAtPath + body: string + response: string diff --git a/seed/openapi/exhaustive/.mock/definition/endpoints/primitive.yml b/seed/openapi/exhaustive/.mock/definition/endpoints/primitive.yml new file mode 100644 index 00000000000..8dd7674164c --- /dev/null +++ b/seed/openapi/exhaustive/.mock/definition/endpoints/primitive.yml @@ -0,0 +1,60 @@ +imports: + objects: ../types/object.yml + +service: + auth: true + base-path: /primitive + endpoints: + getAndReturnString: + path: /string + method: POST + request: string + response: string + + getAndReturnInt: + path: /integer + method: POST + request: integer + response: integer + + getAndReturnLong: + path: /long + method: POST + request: long + response: long + + getAndReturnDouble: + path: /double + method: POST + request: double + response: double + + getAndReturnBool: + path: /boolean + method: POST + request: boolean + response: boolean + + getAndReturnDatetime: + path: /datetime + method: POST + request: datetime + response: datetime + + getAndReturnDate: + path: /date + method: POST + request: date + response: date + + getAndReturnUUID: + path: /uuid + method: POST + request: uuid + response: uuid + + getAndReturnBase64: + path: /base64 + method: POST + request: base64 + response: base64 diff --git a/seed/openapi/exhaustive/.mock/definition/endpoints/union.yml b/seed/openapi/exhaustive/.mock/definition/endpoints/union.yml new file mode 100644 index 00000000000..ce9021160d7 --- /dev/null +++ b/seed/openapi/exhaustive/.mock/definition/endpoints/union.yml @@ -0,0 +1,12 @@ +imports: + unions: ../types/union.yml + +service: + auth: true + base-path: /union + endpoints: + getAndReturnUnion: + method: POST + path: "" + request: unions.Animal + response: unions.Animal diff --git a/seed/openapi/exhaustive/.mock/definition/general-errors.yml b/seed/openapi/exhaustive/.mock/definition/general-errors.yml new file mode 100644 index 00000000000..5fbf9cfc417 --- /dev/null +++ b/seed/openapi/exhaustive/.mock/definition/general-errors.yml @@ -0,0 +1,9 @@ +errors: + BadRequestBody: + status-code: 400 + type: BadObjectRequestInfo + +types: + BadObjectRequestInfo: + properties: + message: string diff --git a/seed/openapi/exhaustive/.mock/definition/inlined-requests.yml b/seed/openapi/exhaustive/.mock/definition/inlined-requests.yml new file mode 100644 index 00000000000..9347fe7e335 --- /dev/null +++ b/seed/openapi/exhaustive/.mock/definition/inlined-requests.yml @@ -0,0 +1,25 @@ +imports: + objects: ./types/object.yml + errors: ./general-errors.yml + +# test req bodies, path params, query params, multiple query params, etc. +# test union and enum as well + +service: + auth: false + base-path: /req-bodies + endpoints: + postWithObjectBodyandResponse: + docs: POST with custom object in request body, response is an object + path: /object + method: POST + request: + name: PostWithObjectBody + body: + properties: + string: string + integer: integer + NestedObject: objects.ObjectWithOptionalField + response: objects.ObjectWithOptionalField + errors: + - errors.BadRequestBody diff --git a/seed/openapi/exhaustive/.mock/definition/no-auth.yml b/seed/openapi/exhaustive/.mock/definition/no-auth.yml new file mode 100644 index 00000000000..e3c33ed7fab --- /dev/null +++ b/seed/openapi/exhaustive/.mock/definition/no-auth.yml @@ -0,0 +1,20 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +imports: + general-errors: ./general-errors.yml + +service: + auth: false + base-path: /no-auth + endpoints: + postWithNoAuth: + auth: false + docs: POST request with no auth + path: "" + method: POST + request: + name: PostWithNoAuth + body: unknown + response: boolean + errors: + - general-errors.BadRequestBody diff --git a/seed/openapi/exhaustive/.mock/definition/no-req-body.yml b/seed/openapi/exhaustive/.mock/definition/no-req-body.yml new file mode 100644 index 00000000000..daffd9a495c --- /dev/null +++ b/seed/openapi/exhaustive/.mock/definition/no-req-body.yml @@ -0,0 +1,16 @@ +imports: + objects: ./types/object.yml + +service: + auth: true + base-path: /no-req-body + endpoints: + getWithNoRequestBody: + path: "" + method: GET + response: objects.ObjectWithOptionalField + + postWithNoRequestBody: + path: "" + method: POST + response: string diff --git a/seed/openapi/exhaustive/.mock/definition/req-with-headers.yml b/seed/openapi/exhaustive/.mock/definition/req-with-headers.yml new file mode 100644 index 00000000000..9e49725782f --- /dev/null +++ b/seed/openapi/exhaustive/.mock/definition/req-with-headers.yml @@ -0,0 +1,14 @@ +service: + base-path: /test-headers + auth: true + headers: + X-TEST-SERVICE-HEADER: string + endpoints: + getWithCustomHeader: + path: /custom-header + method: POST + request: + name: ReqWithHeaders + headers: + X-TEST-ENDPOINT-HEADER: string + body: string diff --git a/seed/openapi/exhaustive/.mock/definition/types/enum.yml b/seed/openapi/exhaustive/.mock/definition/types/enum.yml new file mode 100644 index 00000000000..a90686092e9 --- /dev/null +++ b/seed/openapi/exhaustive/.mock/definition/types/enum.yml @@ -0,0 +1,12 @@ +types: + WeatherReport: + enum: + - SUNNY + - CLOUDY + - RAINING + - SNOWING + +errors: + ErrorWithEnumBody: + status-code: 400 + type: WeatherReport #does this even make sense? the type of the error body would be enum, and it could only be one of the 4 values? diff --git a/seed/openapi/exhaustive/.mock/definition/types/object.yml b/seed/openapi/exhaustive/.mock/definition/types/object.yml new file mode 100644 index 00000000000..b4ac4c13534 --- /dev/null +++ b/seed/openapi/exhaustive/.mock/definition/types/object.yml @@ -0,0 +1,50 @@ +types: + ObjectWithOptionalField: #generic object that supports any type, makes it easier to use when testing + properties: + string: optional + integer: optional + long: optional + double: optional + bool: optional + datetime: optional + date: optional + uuid: optional + base64: optional + list: optional> + set: optional> + map: optional> + + ObjectWithRequiredField: + properties: + string: string + + ObjectWithMapOfMap: + properties: + map: map> + + NestedObjectWithOptionalField: + properties: + string: optional + NestedObject: optional + + NestedObjectWithRequiredField: + properties: + string: string + NestedObject: ObjectWithOptionalField + +errors: + ObjectWithOptionalFieldError: + status-code: 400 + type: ObjectWithOptionalField + + ObjectWithRequiredFieldError: + status-code: 400 + type: ObjectWithRequiredField + + NestedObjectWithOptionalFieldError: + status-code: 400 + type: NestedObjectWithOptionalField + + NestedObjectWithRequiredFieldError: + status-code: 400 + type: NestedObjectWithRequiredField diff --git a/seed/openapi/exhaustive/.mock/definition/types/union.yml b/seed/openapi/exhaustive/.mock/definition/types/union.yml new file mode 100644 index 00000000000..99ce8c75ed0 --- /dev/null +++ b/seed/openapi/exhaustive/.mock/definition/types/union.yml @@ -0,0 +1,21 @@ +types: + Animal: + discriminant: animal + union: + dog: Dog + cat: Cat + + Dog: + properties: + name: string + likesToWoof: boolean + + Cat: + properties: + name: string + likesToMeow: boolean + +errors: + ErrorWithUnionBody: + status-code: 400 + type: Animal #has to send either dog or cat object in error body diff --git a/seed/openapi/exhaustive/.mock/fern.config.json b/seed/openapi/exhaustive/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/exhaustive/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/extends/.mock/definition/__package__.yml b/seed/openapi/extends/.mock/definition/__package__.yml new file mode 100644 index 00000000000..db2aecdbf86 --- /dev/null +++ b/seed/openapi/extends/.mock/definition/__package__.yml @@ -0,0 +1,39 @@ +types: + ExampleType: + extends: Docs + properties: + name: string + examples: + - name: One + value: + docs: This is an example type. + name: Example + + NestedType: + extends: JSON + properties: + name: string + examples: + - name: One + value: + docs: This is an example nested type. + name: NestedExample + raw: '{"nested": "example"}' + + Docs: + properties: + docs: string + examples: + - name: One + value: + docs: Types extend this type to include a docs property. + + JSON: + extends: Docs + properties: + raw: string + examples: + - name: One + value: + docs: Types extend this type to include a docs and json property. + raw: '{"docs": true, "json": true}' diff --git a/seed/openapi/extends/.mock/definition/api.yml b/seed/openapi/extends/.mock/definition/api.yml new file mode 100644 index 00000000000..3d8c3b68e2d --- /dev/null +++ b/seed/openapi/extends/.mock/definition/api.yml @@ -0,0 +1 @@ +name: extends diff --git a/seed/openapi/extends/.mock/fern.config.json b/seed/openapi/extends/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/extends/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/file-download/.mock/definition/api.yml b/seed/openapi/file-download/.mock/definition/api.yml new file mode 100644 index 00000000000..567ec30f014 --- /dev/null +++ b/seed/openapi/file-download/.mock/definition/api.yml @@ -0,0 +1 @@ +name: file-download diff --git a/seed/openapi/file-download/.mock/definition/service.yml b/seed/openapi/file-download/.mock/definition/service.yml new file mode 100644 index 00000000000..0742fce9edb --- /dev/null +++ b/seed/openapi/file-download/.mock/definition/service.yml @@ -0,0 +1,8 @@ +service: + auth: false + base-path: / + endpoints: + downloadFile: + path: "" + method: POST + response: file diff --git a/seed/openapi/file-download/.mock/fern.config.json b/seed/openapi/file-download/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/file-download/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/file-upload/.mock/definition/api.yml b/seed/openapi/file-upload/.mock/definition/api.yml new file mode 100644 index 00000000000..b7f420003fb --- /dev/null +++ b/seed/openapi/file-upload/.mock/definition/api.yml @@ -0,0 +1 @@ +name: file-upload diff --git a/seed/openapi/file-upload/.mock/definition/service.yml b/seed/openapi/file-upload/.mock/definition/service.yml new file mode 100644 index 00000000000..d8741d2235b --- /dev/null +++ b/seed/openapi/file-upload/.mock/definition/service.yml @@ -0,0 +1,54 @@ +service: + auth: false + base-path: / + endpoints: + post: + path: "" + method: POST + request: + name: MyRequest + body: + properties: + maybeString: optional + integer: integer + file: file + fileList: list + maybeFile: optional + maybeFileList: optional> + maybeInteger: optional + optionalListOfStrings: optional> + listOfObjects: list + + justFile: + path: /just-file + method: POST + request: + name: JustFileRequet + body: + properties: + file: file + + justFileWithQueryParams: + path: /just-file-with-query-params + method: POST + request: + name: JustFileWithQueryParamsRequet + query-parameters: + maybeString: optional + integer: integer + maybeInteger: optional + listOfStrings: + type: string + allow-multiple: true + optionalListOfStrings: + type: optional + allow-multiple: true + body: + properties: + file: file + +types: + + MyObject: + properties: + foo: string diff --git a/seed/openapi/file-upload/.mock/fern.config.json b/seed/openapi/file-upload/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/file-upload/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/folders/.mock/definition/__package__.yml b/seed/openapi/folders/.mock/definition/__package__.yml new file mode 100644 index 00000000000..e94d9e8e75a --- /dev/null +++ b/seed/openapi/folders/.mock/definition/__package__.yml @@ -0,0 +1,7 @@ +service: + base-path: / + auth: false + endpoints: + foo: + method: POST + path: "" diff --git a/seed/openapi/folders/.mock/definition/a/b/__package__.yml b/seed/openapi/folders/.mock/definition/a/b/__package__.yml new file mode 100644 index 00000000000..e94d9e8e75a --- /dev/null +++ b/seed/openapi/folders/.mock/definition/a/b/__package__.yml @@ -0,0 +1,7 @@ +service: + base-path: / + auth: false + endpoints: + foo: + method: POST + path: "" diff --git a/seed/openapi/folders/.mock/definition/a/c/__package__.yml b/seed/openapi/folders/.mock/definition/a/c/__package__.yml new file mode 100644 index 00000000000..e94d9e8e75a --- /dev/null +++ b/seed/openapi/folders/.mock/definition/a/c/__package__.yml @@ -0,0 +1,7 @@ +service: + base-path: / + auth: false + endpoints: + foo: + method: POST + path: "" diff --git a/seed/openapi/folders/.mock/definition/a/d/types.yml b/seed/openapi/folders/.mock/definition/a/d/types.yml new file mode 100644 index 00000000000..10d0cf8713d --- /dev/null +++ b/seed/openapi/folders/.mock/definition/a/d/types.yml @@ -0,0 +1,2 @@ +types: + Foo: string diff --git a/seed/openapi/folders/.mock/definition/api.yml b/seed/openapi/folders/.mock/definition/api.yml new file mode 100644 index 00000000000..9888645c477 --- /dev/null +++ b/seed/openapi/folders/.mock/definition/api.yml @@ -0,0 +1,4 @@ +name: api + +error-discrimination: + strategy: status-code diff --git a/seed/openapi/folders/.mock/definition/folder/__package__.yml b/seed/openapi/folders/.mock/definition/folder/__package__.yml new file mode 100644 index 00000000000..e94d9e8e75a --- /dev/null +++ b/seed/openapi/folders/.mock/definition/folder/__package__.yml @@ -0,0 +1,7 @@ +service: + base-path: / + auth: false + endpoints: + foo: + method: POST + path: "" diff --git a/seed/openapi/folders/.mock/definition/folder/service.yml b/seed/openapi/folders/.mock/definition/folder/service.yml new file mode 100644 index 00000000000..8c8a291592d --- /dev/null +++ b/seed/openapi/folders/.mock/definition/folder/service.yml @@ -0,0 +1,17 @@ +service: + base-path: /service + auth: false + endpoints: + endpoint: + method: GET + path: "" + unknownRequest: + method: POST + path: "" + request: unknown + errors: + - NotFoundError +errors: + NotFoundError: + status-code: 404 + type: string diff --git a/seed/openapi/folders/.mock/fern.config.json b/seed/openapi/folders/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/folders/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/idempotency-headers/.mock/definition/api.yml b/seed/openapi/idempotency-headers/.mock/definition/api.yml new file mode 100644 index 00000000000..7fbd5ce078b --- /dev/null +++ b/seed/openapi/idempotency-headers/.mock/definition/api.yml @@ -0,0 +1,5 @@ +name: idempotency-headers +auth: bearer +idempotency-headers: + Idempotency-Key: string + Idempotency-Expiration: integer diff --git a/seed/openapi/idempotency-headers/.mock/definition/payment.yml b/seed/openapi/idempotency-headers/.mock/definition/payment.yml new file mode 100644 index 00000000000..d8eb6950460 --- /dev/null +++ b/seed/openapi/idempotency-headers/.mock/definition/payment.yml @@ -0,0 +1,27 @@ +types: + Currency: + enum: + - USD + - YEN + +service: + auth: true + base-path: /payment + endpoints: + create: + method: POST + path: "" + idempotent: true + request: + name: CreatePaymentRequest + body: + properties: + amount: integer + currency: Currency + response: uuid + + delete: + method: DELETE + path: /{paymentId} + path-parameters: + paymentId: string diff --git a/seed/openapi/idempotency-headers/.mock/fern.config.json b/seed/openapi/idempotency-headers/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/idempotency-headers/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/imdb/custom-overrides/.inputs/config.json b/seed/openapi/imdb/custom-overrides/.inputs/config.json index eb45a4a77b3..bda5b7cf80d 100644 --- a/seed/openapi/imdb/custom-overrides/.inputs/config.json +++ b/seed/openapi/imdb/custom-overrides/.inputs/config.json @@ -13,7 +13,7 @@ } } }, - "workspaceName": "imdb", + "workspaceName": "api", "organization": "seed", "environment": { "type": "local" diff --git a/seed/openapi/imdb/custom-overrides/.mock/definition/api.yml b/seed/openapi/imdb/custom-overrides/.mock/definition/api.yml new file mode 100644 index 00000000000..c437dc0ab29 --- /dev/null +++ b/seed/openapi/imdb/custom-overrides/.mock/definition/api.yml @@ -0,0 +1,4 @@ +name: api +error-discrimination: + strategy: status-code +auth: bearer diff --git a/seed/openapi/imdb/custom-overrides/.mock/definition/imdb.yml b/seed/openapi/imdb/custom-overrides/.mock/definition/imdb.yml new file mode 100644 index 00000000000..beb6df4b7b3 --- /dev/null +++ b/seed/openapi/imdb/custom-overrides/.mock/definition/imdb.yml @@ -0,0 +1,40 @@ +types: + MovieId: string + + Movie: + properties: + id: MovieId + title: string + rating: + type: double + docs: The rating scale is one to five stars + + CreateMovieRequest: + properties: + title: string + rating: double + +service: + auth: false + base-path: /movies + endpoints: + createMovie: + docs: Add a movie to the database + method: POST + path: /create-movie + request: CreateMovieRequest + response: MovieId + + getMovie: + method: GET + path: /{movieId} + path-parameters: + movieId: MovieId + response: Movie + errors: + - MovieDoesNotExistError + +errors: + MovieDoesNotExistError: + status-code: 404 + type: MovieId diff --git a/seed/openapi/imdb/custom-overrides/.mock/fern.config.json b/seed/openapi/imdb/custom-overrides/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/imdb/custom-overrides/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/imdb/json-format/.inputs/config.json b/seed/openapi/imdb/json-format/.inputs/config.json index 3663a993b49..4ee6412abd1 100644 --- a/seed/openapi/imdb/json-format/.inputs/config.json +++ b/seed/openapi/imdb/json-format/.inputs/config.json @@ -9,7 +9,7 @@ "customConfig": { "format": "json" }, - "workspaceName": "imdb", + "workspaceName": "api", "organization": "seed", "environment": { "type": "local" diff --git a/seed/openapi/imdb/json-format/.mock/definition/api.yml b/seed/openapi/imdb/json-format/.mock/definition/api.yml new file mode 100644 index 00000000000..c437dc0ab29 --- /dev/null +++ b/seed/openapi/imdb/json-format/.mock/definition/api.yml @@ -0,0 +1,4 @@ +name: api +error-discrimination: + strategy: status-code +auth: bearer diff --git a/seed/openapi/imdb/json-format/.mock/definition/imdb.yml b/seed/openapi/imdb/json-format/.mock/definition/imdb.yml new file mode 100644 index 00000000000..beb6df4b7b3 --- /dev/null +++ b/seed/openapi/imdb/json-format/.mock/definition/imdb.yml @@ -0,0 +1,40 @@ +types: + MovieId: string + + Movie: + properties: + id: MovieId + title: string + rating: + type: double + docs: The rating scale is one to five stars + + CreateMovieRequest: + properties: + title: string + rating: double + +service: + auth: false + base-path: /movies + endpoints: + createMovie: + docs: Add a movie to the database + method: POST + path: /create-movie + request: CreateMovieRequest + response: MovieId + + getMovie: + method: GET + path: /{movieId} + path-parameters: + movieId: MovieId + response: Movie + errors: + - MovieDoesNotExistError + +errors: + MovieDoesNotExistError: + status-code: 404 + type: MovieId diff --git a/seed/openapi/imdb/json-format/.mock/fern.config.json b/seed/openapi/imdb/json-format/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/imdb/json-format/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/imdb/no-custom-config/.inputs/config.json b/seed/openapi/imdb/no-custom-config/.inputs/config.json index 5182727f96a..b17a96d8a8c 100644 --- a/seed/openapi/imdb/no-custom-config/.inputs/config.json +++ b/seed/openapi/imdb/no-custom-config/.inputs/config.json @@ -7,7 +7,7 @@ "path": "../" }, "customConfig": null, - "workspaceName": "imdb", + "workspaceName": "api", "organization": "seed", "environment": { "type": "local" diff --git a/seed/openapi/imdb/no-custom-config/.mock/definition/api.yml b/seed/openapi/imdb/no-custom-config/.mock/definition/api.yml new file mode 100644 index 00000000000..c437dc0ab29 --- /dev/null +++ b/seed/openapi/imdb/no-custom-config/.mock/definition/api.yml @@ -0,0 +1,4 @@ +name: api +error-discrimination: + strategy: status-code +auth: bearer diff --git a/seed/openapi/imdb/no-custom-config/.mock/definition/imdb.yml b/seed/openapi/imdb/no-custom-config/.mock/definition/imdb.yml new file mode 100644 index 00000000000..beb6df4b7b3 --- /dev/null +++ b/seed/openapi/imdb/no-custom-config/.mock/definition/imdb.yml @@ -0,0 +1,40 @@ +types: + MovieId: string + + Movie: + properties: + id: MovieId + title: string + rating: + type: double + docs: The rating scale is one to five stars + + CreateMovieRequest: + properties: + title: string + rating: double + +service: + auth: false + base-path: /movies + endpoints: + createMovie: + docs: Add a movie to the database + method: POST + path: /create-movie + request: CreateMovieRequest + response: MovieId + + getMovie: + method: GET + path: /{movieId} + path-parameters: + movieId: MovieId + response: Movie + errors: + - MovieDoesNotExistError + +errors: + MovieDoesNotExistError: + status-code: 404 + type: MovieId diff --git a/seed/openapi/imdb/no-custom-config/.mock/fern.config.json b/seed/openapi/imdb/no-custom-config/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/imdb/no-custom-config/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/literal/.mock/definition/__package__.yml b/seed/openapi/literal/.mock/definition/__package__.yml new file mode 100644 index 00000000000..9247629c4d5 --- /dev/null +++ b/seed/openapi/literal/.mock/definition/__package__.yml @@ -0,0 +1,10 @@ +types: + SendResponse: + properties: + message: + type: string + status: + type: integer + success: + type: literal + \ No newline at end of file diff --git a/seed/openapi/literal/.mock/definition/api.yml b/seed/openapi/literal/.mock/definition/api.yml new file mode 100644 index 00000000000..d3b137fcece --- /dev/null +++ b/seed/openapi/literal/.mock/definition/api.yml @@ -0,0 +1,10 @@ +name: literal +docs: | + Test definition for literal schemas. +headers: + X-API-Version: + name: version + type: literal<"02-02-2024"> + X-API-Enable-Audit-Logging: + name: audit_logging + type: literal \ No newline at end of file diff --git a/seed/openapi/literal/.mock/definition/headers.yml b/seed/openapi/literal/.mock/definition/headers.yml new file mode 100644 index 00000000000..1b7e148d61a --- /dev/null +++ b/seed/openapi/literal/.mock/definition/headers.yml @@ -0,0 +1,36 @@ +imports: + root: __package__.yml + +service: + auth: false + base-path: "" + endpoints: + send: + path: /headers + method: POST + request: + name: SendLiteralsInHeadersRequest + headers: + X-Endpoint-Version: + name: endpointVersion + type: literal<"02-12-2024"> + X-Async: + name: async + type: literal + body: + properties: + query: + type: string + response: root.SendResponse + examples: + - headers: + X-Endpoint-Version: "02-12-2024" + X-Async: true + request: + query: "What is the weather today" + response: + body: + message: "The weather is sunny" + status: 200 + success: true + \ No newline at end of file diff --git a/seed/openapi/literal/.mock/definition/inlined.yml b/seed/openapi/literal/.mock/definition/inlined.yml new file mode 100644 index 00000000000..fabd894a7fd --- /dev/null +++ b/seed/openapi/literal/.mock/definition/inlined.yml @@ -0,0 +1,31 @@ +imports: + root: __package__.yml + +service: + auth: false + base-path: "" + endpoints: + send: + path: /inlined + method: POST + request: + name: SendLiteralsInlinedRequest + body: + properties: + prompt: literal<"You are a helpful assistant"> + query: string + temperature: optional + stream: literal + response: root.SendResponse + examples: + - request: + temperature: 10.1 + prompt: "You are a helpful assistant" + stream: false + query: "What is the weather today" + response: + body: + message: "The weather is sunny" + status: 200 + success: true + \ No newline at end of file diff --git a/seed/openapi/literal/.mock/definition/path.yml b/seed/openapi/literal/.mock/definition/path.yml new file mode 100644 index 00000000000..236d8744417 --- /dev/null +++ b/seed/openapi/literal/.mock/definition/path.yml @@ -0,0 +1,22 @@ +imports: + root: __package__.yml + +service: + auth: false + base-path: "" + endpoints: + send: + path: /path/{id} + method: POST + path-parameters: + id: literal<"123"> + response: root.SendResponse + examples: + - path-parameters: + id: "123" + response: + body: + message: "The weather is sunny" + status: 200 + success: true + \ No newline at end of file diff --git a/seed/openapi/literal/.mock/definition/query.yml b/seed/openapi/literal/.mock/definition/query.yml new file mode 100644 index 00000000000..9d6cec5ad8e --- /dev/null +++ b/seed/openapi/literal/.mock/definition/query.yml @@ -0,0 +1,28 @@ +imports: + root: __package__.yml + +service: + auth: false + base-path: "" + endpoints: + send: + path: /query + method: POST + request: + name: SendLiteralsInQueryRequest + query-parameters: + prompt: literal<"You are a helpful assistant"> + query: string + stream: literal + response: root.SendResponse + examples: + - query-parameters: + prompt: "You are a helpful assistant" + stream: false + query: "What is the weather today" + response: + body: + message: "The weather is sunny" + status: 200 + success: true + \ No newline at end of file diff --git a/seed/openapi/literal/.mock/definition/reference.yml b/seed/openapi/literal/.mock/definition/reference.yml new file mode 100644 index 00000000000..c8494da24f0 --- /dev/null +++ b/seed/openapi/literal/.mock/definition/reference.yml @@ -0,0 +1,30 @@ +imports: + root: __package__.yml + +types: + SendRequest: + properties: + prompt: literal<"You are a helpful assistant"> + query: string + stream: literal + +service: + auth: false + base-path: "" + endpoints: + send: + path: /reference + method: POST + request: SendRequest + response: root.SendResponse + examples: + - request: + prompt: "You are a helpful assistant" + stream: false + query: "What is the weather today" + response: + body: + message: "The weather is sunny" + status: 200 + success: true + \ No newline at end of file diff --git a/seed/openapi/literal/.mock/fern.config.json b/seed/openapi/literal/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/literal/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/mixed-case/.mock/definition/api.yml b/seed/openapi/mixed-case/.mock/definition/api.yml new file mode 100644 index 00000000000..cf9d2078f7f --- /dev/null +++ b/seed/openapi/mixed-case/.mock/definition/api.yml @@ -0,0 +1 @@ +name: mixed-case \ No newline at end of file diff --git a/seed/openapi/mixed-case/.mock/definition/service.yml b/seed/openapi/mixed-case/.mock/definition/service.yml new file mode 100644 index 00000000000..5991572a42f --- /dev/null +++ b/seed/openapi/mixed-case/.mock/definition/service.yml @@ -0,0 +1,115 @@ +types: + Organization: + properties: + name: string + examples: + - name: One + value: + name: orgName + + User: + properties: + userName: string + metadata_tags: list + EXTRA_PROPERTIES: map + examples: + - name: One + value: + userName: username + metadata_tags: + - tag1 + - tag2 + EXTRA_PROPERTIES: + foo: bar + baz: qux + + NestedUser: + properties: + Name: string + NestedUser: User + examples: + - name: One + value: + Name: username + NestedUser: + userName: nestedUsername + metadata_tags: + - tag1 + - tag2 + EXTRA_PROPERTIES: + foo: bar + baz: qux + + ResourceStatus: + enum: + - ACTIVE + - INACTIVE + + Resource: + discriminant: + value: resource_type + name: resourceType + base-properties: + status: ResourceStatus + union: + user: User + Organization: Organization + examples: + - value: + resource_type: user + userName: username + metadata_tags: + - tag1 + - tag2 + EXTRA_PROPERTIES: + foo: bar + baz: qux + +service: + base-path: /resource + auth: false + endpoints: + getResource: + path: "/{ResourceID}" + method: GET + path-parameters: + ResourceID: string + response: Resource + examples: + - path-parameters: + ResourceID: "rsc-xyz" + response: + body: + resource_type: user + userName: username + metadata_tags: + - tag1 + - tag2 + EXTRA_PROPERTIES: + foo: bar + baz: qux + + listResources: + path: "" + method: GET + request: + name: ListResourcesRequest + query-parameters: + page_limit: integer + beforeDate: date + response: list + examples: + - name: One + query-parameters: + page_limit: 10 + beforeDate: "2023-01-01" + response: + body: + - resource_type: user + userName: username + metadata_tags: + - tag1 + - tag2 + EXTRA_PROPERTIES: + foo: bar + baz: qux diff --git a/seed/openapi/mixed-case/.mock/fern.config.json b/seed/openapi/mixed-case/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/mixed-case/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/multi-url-environment/.mock/definition/api.yml b/seed/openapi/multi-url-environment/.mock/definition/api.yml new file mode 100644 index 00000000000..f362d991927 --- /dev/null +++ b/seed/openapi/multi-url-environment/.mock/definition/api.yml @@ -0,0 +1,14 @@ +name: multi-url-environment +auth: bearer +environments: + Production: + urls: + ec2: https://ec2.aws.com + s3: https://s3.aws.com + Staging: + urls: + ec2: https://staging.ec2.aws.com + s3: https://staging.s3.aws.com +default-environment: Production +error-discrimination: + strategy: status-code diff --git a/seed/openapi/multi-url-environment/.mock/definition/ec2.yml b/seed/openapi/multi-url-environment/.mock/definition/ec2.yml new file mode 100644 index 00000000000..a3acc4216ff --- /dev/null +++ b/seed/openapi/multi-url-environment/.mock/definition/ec2.yml @@ -0,0 +1,16 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +service: + auth: true + url: ec2 + base-path: /ec2 + endpoints: + bootInstance: + auth: true + path: /boot + method: POST + request: + name: BootInstanceRequest + body: + properties: + size: string diff --git a/seed/openapi/multi-url-environment/.mock/definition/s3.yml b/seed/openapi/multi-url-environment/.mock/definition/s3.yml new file mode 100644 index 00000000000..ca741b783f5 --- /dev/null +++ b/seed/openapi/multi-url-environment/.mock/definition/s3.yml @@ -0,0 +1,17 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +service: + auth: true + url: s3 + base-path: /s3 + endpoints: + getPresignedUrl: + auth: true + path: /presigned-url + method: POST + request: + name: GetPresignedUrlRequest + body: + properties: + s3Key: string + response: string diff --git a/seed/openapi/multi-url-environment/.mock/fern.config.json b/seed/openapi/multi-url-environment/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/multi-url-environment/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/no-environment/.mock/definition/api.yml b/seed/openapi/no-environment/.mock/definition/api.yml new file mode 100644 index 00000000000..d47556ced41 --- /dev/null +++ b/seed/openapi/no-environment/.mock/definition/api.yml @@ -0,0 +1,4 @@ +name: no-environment +auth: bearer +error-discrimination: + strategy: status-code diff --git a/seed/openapi/no-environment/.mock/definition/dummy.yml b/seed/openapi/no-environment/.mock/definition/dummy.yml new file mode 100644 index 00000000000..e767095a9b0 --- /dev/null +++ b/seed/openapi/no-environment/.mock/definition/dummy.yml @@ -0,0 +1,11 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +service: + auth: true + base-path: "" + endpoints: + getDummy: + auth: true + path: /dummy + method: GET + response: string diff --git a/seed/openapi/no-environment/.mock/fern.config.json b/seed/openapi/no-environment/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/no-environment/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/object/.mock/definition/__package__.yml b/seed/openapi/object/.mock/definition/__package__.yml new file mode 100644 index 00000000000..7ee1a972b23 --- /dev/null +++ b/seed/openapi/object/.mock/definition/__package__.yml @@ -0,0 +1,71 @@ +types: + Type: + docs: | + Exercises all of the built-in types. + properties: + one: integer + two: double + three: string + four: boolean + five: long + six: datetime + seven: date + eight: uuid + nine: base64 + ten: list + eleven: set + twelve: map + thirteen: optional + fourteen: unknown + fifteen: list> + sixteen: list> + seventeen: list> + eighteen: literal<"eighteen"> + nineteen: Name + examples: + - name: One + value: + one: 1 + two: 2 + three: three + four: true + five: 5 + six: 1994-01-01T01:01:01Z + seven: 1994-01-01 + eight: 7f71f677-e138-4a5c-bb01-e4453a19bfef + nine: TWFueSBoYW5kcyBtYWtlIGxpZ2h0IHdvcmsu + ten: + - 10 + - 10 + eleven: + - 11 + twelve: + invalid: false + exists: true + thirteen: 13 + fourteen: {} + fifteen: + - - 15 + - 15 + - - 15 + - 15 + sixteen: + - foo: 16 + bar: 16 + seventeen: + - 244c6643-f99d-4bfc-b20d-a6518f3a4cf4 + - 07791987-dec3-43b5-8dc4-250ab5dc0478 + eighteen: eighteen + nineteen: + id: name-129fsdj9 + value: nineteen + + Name: + properties: + id: string + value: string + examples: + - name: One + value: + id: name-sdfg8ajk + value: name diff --git a/seed/openapi/object/.mock/definition/api.yml b/seed/openapi/object/.mock/definition/api.yml new file mode 100644 index 00000000000..a82930c145b --- /dev/null +++ b/seed/openapi/object/.mock/definition/api.yml @@ -0,0 +1 @@ +name: object diff --git a/seed/openapi/object/.mock/fern.config.json b/seed/openapi/object/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/object/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/objects-with-imports/.mock/definition/__package__.yml b/seed/openapi/objects-with-imports/.mock/definition/__package__.yml new file mode 100644 index 00000000000..f3bdf68f26a --- /dev/null +++ b/seed/openapi/objects-with-imports/.mock/definition/__package__.yml @@ -0,0 +1,37 @@ +imports: + metadata: commons/metadata.yml +types: + Node: + properties: + id: string + label: optional + metadata: optional + examples: + - name: Left + value: + id: node-8dvgfja2 + label: left + metadata: + id: metadata-kjasf923 + data: + foo: bar + baz: qux + - name: Right + value: + id: node-cwda9fi2x + label: right + metadata: + id: metadata-lkasdfv9j + data: + one: two + three: four + + Tree: + properties: + nodes: optional> + examples: + - name: Root + value: + nodes: + - $Node.Left + - $Node.Right diff --git a/seed/openapi/objects-with-imports/.mock/definition/api.yml b/seed/openapi/objects-with-imports/.mock/definition/api.yml new file mode 100644 index 00000000000..de1eb78549d --- /dev/null +++ b/seed/openapi/objects-with-imports/.mock/definition/api.yml @@ -0,0 +1 @@ +name: objects-with-imports diff --git a/seed/openapi/objects-with-imports/.mock/definition/commons/metadata.yml b/seed/openapi/objects-with-imports/.mock/definition/commons/metadata.yml new file mode 100644 index 00000000000..5672f92f415 --- /dev/null +++ b/seed/openapi/objects-with-imports/.mock/definition/commons/metadata.yml @@ -0,0 +1,12 @@ +types: + Metadata: + properties: + id: string + data: optional> + examples: + - name: One + value: + id: metadata-js8dg24b + data: + foo: bar + baz: qux diff --git a/seed/openapi/objects-with-imports/.mock/definition/file.yml b/seed/openapi/objects-with-imports/.mock/definition/file.yml new file mode 100644 index 00000000000..187b75e3af0 --- /dev/null +++ b/seed/openapi/objects-with-imports/.mock/definition/file.yml @@ -0,0 +1,29 @@ +types: + File: + properties: + name: string + contents: string + info: FileInfo + examples: + - name: One + value: + name: file.txt + contents: ... + info: REGULAR + - name: Two + value: + name: another_file.txt + contents: ... + info: REGULAR + + FileInfo: + enum: + - value: REGULAR + docs: A regular file (e.g. foo.txt). + - value: DIRECTORY + docs: A directory (e.g. foo/). + examples: + - name: Regular + value: REGULAR + - name: Directory + value: DIRECTORY diff --git a/seed/openapi/objects-with-imports/.mock/definition/file/directory.yml b/seed/openapi/objects-with-imports/.mock/definition/file/directory.yml new file mode 100644 index 00000000000..4902de7db69 --- /dev/null +++ b/seed/openapi/objects-with-imports/.mock/definition/file/directory.yml @@ -0,0 +1,18 @@ +imports: + file: ../file.yml +types: + Directory: + properties: + name: string + files: optional> + directories: optional> + examples: + - name: One + value: + name: root + files: + - $file.File.One + directories: + - name: tmp + files: + - $file.File.Two diff --git a/seed/openapi/objects-with-imports/.mock/fern.config.json b/seed/openapi/objects-with-imports/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/objects-with-imports/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/optional/.mock/definition/api.yml b/seed/openapi/optional/.mock/definition/api.yml new file mode 100644 index 00000000000..de1eb78549d --- /dev/null +++ b/seed/openapi/optional/.mock/definition/api.yml @@ -0,0 +1 @@ +name: objects-with-imports diff --git a/seed/openapi/optional/.mock/definition/optional.yml b/seed/openapi/optional/.mock/definition/optional.yml new file mode 100644 index 00000000000..111f55357bb --- /dev/null +++ b/seed/openapi/optional/.mock/definition/optional.yml @@ -0,0 +1,11 @@ +service: + auth: false + base-path: "" + endpoints: + sendOptionalBody: + method: POST + path: /send-optional-body + request: optional> + response: + type: string + docs: Id of the created resource diff --git a/seed/openapi/optional/.mock/fern.config.json b/seed/openapi/optional/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/optional/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/package-yml/.mock/definition/__package__.yml b/seed/openapi/package-yml/.mock/definition/__package__.yml new file mode 100644 index 00000000000..54399e2e089 --- /dev/null +++ b/seed/openapi/package-yml/.mock/definition/__package__.yml @@ -0,0 +1,15 @@ +service: + auth: false + base-path: / + endpoints: + echo: + method: POST + path: "" + request: string + response: string + examples: + - path-parameters: + id: id-ksfd9c1 + request: Hello world! + response: + body: Hello world! diff --git a/seed/openapi/package-yml/.mock/definition/api.yml b/seed/openapi/package-yml/.mock/definition/api.yml new file mode 100644 index 00000000000..eedda1ebe19 --- /dev/null +++ b/seed/openapi/package-yml/.mock/definition/api.yml @@ -0,0 +1,4 @@ +name: package-yml +base-path: /{id} +path-parameters: + id: string diff --git a/seed/openapi/package-yml/.mock/definition/service.yml b/seed/openapi/package-yml/.mock/definition/service.yml new file mode 100644 index 00000000000..3201fb14c66 --- /dev/null +++ b/seed/openapi/package-yml/.mock/definition/service.yml @@ -0,0 +1,13 @@ +service: + auth: false + base-path: / + endpoints: + nop: + method: GET + path: /{nestedId} + path-parameters: + nestedId: string + examples: + - path-parameters: + id: id-a2ijs82 + nestedId: id-219xca8 diff --git a/seed/openapi/package-yml/.mock/fern.config.json b/seed/openapi/package-yml/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/package-yml/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/plain-text/.mock/definition/api.yml b/seed/openapi/plain-text/.mock/definition/api.yml new file mode 100644 index 00000000000..4ee1d9980a2 --- /dev/null +++ b/seed/openapi/plain-text/.mock/definition/api.yml @@ -0,0 +1 @@ +name: plain-text diff --git a/seed/openapi/plain-text/.mock/definition/service.yml b/seed/openapi/plain-text/.mock/definition/service.yml new file mode 100644 index 00000000000..c42c866bcc9 --- /dev/null +++ b/seed/openapi/plain-text/.mock/definition/service.yml @@ -0,0 +1,8 @@ +service: + auth: false + base-path: "" + endpoints: + getText: + path: /text + method: POST + response: text diff --git a/seed/openapi/plain-text/.mock/fern.config.json b/seed/openapi/plain-text/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/plain-text/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/query-parameters/.mock/definition/api.yml b/seed/openapi/query-parameters/.mock/definition/api.yml new file mode 100644 index 00000000000..f5aa88ee4e4 --- /dev/null +++ b/seed/openapi/query-parameters/.mock/definition/api.yml @@ -0,0 +1 @@ +name: query-parameters diff --git a/seed/openapi/query-parameters/.mock/definition/user.yml b/seed/openapi/query-parameters/.mock/definition/user.yml new file mode 100644 index 00000000000..6587ab788ea --- /dev/null +++ b/seed/openapi/query-parameters/.mock/definition/user.yml @@ -0,0 +1,37 @@ +types: + User: + properties: + name: string + tags: list + NestedUser: + properties: + name: string + user: User + +service: + base-path: /user + auth: false + endpoints: + getUsername: + path: "" + method: GET + request: + name: GetUsersRequest + query-parameters: + limit: integer + id: uuid + date: date + deadline: datetime + bytes: base64 + user: User + keyValue: map + optionalString: optional + nestedUser: NestedUser + optionalUser: optional + excludeUser: + type: User + allow-multiple: true + filter: + type: string + allow-multiple: true + response: User diff --git a/seed/openapi/query-parameters/.mock/fern.config.json b/seed/openapi/query-parameters/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/query-parameters/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/reserved-keywords/.mock/definition/api.yml b/seed/openapi/reserved-keywords/.mock/definition/api.yml new file mode 100644 index 00000000000..db5bb47ddd7 --- /dev/null +++ b/seed/openapi/reserved-keywords/.mock/definition/api.yml @@ -0,0 +1,5 @@ +name: nursery-api + +error-discrimination: + strategy: property + property-name: errorName diff --git a/seed/openapi/reserved-keywords/.mock/definition/package.yml b/seed/openapi/reserved-keywords/.mock/definition/package.yml new file mode 100644 index 00000000000..a2328bf1a8e --- /dev/null +++ b/seed/openapi/reserved-keywords/.mock/definition/package.yml @@ -0,0 +1,20 @@ +types: + Package: + properties: + name: string + Record: + properties: + foo: map + 3d: integer + +service: + base-path: / + auth: false + endpoints: + test: + method: POST + path: "" + request: + name: TestRequest + query-parameters: + for: string diff --git a/seed/openapi/reserved-keywords/.mock/fern.config.json b/seed/openapi/reserved-keywords/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/reserved-keywords/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/response-property/.mock/definition/__package__.yml b/seed/openapi/response-property/.mock/definition/__package__.yml new file mode 100644 index 00000000000..708a5a1139d --- /dev/null +++ b/seed/openapi/response-property/.mock/definition/__package__.yml @@ -0,0 +1,10 @@ +types: + StringResponse: + properties: + data: string + + OptionalStringResponse: optional + + WithMetadata: + properties: + metadata: map diff --git a/seed/openapi/response-property/.mock/definition/api.yml b/seed/openapi/response-property/.mock/definition/api.yml new file mode 100644 index 00000000000..4a1bb4a3045 --- /dev/null +++ b/seed/openapi/response-property/.mock/definition/api.yml @@ -0,0 +1 @@ +name: response-property diff --git a/seed/openapi/response-property/.mock/definition/service.yml b/seed/openapi/response-property/.mock/definition/service.yml new file mode 100644 index 00000000000..15de6ab767f --- /dev/null +++ b/seed/openapi/response-property/.mock/definition/service.yml @@ -0,0 +1,81 @@ +imports: + root: __package__.yml + +types: + WithDocs: + properties: + docs: string + + OptionalWithDocs: optional + + Movie: + properties: + id: string + name: string + + Response: + extends: + - root.WithMetadata + - WithDocs + properties: + data: Movie + +service: + auth: false + base-path: "" + endpoints: + getMovie: + method: POST + path: /movie + request: string + response: + type: Response + property: data + + getMovieDocs: + method: POST + path: /movie + request: string + response: + type: Response + property: docs + + getMovieName: + method: POST + path: /movie + request: string + response: + type: root.StringResponse + property: data + + getMovieMetadata: + method: POST + path: /movie + request: string + response: + type: Response + property: metadata + + getOptionalMovie: + method: POST + path: /movie + request: string + response: + type: optional + property: data + + getOptionalMovieDocs: + method: POST + path: /movie + request: string + response: + type: OptionalWithDocs + property: docs + + getOptionalMovieName: + method: POST + path: /movie + request: string + response: + type: root.OptionalStringResponse + property: data diff --git a/seed/openapi/response-property/.mock/fern.config.json b/seed/openapi/response-property/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/response-property/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/single-url-environment-default/.mock/definition/api.yml b/seed/openapi/single-url-environment-default/.mock/definition/api.yml new file mode 100644 index 00000000000..830028e4fb4 --- /dev/null +++ b/seed/openapi/single-url-environment-default/.mock/definition/api.yml @@ -0,0 +1,8 @@ +name: single-url-environment-default +auth: bearer +environments: + Production: https://production.com/api + Staging: https://staging.com/api +default-environment: Production +error-discrimination: + strategy: status-code diff --git a/seed/openapi/single-url-environment-default/.mock/definition/dummy.yml b/seed/openapi/single-url-environment-default/.mock/definition/dummy.yml new file mode 100644 index 00000000000..e767095a9b0 --- /dev/null +++ b/seed/openapi/single-url-environment-default/.mock/definition/dummy.yml @@ -0,0 +1,11 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +service: + auth: true + base-path: "" + endpoints: + getDummy: + auth: true + path: /dummy + method: GET + response: string diff --git a/seed/openapi/single-url-environment-default/.mock/fern.config.json b/seed/openapi/single-url-environment-default/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/single-url-environment-default/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/single-url-environment-no-default/.mock/definition/api.yml b/seed/openapi/single-url-environment-no-default/.mock/definition/api.yml new file mode 100644 index 00000000000..b80832d5696 --- /dev/null +++ b/seed/openapi/single-url-environment-no-default/.mock/definition/api.yml @@ -0,0 +1,8 @@ +name: single-url-environment-no-default +auth: bearer +environments: + Production: https://production.com/api + Staging: https://staging.com/api +default-environment: null +error-discrimination: + strategy: status-code diff --git a/seed/openapi/single-url-environment-no-default/.mock/definition/dummy.yml b/seed/openapi/single-url-environment-no-default/.mock/definition/dummy.yml new file mode 100644 index 00000000000..e767095a9b0 --- /dev/null +++ b/seed/openapi/single-url-environment-no-default/.mock/definition/dummy.yml @@ -0,0 +1,11 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +service: + auth: true + base-path: "" + endpoints: + getDummy: + auth: true + path: /dummy + method: GET + response: string diff --git a/seed/openapi/single-url-environment-no-default/.mock/fern.config.json b/seed/openapi/single-url-environment-no-default/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/single-url-environment-no-default/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/trace/.mock/definition/admin.yml b/seed/openapi/trace/.mock/definition/admin.yml new file mode 100644 index 00000000000..78c6c58f056 --- /dev/null +++ b/seed/openapi/trace/.mock/definition/admin.yml @@ -0,0 +1,93 @@ +imports: + submission: submission.yml + problemV2: v2/problem.yml + +types: + Test: + union: + and: boolean + or: boolean + +service: + auth: false + base-path: /admin + endpoints: + updateTestSubmissionStatus: + path: /store-test-submission-status/{submissionId} + path-parameters: + submissionId: submission.SubmissionId + request: + body: + type: submission.TestSubmissionStatus + method: POST + + sendTestSubmissionUpdate: + path: /store-test-submission-status-v2/{submissionId} + path-parameters: + submissionId: submission.SubmissionId + request: + body: + type: submission.TestSubmissionUpdate + method: POST + + updateWorkspaceSubmissionStatus: + path: /store-workspace-submission-status/{submissionId} + path-parameters: + submissionId: submission.SubmissionId + request: + body: + type: submission.WorkspaceSubmissionStatus + method: POST + + sendWorkspaceSubmissionUpdate: + path: /store-workspace-submission-status-v2/{submissionId} + path-parameters: + submissionId: submission.SubmissionId + request: + body: + type: submission.WorkspaceSubmissionUpdate + method: POST + + storeTracedTestCase: + path: /store-test-trace/submission/{submissionId}/testCase/{testCaseId} + path-parameters: + submissionId: submission.SubmissionId + testCaseId: string + request: + name: StoreTracedTestCaseRequest + body: + properties: + result: submission.TestCaseResultWithStdout + traceResponses: list + method: POST + + storeTracedTestCaseV2: + path: /store-test-trace-v2/submission/{submissionId}/testCase/{testCaseId} + path-parameters: + submissionId: submission.SubmissionId + testCaseId: problemV2.TestCaseId + request: + body: + type: list + method: POST + + storeTracedWorkspace: + path: /store-workspace-trace/submission/{submissionId} + path-parameters: + submissionId: submission.SubmissionId + request: + name: StoreTracedWorkspaceRequest + body: + properties: + workspaceRunDetails: submission.WorkspaceRunDetails + traceResponses: list + method: POST + + storeTracedWorkspaceV2: + path: /store-workspace-trace-v2/submission/{submissionId} + path-parameters: + submissionId: submission.SubmissionId + request: + body: + type: list + method: POST diff --git a/seed/openapi/trace/.mock/definition/api.yml b/seed/openapi/trace/.mock/definition/api.yml new file mode 100644 index 00000000000..bbcdc367b96 --- /dev/null +++ b/seed/openapi/trace/.mock/definition/api.yml @@ -0,0 +1,11 @@ +name: trace +auth: bearer +headers: + X-Random-Header: optional +error-discrimination: + strategy: property + property-name: errorName + +environments: + Prod: https://api.trace.come +default-environment: Prod diff --git a/seed/openapi/trace/.mock/definition/commons.yml b/seed/openapi/trace/.mock/definition/commons.yml new file mode 100644 index 00000000000..2ab9d51f822 --- /dev/null +++ b/seed/openapi/trace/.mock/definition/commons.yml @@ -0,0 +1,131 @@ +types: + UserId: string + ProblemId: string + NodeId: string + VariableType: + union: + integerType: {} + doubleType: {} + booleanType: {} + stringType: {} + charType: {} + listType: ListType + mapType: MapType + binaryTreeType: {} + singlyLinkedListType: {} + doublyLinkedListType: {} + ListType: + properties: + valueType: VariableType + isFixedLength: + docs: Whether this list is fixed-size (for languages that supports fixed-size + lists). Defaults to false. + type: optional + MapType: + properties: + keyType: VariableType + valueType: VariableType + VariableValue: + union: + integerValue: integer + booleanValue: boolean + doubleValue: double + stringValue: string + charValue: string + mapValue: MapValue + listValue: list + binaryTreeValue: BinaryTreeValue + singlyLinkedListValue: SinglyLinkedListValue + doublyLinkedListValue: DoublyLinkedListValue + nullValue: {} + DebugVariableValue: + union: + integerValue: integer + booleanValue: boolean + doubleValue: double + stringValue: string + charValue: string + mapValue: DebugMapValue + listValue: list + binaryTreeNodeValue: BinaryTreeNodeAndTreeValue + singlyLinkedListNodeValue: SinglyLinkedListNodeAndListValue + doublyLinkedListNodeValue: DoublyLinkedListNodeAndListValue + undefinedValue: {} + nullValue: {} + genericValue: GenericValue + GenericValue: + properties: + stringifiedType: optional + stringifiedValue: string + MapValue: + properties: + keyValuePairs: list + KeyValuePair: + properties: + key: VariableValue + value: VariableValue + BinaryTreeValue: + properties: + root: optional + nodes: map + BinaryTreeNodeValue: + properties: + nodeId: NodeId + val: double + right: optional + left: optional + BinaryTreeNodeAndTreeValue: + properties: + nodeId: NodeId + fullTree: BinaryTreeValue + SinglyLinkedListValue: + properties: + head: optional + nodes: map + SinglyLinkedListNodeValue: + properties: + nodeId: NodeId + val: double + next: optional + SinglyLinkedListNodeAndListValue: + properties: + nodeId: NodeId + fullList: SinglyLinkedListValue + DoublyLinkedListValue: + properties: + head: optional + nodes: map + DoublyLinkedListNodeValue: + properties: + nodeId: NodeId + val: double + next: optional + prev: optional + DoublyLinkedListNodeAndListValue: + properties: + nodeId: NodeId + fullList: DoublyLinkedListValue + DebugMapValue: + properties: + keyValuePairs: list + DebugKeyValuePairs: + properties: + key: DebugVariableValue + value: DebugVariableValue + TestCase: + properties: + id: string + params: list + TestCaseWithExpectedResult: + properties: + testCase: TestCase + expectedResult: VariableValue + FileInfo: + properties: + filename: string + contents: string + Language: + enum: + - JAVA + - JAVASCRIPT + - PYTHON diff --git a/seed/openapi/trace/.mock/definition/homepage.yml b/seed/openapi/trace/.mock/definition/homepage.yml new file mode 100644 index 00000000000..acf9f99a2d2 --- /dev/null +++ b/seed/openapi/trace/.mock/definition/homepage.yml @@ -0,0 +1,18 @@ +imports: + commons: commons.yml + +service: + base-path: /homepage-problems + auth: false + endpoints: + getHomepageProblems: + method: GET + path: "" + response: list + + setHomepageProblems: + method: POST + path: "" + request: + body: + type: list diff --git a/seed/openapi/trace/.mock/definition/lang-server.yml b/seed/openapi/trace/.mock/definition/lang-server.yml new file mode 100644 index 00000000000..01028d30b1b --- /dev/null +++ b/seed/openapi/trace/.mock/definition/lang-server.yml @@ -0,0 +1,7 @@ +types: + LangServerRequest: + properties: + request: unknown + LangServerResponse: + properties: + response: unknown diff --git a/seed/openapi/trace/.mock/definition/migration.yml b/seed/openapi/trace/.mock/definition/migration.yml new file mode 100644 index 00000000000..2a8c8ccf3f0 --- /dev/null +++ b/seed/openapi/trace/.mock/definition/migration.yml @@ -0,0 +1,25 @@ +types: + MigrationStatus: + enum: + - value: RUNNING + docs: The migration is running + - value: FAILED + docs: The migration is failed + - FINISHED + Migration: + properties: + name: string + status: MigrationStatus + +service: + base-path: /migration-info + auth: false + endpoints: + getAttemptedMigrations: + method: GET + path: /all + request: + name: GetAttemptedMigrationsRequest + headers: + admin-key-header: string + response: list diff --git a/seed/openapi/trace/.mock/definition/playlist.yml b/seed/openapi/trace/.mock/definition/playlist.yml new file mode 100644 index 00000000000..7bde8a32d52 --- /dev/null +++ b/seed/openapi/trace/.mock/definition/playlist.yml @@ -0,0 +1,110 @@ +imports: + commons: commons.yml +types: + PlaylistId: string + Playlist: + extends: PlaylistCreateRequest + properties: + playlist_id: PlaylistId + owner-id: commons.UserId + + PlaylistCreateRequest: + properties: + name: string + problems: list + + UpdatePlaylistRequest: + properties: + name: string + problems: + type: list + docs: The problems that make up the playlist. + PlaylistIdNotFoundErrorBody: + union: + playlistId: PlaylistId + + ReservedKeywordEnum: + enum: + - is + - as + +service: + auth: true + base-path: /v2/playlist/{serviceParam} + path-parameters: + serviceParam: integer + endpoints: + createPlaylist: + docs: Create a new playlist + method: POST + path: /create + request: + name: CreatePlaylistRequest + query-parameters: + datetime: datetime + optionalDatetime: optional + body: PlaylistCreateRequest + response: Playlist + + getPlaylists: + docs: Returns the user's playlists + method: GET + path: /all + response: list + request: + name: GetPlaylistsRequest + query-parameters: + limit: optional + otherField: + docs: i'm another field + type: string + multiLineDocs: + docs: | + I'm a multiline + description + type: string + optionalMultipleField: + type: optional + allow-multiple: true + multipleField: + type: string + allow-multiple: true + + getPlaylist: + docs: Returns a playlist + method: GET + path: /{playlistId} + auth: false + path-parameters: + playlistId: PlaylistId + response: Playlist + errors: + - PlaylistIdNotFoundError + - UnauthorizedError + + updatePlaylist: + docs: Updates a playlist + method: PUT + path: /{playlistId} + path-parameters: + playlistId: PlaylistId + request: + body: + type: optional + response: optional + errors: + - PlaylistIdNotFoundError + + deletePlaylist: + docs: Deletes a playlist + method: DELETE + path: /{playlist_id} + path-parameters: + playlist_id: PlaylistId + +errors: + PlaylistIdNotFoundError: + type: PlaylistIdNotFoundErrorBody + status-code: 404 + UnauthorizedError: + status-code: 401 diff --git a/seed/openapi/trace/.mock/definition/problem.yml b/seed/openapi/trace/.mock/definition/problem.yml new file mode 100644 index 00000000000..9506e8bcd5c --- /dev/null +++ b/seed/openapi/trace/.mock/definition/problem.yml @@ -0,0 +1,115 @@ +imports: + commons: commons.yml + +types: + ProblemInfo: + properties: + problemId: commons.ProblemId + problemDescription: ProblemDescription + problemName: string + problemVersion: integer + files: map + inputParams: list + outputType: commons.VariableType + testcases: list + methodName: string + supportsCustomTestCases: boolean + ProblemDescription: + properties: + boards: list + ProblemDescriptionBoard: + union: + html: string + variable: commons.VariableValue + testCaseId: string + ProblemFiles: + properties: + solutionFile: commons.FileInfo + readOnlyFiles: list + VariableTypeAndName: + properties: + variableType: commons.VariableType + name: string + CreateProblemRequest: + properties: + problemName: string + problemDescription: ProblemDescription + files: map + inputParams: list + outputType: commons.VariableType + testcases: list + methodName: string + CreateProblemResponse: + union: + success: commons.ProblemId + error: CreateProblemError + + UpdateProblemResponse: + properties: + problemVersion: integer + + CreateProblemError: + discriminant: + value: _type + name: errorType + union: + generic: GenericCreateProblemError + GenericCreateProblemError: + properties: + message: string + type: string + stacktrace: string + + GetDefaultStarterFilesResponse: + properties: + files: map + +service: + base-path: /problem-crud + auth: false + endpoints: + createProblem: + docs: Creates a problem + method: POST + path: /create + request: CreateProblemRequest + response: CreateProblemResponse + + updateProblem: + docs: Updates a problem + method: POST + path: /update/{problemId} + path-parameters: + problemId: commons.ProblemId + request: + body: + type: CreateProblemRequest + response: UpdateProblemResponse + + deleteProblem: + docs: Soft deletes a problem + method: DELETE + path: /delete/{problemId} + path-parameters: + problemId: commons.ProblemId + + getDefaultStarterFiles: + docs: Returns default starter files for problem + method: POST + path: /default-starter-files + request: + name: GetDefaultStarterFilesRequest + body: + properties: + inputParams: list + outputType: commons.VariableType + methodName: + type: string + docs: | + The name of the `method` that the student has to complete. + The method name cannot include the following characters: + - Greater Than `>` + - Less Than `<`` + - Equals `=` + - Period `.` + response: GetDefaultStarterFilesResponse diff --git a/seed/openapi/trace/.mock/definition/submission.yml b/seed/openapi/trace/.mock/definition/submission.yml new file mode 100644 index 00000000000..20b3b4d8e0d --- /dev/null +++ b/seed/openapi/trace/.mock/definition/submission.yml @@ -0,0 +1,470 @@ +docs: Responsible for spinning up and spinning down execution. +imports: + commons: commons.yml + problemV2: ./v2/problem.yml +types: + SubmissionId: + type: uuid + ShareId: + type: string + SubmissionRequest: + union: + initializeProblemRequest: InitializeProblemRequest + initializeWorkspaceRequest: {} + submitV2: SubmitRequestV2 + workspaceSubmit: WorkspaceSubmitRequest + stop: StopRequest + InitializeProblemRequest: + properties: + problemId: commons.ProblemId + problemVersion: optional + SubmitRequestV2: + properties: + submissionId: SubmissionId + language: commons.Language + submissionFiles: list + problemId: commons.ProblemId + problemVersion: optional + userId: optional + WorkspaceSubmitRequest: + properties: + submissionId: SubmissionId + language: commons.Language + submissionFiles: list + userId: optional + SubmissionFileInfo: + properties: + directory: string + filename: string + contents: string + SubmissionTypeEnum: + enum: + - TEST + docs: Keep in sync with SubmissionType. + StopRequest: + properties: + submissionId: SubmissionId + SubmissionResponse: + union: + serverInitialized: {} + problemInitialized: commons.ProblemId + workspaceInitialized: {} + serverErrored: ExceptionInfo + codeExecutionUpdate: CodeExecutionUpdate + terminated: TerminatedResponse + CodeExecutionUpdate: + union: + buildingExecutor: + type: BuildingExecutorResponse + docs: Statuses if an executor for the session isn't ready (Before + RunningResponse). + running: + type: RunningResponse + docs: Sent once a test submission is executing. + errored: + type: ErroredResponse + docs: Sent if a submission cannot be run (i.e. Compile Error). + stopped: + type: StoppedResponse + docs: Sent if a submission is stopped. + graded: + type: GradedResponse + docs: Graded testcases without trace information. + gradedV2: + type: GradedResponseV2 + docs: Graded submission for v2 problems. + workspaceRan: + type: WorkspaceRanResponse + docs: Workspace run without trace information. + recording: + type: RecordingResponseNotification + docs: Gives progress about what is being recorded. + recorded: + type: RecordedResponseNotification + docs: Graded testcases with trace information. + invalidRequest: + type: InvalidRequestResponse + docs: Sent if an invalid request is sent for a submission. + finished: + type: FinishedResponse + docs: Sent once a submission is graded and fully recorded. + BuildingExecutorResponse: + properties: + submissionId: SubmissionId + status: ExecutionSessionStatus + RunningResponse: + properties: + submissionId: SubmissionId + state: RunningSubmissionState + RunningSubmissionState: + enum: + - QUEUEING_SUBMISSION + - KILLING_HISTORICAL_SUBMISSIONS + - WRITING_SUBMISSION_TO_FILE + - COMPILING_SUBMISSION + - RUNNING_SUBMISSION + ErroredResponse: + properties: + submissionId: SubmissionId + errorInfo: ErrorInfo + ErrorInfo: + union: + compileError: CompileError + runtimeError: + type: RuntimeError + docs: | + If the submission cannot be executed and throws a runtime error before getting to any of the testcases. + internalError: + type: InternalError + docs: | + If the trace backend encounters an unexpected error. + CompileError: + properties: + message: string + RuntimeError: + properties: + message: string + InternalError: + properties: + exceptionInfo: ExceptionInfo + StoppedResponse: + properties: + submissionId: SubmissionId + WorkspaceRanResponse: + properties: + submissionId: SubmissionId + runDetails: WorkspaceRunDetails + WorkspaceRunDetails: + properties: + exceptionV2: optional + exception: optional + stdout: string + GradedResponse: + properties: + submissionId: SubmissionId + testCases: map + GradedResponseV2: + properties: + submissionId: SubmissionId + testCases: map + TestCaseGrade: + union: + hidden: TestCaseHiddenGrade + nonHidden: TestCaseNonHiddenGrade + TestCaseHiddenGrade: + properties: + passed: boolean + TestCaseNonHiddenGrade: + properties: + passed: boolean + actualResult: optional + exception: optional + stdout: string + RecordedResponseNotification: + properties: + submissionId: SubmissionId + traceResponsesSize: integer + testCaseId: optional + RecordingResponseNotification: + properties: + submissionId: SubmissionId + testCaseId: optional + lineNumber: integer + lightweightStackInfo: LightweightStackframeInformation + tracedFile: optional + LightweightStackframeInformation: + properties: + numStackFrames: integer + topStackFrameMethodName: string + TestCaseResultWithStdout: + properties: + result: TestCaseResult + stdout: string + TestCaseResult: + properties: + expectedResult: commons.VariableValue + actualResult: ActualResult + passed: boolean + ActualResult: + union: + value: commons.VariableValue + exception: ExceptionInfo + exceptionV2: ExceptionV2 + ExceptionV2: + union: + generic: ExceptionInfo + timeout: {} + ExceptionInfo: + properties: + exceptionType: string + exceptionMessage: string + exceptionStacktrace: string + InvalidRequestResponse: + properties: + request: SubmissionRequest + cause: InvalidRequestCause + InvalidRequestCause: + union: + submissionIdNotFound: + type: SubmissionIdNotFound + docs: The submission request references a submission id that doesn't exist. + customTestCasesUnsupported: + type: CustomTestCasesUnsupported + unexpectedLanguage: + type: UnexpectedLanguageError + docs: The submission request was routed to an incorrect language executor. + ExistingSubmissionExecuting: + properties: + submissionId: SubmissionId + SubmissionIdNotFound: + properties: + missingSubmissionId: SubmissionId + CustomTestCasesUnsupported: + properties: + problemId: commons.ProblemId + submissionId: SubmissionId + UnexpectedLanguageError: + properties: + expectedLanguage: commons.Language + actualLanguage: commons.Language + TerminatedResponse: + properties: {} + FinishedResponse: + properties: + submissionId: SubmissionId + + StdoutResponse: + properties: + submissionId: SubmissionId + stdout: string + StderrResponse: + properties: + submissionId: SubmissionId + stderr: string + TraceResponse: + properties: + submissionId: SubmissionId + lineNumber: integer + returnValue: optional + expressionLocation: optional + stack: StackInformation + stdout: optional + + TraceResponseV2: + properties: + submissionId: SubmissionId + lineNumber: integer + file: TracedFile + returnValue: optional + expressionLocation: optional + stack: StackInformation + stdout: optional + TracedFile: + properties: + filename: string + directory: string + + ExpressionLocation: + properties: + start: integer + offset: integer + StackInformation: + properties: + numStackFrames: integer + topStackFrame: optional + StackFrame: + properties: + methodName: string + lineNumber: integer + scopes: list + Scope: + properties: + variables: map + ExecutionSessionResponse: + properties: + sessionId: string + executionSessionUrl: optional + language: commons.Language + status: ExecutionSessionStatus + ExecutionSessionStatus: + enum: + - CREATING_CONTAINER #Requesting resources + - PROVISIONING_CONTAINER #Downloading image + - PENDING_CONTAINER #Setting up container + - RUNNING_CONTAINER #Container running + - LIVE_CONTAINER #Container can be pinged + - FAILED_TO_LAUNCH #Container failed to launch + + SubmissionStatusV2: + union: + test: TestSubmissionStatusV2 + workspace: WorkspaceSubmissionStatusV2 + TestSubmissionStatusV2: + properties: + updates: list + problemId: commons.ProblemId + problemVersion: integer + problemInfo: problemV2.ProblemInfoV2 + WorkspaceSubmissionStatusV2: + properties: + updates: list + TestSubmissionUpdate: + properties: + updateTime: datetime + updateInfo: TestSubmissionUpdateInfo + TestSubmissionUpdateInfo: + union: + running: RunningSubmissionState + stopped: {} + errored: ErrorInfo + gradedTestCase: GradedTestCaseUpdate + recordedTestCase: RecordedTestCaseUpdate + finished: {} + WorkspaceSubmissionUpdate: + properties: + updateTime: datetime + updateInfo: WorkspaceSubmissionUpdateInfo + WorkspaceSubmissionUpdateInfo: + union: + running: RunningSubmissionState + ran: WorkspaceRunDetails + stopped: {} + traced: {} + tracedV2: WorkspaceTracedUpdate + errored: ErrorInfo + finished: {} + GradedTestCaseUpdate: + properties: + testCaseId: problemV2.TestCaseId + grade: TestCaseGrade + RecordedTestCaseUpdate: + properties: + testCaseId: problemV2.TestCaseId + traceResponsesSize: integer + WorkspaceTracedUpdate: + properties: + traceResponsesSize: integer + + SubmissionTypeState: + union: + test: TestSubmissionState + workspace: WorkspaceSubmissionState + WorkspaceSubmissionState: + properties: + status: WorkspaceSubmissionStatus + WorkspaceSubmissionStatus: + union: + stopped: {} + errored: ErrorInfo + running: RunningSubmissionState + ran: WorkspaceRunDetails + traced: WorkspaceRunDetails + TestSubmissionState: + properties: + problemId: commons.ProblemId + defaultTestCases: list + customTestCases: list + status: TestSubmissionStatus + TestSubmissionStatus: + union: + stopped: {} + errored: ErrorInfo + running: RunningSubmissionState + testCaseIdToState: map + SubmissionStatusForTestCase: + union: + graded: TestCaseResultWithStdout + gradedV2: TestCaseGrade + traced: TracedTestCase + TracedTestCase: + properties: + result: TestCaseResultWithStdout + traceResponsesSize: integer + TraceResponsesPage: + properties: + offset: + type: optional + docs: | + If present, use this to load subseqent pages. + The offset is the id of the next trace response to load. + traceResponses: list + TraceResponsesPageV2: + properties: + offset: + type: optional + docs: | + If present, use this to load subseqent pages. + The offset is the id of the next trace response to load. + traceResponses: list + GetTraceResponsesPageRequest: + properties: + offset: + type: optional + WorkspaceStarterFilesResponse: + properties: + files: map + WorkspaceStarterFilesResponseV2: + properties: + filesByLanguage: map + WorkspaceFiles: + properties: + mainFile: commons.FileInfo + readOnlyFiles: list + + ExecutionSessionState: + properties: + lastTimeContacted: optional + sessionId: + type: string + docs: > + The auto-generated session id. Formatted as a uuid. + isWarmInstance: boolean + awsTaskId: optional + language: commons.Language + status: ExecutionSessionStatus + + GetExecutionSessionStateResponse: + properties: + states: map + numWarmingInstances: optional + warmingSessionIds: list + + GetSubmissionStateResponse: + properties: + timeSubmitted: optional + submission: string + language: commons.Language + submissionTypeState: SubmissionTypeState + +service: + base-path: /sessions + auth: false + endpoints: + createExecutionSession: + docs: Returns sessionId and execution server URL for session. Spins up server. + method: POST + path: /create-session/{language} + path-parameters: + language: commons.Language + response: ExecutionSessionResponse + + getExecutionSession: + docs: Returns execution server URL for session. Returns empty if session isn't + registered. + method: GET + path: /{sessionId} + path-parameters: + sessionId: string + response: optional + + stopExecutionSession: + docs: Stops execution session. #TODO: only an admin should be able to trigger this + method: DELETE + path: /stop/{sessionId} + path-parameters: + sessionId: string + + getExecutionSessionsState: + method: GET + path: /execution-sessions-state + response: GetExecutionSessionStateResponse diff --git a/seed/openapi/trace/.mock/definition/sysprop.yml b/seed/openapi/trace/.mock/definition/sysprop.yml new file mode 100644 index 00000000000..8388ac30b74 --- /dev/null +++ b/seed/openapi/trace/.mock/definition/sysprop.yml @@ -0,0 +1,18 @@ +imports: + commons: commons.yml + +service: + base-path: /sysprop + auth: false + endpoints: + setNumWarmInstances: + method: PUT + path: /num-warm-instances/{language}/{numWarmInstances} + path-parameters: + language: commons.Language + numWarmInstances: integer + + getNumWarmInstances: + method: GET + path: /num-warm-instances + response: map diff --git a/seed/openapi/trace/.mock/definition/v2/__package__.yml b/seed/openapi/trace/.mock/definition/v2/__package__.yml new file mode 100644 index 00000000000..fd1df211375 --- /dev/null +++ b/seed/openapi/trace/.mock/definition/v2/__package__.yml @@ -0,0 +1,7 @@ +service: + base-path: / + auth: false + endpoints: + test: + path: "" + method: GET diff --git a/seed/openapi/trace/.mock/definition/v2/problem.yml b/seed/openapi/trace/.mock/definition/v2/problem.yml new file mode 100644 index 00000000000..06e3ed623f4 --- /dev/null +++ b/seed/openapi/trace/.mock/definition/v2/problem.yml @@ -0,0 +1,218 @@ +imports: + commons: ../commons.yml + problem: ../problem.yml + +types: + TestCaseTemplateId: string + TestCaseId: string + ParameterId: string + ProblemInfoV2: + properties: + problemId: commons.ProblemId + problemDescription: problem.ProblemDescription + problemName: string + problemVersion: integer + supportedLanguages: set + customFiles: CustomFiles + generatedFiles: GeneratedFiles + customTestCaseTemplates: list + testcases: list + isPublic: boolean + LightweightProblemInfoV2: + properties: + problemId: commons.ProblemId + problemName: string + problemVersion: integer + variableTypes: set + CreateProblemRequestV2: + properties: + problemName: string + problemDescription: problem.ProblemDescription + customFiles: CustomFiles + customTestCaseTemplates: list + testcases: list + supportedLanguages: set + isPublic: boolean + TestCaseV2: + properties: + metadata: TestCaseMetadata + implementation: TestCaseImplementationReference + arguments: map + expects: optional + TestCaseExpects: + properties: + expectedStdout: optional + TestCaseImplementationReference: + union: + templateId: TestCaseTemplateId + implementation: TestCaseImplementation + BasicTestCaseTemplate: + properties: + templateId: TestCaseTemplateId + name: string + description: TestCaseImplementationDescription + expectedValueParameterId: ParameterId + TestCaseTemplate: + properties: + templateId: TestCaseTemplateId + name: string + implementation: TestCaseImplementation + TestCaseImplementation: + properties: + description: TestCaseImplementationDescription + function: TestCaseFunction + TestCaseFunction: + union: + withActualResult: TestCaseWithActualResultImplementation + custom: VoidFunctionDefinition + TestCaseWithActualResultImplementation: + properties: + getActualResult: NonVoidFunctionDefinition + assertCorrectnessCheck: AssertCorrectnessCheck + VoidFunctionDefinition: + properties: + parameters: list + code: FunctionImplementationForMultipleLanguages + Parameter: + properties: + parameterId: ParameterId + name: string + variableType: commons.VariableType + NonVoidFunctionDefinition: + properties: + signature: NonVoidFunctionSignature + code: FunctionImplementationForMultipleLanguages + VoidFunctionSignature: + properties: + parameters: list + NonVoidFunctionSignature: + properties: + parameters: list + returnType: commons.VariableType + VoidFunctionSignatureThatTakesActualResult: + properties: + parameters: list + actualResultType: commons.VariableType + AssertCorrectnessCheck: + union: + deepEquality: DeepEqualityCorrectnessCheck + custom: VoidFunctionDefinitionThatTakesActualResult + DeepEqualityCorrectnessCheck: + properties: + expectedValueParameterId: ParameterId + VoidFunctionDefinitionThatTakesActualResult: + docs: The generated signature will include an additional param, actualResult + properties: + additionalParameters: list + code: FunctionImplementationForMultipleLanguages + TestCaseImplementationDescription: + properties: + boards: list + TestCaseImplementationDescriptionBoard: + union: + html: string + paramId: ParameterId + TestCaseMetadata: + properties: + id: TestCaseId + name: string + hidden: boolean + FunctionImplementationForMultipleLanguages: + properties: + codeByLanguage: map + FunctionImplementation: + properties: + impl: string + imports: optional + GeneratedFiles: + properties: + generatedTestCaseFiles: map + generatedTemplateFiles: map + other: map + CustomFiles: + union: + basic: BasicCustomFiles + custom: map + BasicCustomFiles: + properties: + methodName: string + signature: NonVoidFunctionSignature + additionalFiles: map + basicTestCaseTemplate: BasicTestCaseTemplate + Files: + properties: + files: list + FileInfoV2: + properties: + filename: string + directory: string + contents: string + editable: boolean + DefaultProvidedFile: + properties: + file: FileInfoV2 + relatedTypes: list + FunctionSignature: + union: + void: VoidFunctionSignature + nonVoid: NonVoidFunctionSignature + voidThatTakesActualResult: + type: VoidFunctionSignatureThatTakesActualResult + docs: Useful when specifying custom grading for a testcase where actualResult is + defined. + GetFunctionSignatureRequest: + properties: + functionSignature: FunctionSignature + GetFunctionSignatureResponse: + properties: + functionByLanguage: map + + GetBasicSolutionFileRequest: + properties: + methodName: string + signature: NonVoidFunctionSignature + GetBasicSolutionFileResponse: + properties: + solutionFileByLanguage: map + + GetGeneratedTestCaseFileRequest: + properties: + template: optional + testCase: TestCaseV2 + + GetGeneratedTestCaseTemplateFileRequest: + properties: + template: TestCaseTemplate + +service: + base-path: /problems-v2 + auth: false + endpoints: + getLightweightProblems: + docs: Returns lightweight versions of all problems + method: GET + path: /lightweight-problem-info + response: list + + getProblems: + docs: Returns latest versions of all problems + method: GET + path: /problem-info + response: list + + getLatestProblem: + docs: Returns latest version of a problem + method: GET + path: /problem-info/{problemId} + path-parameters: + problemId: commons.ProblemId + response: ProblemInfoV2 + + getProblemVersion: + docs: Returns requested version of a problem + method: GET + path: /problem-info/{problemId}/version/{problemVersion} + path-parameters: + problemId: commons.ProblemId + problemVersion: integer + response: ProblemInfoV2 diff --git a/seed/openapi/trace/.mock/definition/v2/v3/problem.yml b/seed/openapi/trace/.mock/definition/v2/v3/problem.yml new file mode 100644 index 00000000000..8699c81c7d1 --- /dev/null +++ b/seed/openapi/trace/.mock/definition/v2/v3/problem.yml @@ -0,0 +1,218 @@ +imports: + commons: ../../commons.yml + problem: ../../problem.yml + +types: + TestCaseTemplateId: string + TestCaseId: string + ParameterId: string + ProblemInfoV2: + properties: + problemId: commons.ProblemId + problemDescription: problem.ProblemDescription + problemName: string + problemVersion: integer + supportedLanguages: set + customFiles: CustomFiles + generatedFiles: GeneratedFiles + customTestCaseTemplates: list + testcases: list + isPublic: boolean + LightweightProblemInfoV2: + properties: + problemId: commons.ProblemId + problemName: string + problemVersion: integer + variableTypes: set + CreateProblemRequestV2: + properties: + problemName: string + problemDescription: problem.ProblemDescription + customFiles: CustomFiles + customTestCaseTemplates: list + testcases: list + supportedLanguages: set + isPublic: boolean + TestCaseV2: + properties: + metadata: TestCaseMetadata + implementation: TestCaseImplementationReference + arguments: map + expects: optional + TestCaseExpects: + properties: + expectedStdout: optional + TestCaseImplementationReference: + union: + templateId: TestCaseTemplateId + implementation: TestCaseImplementation + BasicTestCaseTemplate: + properties: + templateId: TestCaseTemplateId + name: string + description: TestCaseImplementationDescription + expectedValueParameterId: ParameterId + TestCaseTemplate: + properties: + templateId: TestCaseTemplateId + name: string + implementation: TestCaseImplementation + TestCaseImplementation: + properties: + description: TestCaseImplementationDescription + function: TestCaseFunction + TestCaseFunction: + union: + withActualResult: TestCaseWithActualResultImplementation + custom: VoidFunctionDefinition + TestCaseWithActualResultImplementation: + properties: + getActualResult: NonVoidFunctionDefinition + assertCorrectnessCheck: AssertCorrectnessCheck + VoidFunctionDefinition: + properties: + parameters: list + code: FunctionImplementationForMultipleLanguages + Parameter: + properties: + parameterId: ParameterId + name: string + variableType: commons.VariableType + NonVoidFunctionDefinition: + properties: + signature: NonVoidFunctionSignature + code: FunctionImplementationForMultipleLanguages + VoidFunctionSignature: + properties: + parameters: list + NonVoidFunctionSignature: + properties: + parameters: list + returnType: commons.VariableType + VoidFunctionSignatureThatTakesActualResult: + properties: + parameters: list + actualResultType: commons.VariableType + AssertCorrectnessCheck: + union: + deepEquality: DeepEqualityCorrectnessCheck + custom: VoidFunctionDefinitionThatTakesActualResult + DeepEqualityCorrectnessCheck: + properties: + expectedValueParameterId: ParameterId + VoidFunctionDefinitionThatTakesActualResult: + docs: The generated signature will include an additional param, actualResult + properties: + additionalParameters: list + code: FunctionImplementationForMultipleLanguages + TestCaseImplementationDescription: + properties: + boards: list + TestCaseImplementationDescriptionBoard: + union: + html: string + paramId: ParameterId + TestCaseMetadata: + properties: + id: TestCaseId + name: string + hidden: boolean + FunctionImplementationForMultipleLanguages: + properties: + codeByLanguage: map + FunctionImplementation: + properties: + impl: string + imports: optional + GeneratedFiles: + properties: + generatedTestCaseFiles: map + generatedTemplateFiles: map + other: map + CustomFiles: + union: + basic: BasicCustomFiles + custom: map + BasicCustomFiles: + properties: + methodName: string + signature: NonVoidFunctionSignature + additionalFiles: map + basicTestCaseTemplate: BasicTestCaseTemplate + Files: + properties: + files: list + FileInfoV2: + properties: + filename: string + directory: string + contents: string + editable: boolean + DefaultProvidedFile: + properties: + file: FileInfoV2 + relatedTypes: list + FunctionSignature: + union: + void: VoidFunctionSignature + nonVoid: NonVoidFunctionSignature + voidThatTakesActualResult: + type: VoidFunctionSignatureThatTakesActualResult + docs: Useful when specifying custom grading for a testcase where actualResult is + defined. + GetFunctionSignatureRequest: + properties: + functionSignature: FunctionSignature + GetFunctionSignatureResponse: + properties: + functionByLanguage: map + + GetBasicSolutionFileRequest: + properties: + methodName: string + signature: NonVoidFunctionSignature + GetBasicSolutionFileResponse: + properties: + solutionFileByLanguage: map + + GetGeneratedTestCaseFileRequest: + properties: + template: optional + testCase: TestCaseV2 + + GetGeneratedTestCaseTemplateFileRequest: + properties: + template: TestCaseTemplate + +service: + base-path: /problems-v2 + auth: false + endpoints: + getLightweightProblems: + docs: Returns lightweight versions of all problems + method: GET + path: /lightweight-problem-info + response: list + + getProblems: + docs: Returns latest versions of all problems + method: GET + path: /problem-info + response: list + + getLatestProblem: + docs: Returns latest version of a problem + method: GET + path: /problem-info/{problemId} + path-parameters: + problemId: commons.ProblemId + response: ProblemInfoV2 + + getProblemVersion: + docs: Returns requested version of a problem + method: GET + path: /problem-info/{problemId}/version/{problemVersion} + path-parameters: + problemId: commons.ProblemId + problemVersion: integer + response: ProblemInfoV2 diff --git a/seed/openapi/trace/.mock/fern.config.json b/seed/openapi/trace/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/trace/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/undiscriminated-unions/.mock/definition/api.yml b/seed/openapi/undiscriminated-unions/.mock/definition/api.yml new file mode 100644 index 00000000000..79844430e1b --- /dev/null +++ b/seed/openapi/undiscriminated-unions/.mock/definition/api.yml @@ -0,0 +1 @@ +name: undiscriminated-unions diff --git a/seed/openapi/undiscriminated-unions/.mock/definition/union.yml b/seed/openapi/undiscriminated-unions/.mock/definition/union.yml new file mode 100644 index 00000000000..d5d412253a0 --- /dev/null +++ b/seed/openapi/undiscriminated-unions/.mock/definition/union.yml @@ -0,0 +1,21 @@ +service: + auth: false + base-path: / + endpoints: + get: + path: "" + method: POST + request: MyUnion + response: MyUnion + +types: + MyUnion: + docs: | + Several different types are accepted. + discriminated: false + union: + - string + - list + - integer + - list + - list> diff --git a/seed/openapi/undiscriminated-unions/.mock/fern.config.json b/seed/openapi/undiscriminated-unions/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/undiscriminated-unions/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/unions/.mock/definition/api.yml b/seed/openapi/unions/.mock/definition/api.yml new file mode 100644 index 00000000000..469b144f283 --- /dev/null +++ b/seed/openapi/unions/.mock/definition/api.yml @@ -0,0 +1 @@ +name: unions diff --git a/seed/openapi/unions/.mock/definition/types.yml b/seed/openapi/unions/.mock/definition/types.yml new file mode 100644 index 00000000000..1f4613f22c0 --- /dev/null +++ b/seed/openapi/unions/.mock/definition/types.yml @@ -0,0 +1,74 @@ +types: + Union: + docs: "This is a simple union." + union: + foo: + type: Foo + key: foo + bar: + type: Bar + key: bar + + UnionWithDiscriminant: + discriminant: + value: _type + name: type + union: + foo: + docs: "This is a Foo field." + type: Foo + key: foo + bar: + type: Bar + key: bar + + UnionWithPrimitive: + union: + integer: integer + string: string + + UnionWithoutKey: + union: + foo: Foo + bar: + docs: "This is a bar field." + type: Bar + + UnionWithUnknown: + union: + foo: Foo + unknown: {} + + UnionWithLiteral: + base-properties: + base: literal<"base"> + union: + fern: literal<"fern"> + + UnionWithBaseProperties: + base-properties: + id: string + union: + integer: integer + string: string + foo: Foo + + UnionWithTime: + union: + value: integer + date: date + datetime: datetime + + UnionWithOptionalTime: + union: + date: optional + dateimte: optional + + Foo: + properties: + name: string + + Bar: + properties: + name: string + diff --git a/seed/openapi/unions/.mock/definition/union.yml b/seed/openapi/unions/.mock/definition/union.yml new file mode 100644 index 00000000000..39acd2b9457 --- /dev/null +++ b/seed/openapi/unions/.mock/definition/union.yml @@ -0,0 +1,36 @@ +types: + GetShapeRequest: + properties: + id: string + + Shape: + base-properties: + id: string + union: + circle: Circle + square: Square + + Circle: + properties: + radius: double + + Square: + properties: + length: double + +service: + auth: false + base-path: / + endpoints: + get: + path: /{id} + method: GET + path-parameters: + id: string + response: Shape + + update: + path: "" + method: PATCH + request: Shape + response: boolean diff --git a/seed/openapi/unions/.mock/fern.config.json b/seed/openapi/unions/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/unions/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/unknown/.mock/definition/api.yml b/seed/openapi/unknown/.mock/definition/api.yml new file mode 100644 index 00000000000..de1ea38d7a6 --- /dev/null +++ b/seed/openapi/unknown/.mock/definition/api.yml @@ -0,0 +1 @@ +name: unknown-as-any diff --git a/seed/openapi/unknown/.mock/definition/unknown.yml b/seed/openapi/unknown/.mock/definition/unknown.yml new file mode 100644 index 00000000000..a24c65e36a7 --- /dev/null +++ b/seed/openapi/unknown/.mock/definition/unknown.yml @@ -0,0 +1,15 @@ +service: + auth: false + base-path: / + endpoints: + post: + path: "" + method: POST + request: unknown + response: list + +types: + MyAlias: unknown + MyObject: + properties: + unknown: unknown diff --git a/seed/openapi/unknown/.mock/fern.config.json b/seed/openapi/unknown/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/unknown/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/variables/.mock/definition/api.yml b/seed/openapi/variables/.mock/definition/api.yml new file mode 100644 index 00000000000..5e83d609091 --- /dev/null +++ b/seed/openapi/variables/.mock/definition/api.yml @@ -0,0 +1,4 @@ +name: variables + +variables: + rootVariable: string diff --git a/seed/openapi/variables/.mock/definition/service.yml b/seed/openapi/variables/.mock/definition/service.yml new file mode 100644 index 00000000000..d0216557d75 --- /dev/null +++ b/seed/openapi/variables/.mock/definition/service.yml @@ -0,0 +1,9 @@ +service: + auth: false + base-path: / + endpoints: + post: + path: "/{endpointParam}" + path-parameters: + endpointParam: $rootVariable + method: POST diff --git a/seed/openapi/variables/.mock/fern.config.json b/seed/openapi/variables/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/variables/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/openapi/websocket/.mock/definition/api.yml b/seed/openapi/websocket/.mock/definition/api.yml new file mode 100644 index 00000000000..6b9c0d61dcb --- /dev/null +++ b/seed/openapi/websocket/.mock/definition/api.yml @@ -0,0 +1 @@ +name: websocket diff --git a/seed/openapi/websocket/.mock/definition/realtime.yml b/seed/openapi/websocket/.mock/definition/realtime.yml new file mode 100644 index 00000000000..ddee9418b74 --- /dev/null +++ b/seed/openapi/websocket/.mock/definition/realtime.yml @@ -0,0 +1,36 @@ +# yaml-language-server: $schema=./../../../../../fern.schema.json + +channel: + path: /realtime/{id} + auth: true + path-parameters: + id: string + query-parameters: + model: optional + temperature: optional + messages: + send: + display-name: "Send" + origin: client + body: string + + receive: + display-name: "Receive" + origin: server + body: + name: ReceiveEvent + properties: + text: string + + examples: + - name: Default example + path-parameters: + id: doc_123 + messages: + - type: send + body: "uvxcdv12344412b" + - type: receive + body: + text: "The weather for today..." + - type: send + body: "uvxcdv12344412b" diff --git a/seed/openapi/websocket/.mock/fern.config.json b/seed/openapi/websocket/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/openapi/websocket/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/alias/.mock/definition/__package__.yml b/seed/postman/alias/.mock/definition/__package__.yml new file mode 100644 index 00000000000..4776fa6a51f --- /dev/null +++ b/seed/postman/alias/.mock/definition/__package__.yml @@ -0,0 +1,27 @@ +types: + TypeId: + docs: An alias for type IDs. + type: string + examples: + - name: One + value: type-kaljhv87 + + Type: + docs: A simple type with just a name. + properties: + id: TypeId + name: string + examples: + - name: One + value: + id: type-df89sdg1 + name: foo + + Object: + docs: Object is an alias for a type. + type: Type + examples: + - name: One + value: + id: kljasc85 + name: bar diff --git a/seed/postman/alias/.mock/definition/api.yml b/seed/postman/alias/.mock/definition/api.yml new file mode 100644 index 00000000000..6ca90528fe0 --- /dev/null +++ b/seed/postman/alias/.mock/definition/api.yml @@ -0,0 +1 @@ +name: alias diff --git a/seed/postman/alias/.mock/fern.config.json b/seed/postman/alias/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/alias/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/audiences/.mock/definition/api.yml b/seed/postman/audiences/.mock/definition/api.yml new file mode 100644 index 00000000000..b3c06b39178 --- /dev/null +++ b/seed/postman/audiences/.mock/definition/api.yml @@ -0,0 +1,4 @@ +name: audiences +display-name: Audiences API +audiences: + - public diff --git a/seed/postman/audiences/.mock/definition/commons.yml b/seed/postman/audiences/.mock/definition/commons.yml new file mode 100644 index 00000000000..0cdcfc9fb9b --- /dev/null +++ b/seed/postman/audiences/.mock/definition/commons.yml @@ -0,0 +1,5 @@ +imports: + commons: commons.yml + +types: + Imported: string diff --git a/seed/postman/audiences/.mock/definition/folder-a/service.yml b/seed/postman/audiences/.mock/definition/folder-a/service.yml new file mode 100644 index 00000000000..11d499ee5db --- /dev/null +++ b/seed/postman/audiences/.mock/definition/folder-a/service.yml @@ -0,0 +1,20 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +imports: + folderBCommons: ../folder-b/common.yml + +service: + auth: false + audiences: + - public + base-path: / + endpoints: + getDirectThread: + path: "" + method: GET + response: Response + +types: + Response: + properties: + foo: optional diff --git a/seed/postman/audiences/.mock/definition/folder-b/common.yml b/seed/postman/audiences/.mock/definition/folder-b/common.yml new file mode 100644 index 00000000000..fe77c996c07 --- /dev/null +++ b/seed/postman/audiences/.mock/definition/folder-b/common.yml @@ -0,0 +1,9 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +imports: + folderCCommons: ../folder-c/common.yml + +types: + Foo: + properties: + foo: optional diff --git a/seed/postman/audiences/.mock/definition/folder-c/common.yml b/seed/postman/audiences/.mock/definition/folder-c/common.yml new file mode 100644 index 00000000000..5911f31e57f --- /dev/null +++ b/seed/postman/audiences/.mock/definition/folder-c/common.yml @@ -0,0 +1,6 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +types: + Foo: + properties: + bar_property: uuid diff --git a/seed/postman/audiences/.mock/definition/foo.yml b/seed/postman/audiences/.mock/definition/foo.yml new file mode 100644 index 00000000000..3909327a897 --- /dev/null +++ b/seed/postman/audiences/.mock/definition/foo.yml @@ -0,0 +1,42 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +imports: + commons: commons.yml + +service: + auth: false + base-path: / + endpoints: + find: + audiences: + - public + path: "" + method: POST + request: + name: FindRequest + query-parameters: + optionalString: OptionalString + body: + properties: + publicProperty: + type: optional + audiences: + - public + privateProperty: optional + response: ImportingType + +types: + ImportingType: + properties: + imported: commons.Imported + OptionalString: optional + + FilteredType: + audiences: + - public + properties: + public_property: + type: optional + audiences: + - public + private_property: integer diff --git a/seed/postman/audiences/.mock/fern.config.json b/seed/postman/audiences/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/audiences/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/auth-environment-variables/.mock/definition/api.yml b/seed/postman/auth-environment-variables/.mock/definition/api.yml new file mode 100644 index 00000000000..2c6038ea261 --- /dev/null +++ b/seed/postman/auth-environment-variables/.mock/definition/api.yml @@ -0,0 +1,11 @@ +name: auth-environment-variables +auth: APIKey +auth-schemes: + APIKey: + header: X-FERN-API-KEY + type: string + env: FERN_API_KEY +headers: + X-Another-Header: + type: string + env: ANOTHER_ENV_VAR diff --git a/seed/postman/auth-environment-variables/.mock/definition/service.yml b/seed/postman/auth-environment-variables/.mock/definition/service.yml new file mode 100644 index 00000000000..9e5d595f4a2 --- /dev/null +++ b/seed/postman/auth-environment-variables/.mock/definition/service.yml @@ -0,0 +1,25 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +service: + auth: false + base-path: "" + endpoints: + getWithApiKey: + auth: true + docs: GET request with custom api key + path: /apiKey + method: GET + response: string + + getWithHeader: + docs: GET request with custom api key + path: /apiKeyInHeader + method: GET + request: + name: HeaderAuthRequest + headers: + X-Endpoint-Header: + docs: "Specifies the endpoint key." + type: string + env: MY_HEADER_ENV + response: string diff --git a/seed/postman/auth-environment-variables/.mock/fern.config.json b/seed/postman/auth-environment-variables/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/auth-environment-variables/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/basic-auth/.mock/definition/api.yml b/seed/postman/basic-auth/.mock/definition/api.yml new file mode 100644 index 00000000000..2d6df22f2d1 --- /dev/null +++ b/seed/postman/basic-auth/.mock/definition/api.yml @@ -0,0 +1,4 @@ +name: basic-auth +auth: basic +error-discrimination: + strategy: status-code diff --git a/seed/postman/basic-auth/.mock/definition/basic-auth.yml b/seed/postman/basic-auth/.mock/definition/basic-auth.yml new file mode 100644 index 00000000000..8a04bc9f070 --- /dev/null +++ b/seed/postman/basic-auth/.mock/definition/basic-auth.yml @@ -0,0 +1,35 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +imports: + errors: ./errors.yml + +service: + auth: false + base-path: "" + endpoints: + getWithBasicAuth: + auth: true + docs: GET request with basic auth scheme + path: /basic-auth + method: GET + response: + boolean + # headers: + # WWW-Authenticate: optional # Specifies which auth scheme to use if CustomAuthScheme was not applied + # body: + # success: boolean + errors: + - errors.UnauthorizedRequest + + postWithBasicAuth: + auth: true + docs: POST request with basic auth scheme + path: /basic-auth + method: POST + request: + name: PostWithBasicAuth + body: unknown + response: boolean + errors: + - errors.UnauthorizedRequest + - errors.BadRequest diff --git a/seed/postman/basic-auth/.mock/definition/errors.yml b/seed/postman/basic-auth/.mock/definition/errors.yml new file mode 100644 index 00000000000..cdd6a966703 --- /dev/null +++ b/seed/postman/basic-auth/.mock/definition/errors.yml @@ -0,0 +1,11 @@ +errors: + UnauthorizedRequest: + status-code: 401 + type: UnauthorizedRequestErrorBody + BadRequest: + status-code: 400 + +types: + UnauthorizedRequestErrorBody: + properties: + message: string diff --git a/seed/postman/basic-auth/.mock/fern.config.json b/seed/postman/basic-auth/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/basic-auth/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/bearer-token-environment-variable/.mock/definition/api.yml b/seed/postman/bearer-token-environment-variable/.mock/definition/api.yml new file mode 100644 index 00000000000..819d8807966 --- /dev/null +++ b/seed/postman/bearer-token-environment-variable/.mock/definition/api.yml @@ -0,0 +1,8 @@ +name: bearer-token-environment-variable +auth: Bearer +auth-schemes: + Bearer: + scheme: bearer + token: + name: apiKey + env: COURIER_API_KEY diff --git a/seed/postman/bearer-token-environment-variable/.mock/definition/service.yml b/seed/postman/bearer-token-environment-variable/.mock/definition/service.yml new file mode 100644 index 00000000000..d38a6ca2913 --- /dev/null +++ b/seed/postman/bearer-token-environment-variable/.mock/definition/service.yml @@ -0,0 +1,12 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +service: + auth: false + base-path: "" + endpoints: + getWithBearerToken: + auth: true + docs: GET request with custom api key + path: /apiKey + method: GET + response: string diff --git a/seed/postman/bearer-token-environment-variable/.mock/fern.config.json b/seed/postman/bearer-token-environment-variable/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/bearer-token-environment-variable/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/bytes/.mock/definition/api.yml b/seed/postman/bytes/.mock/definition/api.yml new file mode 100644 index 00000000000..cdfcf5be4a1 --- /dev/null +++ b/seed/postman/bytes/.mock/definition/api.yml @@ -0,0 +1 @@ +name: bytes diff --git a/seed/postman/bytes/.mock/definition/service.yml b/seed/postman/bytes/.mock/definition/service.yml new file mode 100644 index 00000000000..b0610fa616c --- /dev/null +++ b/seed/postman/bytes/.mock/definition/service.yml @@ -0,0 +1,10 @@ +service: + auth: false + base-path: "" + endpoints: + upload: + path: /upload-content + method: POST + request: + content-type: "application/octet-stream" + body: bytes diff --git a/seed/postman/bytes/.mock/fern.config.json b/seed/postman/bytes/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/bytes/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/circular-references-advanced/.mock/definition/__package__.yml b/seed/postman/circular-references-advanced/.mock/definition/__package__.yml new file mode 100644 index 00000000000..35979beb883 --- /dev/null +++ b/seed/postman/circular-references-advanced/.mock/definition/__package__.yml @@ -0,0 +1,13 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +imports: + a: a.yml + +types: + ImportingA: + properties: + a: optional + + RootType: + properties: + s: string diff --git a/seed/postman/circular-references-advanced/.mock/definition/a.yml b/seed/postman/circular-references-advanced/.mock/definition/a.yml new file mode 100644 index 00000000000..50553c25d2b --- /dev/null +++ b/seed/postman/circular-references-advanced/.mock/definition/a.yml @@ -0,0 +1,8 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +imports: + root: __package__.yml + +types: + A: + extends: root.RootType diff --git a/seed/postman/circular-references-advanced/.mock/definition/api.yml b/seed/postman/circular-references-advanced/.mock/definition/api.yml new file mode 100644 index 00000000000..9a8ae7d166b --- /dev/null +++ b/seed/postman/circular-references-advanced/.mock/definition/api.yml @@ -0,0 +1 @@ +name: api diff --git a/seed/postman/circular-references-advanced/.mock/definition/ast.yml b/seed/postman/circular-references-advanced/.mock/definition/ast.yml new file mode 100644 index 00000000000..c48c39070df --- /dev/null +++ b/seed/postman/circular-references-advanced/.mock/definition/ast.yml @@ -0,0 +1,23 @@ +types: + ContainerValue: + union: + list: list + optional: optional + PrimitiveValue: + enum: + - STRING + - NUMBER + ObjectValue: + properties: {} + FieldName: string + FieldValue: + union: + primitive_value: PrimitiveValue + object_value: ObjectValue + container_value: ContainerValue + ObjectFieldValue: + docs: This type allows us to test a circular reference with a union type (see FieldValue). + properties: + name: FieldName + value: FieldValue + diff --git a/seed/postman/circular-references-advanced/.mock/fern.config.json b/seed/postman/circular-references-advanced/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/circular-references-advanced/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/circular-references/.mock/definition/__package__.yml b/seed/postman/circular-references/.mock/definition/__package__.yml new file mode 100644 index 00000000000..35979beb883 --- /dev/null +++ b/seed/postman/circular-references/.mock/definition/__package__.yml @@ -0,0 +1,13 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +imports: + a: a.yml + +types: + ImportingA: + properties: + a: optional + + RootType: + properties: + s: string diff --git a/seed/postman/circular-references/.mock/definition/a.yml b/seed/postman/circular-references/.mock/definition/a.yml new file mode 100644 index 00000000000..50553c25d2b --- /dev/null +++ b/seed/postman/circular-references/.mock/definition/a.yml @@ -0,0 +1,8 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +imports: + root: __package__.yml + +types: + A: + extends: root.RootType diff --git a/seed/postman/circular-references/.mock/definition/api.yml b/seed/postman/circular-references/.mock/definition/api.yml new file mode 100644 index 00000000000..9a8ae7d166b --- /dev/null +++ b/seed/postman/circular-references/.mock/definition/api.yml @@ -0,0 +1 @@ +name: api diff --git a/seed/postman/circular-references/.mock/definition/ast.yml b/seed/postman/circular-references/.mock/definition/ast.yml new file mode 100644 index 00000000000..b6711dc9d68 --- /dev/null +++ b/seed/postman/circular-references/.mock/definition/ast.yml @@ -0,0 +1,16 @@ +types: + FieldValue: + union: + primitive_value: PrimitiveValue + object_value: ObjectValue + container_value: ContainerValue + ContainerValue: + union: + list: list + optional: optional + PrimitiveValue: + enum: + - STRING + - NUMBER + ObjectValue: + properties: {} diff --git a/seed/postman/circular-references/.mock/fern.config.json b/seed/postman/circular-references/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/circular-references/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/code-samples/.mock/definition/api.yml b/seed/postman/code-samples/.mock/definition/api.yml new file mode 100644 index 00000000000..be7bbb0492a --- /dev/null +++ b/seed/postman/code-samples/.mock/definition/api.yml @@ -0,0 +1,3 @@ +name: code-samples +error-discrimination: + strategy: status-code diff --git a/seed/postman/code-samples/.mock/definition/service.yml b/seed/postman/code-samples/.mock/definition/service.yml new file mode 100644 index 00000000000..a411feebe13 --- /dev/null +++ b/seed/postman/code-samples/.mock/definition/service.yml @@ -0,0 +1,43 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +types: + MyResponse: + properties: + id: string + name: optional + +service: + auth: false + base-path: "" + endpoints: + hello: + path: /hello + method: POST + request: + name: MyRequest + body: + properties: + num_events: integer + response: + type: MyResponse + examples: + - request: + num_events: 5 + response: + body: + id: "123" + name: "hello" + code-samples: + - name: curl + sdk: curl + code: | + curl -X POST "http://localhost:8080/hello" + -H "Content-Type: application/json" + -d '{"num_events": 5}' + - name: python + sdk: python + code: | + import requests + response = requests.post("http://localhost:8080/hello", json={"num_events": 5}) + print(response.json()) + diff --git a/seed/postman/code-samples/.mock/fern.config.json b/seed/postman/code-samples/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/code-samples/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/custom-auth/.mock/definition/api.yml b/seed/postman/custom-auth/.mock/definition/api.yml new file mode 100644 index 00000000000..1d61eeff283 --- /dev/null +++ b/seed/postman/custom-auth/.mock/definition/api.yml @@ -0,0 +1,8 @@ +name: custom-auth +auth: CustomAuthScheme +auth-schemes: + CustomAuthScheme: + header: X-API-KEY + type: string +error-discrimination: + strategy: status-code diff --git a/seed/postman/custom-auth/.mock/definition/custom-auth.yml b/seed/postman/custom-auth/.mock/definition/custom-auth.yml new file mode 100644 index 00000000000..de23674da02 --- /dev/null +++ b/seed/postman/custom-auth/.mock/definition/custom-auth.yml @@ -0,0 +1,30 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +imports: + errors: ./errors.yml + +service: + auth: false + base-path: "" + endpoints: + getWithCustomAuth: + auth: true + docs: GET request with custom auth scheme + path: /custom-auth + method: GET + response: boolean + errors: + - errors.UnauthorizedRequest + + postWithCustomAuth: + auth: true + docs: POST request with custom auth scheme + path: /custom-auth + method: POST + request: + name: PostWithCustomAuth + body: unknown + response: boolean + errors: + - errors.UnauthorizedRequest + - errors.BadRequest diff --git a/seed/postman/custom-auth/.mock/definition/errors.yml b/seed/postman/custom-auth/.mock/definition/errors.yml new file mode 100644 index 00000000000..cdd6a966703 --- /dev/null +++ b/seed/postman/custom-auth/.mock/definition/errors.yml @@ -0,0 +1,11 @@ +errors: + UnauthorizedRequest: + status-code: 401 + type: UnauthorizedRequestErrorBody + BadRequest: + status-code: 400 + +types: + UnauthorizedRequestErrorBody: + properties: + message: string diff --git a/seed/postman/custom-auth/.mock/fern.config.json b/seed/postman/custom-auth/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/custom-auth/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/enum/.mock/definition/__package__.yml b/seed/postman/enum/.mock/definition/__package__.yml new file mode 100644 index 00000000000..a72e076f94d --- /dev/null +++ b/seed/postman/enum/.mock/definition/__package__.yml @@ -0,0 +1,38 @@ +types: + Operand: + docs: | + Tests enum name and value can be + different. + enum: + - value: ">" + name: GREATER_THAN + - value: "=" + name: EQUAL_TO + - value: "less_than" + docs: | + The name and value should be similar + are similar for less than. + examples: + - name: GreaterThan + value: ">" + - name: LessThan + value: "less_than" + + Color: + enum: + - value: "red" + name: RED + - value: "blue" + name: BLUE + examples: + - name: Red + value: "red" + + ColorOrOperand: + discriminated: false + union: + - Color + - Operand + examples: + - name: Red + value: "red" diff --git a/seed/postman/enum/.mock/definition/api.yml b/seed/postman/enum/.mock/definition/api.yml new file mode 100644 index 00000000000..3e2ce7d17a8 --- /dev/null +++ b/seed/postman/enum/.mock/definition/api.yml @@ -0,0 +1 @@ +name: enum diff --git a/seed/postman/enum/.mock/definition/inlined-request.yml b/seed/postman/enum/.mock/definition/inlined-request.yml new file mode 100644 index 00000000000..f17deabdaaf --- /dev/null +++ b/seed/postman/enum/.mock/definition/inlined-request.yml @@ -0,0 +1,24 @@ +imports: + root: __package__.yml + +service: + auth: false + base-path: "" + endpoints: + send: + path: /inlined + method: POST + request: + name: SendEnumInlinedRequest + body: + properties: + operand: + type: root.Operand + maybeOperand: optional + operandOrColor: root.ColorOrOperand + maybeOperandOrColor: optional + examples: + - request: + operand: $root.Operand.GreaterThan + operandOrColor: $root.ColorOrOperand.Red + \ No newline at end of file diff --git a/seed/postman/enum/.mock/definition/path-param.yml b/seed/postman/enum/.mock/definition/path-param.yml new file mode 100644 index 00000000000..7553551fdc2 --- /dev/null +++ b/seed/postman/enum/.mock/definition/path-param.yml @@ -0,0 +1,21 @@ +imports: + root: __package__.yml + +service: + auth: false + base-path: "" + endpoints: + send: + path: /path/{operand}/{maybeOperand}/{operandOrColor}/{maybeOperandOrColor} + method: POST + path-parameters: + operand: root.Operand + maybeOperand: optional + operandOrColor: root.ColorOrOperand + maybeOperandOrColor: optional + examples: + - path-parameters: + operand: $root.Operand.GreaterThan + maybeOperand: $root.Operand.LessThan + operandOrColor: $root.ColorOrOperand.Red + maybeOperandOrColor: $root.ColorOrOperand.Red \ No newline at end of file diff --git a/seed/postman/enum/.mock/definition/query-param.yml b/seed/postman/enum/.mock/definition/query-param.yml new file mode 100644 index 00000000000..2b3724eba7e --- /dev/null +++ b/seed/postman/enum/.mock/definition/query-param.yml @@ -0,0 +1,40 @@ +imports: + root: __package__.yml + +service: + auth: false + base-path: "" + endpoints: + send: + path: /query + method: POST + request: + name: SendEnumAsQueryParamRequest + query-parameters: + operand: root.Operand + maybeOperand: optional + operandOrColor: root.ColorOrOperand + maybeOperandOrColor: optional + examples: + - query-parameters: + operand: $root.Operand.GreaterThan + operandOrColor: $root.ColorOrOperand.Red + + sendList: + path: /query-list + method: POST + request: + name: SendEnumListAsQueryParamRequest + query-parameters: + operand: + type: root.Operand + allow-multiple: true + maybeOperand: + type: optional + allow-multiple: true + operandOrColor: + type: root.ColorOrOperand + allow-multiple: true + maybeOperandOrColor: + type: optional + allow-multiple: true diff --git a/seed/postman/enum/.mock/fern.config.json b/seed/postman/enum/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/enum/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/error-property/.mock/definition/api.yml b/seed/postman/error-property/.mock/definition/api.yml new file mode 100644 index 00000000000..48a882c38b3 --- /dev/null +++ b/seed/postman/error-property/.mock/definition/api.yml @@ -0,0 +1,4 @@ +name: error-property +error-discrimination: + strategy: property + property-name: errorName diff --git a/seed/postman/error-property/.mock/definition/errors.yml b/seed/postman/error-property/.mock/definition/errors.yml new file mode 100644 index 00000000000..b700adf4582 --- /dev/null +++ b/seed/postman/error-property/.mock/definition/errors.yml @@ -0,0 +1,9 @@ +errors: + PropertyBasedErrorTest: #returns a JSON object with { ErrorName: PropertyBasedErrorTest, body: {PropertyBasedErrorTestBody}} + status-code: 400 + type: PropertyBasedErrorTestBody + +types: + PropertyBasedErrorTestBody: + properties: + message: string diff --git a/seed/postman/error-property/.mock/definition/property-based-error.yml b/seed/postman/error-property/.mock/definition/property-based-error.yml new file mode 100644 index 00000000000..dd93ae75fc0 --- /dev/null +++ b/seed/postman/error-property/.mock/definition/property-based-error.yml @@ -0,0 +1,18 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +#return an error no matter what for this endpoint so that the errorName can be confirmed + +imports: + errors: ./errors.yml + +service: + auth: false + base-path: "" + endpoints: + ThrowError: + docs: GET request that always throws an error + path: /property-based-error + method: GET + response: string + errors: + - errors.PropertyBasedErrorTest diff --git a/seed/postman/error-property/.mock/fern.config.json b/seed/postman/error-property/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/error-property/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/examples/.mock/definition/__package__.yml b/seed/postman/examples/.mock/definition/__package__.yml new file mode 100644 index 00000000000..4ae5b9fbd63 --- /dev/null +++ b/seed/postman/examples/.mock/definition/__package__.yml @@ -0,0 +1,13 @@ +service: + auth: false + base-path: / + endpoints: + echo: + method: POST + path: "" + request: string + response: string + examples: + - request: Hello world!\n\nwith\n\tnewlines + response: + body: Hello world!\n\nwith\n\tnewlines diff --git a/seed/postman/examples/.mock/definition/api.yml b/seed/postman/examples/.mock/definition/api.yml new file mode 100644 index 00000000000..3f3cb4540de --- /dev/null +++ b/seed/postman/examples/.mock/definition/api.yml @@ -0,0 +1,8 @@ +name: examples +auth: bearer +error-discrimination: + strategy: status-code +environments: + Production: https://production.com/api + Staging: https://staging.com/api +default-environment: null diff --git a/seed/postman/examples/.mock/definition/commons/types.yml b/seed/postman/examples/.mock/definition/commons/types.yml new file mode 100644 index 00000000000..33f95a4ab1b --- /dev/null +++ b/seed/postman/examples/.mock/definition/commons/types.yml @@ -0,0 +1,43 @@ +types: + Tag: + type: string + examples: + - name: One + value: tag-wf9as23d + + Metadata: + properties: + id: string + data: optional> + jsonString: optional + examples: + - name: One + value: + id: metadata-js8dg24b + data: + foo: bar + baz: qux + jsonString: '{"foo": "bar", "baz": "qux"}' + + EventInfo: + union: + metadata: Metadata + tag: Tag + examples: + - name: Metadata + value: + type: metadata + id: metadata-alskjfg8 + data: + one: two + jsonString: '{"one": "two"}' + + Data: + union: + string: string + base64: base64 + examples: + - name: String + value: + type: string + value: data diff --git a/seed/postman/examples/.mock/definition/file/notification/service.yml b/seed/postman/examples/.mock/definition/file/notification/service.yml new file mode 100644 index 00000000000..7f518565dcf --- /dev/null +++ b/seed/postman/examples/.mock/definition/file/notification/service.yml @@ -0,0 +1,18 @@ +imports: + types: ../../types.yml + +service: + auth: true + base-path: /file/notification/{notificationId} + path-parameters: + notificationId: string + endpoints: + getException: + method: GET + path: "" + response: types.Exception + examples: + - path-parameters: + notificationId: notification-hsy129x + response: + body: $types.Exception.One diff --git a/seed/postman/examples/.mock/definition/file/service.yml b/seed/postman/examples/.mock/definition/file/service.yml new file mode 100644 index 00000000000..349d80d6543 --- /dev/null +++ b/seed/postman/examples/.mock/definition/file/service.yml @@ -0,0 +1,37 @@ +imports: + types: ../types.yml + +types: + Filename: + type: string + examples: + - name: Example0 + value: file.txt + +service: + auth: true + base-path: /file + headers: + X-File-API-Version: string + endpoints: + getFile: + docs: "This endpoint returns a file by its name." + method: GET + path: /{filename} + path-parameters: + filename: + type: string + docs: This is a filename + request: + name: GetFileRequest + response: types.File + errors: + - types.NotFoundError + examples: + - path-parameters: + filename: $Filename.Example0 + headers: + X-File-API-Version: 0.0.2 + response: + error: types.NotFoundError + body: A file with that name was not found! diff --git a/seed/postman/examples/.mock/definition/health/service.yml b/seed/postman/examples/.mock/definition/health/service.yml new file mode 100644 index 00000000000..a3827e965ed --- /dev/null +++ b/seed/postman/examples/.mock/definition/health/service.yml @@ -0,0 +1,27 @@ +imports: + types: ../types.yml + +service: + auth: true + base-path: / + endpoints: + check: + docs: "This endpoint checks the health of a resource." + method: GET + path: /check/{id} + path-parameters: + id: + type: string + docs: The id to check + examples: + - path-parameters: + id: id-2sdx82h + + ping: + docs: "This endpoint checks the health of the service." + method: GET + path: /ping + response: boolean + examples: + - response: + body: true diff --git a/seed/postman/examples/.mock/definition/service.yml b/seed/postman/examples/.mock/definition/service.yml new file mode 100644 index 00000000000..0d7c67e4fcb --- /dev/null +++ b/seed/postman/examples/.mock/definition/service.yml @@ -0,0 +1,50 @@ +imports: + types: types.yml + +service: + auth: false + base-path: / + endpoints: + getMovie: + method: GET + path: /movie/{movieId} + path-parameters: + movieId: types.MovieId + response: types.Movie + examples: + - path-parameters: + movieId: $types.MovieId.One + response: + body: $types.Movie.One + + createMovie: + method: POST + path: /movie + request: types.Movie + response: types.MovieId + examples: + - request: $types.Movie.One + response: + body: $types.MovieId.One + + getMetadata: + method: GET + path: /metadata + request: + name: GetMetadataRequest + query-parameters: + shallow: optional + tag: + type: optional + allow-multiple: true + headers: + X-API-Version: string + response: types.Metadata + examples: + - query-parameters: + shallow: false + tag: development + headers: + X-API-Version: 0.0.1 + response: + body: $types.Metadata.One diff --git a/seed/postman/examples/.mock/definition/types.yml b/seed/postman/examples/.mock/definition/types.yml new file mode 100644 index 00000000000..2ccbbdc1e80 --- /dev/null +++ b/seed/postman/examples/.mock/definition/types.yml @@ -0,0 +1,272 @@ +imports: + commons: commons/types.yml + +errors: + NotFoundError: + status-code: 404 + type: string + +types: + MovieId: + type: string + examples: + - name: One + value: movie-c06a4ad7 + + Movie: + properties: + id: MovieId + prequel: optional + title: string + from: string + rating: + type: double + docs: The rating scale is one to five stars + type: literal<"movie"> + tag: commons.Tag + book: optional + metadata: map + examples: + - name: One + value: + id: $MovieId.One + prequel: "movie-cv9b914f" + title: The Boy and the Heron + from: Hayao Miyazaki + rating: 8.0 + type: movie + tag: $commons.Tag.One + metadata: + actors: + - Christian Bale + - Florence Pugh + - Willem Dafoe + releaseDate: "2023-12-08" + ratings: + rottenTomatoes: 97 + imdb: 7.6 + + CastMember: + discriminated: false + union: + - Actor + - Actress + - StuntDouble + examples: + - name: Example0 + value: + id: actor_123 + name: "Brad Pitt" + - name: Example1 + value: $Actress.Example0 + + Actor: + properties: + name: string + id: string + + Actress: + properties: + name: string + id: string + examples: + - name: Example0 + value: + name: Jennifer Lawrence + id: actor_456 + + StuntDouble: + properties: + name: string + actorOrActressId: string + + ExtendedMovie: + extends: Movie + properties: + cast: list + examples: + - value: + id: movie-sda231x + title: Pulp Fiction + from: Quentin Tarantino + rating: 8.5 + type: movie + tag: tag-12efs9dv + cast: + - John Travolta + - Samuel L. Jackson + - Uma Thurman + - Bruce Willis + metadata: + academyAward: true + releaseDate: "2023-12-08" + ratings: + rottenTomatoes: 97 + imdb: 7.6 + + Moment: + properties: + id: uuid + date: date + datetime: datetime + examples: + - value: + id: 656f12d6-f592-444c-a1d3-a3cfd46d5b39 + date: 1994-01-01 + datetime: 1994-01-01T01:01:01Z + + File: + properties: + name: string + contents: string + examples: + - name: One + value: + name: file.txt + contents: ... + - name: Two + value: + name: another_file.txt + contents: ... + + Directory: + properties: + name: string + files: optional> + directories: optional> + examples: + - name: One + value: + name: root + files: + - $File.One + directories: + - name: tmp + files: + - $File.Two + + Node: + properties: + name: string + nodes: optional> + trees: optional> + examples: + - name: Tree + value: + name: root + nodes: + - $Node.Left + - $Node.Right + trees: + - $Tree.Root + - name: Left + value: + name: left + - name: Right + value: + name: right + + Tree: + properties: + nodes: optional> + examples: + - name: Root + value: + nodes: + - $Node.Left + - $Node.Right + + Metadata: + base-properties: + extra: map + tags: set + union: + html: string + markdown: string + examples: + - name: One + value: + type: html + extra: + version: 0.0.1 + tenancy: test + tags: + - development + - public + value: ... + + Exception: + union: + generic: ExceptionInfo + timeout: {} + examples: + - name: One + value: + type: generic + exceptionType: Unavailable + exceptionMessage: This component is unavailable! + exceptionStacktrace: + + ExceptionInfo: + properties: + exceptionType: string + exceptionMessage: string + exceptionStacktrace: string + examples: + - name: One + value: + exceptionType: Unavailable + exceptionMessage: This component is unavailable! + exceptionStacktrace: + + MigrationStatus: + enum: + - value: RUNNING + docs: The migration is running. + - value: FAILED + docs: The migration failed. + - FINISHED + examples: + - name: Running + value: RUNNING + - name: Failed + value: FAILED + + Migration: + properties: + name: string + status: MigrationStatus + examples: + - value: + name: 001_init + status: $MigrationStatus.Running + + Request: + properties: + request: unknown + examples: + - name: Empty + value: + request: {} + + Response: + properties: + response: unknown + examples: + - name: String + value: + response: "Initializing..." + + Test: + union: + and: boolean + or: boolean + examples: + - name: And + value: + type: and + value: true + - name: Or + value: + type: or + value: true diff --git a/seed/postman/examples/.mock/fern.config.json b/seed/postman/examples/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/examples/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/exhaustive/.mock/definition/api.yml b/seed/postman/exhaustive/.mock/definition/api.yml new file mode 100644 index 00000000000..dd65915538f --- /dev/null +++ b/seed/postman/exhaustive/.mock/definition/api.yml @@ -0,0 +1,4 @@ +name: exhaustive +auth: bearer +error-discrimination: + strategy: status-code diff --git a/seed/postman/exhaustive/.mock/definition/endpoints/container.yml b/seed/postman/exhaustive/.mock/definition/endpoints/container.yml new file mode 100644 index 00000000000..165a039dc65 --- /dev/null +++ b/seed/postman/exhaustive/.mock/definition/endpoints/container.yml @@ -0,0 +1,48 @@ +imports: + objects: ../types/object.yml + +service: + auth: true + base-path: /container + endpoints: + getAndReturnListOfPrimitives: + path: /list-of-primitives + method: POST + request: list + response: list + + getAndReturnListOfObjects: + path: /list-of-objects + method: POST + request: list + response: list + + getAndReturnSetOfPrimitives: + path: /set-of-primitives + method: POST + request: set + response: set + + getAndReturnSetOfObjects: + path: /set-of-objects + method: POST + request: set + response: set + + getAndReturnMapPrimToPrim: + path: /map-prim-to-prim + method: POST + request: map + response: map + + getAndReturnMapOfPrimToObject: + path: /map-prim-to-object + method: POST + request: map + response: map + + getAndReturnOptional: + path: /opt-objects + method: POST + request: optional + response: optional diff --git a/seed/postman/exhaustive/.mock/definition/endpoints/enum.yml b/seed/postman/exhaustive/.mock/definition/endpoints/enum.yml new file mode 100644 index 00000000000..335a0889cc7 --- /dev/null +++ b/seed/postman/exhaustive/.mock/definition/endpoints/enum.yml @@ -0,0 +1,12 @@ +imports: + enums: ../types/enum.yml + +service: + auth: true + base-path: /enum + endpoints: + getAndReturnEnum: + method: POST + path: "" + request: enums.WeatherReport + response: enums.WeatherReport diff --git a/seed/postman/exhaustive/.mock/definition/endpoints/http-methods.yml b/seed/postman/exhaustive/.mock/definition/endpoints/http-methods.yml new file mode 100644 index 00000000000..51a54c0802c --- /dev/null +++ b/seed/postman/exhaustive/.mock/definition/endpoints/http-methods.yml @@ -0,0 +1,43 @@ +imports: + objects: ../types/object.yml + +service: + auth: true + base-path: /http-methods + + endpoints: + testGet: + method: GET + path: /{id} + path-parameters: + id: string + response: string + + testPost: + method: POST + path: "" + request: objects.ObjectWithRequiredField + response: objects.ObjectWithOptionalField + + testPut: + method: PUT + path: /{id} + path-parameters: + id: string + request: objects.ObjectWithRequiredField + response: objects.ObjectWithOptionalField + + testPatch: + method: PATCH + path: /{id} + path-parameters: + id: string + request: objects.ObjectWithOptionalField + response: objects.ObjectWithOptionalField + + testDelete: + method: DELETE + path: /{id} + path-parameters: + id: string + response: boolean diff --git a/seed/postman/exhaustive/.mock/definition/endpoints/object.yml b/seed/postman/exhaustive/.mock/definition/endpoints/object.yml new file mode 100644 index 00000000000..313f08cede4 --- /dev/null +++ b/seed/postman/exhaustive/.mock/definition/endpoints/object.yml @@ -0,0 +1,42 @@ +imports: + objects: ../types/object.yml + +service: + auth: true + base-path: /object + endpoints: + getAndReturnWithOptionalField: + path: /get-and-return-with-optional-field + method: POST + request: objects.ObjectWithOptionalField + response: objects.ObjectWithOptionalField + + getAndReturnWithRequiredField: + path: /get-and-return-with-required-field + method: POST + request: objects.ObjectWithRequiredField + response: objects.ObjectWithRequiredField + + getAndReturnWithMapOfMap: + path: /get-and-return-with-map-of-map + method: POST + request: objects.ObjectWithMapOfMap + response: objects.ObjectWithMapOfMap + + getAndReturnNestedWithOptionalField: + path: /get-and-return-nested-with-optional-field + method: POST + request: objects.NestedObjectWithOptionalField + response: objects.NestedObjectWithOptionalField + + getAndReturnNestedWithRequiredField: + path: /get-and-return-nested-with-required-field + method: POST + request: objects.NestedObjectWithRequiredField + response: objects.NestedObjectWithRequiredField + + getAndReturnNestedWithRequiredFieldAsList: + path: /get-and-return-nested-with-required-field-list + method: POST + request: list + response: objects.NestedObjectWithRequiredField diff --git a/seed/postman/exhaustive/.mock/definition/endpoints/params.yml b/seed/postman/exhaustive/.mock/definition/endpoints/params.yml new file mode 100644 index 00000000000..7766547ad79 --- /dev/null +++ b/seed/postman/exhaustive/.mock/definition/endpoints/params.yml @@ -0,0 +1,57 @@ +service: + auth: true + base-path: /params + endpoints: + getWithPath: + docs: GET with path param + path: /path/{param} + path-parameters: + param: string + method: GET + response: string + + getWithQuery: + docs: GET with query param + path: "" + method: GET + request: + name: GetWithQuery + query-parameters: + query: string #mandatory for test + number: integer + + getWithAllowMultipleQuery: + docs: GET with multiple of same query param + path: "" + method: GET + request: + name: GetWithMultipleQuery + query-parameters: + query: + type: string + allow-multiple: true + numer: + type: integer + allow-multiple: true + + getWithPathAndQuery: + docs: GET with path and query params + path: /path-query/{param} + path-parameters: + param: string + method: GET + request: + name: GetWithPathAndQuery + query-parameters: + query: string #mandatory for test + + modifyWithPath: + docs: PUT to update with path param + path: /path/{param} + path-parameters: + param: string + method: PUT + request: + name: ModifyResourceAtPath + body: string + response: string diff --git a/seed/postman/exhaustive/.mock/definition/endpoints/primitive.yml b/seed/postman/exhaustive/.mock/definition/endpoints/primitive.yml new file mode 100644 index 00000000000..8dd7674164c --- /dev/null +++ b/seed/postman/exhaustive/.mock/definition/endpoints/primitive.yml @@ -0,0 +1,60 @@ +imports: + objects: ../types/object.yml + +service: + auth: true + base-path: /primitive + endpoints: + getAndReturnString: + path: /string + method: POST + request: string + response: string + + getAndReturnInt: + path: /integer + method: POST + request: integer + response: integer + + getAndReturnLong: + path: /long + method: POST + request: long + response: long + + getAndReturnDouble: + path: /double + method: POST + request: double + response: double + + getAndReturnBool: + path: /boolean + method: POST + request: boolean + response: boolean + + getAndReturnDatetime: + path: /datetime + method: POST + request: datetime + response: datetime + + getAndReturnDate: + path: /date + method: POST + request: date + response: date + + getAndReturnUUID: + path: /uuid + method: POST + request: uuid + response: uuid + + getAndReturnBase64: + path: /base64 + method: POST + request: base64 + response: base64 diff --git a/seed/postman/exhaustive/.mock/definition/endpoints/union.yml b/seed/postman/exhaustive/.mock/definition/endpoints/union.yml new file mode 100644 index 00000000000..ce9021160d7 --- /dev/null +++ b/seed/postman/exhaustive/.mock/definition/endpoints/union.yml @@ -0,0 +1,12 @@ +imports: + unions: ../types/union.yml + +service: + auth: true + base-path: /union + endpoints: + getAndReturnUnion: + method: POST + path: "" + request: unions.Animal + response: unions.Animal diff --git a/seed/postman/exhaustive/.mock/definition/general-errors.yml b/seed/postman/exhaustive/.mock/definition/general-errors.yml new file mode 100644 index 00000000000..5fbf9cfc417 --- /dev/null +++ b/seed/postman/exhaustive/.mock/definition/general-errors.yml @@ -0,0 +1,9 @@ +errors: + BadRequestBody: + status-code: 400 + type: BadObjectRequestInfo + +types: + BadObjectRequestInfo: + properties: + message: string diff --git a/seed/postman/exhaustive/.mock/definition/inlined-requests.yml b/seed/postman/exhaustive/.mock/definition/inlined-requests.yml new file mode 100644 index 00000000000..9347fe7e335 --- /dev/null +++ b/seed/postman/exhaustive/.mock/definition/inlined-requests.yml @@ -0,0 +1,25 @@ +imports: + objects: ./types/object.yml + errors: ./general-errors.yml + +# test req bodies, path params, query params, multiple query params, etc. +# test union and enum as well + +service: + auth: false + base-path: /req-bodies + endpoints: + postWithObjectBodyandResponse: + docs: POST with custom object in request body, response is an object + path: /object + method: POST + request: + name: PostWithObjectBody + body: + properties: + string: string + integer: integer + NestedObject: objects.ObjectWithOptionalField + response: objects.ObjectWithOptionalField + errors: + - errors.BadRequestBody diff --git a/seed/postman/exhaustive/.mock/definition/no-auth.yml b/seed/postman/exhaustive/.mock/definition/no-auth.yml new file mode 100644 index 00000000000..e3c33ed7fab --- /dev/null +++ b/seed/postman/exhaustive/.mock/definition/no-auth.yml @@ -0,0 +1,20 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +imports: + general-errors: ./general-errors.yml + +service: + auth: false + base-path: /no-auth + endpoints: + postWithNoAuth: + auth: false + docs: POST request with no auth + path: "" + method: POST + request: + name: PostWithNoAuth + body: unknown + response: boolean + errors: + - general-errors.BadRequestBody diff --git a/seed/postman/exhaustive/.mock/definition/no-req-body.yml b/seed/postman/exhaustive/.mock/definition/no-req-body.yml new file mode 100644 index 00000000000..daffd9a495c --- /dev/null +++ b/seed/postman/exhaustive/.mock/definition/no-req-body.yml @@ -0,0 +1,16 @@ +imports: + objects: ./types/object.yml + +service: + auth: true + base-path: /no-req-body + endpoints: + getWithNoRequestBody: + path: "" + method: GET + response: objects.ObjectWithOptionalField + + postWithNoRequestBody: + path: "" + method: POST + response: string diff --git a/seed/postman/exhaustive/.mock/definition/req-with-headers.yml b/seed/postman/exhaustive/.mock/definition/req-with-headers.yml new file mode 100644 index 00000000000..9e49725782f --- /dev/null +++ b/seed/postman/exhaustive/.mock/definition/req-with-headers.yml @@ -0,0 +1,14 @@ +service: + base-path: /test-headers + auth: true + headers: + X-TEST-SERVICE-HEADER: string + endpoints: + getWithCustomHeader: + path: /custom-header + method: POST + request: + name: ReqWithHeaders + headers: + X-TEST-ENDPOINT-HEADER: string + body: string diff --git a/seed/postman/exhaustive/.mock/definition/types/enum.yml b/seed/postman/exhaustive/.mock/definition/types/enum.yml new file mode 100644 index 00000000000..a90686092e9 --- /dev/null +++ b/seed/postman/exhaustive/.mock/definition/types/enum.yml @@ -0,0 +1,12 @@ +types: + WeatherReport: + enum: + - SUNNY + - CLOUDY + - RAINING + - SNOWING + +errors: + ErrorWithEnumBody: + status-code: 400 + type: WeatherReport #does this even make sense? the type of the error body would be enum, and it could only be one of the 4 values? diff --git a/seed/postman/exhaustive/.mock/definition/types/object.yml b/seed/postman/exhaustive/.mock/definition/types/object.yml new file mode 100644 index 00000000000..b4ac4c13534 --- /dev/null +++ b/seed/postman/exhaustive/.mock/definition/types/object.yml @@ -0,0 +1,50 @@ +types: + ObjectWithOptionalField: #generic object that supports any type, makes it easier to use when testing + properties: + string: optional + integer: optional + long: optional + double: optional + bool: optional + datetime: optional + date: optional + uuid: optional + base64: optional + list: optional> + set: optional> + map: optional> + + ObjectWithRequiredField: + properties: + string: string + + ObjectWithMapOfMap: + properties: + map: map> + + NestedObjectWithOptionalField: + properties: + string: optional + NestedObject: optional + + NestedObjectWithRequiredField: + properties: + string: string + NestedObject: ObjectWithOptionalField + +errors: + ObjectWithOptionalFieldError: + status-code: 400 + type: ObjectWithOptionalField + + ObjectWithRequiredFieldError: + status-code: 400 + type: ObjectWithRequiredField + + NestedObjectWithOptionalFieldError: + status-code: 400 + type: NestedObjectWithOptionalField + + NestedObjectWithRequiredFieldError: + status-code: 400 + type: NestedObjectWithRequiredField diff --git a/seed/postman/exhaustive/.mock/definition/types/union.yml b/seed/postman/exhaustive/.mock/definition/types/union.yml new file mode 100644 index 00000000000..99ce8c75ed0 --- /dev/null +++ b/seed/postman/exhaustive/.mock/definition/types/union.yml @@ -0,0 +1,21 @@ +types: + Animal: + discriminant: animal + union: + dog: Dog + cat: Cat + + Dog: + properties: + name: string + likesToWoof: boolean + + Cat: + properties: + name: string + likesToMeow: boolean + +errors: + ErrorWithUnionBody: + status-code: 400 + type: Animal #has to send either dog or cat object in error body diff --git a/seed/postman/exhaustive/.mock/fern.config.json b/seed/postman/exhaustive/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/exhaustive/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/extends/.mock/definition/__package__.yml b/seed/postman/extends/.mock/definition/__package__.yml new file mode 100644 index 00000000000..db2aecdbf86 --- /dev/null +++ b/seed/postman/extends/.mock/definition/__package__.yml @@ -0,0 +1,39 @@ +types: + ExampleType: + extends: Docs + properties: + name: string + examples: + - name: One + value: + docs: This is an example type. + name: Example + + NestedType: + extends: JSON + properties: + name: string + examples: + - name: One + value: + docs: This is an example nested type. + name: NestedExample + raw: '{"nested": "example"}' + + Docs: + properties: + docs: string + examples: + - name: One + value: + docs: Types extend this type to include a docs property. + + JSON: + extends: Docs + properties: + raw: string + examples: + - name: One + value: + docs: Types extend this type to include a docs and json property. + raw: '{"docs": true, "json": true}' diff --git a/seed/postman/extends/.mock/definition/api.yml b/seed/postman/extends/.mock/definition/api.yml new file mode 100644 index 00000000000..3d8c3b68e2d --- /dev/null +++ b/seed/postman/extends/.mock/definition/api.yml @@ -0,0 +1 @@ +name: extends diff --git a/seed/postman/extends/.mock/fern.config.json b/seed/postman/extends/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/extends/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/file-download/.mock/definition/api.yml b/seed/postman/file-download/.mock/definition/api.yml new file mode 100644 index 00000000000..567ec30f014 --- /dev/null +++ b/seed/postman/file-download/.mock/definition/api.yml @@ -0,0 +1 @@ +name: file-download diff --git a/seed/postman/file-download/.mock/definition/service.yml b/seed/postman/file-download/.mock/definition/service.yml new file mode 100644 index 00000000000..0742fce9edb --- /dev/null +++ b/seed/postman/file-download/.mock/definition/service.yml @@ -0,0 +1,8 @@ +service: + auth: false + base-path: / + endpoints: + downloadFile: + path: "" + method: POST + response: file diff --git a/seed/postman/file-download/.mock/fern.config.json b/seed/postman/file-download/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/file-download/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/file-upload/.mock/definition/api.yml b/seed/postman/file-upload/.mock/definition/api.yml new file mode 100644 index 00000000000..b7f420003fb --- /dev/null +++ b/seed/postman/file-upload/.mock/definition/api.yml @@ -0,0 +1 @@ +name: file-upload diff --git a/seed/postman/file-upload/.mock/definition/service.yml b/seed/postman/file-upload/.mock/definition/service.yml new file mode 100644 index 00000000000..d8741d2235b --- /dev/null +++ b/seed/postman/file-upload/.mock/definition/service.yml @@ -0,0 +1,54 @@ +service: + auth: false + base-path: / + endpoints: + post: + path: "" + method: POST + request: + name: MyRequest + body: + properties: + maybeString: optional + integer: integer + file: file + fileList: list + maybeFile: optional + maybeFileList: optional> + maybeInteger: optional + optionalListOfStrings: optional> + listOfObjects: list + + justFile: + path: /just-file + method: POST + request: + name: JustFileRequet + body: + properties: + file: file + + justFileWithQueryParams: + path: /just-file-with-query-params + method: POST + request: + name: JustFileWithQueryParamsRequet + query-parameters: + maybeString: optional + integer: integer + maybeInteger: optional + listOfStrings: + type: string + allow-multiple: true + optionalListOfStrings: + type: optional + allow-multiple: true + body: + properties: + file: file + +types: + + MyObject: + properties: + foo: string diff --git a/seed/postman/file-upload/.mock/fern.config.json b/seed/postman/file-upload/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/file-upload/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/folders/.mock/definition/__package__.yml b/seed/postman/folders/.mock/definition/__package__.yml new file mode 100644 index 00000000000..e94d9e8e75a --- /dev/null +++ b/seed/postman/folders/.mock/definition/__package__.yml @@ -0,0 +1,7 @@ +service: + base-path: / + auth: false + endpoints: + foo: + method: POST + path: "" diff --git a/seed/postman/folders/.mock/definition/a/b/__package__.yml b/seed/postman/folders/.mock/definition/a/b/__package__.yml new file mode 100644 index 00000000000..e94d9e8e75a --- /dev/null +++ b/seed/postman/folders/.mock/definition/a/b/__package__.yml @@ -0,0 +1,7 @@ +service: + base-path: / + auth: false + endpoints: + foo: + method: POST + path: "" diff --git a/seed/postman/folders/.mock/definition/a/c/__package__.yml b/seed/postman/folders/.mock/definition/a/c/__package__.yml new file mode 100644 index 00000000000..e94d9e8e75a --- /dev/null +++ b/seed/postman/folders/.mock/definition/a/c/__package__.yml @@ -0,0 +1,7 @@ +service: + base-path: / + auth: false + endpoints: + foo: + method: POST + path: "" diff --git a/seed/postman/folders/.mock/definition/a/d/types.yml b/seed/postman/folders/.mock/definition/a/d/types.yml new file mode 100644 index 00000000000..10d0cf8713d --- /dev/null +++ b/seed/postman/folders/.mock/definition/a/d/types.yml @@ -0,0 +1,2 @@ +types: + Foo: string diff --git a/seed/postman/folders/.mock/definition/api.yml b/seed/postman/folders/.mock/definition/api.yml new file mode 100644 index 00000000000..9888645c477 --- /dev/null +++ b/seed/postman/folders/.mock/definition/api.yml @@ -0,0 +1,4 @@ +name: api + +error-discrimination: + strategy: status-code diff --git a/seed/postman/folders/.mock/definition/folder/__package__.yml b/seed/postman/folders/.mock/definition/folder/__package__.yml new file mode 100644 index 00000000000..e94d9e8e75a --- /dev/null +++ b/seed/postman/folders/.mock/definition/folder/__package__.yml @@ -0,0 +1,7 @@ +service: + base-path: / + auth: false + endpoints: + foo: + method: POST + path: "" diff --git a/seed/postman/folders/.mock/definition/folder/service.yml b/seed/postman/folders/.mock/definition/folder/service.yml new file mode 100644 index 00000000000..8c8a291592d --- /dev/null +++ b/seed/postman/folders/.mock/definition/folder/service.yml @@ -0,0 +1,17 @@ +service: + base-path: /service + auth: false + endpoints: + endpoint: + method: GET + path: "" + unknownRequest: + method: POST + path: "" + request: unknown + errors: + - NotFoundError +errors: + NotFoundError: + status-code: 404 + type: string diff --git a/seed/postman/folders/.mock/fern.config.json b/seed/postman/folders/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/folders/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/idempotency-headers/.mock/definition/api.yml b/seed/postman/idempotency-headers/.mock/definition/api.yml new file mode 100644 index 00000000000..7fbd5ce078b --- /dev/null +++ b/seed/postman/idempotency-headers/.mock/definition/api.yml @@ -0,0 +1,5 @@ +name: idempotency-headers +auth: bearer +idempotency-headers: + Idempotency-Key: string + Idempotency-Expiration: integer diff --git a/seed/postman/idempotency-headers/.mock/definition/payment.yml b/seed/postman/idempotency-headers/.mock/definition/payment.yml new file mode 100644 index 00000000000..d8eb6950460 --- /dev/null +++ b/seed/postman/idempotency-headers/.mock/definition/payment.yml @@ -0,0 +1,27 @@ +types: + Currency: + enum: + - USD + - YEN + +service: + auth: true + base-path: /payment + endpoints: + create: + method: POST + path: "" + idempotent: true + request: + name: CreatePaymentRequest + body: + properties: + amount: integer + currency: Currency + response: uuid + + delete: + method: DELETE + path: /{paymentId} + path-parameters: + paymentId: string diff --git a/seed/postman/idempotency-headers/.mock/fern.config.json b/seed/postman/idempotency-headers/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/idempotency-headers/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/imdb/.mock/definition/api.yml b/seed/postman/imdb/.mock/definition/api.yml new file mode 100644 index 00000000000..c437dc0ab29 --- /dev/null +++ b/seed/postman/imdb/.mock/definition/api.yml @@ -0,0 +1,4 @@ +name: api +error-discrimination: + strategy: status-code +auth: bearer diff --git a/seed/postman/imdb/.mock/definition/imdb.yml b/seed/postman/imdb/.mock/definition/imdb.yml new file mode 100644 index 00000000000..beb6df4b7b3 --- /dev/null +++ b/seed/postman/imdb/.mock/definition/imdb.yml @@ -0,0 +1,40 @@ +types: + MovieId: string + + Movie: + properties: + id: MovieId + title: string + rating: + type: double + docs: The rating scale is one to five stars + + CreateMovieRequest: + properties: + title: string + rating: double + +service: + auth: false + base-path: /movies + endpoints: + createMovie: + docs: Add a movie to the database + method: POST + path: /create-movie + request: CreateMovieRequest + response: MovieId + + getMovie: + method: GET + path: /{movieId} + path-parameters: + movieId: MovieId + response: Movie + errors: + - MovieDoesNotExistError + +errors: + MovieDoesNotExistError: + status-code: 404 + type: MovieId diff --git a/seed/postman/imdb/.mock/fern.config.json b/seed/postman/imdb/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/imdb/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/literal/.mock/definition/__package__.yml b/seed/postman/literal/.mock/definition/__package__.yml new file mode 100644 index 00000000000..9247629c4d5 --- /dev/null +++ b/seed/postman/literal/.mock/definition/__package__.yml @@ -0,0 +1,10 @@ +types: + SendResponse: + properties: + message: + type: string + status: + type: integer + success: + type: literal + \ No newline at end of file diff --git a/seed/postman/literal/.mock/definition/api.yml b/seed/postman/literal/.mock/definition/api.yml new file mode 100644 index 00000000000..d3b137fcece --- /dev/null +++ b/seed/postman/literal/.mock/definition/api.yml @@ -0,0 +1,10 @@ +name: literal +docs: | + Test definition for literal schemas. +headers: + X-API-Version: + name: version + type: literal<"02-02-2024"> + X-API-Enable-Audit-Logging: + name: audit_logging + type: literal \ No newline at end of file diff --git a/seed/postman/literal/.mock/definition/headers.yml b/seed/postman/literal/.mock/definition/headers.yml new file mode 100644 index 00000000000..1b7e148d61a --- /dev/null +++ b/seed/postman/literal/.mock/definition/headers.yml @@ -0,0 +1,36 @@ +imports: + root: __package__.yml + +service: + auth: false + base-path: "" + endpoints: + send: + path: /headers + method: POST + request: + name: SendLiteralsInHeadersRequest + headers: + X-Endpoint-Version: + name: endpointVersion + type: literal<"02-12-2024"> + X-Async: + name: async + type: literal + body: + properties: + query: + type: string + response: root.SendResponse + examples: + - headers: + X-Endpoint-Version: "02-12-2024" + X-Async: true + request: + query: "What is the weather today" + response: + body: + message: "The weather is sunny" + status: 200 + success: true + \ No newline at end of file diff --git a/seed/postman/literal/.mock/definition/inlined.yml b/seed/postman/literal/.mock/definition/inlined.yml new file mode 100644 index 00000000000..fabd894a7fd --- /dev/null +++ b/seed/postman/literal/.mock/definition/inlined.yml @@ -0,0 +1,31 @@ +imports: + root: __package__.yml + +service: + auth: false + base-path: "" + endpoints: + send: + path: /inlined + method: POST + request: + name: SendLiteralsInlinedRequest + body: + properties: + prompt: literal<"You are a helpful assistant"> + query: string + temperature: optional + stream: literal + response: root.SendResponse + examples: + - request: + temperature: 10.1 + prompt: "You are a helpful assistant" + stream: false + query: "What is the weather today" + response: + body: + message: "The weather is sunny" + status: 200 + success: true + \ No newline at end of file diff --git a/seed/postman/literal/.mock/definition/path.yml b/seed/postman/literal/.mock/definition/path.yml new file mode 100644 index 00000000000..236d8744417 --- /dev/null +++ b/seed/postman/literal/.mock/definition/path.yml @@ -0,0 +1,22 @@ +imports: + root: __package__.yml + +service: + auth: false + base-path: "" + endpoints: + send: + path: /path/{id} + method: POST + path-parameters: + id: literal<"123"> + response: root.SendResponse + examples: + - path-parameters: + id: "123" + response: + body: + message: "The weather is sunny" + status: 200 + success: true + \ No newline at end of file diff --git a/seed/postman/literal/.mock/definition/query.yml b/seed/postman/literal/.mock/definition/query.yml new file mode 100644 index 00000000000..9d6cec5ad8e --- /dev/null +++ b/seed/postman/literal/.mock/definition/query.yml @@ -0,0 +1,28 @@ +imports: + root: __package__.yml + +service: + auth: false + base-path: "" + endpoints: + send: + path: /query + method: POST + request: + name: SendLiteralsInQueryRequest + query-parameters: + prompt: literal<"You are a helpful assistant"> + query: string + stream: literal + response: root.SendResponse + examples: + - query-parameters: + prompt: "You are a helpful assistant" + stream: false + query: "What is the weather today" + response: + body: + message: "The weather is sunny" + status: 200 + success: true + \ No newline at end of file diff --git a/seed/postman/literal/.mock/definition/reference.yml b/seed/postman/literal/.mock/definition/reference.yml new file mode 100644 index 00000000000..c8494da24f0 --- /dev/null +++ b/seed/postman/literal/.mock/definition/reference.yml @@ -0,0 +1,30 @@ +imports: + root: __package__.yml + +types: + SendRequest: + properties: + prompt: literal<"You are a helpful assistant"> + query: string + stream: literal + +service: + auth: false + base-path: "" + endpoints: + send: + path: /reference + method: POST + request: SendRequest + response: root.SendResponse + examples: + - request: + prompt: "You are a helpful assistant" + stream: false + query: "What is the weather today" + response: + body: + message: "The weather is sunny" + status: 200 + success: true + \ No newline at end of file diff --git a/seed/postman/literal/.mock/fern.config.json b/seed/postman/literal/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/literal/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/mixed-case/.mock/definition/api.yml b/seed/postman/mixed-case/.mock/definition/api.yml new file mode 100644 index 00000000000..cf9d2078f7f --- /dev/null +++ b/seed/postman/mixed-case/.mock/definition/api.yml @@ -0,0 +1 @@ +name: mixed-case \ No newline at end of file diff --git a/seed/postman/mixed-case/.mock/definition/service.yml b/seed/postman/mixed-case/.mock/definition/service.yml new file mode 100644 index 00000000000..5991572a42f --- /dev/null +++ b/seed/postman/mixed-case/.mock/definition/service.yml @@ -0,0 +1,115 @@ +types: + Organization: + properties: + name: string + examples: + - name: One + value: + name: orgName + + User: + properties: + userName: string + metadata_tags: list + EXTRA_PROPERTIES: map + examples: + - name: One + value: + userName: username + metadata_tags: + - tag1 + - tag2 + EXTRA_PROPERTIES: + foo: bar + baz: qux + + NestedUser: + properties: + Name: string + NestedUser: User + examples: + - name: One + value: + Name: username + NestedUser: + userName: nestedUsername + metadata_tags: + - tag1 + - tag2 + EXTRA_PROPERTIES: + foo: bar + baz: qux + + ResourceStatus: + enum: + - ACTIVE + - INACTIVE + + Resource: + discriminant: + value: resource_type + name: resourceType + base-properties: + status: ResourceStatus + union: + user: User + Organization: Organization + examples: + - value: + resource_type: user + userName: username + metadata_tags: + - tag1 + - tag2 + EXTRA_PROPERTIES: + foo: bar + baz: qux + +service: + base-path: /resource + auth: false + endpoints: + getResource: + path: "/{ResourceID}" + method: GET + path-parameters: + ResourceID: string + response: Resource + examples: + - path-parameters: + ResourceID: "rsc-xyz" + response: + body: + resource_type: user + userName: username + metadata_tags: + - tag1 + - tag2 + EXTRA_PROPERTIES: + foo: bar + baz: qux + + listResources: + path: "" + method: GET + request: + name: ListResourcesRequest + query-parameters: + page_limit: integer + beforeDate: date + response: list + examples: + - name: One + query-parameters: + page_limit: 10 + beforeDate: "2023-01-01" + response: + body: + - resource_type: user + userName: username + metadata_tags: + - tag1 + - tag2 + EXTRA_PROPERTIES: + foo: bar + baz: qux diff --git a/seed/postman/mixed-case/.mock/fern.config.json b/seed/postman/mixed-case/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/mixed-case/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/multi-url-environment/.mock/definition/api.yml b/seed/postman/multi-url-environment/.mock/definition/api.yml new file mode 100644 index 00000000000..f362d991927 --- /dev/null +++ b/seed/postman/multi-url-environment/.mock/definition/api.yml @@ -0,0 +1,14 @@ +name: multi-url-environment +auth: bearer +environments: + Production: + urls: + ec2: https://ec2.aws.com + s3: https://s3.aws.com + Staging: + urls: + ec2: https://staging.ec2.aws.com + s3: https://staging.s3.aws.com +default-environment: Production +error-discrimination: + strategy: status-code diff --git a/seed/postman/multi-url-environment/.mock/definition/ec2.yml b/seed/postman/multi-url-environment/.mock/definition/ec2.yml new file mode 100644 index 00000000000..a3acc4216ff --- /dev/null +++ b/seed/postman/multi-url-environment/.mock/definition/ec2.yml @@ -0,0 +1,16 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +service: + auth: true + url: ec2 + base-path: /ec2 + endpoints: + bootInstance: + auth: true + path: /boot + method: POST + request: + name: BootInstanceRequest + body: + properties: + size: string diff --git a/seed/postman/multi-url-environment/.mock/definition/s3.yml b/seed/postman/multi-url-environment/.mock/definition/s3.yml new file mode 100644 index 00000000000..ca741b783f5 --- /dev/null +++ b/seed/postman/multi-url-environment/.mock/definition/s3.yml @@ -0,0 +1,17 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +service: + auth: true + url: s3 + base-path: /s3 + endpoints: + getPresignedUrl: + auth: true + path: /presigned-url + method: POST + request: + name: GetPresignedUrlRequest + body: + properties: + s3Key: string + response: string diff --git a/seed/postman/multi-url-environment/.mock/fern.config.json b/seed/postman/multi-url-environment/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/multi-url-environment/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/no-environment/.mock/definition/api.yml b/seed/postman/no-environment/.mock/definition/api.yml new file mode 100644 index 00000000000..d47556ced41 --- /dev/null +++ b/seed/postman/no-environment/.mock/definition/api.yml @@ -0,0 +1,4 @@ +name: no-environment +auth: bearer +error-discrimination: + strategy: status-code diff --git a/seed/postman/no-environment/.mock/definition/dummy.yml b/seed/postman/no-environment/.mock/definition/dummy.yml new file mode 100644 index 00000000000..e767095a9b0 --- /dev/null +++ b/seed/postman/no-environment/.mock/definition/dummy.yml @@ -0,0 +1,11 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +service: + auth: true + base-path: "" + endpoints: + getDummy: + auth: true + path: /dummy + method: GET + response: string diff --git a/seed/postman/no-environment/.mock/fern.config.json b/seed/postman/no-environment/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/no-environment/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/object/.mock/definition/__package__.yml b/seed/postman/object/.mock/definition/__package__.yml new file mode 100644 index 00000000000..7ee1a972b23 --- /dev/null +++ b/seed/postman/object/.mock/definition/__package__.yml @@ -0,0 +1,71 @@ +types: + Type: + docs: | + Exercises all of the built-in types. + properties: + one: integer + two: double + three: string + four: boolean + five: long + six: datetime + seven: date + eight: uuid + nine: base64 + ten: list + eleven: set + twelve: map + thirteen: optional + fourteen: unknown + fifteen: list> + sixteen: list> + seventeen: list> + eighteen: literal<"eighteen"> + nineteen: Name + examples: + - name: One + value: + one: 1 + two: 2 + three: three + four: true + five: 5 + six: 1994-01-01T01:01:01Z + seven: 1994-01-01 + eight: 7f71f677-e138-4a5c-bb01-e4453a19bfef + nine: TWFueSBoYW5kcyBtYWtlIGxpZ2h0IHdvcmsu + ten: + - 10 + - 10 + eleven: + - 11 + twelve: + invalid: false + exists: true + thirteen: 13 + fourteen: {} + fifteen: + - - 15 + - 15 + - - 15 + - 15 + sixteen: + - foo: 16 + bar: 16 + seventeen: + - 244c6643-f99d-4bfc-b20d-a6518f3a4cf4 + - 07791987-dec3-43b5-8dc4-250ab5dc0478 + eighteen: eighteen + nineteen: + id: name-129fsdj9 + value: nineteen + + Name: + properties: + id: string + value: string + examples: + - name: One + value: + id: name-sdfg8ajk + value: name diff --git a/seed/postman/object/.mock/definition/api.yml b/seed/postman/object/.mock/definition/api.yml new file mode 100644 index 00000000000..a82930c145b --- /dev/null +++ b/seed/postman/object/.mock/definition/api.yml @@ -0,0 +1 @@ +name: object diff --git a/seed/postman/object/.mock/fern.config.json b/seed/postman/object/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/object/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/objects-with-imports/.mock/definition/__package__.yml b/seed/postman/objects-with-imports/.mock/definition/__package__.yml new file mode 100644 index 00000000000..f3bdf68f26a --- /dev/null +++ b/seed/postman/objects-with-imports/.mock/definition/__package__.yml @@ -0,0 +1,37 @@ +imports: + metadata: commons/metadata.yml +types: + Node: + properties: + id: string + label: optional + metadata: optional + examples: + - name: Left + value: + id: node-8dvgfja2 + label: left + metadata: + id: metadata-kjasf923 + data: + foo: bar + baz: qux + - name: Right + value: + id: node-cwda9fi2x + label: right + metadata: + id: metadata-lkasdfv9j + data: + one: two + three: four + + Tree: + properties: + nodes: optional> + examples: + - name: Root + value: + nodes: + - $Node.Left + - $Node.Right diff --git a/seed/postman/objects-with-imports/.mock/definition/api.yml b/seed/postman/objects-with-imports/.mock/definition/api.yml new file mode 100644 index 00000000000..de1eb78549d --- /dev/null +++ b/seed/postman/objects-with-imports/.mock/definition/api.yml @@ -0,0 +1 @@ +name: objects-with-imports diff --git a/seed/postman/objects-with-imports/.mock/definition/commons/metadata.yml b/seed/postman/objects-with-imports/.mock/definition/commons/metadata.yml new file mode 100644 index 00000000000..5672f92f415 --- /dev/null +++ b/seed/postman/objects-with-imports/.mock/definition/commons/metadata.yml @@ -0,0 +1,12 @@ +types: + Metadata: + properties: + id: string + data: optional> + examples: + - name: One + value: + id: metadata-js8dg24b + data: + foo: bar + baz: qux diff --git a/seed/postman/objects-with-imports/.mock/definition/file.yml b/seed/postman/objects-with-imports/.mock/definition/file.yml new file mode 100644 index 00000000000..187b75e3af0 --- /dev/null +++ b/seed/postman/objects-with-imports/.mock/definition/file.yml @@ -0,0 +1,29 @@ +types: + File: + properties: + name: string + contents: string + info: FileInfo + examples: + - name: One + value: + name: file.txt + contents: ... + info: REGULAR + - name: Two + value: + name: another_file.txt + contents: ... + info: REGULAR + + FileInfo: + enum: + - value: REGULAR + docs: A regular file (e.g. foo.txt). + - value: DIRECTORY + docs: A directory (e.g. foo/). + examples: + - name: Regular + value: REGULAR + - name: Directory + value: DIRECTORY diff --git a/seed/postman/objects-with-imports/.mock/definition/file/directory.yml b/seed/postman/objects-with-imports/.mock/definition/file/directory.yml new file mode 100644 index 00000000000..4902de7db69 --- /dev/null +++ b/seed/postman/objects-with-imports/.mock/definition/file/directory.yml @@ -0,0 +1,18 @@ +imports: + file: ../file.yml +types: + Directory: + properties: + name: string + files: optional> + directories: optional> + examples: + - name: One + value: + name: root + files: + - $file.File.One + directories: + - name: tmp + files: + - $file.File.Two diff --git a/seed/postman/objects-with-imports/.mock/fern.config.json b/seed/postman/objects-with-imports/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/objects-with-imports/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/optional/.mock/definition/api.yml b/seed/postman/optional/.mock/definition/api.yml new file mode 100644 index 00000000000..de1eb78549d --- /dev/null +++ b/seed/postman/optional/.mock/definition/api.yml @@ -0,0 +1 @@ +name: objects-with-imports diff --git a/seed/postman/optional/.mock/definition/optional.yml b/seed/postman/optional/.mock/definition/optional.yml new file mode 100644 index 00000000000..111f55357bb --- /dev/null +++ b/seed/postman/optional/.mock/definition/optional.yml @@ -0,0 +1,11 @@ +service: + auth: false + base-path: "" + endpoints: + sendOptionalBody: + method: POST + path: /send-optional-body + request: optional> + response: + type: string + docs: Id of the created resource diff --git a/seed/postman/optional/.mock/fern.config.json b/seed/postman/optional/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/optional/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/package-yml/.mock/definition/__package__.yml b/seed/postman/package-yml/.mock/definition/__package__.yml new file mode 100644 index 00000000000..54399e2e089 --- /dev/null +++ b/seed/postman/package-yml/.mock/definition/__package__.yml @@ -0,0 +1,15 @@ +service: + auth: false + base-path: / + endpoints: + echo: + method: POST + path: "" + request: string + response: string + examples: + - path-parameters: + id: id-ksfd9c1 + request: Hello world! + response: + body: Hello world! diff --git a/seed/postman/package-yml/.mock/definition/api.yml b/seed/postman/package-yml/.mock/definition/api.yml new file mode 100644 index 00000000000..eedda1ebe19 --- /dev/null +++ b/seed/postman/package-yml/.mock/definition/api.yml @@ -0,0 +1,4 @@ +name: package-yml +base-path: /{id} +path-parameters: + id: string diff --git a/seed/postman/package-yml/.mock/definition/service.yml b/seed/postman/package-yml/.mock/definition/service.yml new file mode 100644 index 00000000000..3201fb14c66 --- /dev/null +++ b/seed/postman/package-yml/.mock/definition/service.yml @@ -0,0 +1,13 @@ +service: + auth: false + base-path: / + endpoints: + nop: + method: GET + path: /{nestedId} + path-parameters: + nestedId: string + examples: + - path-parameters: + id: id-a2ijs82 + nestedId: id-219xca8 diff --git a/seed/postman/package-yml/.mock/fern.config.json b/seed/postman/package-yml/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/package-yml/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/plain-text/.mock/definition/api.yml b/seed/postman/plain-text/.mock/definition/api.yml new file mode 100644 index 00000000000..4ee1d9980a2 --- /dev/null +++ b/seed/postman/plain-text/.mock/definition/api.yml @@ -0,0 +1 @@ +name: plain-text diff --git a/seed/postman/plain-text/.mock/definition/service.yml b/seed/postman/plain-text/.mock/definition/service.yml new file mode 100644 index 00000000000..c42c866bcc9 --- /dev/null +++ b/seed/postman/plain-text/.mock/definition/service.yml @@ -0,0 +1,8 @@ +service: + auth: false + base-path: "" + endpoints: + getText: + path: /text + method: POST + response: text diff --git a/seed/postman/plain-text/.mock/fern.config.json b/seed/postman/plain-text/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/plain-text/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/query-parameters/.mock/definition/api.yml b/seed/postman/query-parameters/.mock/definition/api.yml new file mode 100644 index 00000000000..f5aa88ee4e4 --- /dev/null +++ b/seed/postman/query-parameters/.mock/definition/api.yml @@ -0,0 +1 @@ +name: query-parameters diff --git a/seed/postman/query-parameters/.mock/definition/user.yml b/seed/postman/query-parameters/.mock/definition/user.yml new file mode 100644 index 00000000000..6587ab788ea --- /dev/null +++ b/seed/postman/query-parameters/.mock/definition/user.yml @@ -0,0 +1,37 @@ +types: + User: + properties: + name: string + tags: list + NestedUser: + properties: + name: string + user: User + +service: + base-path: /user + auth: false + endpoints: + getUsername: + path: "" + method: GET + request: + name: GetUsersRequest + query-parameters: + limit: integer + id: uuid + date: date + deadline: datetime + bytes: base64 + user: User + keyValue: map + optionalString: optional + nestedUser: NestedUser + optionalUser: optional + excludeUser: + type: User + allow-multiple: true + filter: + type: string + allow-multiple: true + response: User diff --git a/seed/postman/query-parameters/.mock/fern.config.json b/seed/postman/query-parameters/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/query-parameters/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/reserved-keywords/.mock/definition/api.yml b/seed/postman/reserved-keywords/.mock/definition/api.yml new file mode 100644 index 00000000000..db5bb47ddd7 --- /dev/null +++ b/seed/postman/reserved-keywords/.mock/definition/api.yml @@ -0,0 +1,5 @@ +name: nursery-api + +error-discrimination: + strategy: property + property-name: errorName diff --git a/seed/postman/reserved-keywords/.mock/definition/package.yml b/seed/postman/reserved-keywords/.mock/definition/package.yml new file mode 100644 index 00000000000..a2328bf1a8e --- /dev/null +++ b/seed/postman/reserved-keywords/.mock/definition/package.yml @@ -0,0 +1,20 @@ +types: + Package: + properties: + name: string + Record: + properties: + foo: map + 3d: integer + +service: + base-path: / + auth: false + endpoints: + test: + method: POST + path: "" + request: + name: TestRequest + query-parameters: + for: string diff --git a/seed/postman/reserved-keywords/.mock/fern.config.json b/seed/postman/reserved-keywords/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/reserved-keywords/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/response-property/.mock/definition/__package__.yml b/seed/postman/response-property/.mock/definition/__package__.yml new file mode 100644 index 00000000000..708a5a1139d --- /dev/null +++ b/seed/postman/response-property/.mock/definition/__package__.yml @@ -0,0 +1,10 @@ +types: + StringResponse: + properties: + data: string + + OptionalStringResponse: optional + + WithMetadata: + properties: + metadata: map diff --git a/seed/postman/response-property/.mock/definition/api.yml b/seed/postman/response-property/.mock/definition/api.yml new file mode 100644 index 00000000000..4a1bb4a3045 --- /dev/null +++ b/seed/postman/response-property/.mock/definition/api.yml @@ -0,0 +1 @@ +name: response-property diff --git a/seed/postman/response-property/.mock/definition/service.yml b/seed/postman/response-property/.mock/definition/service.yml new file mode 100644 index 00000000000..15de6ab767f --- /dev/null +++ b/seed/postman/response-property/.mock/definition/service.yml @@ -0,0 +1,81 @@ +imports: + root: __package__.yml + +types: + WithDocs: + properties: + docs: string + + OptionalWithDocs: optional + + Movie: + properties: + id: string + name: string + + Response: + extends: + - root.WithMetadata + - WithDocs + properties: + data: Movie + +service: + auth: false + base-path: "" + endpoints: + getMovie: + method: POST + path: /movie + request: string + response: + type: Response + property: data + + getMovieDocs: + method: POST + path: /movie + request: string + response: + type: Response + property: docs + + getMovieName: + method: POST + path: /movie + request: string + response: + type: root.StringResponse + property: data + + getMovieMetadata: + method: POST + path: /movie + request: string + response: + type: Response + property: metadata + + getOptionalMovie: + method: POST + path: /movie + request: string + response: + type: optional + property: data + + getOptionalMovieDocs: + method: POST + path: /movie + request: string + response: + type: OptionalWithDocs + property: docs + + getOptionalMovieName: + method: POST + path: /movie + request: string + response: + type: root.OptionalStringResponse + property: data diff --git a/seed/postman/response-property/.mock/fern.config.json b/seed/postman/response-property/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/response-property/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/single-url-environment-default/.mock/definition/api.yml b/seed/postman/single-url-environment-default/.mock/definition/api.yml new file mode 100644 index 00000000000..830028e4fb4 --- /dev/null +++ b/seed/postman/single-url-environment-default/.mock/definition/api.yml @@ -0,0 +1,8 @@ +name: single-url-environment-default +auth: bearer +environments: + Production: https://production.com/api + Staging: https://staging.com/api +default-environment: Production +error-discrimination: + strategy: status-code diff --git a/seed/postman/single-url-environment-default/.mock/definition/dummy.yml b/seed/postman/single-url-environment-default/.mock/definition/dummy.yml new file mode 100644 index 00000000000..e767095a9b0 --- /dev/null +++ b/seed/postman/single-url-environment-default/.mock/definition/dummy.yml @@ -0,0 +1,11 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +service: + auth: true + base-path: "" + endpoints: + getDummy: + auth: true + path: /dummy + method: GET + response: string diff --git a/seed/postman/single-url-environment-default/.mock/fern.config.json b/seed/postman/single-url-environment-default/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/single-url-environment-default/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/single-url-environment-no-default/.mock/definition/api.yml b/seed/postman/single-url-environment-no-default/.mock/definition/api.yml new file mode 100644 index 00000000000..b80832d5696 --- /dev/null +++ b/seed/postman/single-url-environment-no-default/.mock/definition/api.yml @@ -0,0 +1,8 @@ +name: single-url-environment-no-default +auth: bearer +environments: + Production: https://production.com/api + Staging: https://staging.com/api +default-environment: null +error-discrimination: + strategy: status-code diff --git a/seed/postman/single-url-environment-no-default/.mock/definition/dummy.yml b/seed/postman/single-url-environment-no-default/.mock/definition/dummy.yml new file mode 100644 index 00000000000..e767095a9b0 --- /dev/null +++ b/seed/postman/single-url-environment-no-default/.mock/definition/dummy.yml @@ -0,0 +1,11 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +service: + auth: true + base-path: "" + endpoints: + getDummy: + auth: true + path: /dummy + method: GET + response: string diff --git a/seed/postman/single-url-environment-no-default/.mock/fern.config.json b/seed/postman/single-url-environment-no-default/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/single-url-environment-no-default/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/trace/.mock/definition/admin.yml b/seed/postman/trace/.mock/definition/admin.yml new file mode 100644 index 00000000000..78c6c58f056 --- /dev/null +++ b/seed/postman/trace/.mock/definition/admin.yml @@ -0,0 +1,93 @@ +imports: + submission: submission.yml + problemV2: v2/problem.yml + +types: + Test: + union: + and: boolean + or: boolean + +service: + auth: false + base-path: /admin + endpoints: + updateTestSubmissionStatus: + path: /store-test-submission-status/{submissionId} + path-parameters: + submissionId: submission.SubmissionId + request: + body: + type: submission.TestSubmissionStatus + method: POST + + sendTestSubmissionUpdate: + path: /store-test-submission-status-v2/{submissionId} + path-parameters: + submissionId: submission.SubmissionId + request: + body: + type: submission.TestSubmissionUpdate + method: POST + + updateWorkspaceSubmissionStatus: + path: /store-workspace-submission-status/{submissionId} + path-parameters: + submissionId: submission.SubmissionId + request: + body: + type: submission.WorkspaceSubmissionStatus + method: POST + + sendWorkspaceSubmissionUpdate: + path: /store-workspace-submission-status-v2/{submissionId} + path-parameters: + submissionId: submission.SubmissionId + request: + body: + type: submission.WorkspaceSubmissionUpdate + method: POST + + storeTracedTestCase: + path: /store-test-trace/submission/{submissionId}/testCase/{testCaseId} + path-parameters: + submissionId: submission.SubmissionId + testCaseId: string + request: + name: StoreTracedTestCaseRequest + body: + properties: + result: submission.TestCaseResultWithStdout + traceResponses: list + method: POST + + storeTracedTestCaseV2: + path: /store-test-trace-v2/submission/{submissionId}/testCase/{testCaseId} + path-parameters: + submissionId: submission.SubmissionId + testCaseId: problemV2.TestCaseId + request: + body: + type: list + method: POST + + storeTracedWorkspace: + path: /store-workspace-trace/submission/{submissionId} + path-parameters: + submissionId: submission.SubmissionId + request: + name: StoreTracedWorkspaceRequest + body: + properties: + workspaceRunDetails: submission.WorkspaceRunDetails + traceResponses: list + method: POST + + storeTracedWorkspaceV2: + path: /store-workspace-trace-v2/submission/{submissionId} + path-parameters: + submissionId: submission.SubmissionId + request: + body: + type: list + method: POST diff --git a/seed/postman/trace/.mock/definition/api.yml b/seed/postman/trace/.mock/definition/api.yml new file mode 100644 index 00000000000..bbcdc367b96 --- /dev/null +++ b/seed/postman/trace/.mock/definition/api.yml @@ -0,0 +1,11 @@ +name: trace +auth: bearer +headers: + X-Random-Header: optional +error-discrimination: + strategy: property + property-name: errorName + +environments: + Prod: https://api.trace.come +default-environment: Prod diff --git a/seed/postman/trace/.mock/definition/commons.yml b/seed/postman/trace/.mock/definition/commons.yml new file mode 100644 index 00000000000..2ab9d51f822 --- /dev/null +++ b/seed/postman/trace/.mock/definition/commons.yml @@ -0,0 +1,131 @@ +types: + UserId: string + ProblemId: string + NodeId: string + VariableType: + union: + integerType: {} + doubleType: {} + booleanType: {} + stringType: {} + charType: {} + listType: ListType + mapType: MapType + binaryTreeType: {} + singlyLinkedListType: {} + doublyLinkedListType: {} + ListType: + properties: + valueType: VariableType + isFixedLength: + docs: Whether this list is fixed-size (for languages that supports fixed-size + lists). Defaults to false. + type: optional + MapType: + properties: + keyType: VariableType + valueType: VariableType + VariableValue: + union: + integerValue: integer + booleanValue: boolean + doubleValue: double + stringValue: string + charValue: string + mapValue: MapValue + listValue: list + binaryTreeValue: BinaryTreeValue + singlyLinkedListValue: SinglyLinkedListValue + doublyLinkedListValue: DoublyLinkedListValue + nullValue: {} + DebugVariableValue: + union: + integerValue: integer + booleanValue: boolean + doubleValue: double + stringValue: string + charValue: string + mapValue: DebugMapValue + listValue: list + binaryTreeNodeValue: BinaryTreeNodeAndTreeValue + singlyLinkedListNodeValue: SinglyLinkedListNodeAndListValue + doublyLinkedListNodeValue: DoublyLinkedListNodeAndListValue + undefinedValue: {} + nullValue: {} + genericValue: GenericValue + GenericValue: + properties: + stringifiedType: optional + stringifiedValue: string + MapValue: + properties: + keyValuePairs: list + KeyValuePair: + properties: + key: VariableValue + value: VariableValue + BinaryTreeValue: + properties: + root: optional + nodes: map + BinaryTreeNodeValue: + properties: + nodeId: NodeId + val: double + right: optional + left: optional + BinaryTreeNodeAndTreeValue: + properties: + nodeId: NodeId + fullTree: BinaryTreeValue + SinglyLinkedListValue: + properties: + head: optional + nodes: map + SinglyLinkedListNodeValue: + properties: + nodeId: NodeId + val: double + next: optional + SinglyLinkedListNodeAndListValue: + properties: + nodeId: NodeId + fullList: SinglyLinkedListValue + DoublyLinkedListValue: + properties: + head: optional + nodes: map + DoublyLinkedListNodeValue: + properties: + nodeId: NodeId + val: double + next: optional + prev: optional + DoublyLinkedListNodeAndListValue: + properties: + nodeId: NodeId + fullList: DoublyLinkedListValue + DebugMapValue: + properties: + keyValuePairs: list + DebugKeyValuePairs: + properties: + key: DebugVariableValue + value: DebugVariableValue + TestCase: + properties: + id: string + params: list + TestCaseWithExpectedResult: + properties: + testCase: TestCase + expectedResult: VariableValue + FileInfo: + properties: + filename: string + contents: string + Language: + enum: + - JAVA + - JAVASCRIPT + - PYTHON diff --git a/seed/postman/trace/.mock/definition/homepage.yml b/seed/postman/trace/.mock/definition/homepage.yml new file mode 100644 index 00000000000..acf9f99a2d2 --- /dev/null +++ b/seed/postman/trace/.mock/definition/homepage.yml @@ -0,0 +1,18 @@ +imports: + commons: commons.yml + +service: + base-path: /homepage-problems + auth: false + endpoints: + getHomepageProblems: + method: GET + path: "" + response: list + + setHomepageProblems: + method: POST + path: "" + request: + body: + type: list diff --git a/seed/postman/trace/.mock/definition/lang-server.yml b/seed/postman/trace/.mock/definition/lang-server.yml new file mode 100644 index 00000000000..01028d30b1b --- /dev/null +++ b/seed/postman/trace/.mock/definition/lang-server.yml @@ -0,0 +1,7 @@ +types: + LangServerRequest: + properties: + request: unknown + LangServerResponse: + properties: + response: unknown diff --git a/seed/postman/trace/.mock/definition/migration.yml b/seed/postman/trace/.mock/definition/migration.yml new file mode 100644 index 00000000000..2a8c8ccf3f0 --- /dev/null +++ b/seed/postman/trace/.mock/definition/migration.yml @@ -0,0 +1,25 @@ +types: + MigrationStatus: + enum: + - value: RUNNING + docs: The migration is running + - value: FAILED + docs: The migration is failed + - FINISHED + Migration: + properties: + name: string + status: MigrationStatus + +service: + base-path: /migration-info + auth: false + endpoints: + getAttemptedMigrations: + method: GET + path: /all + request: + name: GetAttemptedMigrationsRequest + headers: + admin-key-header: string + response: list diff --git a/seed/postman/trace/.mock/definition/playlist.yml b/seed/postman/trace/.mock/definition/playlist.yml new file mode 100644 index 00000000000..7bde8a32d52 --- /dev/null +++ b/seed/postman/trace/.mock/definition/playlist.yml @@ -0,0 +1,110 @@ +imports: + commons: commons.yml +types: + PlaylistId: string + Playlist: + extends: PlaylistCreateRequest + properties: + playlist_id: PlaylistId + owner-id: commons.UserId + + PlaylistCreateRequest: + properties: + name: string + problems: list + + UpdatePlaylistRequest: + properties: + name: string + problems: + type: list + docs: The problems that make up the playlist. + PlaylistIdNotFoundErrorBody: + union: + playlistId: PlaylistId + + ReservedKeywordEnum: + enum: + - is + - as + +service: + auth: true + base-path: /v2/playlist/{serviceParam} + path-parameters: + serviceParam: integer + endpoints: + createPlaylist: + docs: Create a new playlist + method: POST + path: /create + request: + name: CreatePlaylistRequest + query-parameters: + datetime: datetime + optionalDatetime: optional + body: PlaylistCreateRequest + response: Playlist + + getPlaylists: + docs: Returns the user's playlists + method: GET + path: /all + response: list + request: + name: GetPlaylistsRequest + query-parameters: + limit: optional + otherField: + docs: i'm another field + type: string + multiLineDocs: + docs: | + I'm a multiline + description + type: string + optionalMultipleField: + type: optional + allow-multiple: true + multipleField: + type: string + allow-multiple: true + + getPlaylist: + docs: Returns a playlist + method: GET + path: /{playlistId} + auth: false + path-parameters: + playlistId: PlaylistId + response: Playlist + errors: + - PlaylistIdNotFoundError + - UnauthorizedError + + updatePlaylist: + docs: Updates a playlist + method: PUT + path: /{playlistId} + path-parameters: + playlistId: PlaylistId + request: + body: + type: optional + response: optional + errors: + - PlaylistIdNotFoundError + + deletePlaylist: + docs: Deletes a playlist + method: DELETE + path: /{playlist_id} + path-parameters: + playlist_id: PlaylistId + +errors: + PlaylistIdNotFoundError: + type: PlaylistIdNotFoundErrorBody + status-code: 404 + UnauthorizedError: + status-code: 401 diff --git a/seed/postman/trace/.mock/definition/problem.yml b/seed/postman/trace/.mock/definition/problem.yml new file mode 100644 index 00000000000..9506e8bcd5c --- /dev/null +++ b/seed/postman/trace/.mock/definition/problem.yml @@ -0,0 +1,115 @@ +imports: + commons: commons.yml + +types: + ProblemInfo: + properties: + problemId: commons.ProblemId + problemDescription: ProblemDescription + problemName: string + problemVersion: integer + files: map + inputParams: list + outputType: commons.VariableType + testcases: list + methodName: string + supportsCustomTestCases: boolean + ProblemDescription: + properties: + boards: list + ProblemDescriptionBoard: + union: + html: string + variable: commons.VariableValue + testCaseId: string + ProblemFiles: + properties: + solutionFile: commons.FileInfo + readOnlyFiles: list + VariableTypeAndName: + properties: + variableType: commons.VariableType + name: string + CreateProblemRequest: + properties: + problemName: string + problemDescription: ProblemDescription + files: map + inputParams: list + outputType: commons.VariableType + testcases: list + methodName: string + CreateProblemResponse: + union: + success: commons.ProblemId + error: CreateProblemError + + UpdateProblemResponse: + properties: + problemVersion: integer + + CreateProblemError: + discriminant: + value: _type + name: errorType + union: + generic: GenericCreateProblemError + GenericCreateProblemError: + properties: + message: string + type: string + stacktrace: string + + GetDefaultStarterFilesResponse: + properties: + files: map + +service: + base-path: /problem-crud + auth: false + endpoints: + createProblem: + docs: Creates a problem + method: POST + path: /create + request: CreateProblemRequest + response: CreateProblemResponse + + updateProblem: + docs: Updates a problem + method: POST + path: /update/{problemId} + path-parameters: + problemId: commons.ProblemId + request: + body: + type: CreateProblemRequest + response: UpdateProblemResponse + + deleteProblem: + docs: Soft deletes a problem + method: DELETE + path: /delete/{problemId} + path-parameters: + problemId: commons.ProblemId + + getDefaultStarterFiles: + docs: Returns default starter files for problem + method: POST + path: /default-starter-files + request: + name: GetDefaultStarterFilesRequest + body: + properties: + inputParams: list + outputType: commons.VariableType + methodName: + type: string + docs: | + The name of the `method` that the student has to complete. + The method name cannot include the following characters: + - Greater Than `>` + - Less Than `<`` + - Equals `=` + - Period `.` + response: GetDefaultStarterFilesResponse diff --git a/seed/postman/trace/.mock/definition/submission.yml b/seed/postman/trace/.mock/definition/submission.yml new file mode 100644 index 00000000000..20b3b4d8e0d --- /dev/null +++ b/seed/postman/trace/.mock/definition/submission.yml @@ -0,0 +1,470 @@ +docs: Responsible for spinning up and spinning down execution. +imports: + commons: commons.yml + problemV2: ./v2/problem.yml +types: + SubmissionId: + type: uuid + ShareId: + type: string + SubmissionRequest: + union: + initializeProblemRequest: InitializeProblemRequest + initializeWorkspaceRequest: {} + submitV2: SubmitRequestV2 + workspaceSubmit: WorkspaceSubmitRequest + stop: StopRequest + InitializeProblemRequest: + properties: + problemId: commons.ProblemId + problemVersion: optional + SubmitRequestV2: + properties: + submissionId: SubmissionId + language: commons.Language + submissionFiles: list + problemId: commons.ProblemId + problemVersion: optional + userId: optional + WorkspaceSubmitRequest: + properties: + submissionId: SubmissionId + language: commons.Language + submissionFiles: list + userId: optional + SubmissionFileInfo: + properties: + directory: string + filename: string + contents: string + SubmissionTypeEnum: + enum: + - TEST + docs: Keep in sync with SubmissionType. + StopRequest: + properties: + submissionId: SubmissionId + SubmissionResponse: + union: + serverInitialized: {} + problemInitialized: commons.ProblemId + workspaceInitialized: {} + serverErrored: ExceptionInfo + codeExecutionUpdate: CodeExecutionUpdate + terminated: TerminatedResponse + CodeExecutionUpdate: + union: + buildingExecutor: + type: BuildingExecutorResponse + docs: Statuses if an executor for the session isn't ready (Before + RunningResponse). + running: + type: RunningResponse + docs: Sent once a test submission is executing. + errored: + type: ErroredResponse + docs: Sent if a submission cannot be run (i.e. Compile Error). + stopped: + type: StoppedResponse + docs: Sent if a submission is stopped. + graded: + type: GradedResponse + docs: Graded testcases without trace information. + gradedV2: + type: GradedResponseV2 + docs: Graded submission for v2 problems. + workspaceRan: + type: WorkspaceRanResponse + docs: Workspace run without trace information. + recording: + type: RecordingResponseNotification + docs: Gives progress about what is being recorded. + recorded: + type: RecordedResponseNotification + docs: Graded testcases with trace information. + invalidRequest: + type: InvalidRequestResponse + docs: Sent if an invalid request is sent for a submission. + finished: + type: FinishedResponse + docs: Sent once a submission is graded and fully recorded. + BuildingExecutorResponse: + properties: + submissionId: SubmissionId + status: ExecutionSessionStatus + RunningResponse: + properties: + submissionId: SubmissionId + state: RunningSubmissionState + RunningSubmissionState: + enum: + - QUEUEING_SUBMISSION + - KILLING_HISTORICAL_SUBMISSIONS + - WRITING_SUBMISSION_TO_FILE + - COMPILING_SUBMISSION + - RUNNING_SUBMISSION + ErroredResponse: + properties: + submissionId: SubmissionId + errorInfo: ErrorInfo + ErrorInfo: + union: + compileError: CompileError + runtimeError: + type: RuntimeError + docs: | + If the submission cannot be executed and throws a runtime error before getting to any of the testcases. + internalError: + type: InternalError + docs: | + If the trace backend encounters an unexpected error. + CompileError: + properties: + message: string + RuntimeError: + properties: + message: string + InternalError: + properties: + exceptionInfo: ExceptionInfo + StoppedResponse: + properties: + submissionId: SubmissionId + WorkspaceRanResponse: + properties: + submissionId: SubmissionId + runDetails: WorkspaceRunDetails + WorkspaceRunDetails: + properties: + exceptionV2: optional + exception: optional + stdout: string + GradedResponse: + properties: + submissionId: SubmissionId + testCases: map + GradedResponseV2: + properties: + submissionId: SubmissionId + testCases: map + TestCaseGrade: + union: + hidden: TestCaseHiddenGrade + nonHidden: TestCaseNonHiddenGrade + TestCaseHiddenGrade: + properties: + passed: boolean + TestCaseNonHiddenGrade: + properties: + passed: boolean + actualResult: optional + exception: optional + stdout: string + RecordedResponseNotification: + properties: + submissionId: SubmissionId + traceResponsesSize: integer + testCaseId: optional + RecordingResponseNotification: + properties: + submissionId: SubmissionId + testCaseId: optional + lineNumber: integer + lightweightStackInfo: LightweightStackframeInformation + tracedFile: optional + LightweightStackframeInformation: + properties: + numStackFrames: integer + topStackFrameMethodName: string + TestCaseResultWithStdout: + properties: + result: TestCaseResult + stdout: string + TestCaseResult: + properties: + expectedResult: commons.VariableValue + actualResult: ActualResult + passed: boolean + ActualResult: + union: + value: commons.VariableValue + exception: ExceptionInfo + exceptionV2: ExceptionV2 + ExceptionV2: + union: + generic: ExceptionInfo + timeout: {} + ExceptionInfo: + properties: + exceptionType: string + exceptionMessage: string + exceptionStacktrace: string + InvalidRequestResponse: + properties: + request: SubmissionRequest + cause: InvalidRequestCause + InvalidRequestCause: + union: + submissionIdNotFound: + type: SubmissionIdNotFound + docs: The submission request references a submission id that doesn't exist. + customTestCasesUnsupported: + type: CustomTestCasesUnsupported + unexpectedLanguage: + type: UnexpectedLanguageError + docs: The submission request was routed to an incorrect language executor. + ExistingSubmissionExecuting: + properties: + submissionId: SubmissionId + SubmissionIdNotFound: + properties: + missingSubmissionId: SubmissionId + CustomTestCasesUnsupported: + properties: + problemId: commons.ProblemId + submissionId: SubmissionId + UnexpectedLanguageError: + properties: + expectedLanguage: commons.Language + actualLanguage: commons.Language + TerminatedResponse: + properties: {} + FinishedResponse: + properties: + submissionId: SubmissionId + + StdoutResponse: + properties: + submissionId: SubmissionId + stdout: string + StderrResponse: + properties: + submissionId: SubmissionId + stderr: string + TraceResponse: + properties: + submissionId: SubmissionId + lineNumber: integer + returnValue: optional + expressionLocation: optional + stack: StackInformation + stdout: optional + + TraceResponseV2: + properties: + submissionId: SubmissionId + lineNumber: integer + file: TracedFile + returnValue: optional + expressionLocation: optional + stack: StackInformation + stdout: optional + TracedFile: + properties: + filename: string + directory: string + + ExpressionLocation: + properties: + start: integer + offset: integer + StackInformation: + properties: + numStackFrames: integer + topStackFrame: optional + StackFrame: + properties: + methodName: string + lineNumber: integer + scopes: list + Scope: + properties: + variables: map + ExecutionSessionResponse: + properties: + sessionId: string + executionSessionUrl: optional + language: commons.Language + status: ExecutionSessionStatus + ExecutionSessionStatus: + enum: + - CREATING_CONTAINER #Requesting resources + - PROVISIONING_CONTAINER #Downloading image + - PENDING_CONTAINER #Setting up container + - RUNNING_CONTAINER #Container running + - LIVE_CONTAINER #Container can be pinged + - FAILED_TO_LAUNCH #Container failed to launch + + SubmissionStatusV2: + union: + test: TestSubmissionStatusV2 + workspace: WorkspaceSubmissionStatusV2 + TestSubmissionStatusV2: + properties: + updates: list + problemId: commons.ProblemId + problemVersion: integer + problemInfo: problemV2.ProblemInfoV2 + WorkspaceSubmissionStatusV2: + properties: + updates: list + TestSubmissionUpdate: + properties: + updateTime: datetime + updateInfo: TestSubmissionUpdateInfo + TestSubmissionUpdateInfo: + union: + running: RunningSubmissionState + stopped: {} + errored: ErrorInfo + gradedTestCase: GradedTestCaseUpdate + recordedTestCase: RecordedTestCaseUpdate + finished: {} + WorkspaceSubmissionUpdate: + properties: + updateTime: datetime + updateInfo: WorkspaceSubmissionUpdateInfo + WorkspaceSubmissionUpdateInfo: + union: + running: RunningSubmissionState + ran: WorkspaceRunDetails + stopped: {} + traced: {} + tracedV2: WorkspaceTracedUpdate + errored: ErrorInfo + finished: {} + GradedTestCaseUpdate: + properties: + testCaseId: problemV2.TestCaseId + grade: TestCaseGrade + RecordedTestCaseUpdate: + properties: + testCaseId: problemV2.TestCaseId + traceResponsesSize: integer + WorkspaceTracedUpdate: + properties: + traceResponsesSize: integer + + SubmissionTypeState: + union: + test: TestSubmissionState + workspace: WorkspaceSubmissionState + WorkspaceSubmissionState: + properties: + status: WorkspaceSubmissionStatus + WorkspaceSubmissionStatus: + union: + stopped: {} + errored: ErrorInfo + running: RunningSubmissionState + ran: WorkspaceRunDetails + traced: WorkspaceRunDetails + TestSubmissionState: + properties: + problemId: commons.ProblemId + defaultTestCases: list + customTestCases: list + status: TestSubmissionStatus + TestSubmissionStatus: + union: + stopped: {} + errored: ErrorInfo + running: RunningSubmissionState + testCaseIdToState: map + SubmissionStatusForTestCase: + union: + graded: TestCaseResultWithStdout + gradedV2: TestCaseGrade + traced: TracedTestCase + TracedTestCase: + properties: + result: TestCaseResultWithStdout + traceResponsesSize: integer + TraceResponsesPage: + properties: + offset: + type: optional + docs: | + If present, use this to load subseqent pages. + The offset is the id of the next trace response to load. + traceResponses: list + TraceResponsesPageV2: + properties: + offset: + type: optional + docs: | + If present, use this to load subseqent pages. + The offset is the id of the next trace response to load. + traceResponses: list + GetTraceResponsesPageRequest: + properties: + offset: + type: optional + WorkspaceStarterFilesResponse: + properties: + files: map + WorkspaceStarterFilesResponseV2: + properties: + filesByLanguage: map + WorkspaceFiles: + properties: + mainFile: commons.FileInfo + readOnlyFiles: list + + ExecutionSessionState: + properties: + lastTimeContacted: optional + sessionId: + type: string + docs: > + The auto-generated session id. Formatted as a uuid. + isWarmInstance: boolean + awsTaskId: optional + language: commons.Language + status: ExecutionSessionStatus + + GetExecutionSessionStateResponse: + properties: + states: map + numWarmingInstances: optional + warmingSessionIds: list + + GetSubmissionStateResponse: + properties: + timeSubmitted: optional + submission: string + language: commons.Language + submissionTypeState: SubmissionTypeState + +service: + base-path: /sessions + auth: false + endpoints: + createExecutionSession: + docs: Returns sessionId and execution server URL for session. Spins up server. + method: POST + path: /create-session/{language} + path-parameters: + language: commons.Language + response: ExecutionSessionResponse + + getExecutionSession: + docs: Returns execution server URL for session. Returns empty if session isn't + registered. + method: GET + path: /{sessionId} + path-parameters: + sessionId: string + response: optional + + stopExecutionSession: + docs: Stops execution session. #TODO: only an admin should be able to trigger this + method: DELETE + path: /stop/{sessionId} + path-parameters: + sessionId: string + + getExecutionSessionsState: + method: GET + path: /execution-sessions-state + response: GetExecutionSessionStateResponse diff --git a/seed/postman/trace/.mock/definition/sysprop.yml b/seed/postman/trace/.mock/definition/sysprop.yml new file mode 100644 index 00000000000..8388ac30b74 --- /dev/null +++ b/seed/postman/trace/.mock/definition/sysprop.yml @@ -0,0 +1,18 @@ +imports: + commons: commons.yml + +service: + base-path: /sysprop + auth: false + endpoints: + setNumWarmInstances: + method: PUT + path: /num-warm-instances/{language}/{numWarmInstances} + path-parameters: + language: commons.Language + numWarmInstances: integer + + getNumWarmInstances: + method: GET + path: /num-warm-instances + response: map diff --git a/seed/postman/trace/.mock/definition/v2/__package__.yml b/seed/postman/trace/.mock/definition/v2/__package__.yml new file mode 100644 index 00000000000..fd1df211375 --- /dev/null +++ b/seed/postman/trace/.mock/definition/v2/__package__.yml @@ -0,0 +1,7 @@ +service: + base-path: / + auth: false + endpoints: + test: + path: "" + method: GET diff --git a/seed/postman/trace/.mock/definition/v2/problem.yml b/seed/postman/trace/.mock/definition/v2/problem.yml new file mode 100644 index 00000000000..06e3ed623f4 --- /dev/null +++ b/seed/postman/trace/.mock/definition/v2/problem.yml @@ -0,0 +1,218 @@ +imports: + commons: ../commons.yml + problem: ../problem.yml + +types: + TestCaseTemplateId: string + TestCaseId: string + ParameterId: string + ProblemInfoV2: + properties: + problemId: commons.ProblemId + problemDescription: problem.ProblemDescription + problemName: string + problemVersion: integer + supportedLanguages: set + customFiles: CustomFiles + generatedFiles: GeneratedFiles + customTestCaseTemplates: list + testcases: list + isPublic: boolean + LightweightProblemInfoV2: + properties: + problemId: commons.ProblemId + problemName: string + problemVersion: integer + variableTypes: set + CreateProblemRequestV2: + properties: + problemName: string + problemDescription: problem.ProblemDescription + customFiles: CustomFiles + customTestCaseTemplates: list + testcases: list + supportedLanguages: set + isPublic: boolean + TestCaseV2: + properties: + metadata: TestCaseMetadata + implementation: TestCaseImplementationReference + arguments: map + expects: optional + TestCaseExpects: + properties: + expectedStdout: optional + TestCaseImplementationReference: + union: + templateId: TestCaseTemplateId + implementation: TestCaseImplementation + BasicTestCaseTemplate: + properties: + templateId: TestCaseTemplateId + name: string + description: TestCaseImplementationDescription + expectedValueParameterId: ParameterId + TestCaseTemplate: + properties: + templateId: TestCaseTemplateId + name: string + implementation: TestCaseImplementation + TestCaseImplementation: + properties: + description: TestCaseImplementationDescription + function: TestCaseFunction + TestCaseFunction: + union: + withActualResult: TestCaseWithActualResultImplementation + custom: VoidFunctionDefinition + TestCaseWithActualResultImplementation: + properties: + getActualResult: NonVoidFunctionDefinition + assertCorrectnessCheck: AssertCorrectnessCheck + VoidFunctionDefinition: + properties: + parameters: list + code: FunctionImplementationForMultipleLanguages + Parameter: + properties: + parameterId: ParameterId + name: string + variableType: commons.VariableType + NonVoidFunctionDefinition: + properties: + signature: NonVoidFunctionSignature + code: FunctionImplementationForMultipleLanguages + VoidFunctionSignature: + properties: + parameters: list + NonVoidFunctionSignature: + properties: + parameters: list + returnType: commons.VariableType + VoidFunctionSignatureThatTakesActualResult: + properties: + parameters: list + actualResultType: commons.VariableType + AssertCorrectnessCheck: + union: + deepEquality: DeepEqualityCorrectnessCheck + custom: VoidFunctionDefinitionThatTakesActualResult + DeepEqualityCorrectnessCheck: + properties: + expectedValueParameterId: ParameterId + VoidFunctionDefinitionThatTakesActualResult: + docs: The generated signature will include an additional param, actualResult + properties: + additionalParameters: list + code: FunctionImplementationForMultipleLanguages + TestCaseImplementationDescription: + properties: + boards: list + TestCaseImplementationDescriptionBoard: + union: + html: string + paramId: ParameterId + TestCaseMetadata: + properties: + id: TestCaseId + name: string + hidden: boolean + FunctionImplementationForMultipleLanguages: + properties: + codeByLanguage: map + FunctionImplementation: + properties: + impl: string + imports: optional + GeneratedFiles: + properties: + generatedTestCaseFiles: map + generatedTemplateFiles: map + other: map + CustomFiles: + union: + basic: BasicCustomFiles + custom: map + BasicCustomFiles: + properties: + methodName: string + signature: NonVoidFunctionSignature + additionalFiles: map + basicTestCaseTemplate: BasicTestCaseTemplate + Files: + properties: + files: list + FileInfoV2: + properties: + filename: string + directory: string + contents: string + editable: boolean + DefaultProvidedFile: + properties: + file: FileInfoV2 + relatedTypes: list + FunctionSignature: + union: + void: VoidFunctionSignature + nonVoid: NonVoidFunctionSignature + voidThatTakesActualResult: + type: VoidFunctionSignatureThatTakesActualResult + docs: Useful when specifying custom grading for a testcase where actualResult is + defined. + GetFunctionSignatureRequest: + properties: + functionSignature: FunctionSignature + GetFunctionSignatureResponse: + properties: + functionByLanguage: map + + GetBasicSolutionFileRequest: + properties: + methodName: string + signature: NonVoidFunctionSignature + GetBasicSolutionFileResponse: + properties: + solutionFileByLanguage: map + + GetGeneratedTestCaseFileRequest: + properties: + template: optional + testCase: TestCaseV2 + + GetGeneratedTestCaseTemplateFileRequest: + properties: + template: TestCaseTemplate + +service: + base-path: /problems-v2 + auth: false + endpoints: + getLightweightProblems: + docs: Returns lightweight versions of all problems + method: GET + path: /lightweight-problem-info + response: list + + getProblems: + docs: Returns latest versions of all problems + method: GET + path: /problem-info + response: list + + getLatestProblem: + docs: Returns latest version of a problem + method: GET + path: /problem-info/{problemId} + path-parameters: + problemId: commons.ProblemId + response: ProblemInfoV2 + + getProblemVersion: + docs: Returns requested version of a problem + method: GET + path: /problem-info/{problemId}/version/{problemVersion} + path-parameters: + problemId: commons.ProblemId + problemVersion: integer + response: ProblemInfoV2 diff --git a/seed/postman/trace/.mock/definition/v2/v3/problem.yml b/seed/postman/trace/.mock/definition/v2/v3/problem.yml new file mode 100644 index 00000000000..8699c81c7d1 --- /dev/null +++ b/seed/postman/trace/.mock/definition/v2/v3/problem.yml @@ -0,0 +1,218 @@ +imports: + commons: ../../commons.yml + problem: ../../problem.yml + +types: + TestCaseTemplateId: string + TestCaseId: string + ParameterId: string + ProblemInfoV2: + properties: + problemId: commons.ProblemId + problemDescription: problem.ProblemDescription + problemName: string + problemVersion: integer + supportedLanguages: set + customFiles: CustomFiles + generatedFiles: GeneratedFiles + customTestCaseTemplates: list + testcases: list + isPublic: boolean + LightweightProblemInfoV2: + properties: + problemId: commons.ProblemId + problemName: string + problemVersion: integer + variableTypes: set + CreateProblemRequestV2: + properties: + problemName: string + problemDescription: problem.ProblemDescription + customFiles: CustomFiles + customTestCaseTemplates: list + testcases: list + supportedLanguages: set + isPublic: boolean + TestCaseV2: + properties: + metadata: TestCaseMetadata + implementation: TestCaseImplementationReference + arguments: map + expects: optional + TestCaseExpects: + properties: + expectedStdout: optional + TestCaseImplementationReference: + union: + templateId: TestCaseTemplateId + implementation: TestCaseImplementation + BasicTestCaseTemplate: + properties: + templateId: TestCaseTemplateId + name: string + description: TestCaseImplementationDescription + expectedValueParameterId: ParameterId + TestCaseTemplate: + properties: + templateId: TestCaseTemplateId + name: string + implementation: TestCaseImplementation + TestCaseImplementation: + properties: + description: TestCaseImplementationDescription + function: TestCaseFunction + TestCaseFunction: + union: + withActualResult: TestCaseWithActualResultImplementation + custom: VoidFunctionDefinition + TestCaseWithActualResultImplementation: + properties: + getActualResult: NonVoidFunctionDefinition + assertCorrectnessCheck: AssertCorrectnessCheck + VoidFunctionDefinition: + properties: + parameters: list + code: FunctionImplementationForMultipleLanguages + Parameter: + properties: + parameterId: ParameterId + name: string + variableType: commons.VariableType + NonVoidFunctionDefinition: + properties: + signature: NonVoidFunctionSignature + code: FunctionImplementationForMultipleLanguages + VoidFunctionSignature: + properties: + parameters: list + NonVoidFunctionSignature: + properties: + parameters: list + returnType: commons.VariableType + VoidFunctionSignatureThatTakesActualResult: + properties: + parameters: list + actualResultType: commons.VariableType + AssertCorrectnessCheck: + union: + deepEquality: DeepEqualityCorrectnessCheck + custom: VoidFunctionDefinitionThatTakesActualResult + DeepEqualityCorrectnessCheck: + properties: + expectedValueParameterId: ParameterId + VoidFunctionDefinitionThatTakesActualResult: + docs: The generated signature will include an additional param, actualResult + properties: + additionalParameters: list + code: FunctionImplementationForMultipleLanguages + TestCaseImplementationDescription: + properties: + boards: list + TestCaseImplementationDescriptionBoard: + union: + html: string + paramId: ParameterId + TestCaseMetadata: + properties: + id: TestCaseId + name: string + hidden: boolean + FunctionImplementationForMultipleLanguages: + properties: + codeByLanguage: map + FunctionImplementation: + properties: + impl: string + imports: optional + GeneratedFiles: + properties: + generatedTestCaseFiles: map + generatedTemplateFiles: map + other: map + CustomFiles: + union: + basic: BasicCustomFiles + custom: map + BasicCustomFiles: + properties: + methodName: string + signature: NonVoidFunctionSignature + additionalFiles: map + basicTestCaseTemplate: BasicTestCaseTemplate + Files: + properties: + files: list + FileInfoV2: + properties: + filename: string + directory: string + contents: string + editable: boolean + DefaultProvidedFile: + properties: + file: FileInfoV2 + relatedTypes: list + FunctionSignature: + union: + void: VoidFunctionSignature + nonVoid: NonVoidFunctionSignature + voidThatTakesActualResult: + type: VoidFunctionSignatureThatTakesActualResult + docs: Useful when specifying custom grading for a testcase where actualResult is + defined. + GetFunctionSignatureRequest: + properties: + functionSignature: FunctionSignature + GetFunctionSignatureResponse: + properties: + functionByLanguage: map + + GetBasicSolutionFileRequest: + properties: + methodName: string + signature: NonVoidFunctionSignature + GetBasicSolutionFileResponse: + properties: + solutionFileByLanguage: map + + GetGeneratedTestCaseFileRequest: + properties: + template: optional + testCase: TestCaseV2 + + GetGeneratedTestCaseTemplateFileRequest: + properties: + template: TestCaseTemplate + +service: + base-path: /problems-v2 + auth: false + endpoints: + getLightweightProblems: + docs: Returns lightweight versions of all problems + method: GET + path: /lightweight-problem-info + response: list + + getProblems: + docs: Returns latest versions of all problems + method: GET + path: /problem-info + response: list + + getLatestProblem: + docs: Returns latest version of a problem + method: GET + path: /problem-info/{problemId} + path-parameters: + problemId: commons.ProblemId + response: ProblemInfoV2 + + getProblemVersion: + docs: Returns requested version of a problem + method: GET + path: /problem-info/{problemId}/version/{problemVersion} + path-parameters: + problemId: commons.ProblemId + problemVersion: integer + response: ProblemInfoV2 diff --git a/seed/postman/trace/.mock/fern.config.json b/seed/postman/trace/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/trace/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/undiscriminated-unions/.mock/definition/api.yml b/seed/postman/undiscriminated-unions/.mock/definition/api.yml new file mode 100644 index 00000000000..79844430e1b --- /dev/null +++ b/seed/postman/undiscriminated-unions/.mock/definition/api.yml @@ -0,0 +1 @@ +name: undiscriminated-unions diff --git a/seed/postman/undiscriminated-unions/.mock/definition/union.yml b/seed/postman/undiscriminated-unions/.mock/definition/union.yml new file mode 100644 index 00000000000..d5d412253a0 --- /dev/null +++ b/seed/postman/undiscriminated-unions/.mock/definition/union.yml @@ -0,0 +1,21 @@ +service: + auth: false + base-path: / + endpoints: + get: + path: "" + method: POST + request: MyUnion + response: MyUnion + +types: + MyUnion: + docs: | + Several different types are accepted. + discriminated: false + union: + - string + - list + - integer + - list + - list> diff --git a/seed/postman/undiscriminated-unions/.mock/fern.config.json b/seed/postman/undiscriminated-unions/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/undiscriminated-unions/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/unions/.mock/definition/api.yml b/seed/postman/unions/.mock/definition/api.yml new file mode 100644 index 00000000000..469b144f283 --- /dev/null +++ b/seed/postman/unions/.mock/definition/api.yml @@ -0,0 +1 @@ +name: unions diff --git a/seed/postman/unions/.mock/definition/types.yml b/seed/postman/unions/.mock/definition/types.yml new file mode 100644 index 00000000000..1f4613f22c0 --- /dev/null +++ b/seed/postman/unions/.mock/definition/types.yml @@ -0,0 +1,74 @@ +types: + Union: + docs: "This is a simple union." + union: + foo: + type: Foo + key: foo + bar: + type: Bar + key: bar + + UnionWithDiscriminant: + discriminant: + value: _type + name: type + union: + foo: + docs: "This is a Foo field." + type: Foo + key: foo + bar: + type: Bar + key: bar + + UnionWithPrimitive: + union: + integer: integer + string: string + + UnionWithoutKey: + union: + foo: Foo + bar: + docs: "This is a bar field." + type: Bar + + UnionWithUnknown: + union: + foo: Foo + unknown: {} + + UnionWithLiteral: + base-properties: + base: literal<"base"> + union: + fern: literal<"fern"> + + UnionWithBaseProperties: + base-properties: + id: string + union: + integer: integer + string: string + foo: Foo + + UnionWithTime: + union: + value: integer + date: date + datetime: datetime + + UnionWithOptionalTime: + union: + date: optional + dateimte: optional + + Foo: + properties: + name: string + + Bar: + properties: + name: string + diff --git a/seed/postman/unions/.mock/definition/union.yml b/seed/postman/unions/.mock/definition/union.yml new file mode 100644 index 00000000000..39acd2b9457 --- /dev/null +++ b/seed/postman/unions/.mock/definition/union.yml @@ -0,0 +1,36 @@ +types: + GetShapeRequest: + properties: + id: string + + Shape: + base-properties: + id: string + union: + circle: Circle + square: Square + + Circle: + properties: + radius: double + + Square: + properties: + length: double + +service: + auth: false + base-path: / + endpoints: + get: + path: /{id} + method: GET + path-parameters: + id: string + response: Shape + + update: + path: "" + method: PATCH + request: Shape + response: boolean diff --git a/seed/postman/unions/.mock/fern.config.json b/seed/postman/unions/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/unions/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/unknown/.mock/definition/api.yml b/seed/postman/unknown/.mock/definition/api.yml new file mode 100644 index 00000000000..de1ea38d7a6 --- /dev/null +++ b/seed/postman/unknown/.mock/definition/api.yml @@ -0,0 +1 @@ +name: unknown-as-any diff --git a/seed/postman/unknown/.mock/definition/unknown.yml b/seed/postman/unknown/.mock/definition/unknown.yml new file mode 100644 index 00000000000..a24c65e36a7 --- /dev/null +++ b/seed/postman/unknown/.mock/definition/unknown.yml @@ -0,0 +1,15 @@ +service: + auth: false + base-path: / + endpoints: + post: + path: "" + method: POST + request: unknown + response: list + +types: + MyAlias: unknown + MyObject: + properties: + unknown: unknown diff --git a/seed/postman/unknown/.mock/fern.config.json b/seed/postman/unknown/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/unknown/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/variables/.mock/definition/api.yml b/seed/postman/variables/.mock/definition/api.yml new file mode 100644 index 00000000000..5e83d609091 --- /dev/null +++ b/seed/postman/variables/.mock/definition/api.yml @@ -0,0 +1,4 @@ +name: variables + +variables: + rootVariable: string diff --git a/seed/postman/variables/.mock/definition/service.yml b/seed/postman/variables/.mock/definition/service.yml new file mode 100644 index 00000000000..d0216557d75 --- /dev/null +++ b/seed/postman/variables/.mock/definition/service.yml @@ -0,0 +1,9 @@ +service: + auth: false + base-path: / + endpoints: + post: + path: "/{endpointParam}" + path-parameters: + endpointParam: $rootVariable + method: POST diff --git a/seed/postman/variables/.mock/fern.config.json b/seed/postman/variables/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/variables/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/postman/websocket/.mock/definition/api.yml b/seed/postman/websocket/.mock/definition/api.yml new file mode 100644 index 00000000000..6b9c0d61dcb --- /dev/null +++ b/seed/postman/websocket/.mock/definition/api.yml @@ -0,0 +1 @@ +name: websocket diff --git a/seed/postman/websocket/.mock/definition/realtime.yml b/seed/postman/websocket/.mock/definition/realtime.yml new file mode 100644 index 00000000000..ddee9418b74 --- /dev/null +++ b/seed/postman/websocket/.mock/definition/realtime.yml @@ -0,0 +1,36 @@ +# yaml-language-server: $schema=./../../../../../fern.schema.json + +channel: + path: /realtime/{id} + auth: true + path-parameters: + id: string + query-parameters: + model: optional + temperature: optional + messages: + send: + display-name: "Send" + origin: client + body: string + + receive: + display-name: "Receive" + origin: server + body: + name: ReceiveEvent + properties: + text: string + + examples: + - name: Default example + path-parameters: + id: doc_123 + messages: + - type: send + body: "uvxcdv12344412b" + - type: receive + body: + text: "The weather for today..." + - type: send + body: "uvxcdv12344412b" diff --git a/seed/postman/websocket/.mock/fern.config.json b/seed/postman/websocket/.mock/fern.config.json new file mode 100644 index 00000000000..5c8eb23d7e1 --- /dev/null +++ b/seed/postman/websocket/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "0.19.0"} \ No newline at end of file diff --git a/seed/python-sdk/websocket/.inputs/config.json b/seed/python-sdk/websocket/.inputs/config.json index bdccb1deaae..8dc1603681d 100644 --- a/seed/python-sdk/websocket/.inputs/config.json +++ b/seed/python-sdk/websocket/.inputs/config.json @@ -1,27 +1,24 @@ { - "irFilepath": "/fern/ir.json", + "irFilepath": "./ir.json", "output": { "mode": { - "type": "github", "repoUrl": "https://github.com/websocket/fern", "version": "0.0.1", "publishInfo": { - "type": "pypi", "registryUrl": "", "packageName": "fern_websocket", "usernameEnvironmentVariable": "", - "passwordEnvironmentVariable": "" - } + "passwordEnvironmentVariable": "", + "type": "pypi" + }, + "type": "github" }, - "path": "/fern/output", - "publishingMetadata": null, - "snippetFilepath": "/fern/snippet.json" + "path": "../" }, - "publish": null, "workspaceName": "websocket", "organization": "seed", "environment": { - "_type": "local" + "type": "local" }, "dryRun": false, "whitelabel": false, diff --git a/seed/ts-express/server-sent-events/.inputs/ir.json b/seed/ts-express/server-sent-events/.inputs/ir.json index ff83b77af06..bc3d2baa515 100644 --- a/seed/ts-express/server-sent-events/.inputs/ir.json +++ b/seed/ts-express/server-sent-events/.inputs/ir.json @@ -384,7 +384,80 @@ } } }, - "response": null, + "response": { + "type": "streaming", + "value": { + "type": "sse", + "payload": { + "_type": "named", + "name": { + "originalName": "StreamedCompletion", + "camelCase": { + "unsafeName": "streamedCompletion", + "safeName": "streamedCompletion" + }, + "snakeCase": { + "unsafeName": "streamed_completion", + "safeName": "streamed_completion" + }, + "screamingSnakeCase": { + "unsafeName": "STREAMED_COMPLETION", + "safeName": "STREAMED_COMPLETION" + }, + "pascalCase": { + "unsafeName": "StreamedCompletion", + "safeName": "StreamedCompletion" + } + }, + "fernFilepath": { + "allParts": [ + { + "originalName": "completions", + "camelCase": { + "unsafeName": "completions", + "safeName": "completions" + }, + "snakeCase": { + "unsafeName": "completions", + "safeName": "completions" + }, + "screamingSnakeCase": { + "unsafeName": "COMPLETIONS", + "safeName": "COMPLETIONS" + }, + "pascalCase": { + "unsafeName": "Completions", + "safeName": "Completions" + } + } + ], + "packagePath": [], + "file": { + "originalName": "completions", + "camelCase": { + "unsafeName": "completions", + "safeName": "completions" + }, + "snakeCase": { + "unsafeName": "completions", + "safeName": "completions" + }, + "screamingSnakeCase": { + "unsafeName": "COMPLETIONS", + "safeName": "COMPLETIONS" + }, + "pascalCase": { + "unsafeName": "Completions", + "safeName": "Completions" + } + } + }, + "typeId": "type_completions:StreamedCompletion" + }, + "terminator": "[[DONE]]", + "docs": null + } + }, "errors": [], "examples": [ { diff --git a/seed/ts-express/streaming/.inputs/ir.json b/seed/ts-express/streaming/.inputs/ir.json index 94481401a1b..bf317fd0643 100644 --- a/seed/ts-express/streaming/.inputs/ir.json +++ b/seed/ts-express/streaming/.inputs/ir.json @@ -386,9 +386,9 @@ }, "response": { "type": "streaming", - "dataEventType": { + "value": { "type": "json", - "json": { + "payload": { "_type": "named", "name": { "originalName": "StreamResponse", @@ -453,10 +453,10 @@ } }, "typeId": "type_dummy:StreamResponse" - } - }, - "terminator": null, - "docs": null + }, + "terminator": null, + "docs": null + } }, "errors": [], "examples": [ From a0bf4c75482e0ea89c93e35c70d5ec0f74015021 Mon Sep 17 00:00:00 2001 From: dsinghvi Date: Sun, 21 Apr 2024 18:35:46 -0400 Subject: [PATCH 09/12] try the scripts again --- packages/seed/src/commands/test/ScriptRunner.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/seed/src/commands/test/ScriptRunner.ts b/packages/seed/src/commands/test/ScriptRunner.ts index 07845b87471..fb1c0f93a5a 100644 --- a/packages/seed/src/commands/test/ScriptRunner.ts +++ b/packages/seed/src/commands/test/ScriptRunner.ts @@ -33,20 +33,22 @@ interface RunningScriptConfig extends ScriptConfig { * Runs scripts on the generated code to verify the output. */ export class ScriptRunner { - private started: boolean = false; + private startContainersFn: Promise; private scripts: RunningScriptConfig[] = []; - constructor(private readonly workspace: GeneratorWorkspace) {} + constructor(private readonly workspace: GeneratorWorkspace) { + this.startContainersFn = this.startContainers(); + } public async run({ taskContext, id, outputDir }: ScriptRunner.RunArgs): Promise { - await this.startContainers(); + await this.startContainersFn; for (const script of this.scripts) { const result = await this.runScript({ taskContext, containerId: script.containerId, outputDir, script, - id, + id }); if (result.type === "failure") { return result; @@ -142,15 +144,11 @@ export class ScriptRunner { } private async startContainers(): Promise { - if (this.started) { - return; - } // Start running a docker container for each script instance for (const script of this.workspace.workspaceConfig.scripts ?? []) { const startSeedCommand = await loggingExeca(undefined, "docker", ["run", "-dit", script.docker, "/bin/sh"]); const containerId = startSeedCommand.stdout; this.scripts.push({ ...script, containerId }); } - this.started = true; } } From d7209fd95bf399d6878f547d304e86503a6703e0 Mon Sep 17 00:00:00 2001 From: dsinghvi Date: Sun, 21 Apr 2024 18:45:39 -0400 Subject: [PATCH 10/12] fix --- packages/seed/src/commands/test/test-runner/DockerTestRunner.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/seed/src/commands/test/test-runner/DockerTestRunner.ts b/packages/seed/src/commands/test/test-runner/DockerTestRunner.ts index 475f4297eeb..1f476a8f9a2 100644 --- a/packages/seed/src/commands/test/test-runner/DockerTestRunner.ts +++ b/packages/seed/src/commands/test/test-runner/DockerTestRunner.ts @@ -84,7 +84,7 @@ export class DockerTestRunner extends TestRunner { fixtureName: fixture, irVersion, publishMetadata, - workspaceName: fixture, + workspaceName: fernWorkspace.name, context: taskContext }); } From a7abdc23201bb1c3d304400e938648e262c419e7 Mon Sep 17 00:00:00 2001 From: dsinghvi Date: Sun, 21 Apr 2024 18:57:50 -0400 Subject: [PATCH 11/12] get ready to merge --- .github/workflows/seed.yml | 4 ++-- .../basicauth/client.go | 6 ------ .../client/client.go | 6 ------ seed/go-sdk/examples/snippet.json | 2 +- seed/go-sdk/literal/.inputs/config.json | 12 ++++++++---- 5 files changed, 11 insertions(+), 19 deletions(-) diff --git a/.github/workflows/seed.yml b/.github/workflows/seed.yml index 1629b2cee39..426bf6b727e 100644 --- a/.github/workflows/seed.yml +++ b/.github/workflows/seed.yml @@ -493,7 +493,7 @@ jobs: env: FORCE_COLOR: "2" run: | - yarn seed:local test --workspace csharp-model --parallel 16 + yarn seed:local test --generator csharp-model --parallel 16 - name: Ensure no changes to git-tracked files run: git --no-pager diff --exit-code @@ -518,7 +518,7 @@ jobs: env: FORCE_COLOR: "2" run: | - yarn seed:local test --workspace csharp-sdk --parallel 16 + yarn seed:local test --generator csharp-sdk --parallel 16 - name: Ensure no changes to git-tracked files run: git --no-pager diff --exit-code diff --git a/seed/go-sdk/basic-auth-environment-variables/basicauth/client.go b/seed/go-sdk/basic-auth-environment-variables/basicauth/client.go index c56a9f0952a..062c72fac6b 100644 --- a/seed/go-sdk/basic-auth-environment-variables/basicauth/client.go +++ b/seed/go-sdk/basic-auth-environment-variables/basicauth/client.go @@ -12,10 +12,7 @@ import ( option "github.com/basic-auth-environment-variables/fern/option" io "io" http "net/http" -<<<<<<< HEAD os "os" -======= ->>>>>>> 925464783 (fix) ) type Client struct { @@ -26,15 +23,12 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) -<<<<<<< HEAD if options.Username == "" { options.Username = os.Getenv("USERNAME") } if options.Password == "" { options.Password = os.Getenv("PASSWORD") } -======= ->>>>>>> 925464783 (fix) return &Client{ baseURL: options.BaseURL, caller: core.NewCaller( diff --git a/seed/go-sdk/basic-auth-environment-variables/client/client.go b/seed/go-sdk/basic-auth-environment-variables/client/client.go index 6f01cee070e..7db92b53328 100644 --- a/seed/go-sdk/basic-auth-environment-variables/client/client.go +++ b/seed/go-sdk/basic-auth-environment-variables/client/client.go @@ -7,10 +7,7 @@ import ( core "github.com/basic-auth-environment-variables/fern/core" option "github.com/basic-auth-environment-variables/fern/option" http "net/http" -<<<<<<< HEAD os "os" -======= ->>>>>>> 925464783 (fix) ) type Client struct { @@ -23,15 +20,12 @@ type Client struct { func NewClient(opts ...option.RequestOption) *Client { options := core.NewRequestOptions(opts...) -<<<<<<< HEAD if options.Username == "" { options.Username = os.Getenv("USERNAME") } if options.Password == "" { options.Password = os.Getenv("PASSWORD") } -======= ->>>>>>> 925464783 (fix) return &Client{ baseURL: options.BaseURL, caller: core.NewCaller( diff --git a/seed/go-sdk/examples/snippet.json b/seed/go-sdk/examples/snippet.json index d97fbbd4a9c..58c2f2ec0f3 100644 --- a/seed/go-sdk/examples/snippet.json +++ b/seed/go-sdk/examples/snippet.json @@ -57,7 +57,7 @@ }, "snippet": { "type": "go", - "client": "import (\n\tcontext \"context\"\n\tfern \"github.com/examples/fern\"\n\tfernclient \"github.com/examples/fern/client\"\n\toption \"github.com/examples/fern/option\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n\toption.WithBaseURL(\n\t\tfern.Environments.Production,\n\t),\n)\nresponse, err := client.Service.CreateMovie(\n\tcontext.TODO(),\n\t\u0026fern.Movie{\n\t\tId: \"movie-c06a4ad7\",\n\t\tPrequel: fern.String(\n\t\t\t\"movie-cv9b914f\",\n\t\t),\n\t\tTitle: \"The Boy and the Heron\",\n\t\tFrom: \"Hayao Miyazaki\",\n\t\tRating: 8,\n\t\tTag: \"tag-wf9as23d\",\n\t\tMetadata: map[string]interface{}{\n\t\t\t\"actors\": []interface{}{\n\t\t\t\t\"Christian Bale\",\n\t\t\t\t\"Florence Pugh\",\n\t\t\t\t\"Willem Dafoe\",\n\t\t\t},\n\t\t\t\"releaseDate\": \"2023-12-08\",\n\t\t\t\"ratings\": map[string]interface{}{\n\t\t\t\t\"imdb\": 7.6,\n\t\t\t\t\"rottenTomatoes\": 97,\n\t\t\t},\n\t\t},\n\t},\n)\n" + "client": "import (\n\tcontext \"context\"\n\tfern \"github.com/examples/fern\"\n\tfernclient \"github.com/examples/fern/client\"\n\toption \"github.com/examples/fern/option\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n\toption.WithBaseURL(\n\t\tfern.Environments.Production,\n\t),\n)\nresponse, err := client.Service.CreateMovie(\n\tcontext.TODO(),\n\t\u0026fern.Movie{\n\t\tId: \"movie-c06a4ad7\",\n\t\tPrequel: fern.String(\n\t\t\t\"movie-cv9b914f\",\n\t\t),\n\t\tTitle: \"The Boy and the Heron\",\n\t\tFrom: \"Hayao Miyazaki\",\n\t\tRating: 8,\n\t\tTag: \"tag-wf9as23d\",\n\t\tMetadata: map[string]interface{}{\n\t\t\t\"actors\": []interface{}{\n\t\t\t\t\"Christian Bale\",\n\t\t\t\t\"Florence Pugh\",\n\t\t\t\t\"Willem Dafoe\",\n\t\t\t},\n\t\t\t\"releaseDate\": \"2023-12-08\",\n\t\t\t\"ratings\": map[string]interface{}{\n\t\t\t\t\"rottenTomatoes\": 97,\n\t\t\t\t\"imdb\": 7.6,\n\t\t\t},\n\t\t},\n\t},\n)\n" } }, { diff --git a/seed/go-sdk/literal/.inputs/config.json b/seed/go-sdk/literal/.inputs/config.json index df550411bb2..dd79a594aa3 100644 --- a/seed/go-sdk/literal/.inputs/config.json +++ b/seed/go-sdk/literal/.inputs/config.json @@ -1,17 +1,21 @@ { - "irFilepath": "./ir.json", + "irFilepath": "/fern/ir.json", "output": { "mode": { + "type": "github", "repoUrl": "https://github.com/literal/fern", "version": "0.0.1", - "type": "github" + "publishInfo": null }, - "path": "../" + "path": "/fern/output", + "publishingMetadata": null, + "snippetFilepath": "/fern/snippet.json" }, + "publish": null, "workspaceName": "literal", "organization": "seed", "environment": { - "type": "local" + "_type": "local" }, "dryRun": false, "whitelabel": false, From 4de16916b279ea5b94dce9fc78b3d85ffd550abd Mon Sep 17 00:00:00 2001 From: dsinghvi Date: Sun, 21 Apr 2024 19:09:50 -0400 Subject: [PATCH 12/12] fix: go sdk passes --- seed/go-sdk/literal/.inputs/config.json | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/seed/go-sdk/literal/.inputs/config.json b/seed/go-sdk/literal/.inputs/config.json index dd79a594aa3..df550411bb2 100644 --- a/seed/go-sdk/literal/.inputs/config.json +++ b/seed/go-sdk/literal/.inputs/config.json @@ -1,21 +1,17 @@ { - "irFilepath": "/fern/ir.json", + "irFilepath": "./ir.json", "output": { "mode": { - "type": "github", "repoUrl": "https://github.com/literal/fern", "version": "0.0.1", - "publishInfo": null + "type": "github" }, - "path": "/fern/output", - "publishingMetadata": null, - "snippetFilepath": "/fern/snippet.json" + "path": "../" }, - "publish": null, "workspaceName": "literal", "organization": "seed", "environment": { - "_type": "local" + "type": "local" }, "dryRun": false, "whitelabel": false,