From 5e4c5e3ab88bffa7989761676cb16f3b83038d1b Mon Sep 17 00:00:00 2001 From: Deep Singhvi Date: Tue, 8 Oct 2024 20:58:08 -0400 Subject: [PATCH] feat(cli): handle multi service conjure files in importer (#4831) --- fern/pages/changelogs/cli/2024-10-09.mdx | 3 + .../changelogs/csharp-sdk/2024-10-08.mdx | 5 + generators/commons/package.json | 1 - .../conjure-sdk/fern/definition/conjure.yml | 1 - .../conjure-sdk/fern/definition/types.yml | 19 +- .../resources/conjure/types/DefinitionFile.ts | 1 - .../types/types/ConjureEnumDeclaration.ts | 4 +- .../types/types/ConjureEnumVariant.ts | 7 + .../types/types/ConjureEnumWithDocs.ts | 9 + .../sdk/api/resources/types/types/index.ts | 2 + .../resources/conjure/types/DefinitionFile.ts | 2 - .../types/types/ConjureEnumDeclaration.ts | 5 +- .../types/types/ConjureEnumVariant.ts | 17 + .../types/types/ConjureEnumWithDocs.ts | 23 + .../resources/types/types/index.ts | 2 + .../__snapshots__/conjure.test.ts.snap | 2411 ---------- .../__test__/__snapshots__/trace.json | 4191 +++++++++++++++++ .../__test__/conjure.test.ts | 4 +- .../conjure/conjure-to-fern/package.json | 2 + .../conjure-to-fern/src/ConjureImporter.ts | 266 +- .../src/{ => utils}/listConjureFiles.ts | 13 +- .../src/utils/visitConjureTypeDeclaration.ts | 50 + .../conjure/conjure-to-fern/tsconfig.json | 2 + .../writeDefinitionForWorkspaces.ts | 49 +- packages/cli/cli/versions.yml | 6 + .../convertGeneratorsConfiguration.ts | 47 +- packages/cli/docs-preview/src/previewDocs.ts | 2 +- .../writeDefinition.test.ts.snap | 2186 ++++----- .../fern/.definition/__package__.yml | 12 +- .../header-overrides/fern/.definition/api.yml | 8 +- .../fern/.definition/pets.yml | 50 +- .../fern/.definition/api.yml | 16 +- .../fern/.definition/v1/__package__.yml | 344 +- .../fern/.definition/v2/__package__.yml | 116 +- .../fern/.definition/v2/v2.yml | 98 +- .../fern/.definition/__package__.yml | 8 +- .../namespaced/fern/.definition/api.yml | 16 +- .../fern/.definition/neopets/__package__.yml | 14 +- .../fern/.definition/neopets/pets.yml | 58 +- .../fern/.definition/stream/__package__.yml | 222 +- .../fern/.definition/trains/__package__.yml | 586 +-- .../fern/.definition/trains/bookings.yml | 164 +- .../fern/.definition/trains/payments.yml | 190 +- .../fern/.definition/trains/stations.yml | 50 +- .../fern/.definition/trains/trains.yml | 34 +- .../fern/.definition/trains/trips.yml | 100 +- .../petstore/fern/.definition/__package__.yml | 12 +- .../petstore/fern/.definition/api.yml | 8 +- .../petstore/fern/.definition/pets.yml | 50 +- .../src/ConjureWorkspace.ts | 14 +- .../__tests__/parseEndpointLocator.test.ts | 16 + .../src/__tests__/removeSuffix.test.ts | 13 + packages/commons/core-utils/src/index.ts | 2 + .../core-utils/src/parseEndpointLocator.ts | 56 + .../commons/core-utils/src/removeSuffix.ts | 6 + packages/commons/fs-utils/src/getFilename.ts | 14 + packages/commons/fs-utils/src/index.ts | 1 + pnpm-lock.yaml | 9 +- 58 files changed, 6918 insertions(+), 4699 deletions(-) create mode 100644 fern/pages/changelogs/cli/2024-10-09.mdx create mode 100644 fern/pages/changelogs/csharp-sdk/2024-10-08.mdx create mode 100644 packages/cli/api-importers/conjure/conjure-sdk/src/sdk/api/resources/types/types/ConjureEnumVariant.ts create mode 100644 packages/cli/api-importers/conjure/conjure-sdk/src/sdk/api/resources/types/types/ConjureEnumWithDocs.ts create mode 100644 packages/cli/api-importers/conjure/conjure-sdk/src/sdk/serialization/resources/types/types/ConjureEnumVariant.ts create mode 100644 packages/cli/api-importers/conjure/conjure-sdk/src/sdk/serialization/resources/types/types/ConjureEnumWithDocs.ts delete mode 100644 packages/cli/api-importers/conjure/conjure-to-fern-tests/__test__/__snapshots__/conjure.test.ts.snap create mode 100644 packages/cli/api-importers/conjure/conjure-to-fern-tests/__test__/__snapshots__/trace.json rename packages/cli/api-importers/conjure/conjure-to-fern/src/{ => utils}/listConjureFiles.ts (72%) create mode 100644 packages/cli/api-importers/conjure/conjure-to-fern/src/utils/visitConjureTypeDeclaration.ts create mode 100644 packages/commons/core-utils/src/__tests__/parseEndpointLocator.test.ts create mode 100644 packages/commons/core-utils/src/__tests__/removeSuffix.test.ts create mode 100644 packages/commons/core-utils/src/parseEndpointLocator.ts create mode 100644 packages/commons/core-utils/src/removeSuffix.ts create mode 100644 packages/commons/fs-utils/src/getFilename.ts diff --git a/fern/pages/changelogs/cli/2024-10-09.mdx b/fern/pages/changelogs/cli/2024-10-09.mdx new file mode 100644 index 00000000000..9b157191d75 --- /dev/null +++ b/fern/pages/changelogs/cli/2024-10-09.mdx @@ -0,0 +1,3 @@ +## 0.44.11 +**`(fix):`** Several improvements to the conjure importer. + diff --git a/fern/pages/changelogs/csharp-sdk/2024-10-08.mdx b/fern/pages/changelogs/csharp-sdk/2024-10-08.mdx new file mode 100644 index 00000000000..d4f6b022ec9 --- /dev/null +++ b/fern/pages/changelogs/csharp-sdk/2024-10-08.mdx @@ -0,0 +1,5 @@ +## 1.8.1 +**`(fix):`** Fixes a bug where the `OauthTokenProvider.cs` was incorrectly referencing +the endpoint method, causing code to fail to compile. + + diff --git a/generators/commons/package.json b/generators/commons/package.json index 98dbd8e65a1..4bc499a8f5e 100644 --- a/generators/commons/package.json +++ b/generators/commons/package.json @@ -39,7 +39,6 @@ "tmp-promise": "^3.0.3" }, "devDependencies": { - "@types/jest": "^29.5.12", "@types/js-yaml": "^4.0.8", "@types/lodash-es": "^4.17.12", "@types/node": "^18.7.18", diff --git a/packages/cli/api-importers/conjure/conjure-sdk/fern/definition/conjure.yml b/packages/cli/api-importers/conjure/conjure-sdk/fern/definition/conjure.yml index 9825b846c7e..8167c11883d 100644 --- a/packages/cli/api-importers/conjure/conjure-sdk/fern/definition/conjure.yml +++ b/packages/cli/api-importers/conjure/conjure-sdk/fern/definition/conjure.yml @@ -8,6 +8,5 @@ types: DefinitionFile: properties: - imports: optional> types: optional services: optional> diff --git a/packages/cli/api-importers/conjure/conjure-sdk/fern/definition/types.yml b/packages/cli/api-importers/conjure/conjure-sdk/fern/definition/types.yml index c8a17e5d005..a9c8b9c4dc5 100644 --- a/packages/cli/api-importers/conjure/conjure-sdk/fern/definition/types.yml +++ b/packages/cli/api-importers/conjure/conjure-sdk/fern/definition/types.yml @@ -1,5 +1,8 @@ # yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json +imports: + commons: commons.yml + types: ConjureTypes: properties: @@ -33,8 +36,20 @@ types: ConjureEnumDeclaration: properties: - values: list - + values: list + + ConjureEnumVariant: + discriminated: false + union: + - string + - ConjureEnumWithDocs + + ConjureEnumWithDocs: + extends: + - commons.WithDocs + properties: + value: string + ConjureTypeReference: discriminated: false union: diff --git a/packages/cli/api-importers/conjure/conjure-sdk/src/sdk/api/resources/conjure/types/DefinitionFile.ts b/packages/cli/api-importers/conjure/conjure-sdk/src/sdk/api/resources/conjure/types/DefinitionFile.ts index 237ab0375de..4761753c313 100644 --- a/packages/cli/api-importers/conjure/conjure-sdk/src/sdk/api/resources/conjure/types/DefinitionFile.ts +++ b/packages/cli/api-importers/conjure/conjure-sdk/src/sdk/api/resources/conjure/types/DefinitionFile.ts @@ -5,7 +5,6 @@ import * as FernConjure from "../../../index"; export interface DefinitionFile { - imports: Record | undefined; types: FernConjure.ConjureTypes | undefined; services: Record | undefined; } diff --git a/packages/cli/api-importers/conjure/conjure-sdk/src/sdk/api/resources/types/types/ConjureEnumDeclaration.ts b/packages/cli/api-importers/conjure/conjure-sdk/src/sdk/api/resources/types/types/ConjureEnumDeclaration.ts index bbc99952fb1..8fa706c85e1 100644 --- a/packages/cli/api-importers/conjure/conjure-sdk/src/sdk/api/resources/types/types/ConjureEnumDeclaration.ts +++ b/packages/cli/api-importers/conjure/conjure-sdk/src/sdk/api/resources/types/types/ConjureEnumDeclaration.ts @@ -2,6 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ +import * as FernConjure from "../../../index"; + export interface ConjureEnumDeclaration { - values: string[]; + values: FernConjure.ConjureEnumVariant[]; } diff --git a/packages/cli/api-importers/conjure/conjure-sdk/src/sdk/api/resources/types/types/ConjureEnumVariant.ts b/packages/cli/api-importers/conjure/conjure-sdk/src/sdk/api/resources/types/types/ConjureEnumVariant.ts new file mode 100644 index 00000000000..d041b9b615e --- /dev/null +++ b/packages/cli/api-importers/conjure/conjure-sdk/src/sdk/api/resources/types/types/ConjureEnumVariant.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as FernConjure from "../../../index"; + +export type ConjureEnumVariant = string | FernConjure.ConjureEnumWithDocs; diff --git a/packages/cli/api-importers/conjure/conjure-sdk/src/sdk/api/resources/types/types/ConjureEnumWithDocs.ts b/packages/cli/api-importers/conjure/conjure-sdk/src/sdk/api/resources/types/types/ConjureEnumWithDocs.ts new file mode 100644 index 00000000000..15403335a87 --- /dev/null +++ b/packages/cli/api-importers/conjure/conjure-sdk/src/sdk/api/resources/types/types/ConjureEnumWithDocs.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as FernConjure from "../../../index"; + +export interface ConjureEnumWithDocs extends FernConjure.WithDocs { + value: string; +} diff --git a/packages/cli/api-importers/conjure/conjure-sdk/src/sdk/api/resources/types/types/index.ts b/packages/cli/api-importers/conjure/conjure-sdk/src/sdk/api/resources/types/types/index.ts index cba7dfc00f4..27673ff4145 100644 --- a/packages/cli/api-importers/conjure/conjure-sdk/src/sdk/api/resources/types/types/index.ts +++ b/packages/cli/api-importers/conjure/conjure-sdk/src/sdk/api/resources/types/types/index.ts @@ -5,6 +5,8 @@ export * from "./ConjureAliasDeclaration"; export * from "./ConjureUnionDeclaration"; export * from "./ConjureObjectDeclaration"; export * from "./ConjureEnumDeclaration"; +export * from "./ConjureEnumVariant"; +export * from "./ConjureEnumWithDocs"; export * from "./ConjureTypeReference"; export * from "./ConjureType"; export * from "./ConjureTypeWithDocs"; diff --git a/packages/cli/api-importers/conjure/conjure-sdk/src/sdk/serialization/resources/conjure/types/DefinitionFile.ts b/packages/cli/api-importers/conjure/conjure-sdk/src/sdk/serialization/resources/conjure/types/DefinitionFile.ts index 77f785e2ef3..eb5a3da81a7 100644 --- a/packages/cli/api-importers/conjure/conjure-sdk/src/sdk/serialization/resources/conjure/types/DefinitionFile.ts +++ b/packages/cli/api-importers/conjure/conjure-sdk/src/sdk/serialization/resources/conjure/types/DefinitionFile.ts @@ -13,14 +13,12 @@ export const DefinitionFile: core.serialization.ObjectSchema< serializers.DefinitionFile.Raw, FernConjure.DefinitionFile > = core.serialization.objectWithoutOptionalProperties({ - imports: core.serialization.record(core.serialization.string(), core.serialization.string()).optional(), types: ConjureTypes.optional(), services: core.serialization.record(ConjureServiceName, ConjureService).optional(), }); export declare namespace DefinitionFile { interface Raw { - imports?: Record | null; types?: ConjureTypes.Raw | null; services?: Record | null; } diff --git a/packages/cli/api-importers/conjure/conjure-sdk/src/sdk/serialization/resources/types/types/ConjureEnumDeclaration.ts b/packages/cli/api-importers/conjure/conjure-sdk/src/sdk/serialization/resources/types/types/ConjureEnumDeclaration.ts index 02f99f17e5a..8912e28224b 100644 --- a/packages/cli/api-importers/conjure/conjure-sdk/src/sdk/serialization/resources/types/types/ConjureEnumDeclaration.ts +++ b/packages/cli/api-importers/conjure/conjure-sdk/src/sdk/serialization/resources/types/types/ConjureEnumDeclaration.ts @@ -5,16 +5,17 @@ import * as serializers from "../../../index"; import * as FernConjure from "../../../../api/index"; import * as core from "../../../../core"; +import { ConjureEnumVariant } from "./ConjureEnumVariant"; export const ConjureEnumDeclaration: core.serialization.ObjectSchema< serializers.ConjureEnumDeclaration.Raw, FernConjure.ConjureEnumDeclaration > = core.serialization.objectWithoutOptionalProperties({ - values: core.serialization.list(core.serialization.string()), + values: core.serialization.list(ConjureEnumVariant), }); export declare namespace ConjureEnumDeclaration { interface Raw { - values: string[]; + values: ConjureEnumVariant.Raw[]; } } diff --git a/packages/cli/api-importers/conjure/conjure-sdk/src/sdk/serialization/resources/types/types/ConjureEnumVariant.ts b/packages/cli/api-importers/conjure/conjure-sdk/src/sdk/serialization/resources/types/types/ConjureEnumVariant.ts new file mode 100644 index 00000000000..e15c6785fac --- /dev/null +++ b/packages/cli/api-importers/conjure/conjure-sdk/src/sdk/serialization/resources/types/types/ConjureEnumVariant.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as FernConjure from "../../../../api/index"; +import * as core from "../../../../core"; +import { ConjureEnumWithDocs } from "./ConjureEnumWithDocs"; + +export const ConjureEnumVariant: core.serialization.Schema< + serializers.ConjureEnumVariant.Raw, + FernConjure.ConjureEnumVariant +> = core.serialization.undiscriminatedUnion([core.serialization.string(), ConjureEnumWithDocs]); + +export declare namespace ConjureEnumVariant { + type Raw = string | ConjureEnumWithDocs.Raw; +} diff --git a/packages/cli/api-importers/conjure/conjure-sdk/src/sdk/serialization/resources/types/types/ConjureEnumWithDocs.ts b/packages/cli/api-importers/conjure/conjure-sdk/src/sdk/serialization/resources/types/types/ConjureEnumWithDocs.ts new file mode 100644 index 00000000000..aff9c2d372d --- /dev/null +++ b/packages/cli/api-importers/conjure/conjure-sdk/src/sdk/serialization/resources/types/types/ConjureEnumWithDocs.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as FernConjure from "../../../../api/index"; +import * as core from "../../../../core"; +import { WithDocs } from "../../commons/types/WithDocs"; + +export const ConjureEnumWithDocs: core.serialization.ObjectSchema< + serializers.ConjureEnumWithDocs.Raw, + FernConjure.ConjureEnumWithDocs +> = core.serialization + .objectWithoutOptionalProperties({ + value: core.serialization.string(), + }) + .extend(WithDocs); + +export declare namespace ConjureEnumWithDocs { + interface Raw extends WithDocs.Raw { + value: string; + } +} diff --git a/packages/cli/api-importers/conjure/conjure-sdk/src/sdk/serialization/resources/types/types/index.ts b/packages/cli/api-importers/conjure/conjure-sdk/src/sdk/serialization/resources/types/types/index.ts index cba7dfc00f4..27673ff4145 100644 --- a/packages/cli/api-importers/conjure/conjure-sdk/src/sdk/serialization/resources/types/types/index.ts +++ b/packages/cli/api-importers/conjure/conjure-sdk/src/sdk/serialization/resources/types/types/index.ts @@ -5,6 +5,8 @@ export * from "./ConjureAliasDeclaration"; export * from "./ConjureUnionDeclaration"; export * from "./ConjureObjectDeclaration"; export * from "./ConjureEnumDeclaration"; +export * from "./ConjureEnumVariant"; +export * from "./ConjureEnumWithDocs"; export * from "./ConjureTypeReference"; export * from "./ConjureType"; export * from "./ConjureTypeWithDocs"; diff --git a/packages/cli/api-importers/conjure/conjure-to-fern-tests/__test__/__snapshots__/conjure.test.ts.snap b/packages/cli/api-importers/conjure/conjure-to-fern-tests/__test__/__snapshots__/conjure.test.ts.snap deleted file mode 100644 index 49da00aa10e..00000000000 --- a/packages/cli/api-importers/conjure/conjure-to-fern-tests/__test__/__snapshots__/conjure.test.ts.snap +++ /dev/null @@ -1,2411 +0,0 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - -exports[`ir > {"name":"trace"} 1`] = ` -{ - "absoluteFilePath": "/DUMMY_PATH", - "importedDefinitions": {}, - "namedDefinitionFiles": { - "__package__.yml": { - "absoluteFilepath": "/DUMMY_PATH", - "contents": {}, - "rawContents": "{} -", - }, - "admin.yml": { - "absoluteFilepath": "/DUMMY_PATH", - "contents": { - "service": { - "auth": false, - "base-path": "", - "endpoints": { - "sendTestSubmissionUpdate": { - "auth": true, - "method": "/store-test-submission-status-v2/{submissionId}", - "path": "POST", - "response": undefined, - }, - "sendWorkspaceSubmissionUpdate": { - "auth": true, - "method": "/store-workspace-submission-status-v2/{submissionId}", - "path": "POST", - "response": undefined, - }, - "storeTracedTestCase": { - "auth": true, - "method": "/store-test-trace/submission/{submissionId}/testCase/{testCaseId}", - "path": "POST", - "response": undefined, - }, - "storeTracedTestCaseV2": { - "auth": true, - "method": "/store-test-trace-v2/submission/{submissionId}/testCase/{testCaseId}", - "path": "POST", - "response": undefined, - }, - "storeTracedWorkspace": { - "auth": true, - "method": "/store-workspace-trace/submission/{submissionId}", - "path": "POST", - "response": undefined, - }, - "storeTracedWorkspaceV2": { - "auth": true, - "method": "/store-workspace-trace-v2/submission/{submissionId}", - "path": "POST", - "response": undefined, - }, - "updateTestSubmissionStatus": { - "auth": true, - "method": "/store-test-submission-status/{submissionId}", - "path": "POST", - "response": undefined, - }, - "updateWorkspaceSubmissionStatus": { - "auth": true, - "method": "/store-workspace-submission-status/{submissionId}", - "path": "POST", - "response": undefined, - }, - }, - }, - "types": { - "StoreTracedTestCaseRequest": { - "properties": { - "result": "submission.TestCaseResultWithStdout", - "traceResponses": "list", - }, - }, - "StoreTracedWorkspaceRequest": { - "properties": { - "traceResponses": "list", - "workspaceRunDetails": "submission.WorkspaceRunDetails", - }, - }, - }, - }, - "rawContents": "types: - StoreTracedTestCaseRequest: - properties: - result: submission.TestCaseResultWithStdout - traceResponses: list - StoreTracedWorkspaceRequest: - properties: - workspaceRunDetails: submission.WorkspaceRunDetails - traceResponses: list -service: - auth: false - base-path: '' - endpoints: - updateTestSubmissionStatus: - auth: true - path: POST - method: /store-test-submission-status/{submissionId} - sendTestSubmissionUpdate: - auth: true - path: POST - method: /store-test-submission-status-v2/{submissionId} - updateWorkspaceSubmissionStatus: - auth: true - path: POST - method: /store-workspace-submission-status/{submissionId} - sendWorkspaceSubmissionUpdate: - auth: true - path: POST - method: /store-workspace-submission-status-v2/{submissionId} - storeTracedTestCase: - auth: true - path: POST - method: /store-test-trace/submission/{submissionId}/testCase/{testCaseId} - storeTracedTestCaseV2: - auth: true - path: POST - method: /store-test-trace-v2/submission/{submissionId}/testCase/{testCaseId} - storeTracedWorkspace: - auth: true - path: POST - method: /store-workspace-trace/submission/{submissionId} - storeTracedWorkspaceV2: - auth: true - path: POST - method: /store-workspace-trace-v2/submission/{submissionId} -", - }, - "commons.yml": { - "absoluteFilepath": "/DUMMY_PATH", - "contents": { - "types": { - "BinaryTreeNodeAndTreeValue": { - "properties": { - "fullTree": "BinaryTreeValue", - "nodeId": "NodeId", - }, - }, - "BinaryTreeNodeValue": { - "properties": { - "left": "optional", - "nodeId": "NodeId", - "right": "optional", - "val": "double", - }, - }, - "BinaryTreeValue": { - "properties": { - "nodes": "map", - "root": "optional", - }, - }, - "DebugKeyValuePairs": { - "properties": { - "key": "DebugVariableValue", - "value": "DebugVariableValue", - }, - }, - "DebugMapValue": { - "properties": { - "keyValuePairs": "list", - }, - }, - "DoublyLinkedListNodeAndListValue": { - "properties": { - "fullList": "DoublyLinkedListValue", - "nodeId": "NodeId", - }, - }, - "DoublyLinkedListNodeValue": { - "properties": { - "next": "optional", - "nodeId": "NodeId", - "prev": "optional", - "val": "double", - }, - }, - "DoublyLinkedListValue": { - "properties": { - "head": "optional", - "nodes": "map", - }, - }, - "EmptyObject": { - "properties": {}, - }, - "FileInfo": { - "properties": { - "contents": "string", - "filename": "string", - }, - }, - "FrontendBinaryTreeNodeValue": { - "properties": { - "left": "optional", - "nodeId": "NodeId", - "right": "optional", - "val": "optional", - }, - }, - "FrontendBinaryTreeValue": { - "properties": { - "nodes": "map", - "root": "NodeId", - }, - }, - "FrontendDoublyLinkedListNodeValue": { - "properties": { - "next": "optional", - "nodeId": "NodeId", - "prev": "optional", - "val": "optional", - }, - }, - "FrontendDoublyLinkedListValue": { - "properties": { - "head": "NodeId", - "nodes": "map", - }, - }, - "FrontendKeyValuePair": { - "properties": { - "key": "FrontendVariableValue", - "value": "FrontendVariableValue", - }, - }, - "FrontendMapValue": { - "properties": { - "keyValuePairs": "list", - }, - }, - "FrontendSinglyLinkedListNodeValue": { - "properties": { - "next": "optional", - "nodeId": "NodeId", - "val": "optional", - }, - }, - "FrontendSinglyLinkedListValue": { - "properties": { - "head": "NodeId", - "nodes": "map", - }, - }, - "GenericValue": { - "properties": { - "stringifiedType": "optional", - "stringifiedValue": "string", - }, - }, - "KeyValuePair": { - "properties": { - "key": "VariableValue", - "value": "VariableValue", - }, - }, - "Language": { - "enum": [ - "JAVA", - "JAVASCRIPT", - "PYTHON", - ], - }, - "ListType": { - "properties": { - "isFixedLength": { - "docs": "Whether this list is fixed-size (for languages that supports fixed-size lists). Defaults to false.", - "type": "optional", - }, - "valueType": "VariableType", - }, - }, - "MapType": { - "properties": { - "keyType": "VariableType", - "valueType": "VariableType", - }, - }, - "MapValue": { - "properties": { - "keyValuePairs": "list", - }, - }, - "NodeId": { - "docs": undefined, - "type": "string", - }, - "ProblemId": { - "docs": undefined, - "type": "string", - }, - "SinglyLinkedListNodeAndListValue": { - "properties": { - "fullList": "SinglyLinkedListValue", - "nodeId": "NodeId", - }, - }, - "SinglyLinkedListNodeValue": { - "properties": { - "next": "optional", - "nodeId": "NodeId", - "val": "double", - }, - }, - "SinglyLinkedListValue": { - "properties": { - "head": "optional", - "nodes": "map", - }, - }, - "TestCase": { - "properties": { - "id": "string", - "params": "list", - }, - }, - "TestCaseWithExpectedResult": { - "properties": { - "expectedResult": "VariableValue", - "testCase": "TestCase", - }, - }, - "UserId": { - "docs": undefined, - "type": "string", - }, - }, - }, - "rawContents": "types: - EmptyObject: - properties: {} - ProblemId: - type: string - NodeId: - type: string - 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 - 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 - FrontendMapValue: - properties: - keyValuePairs: list - FrontendKeyValuePair: - properties: - key: FrontendVariableValue - value: FrontendVariableValue - FrontendBinaryTreeValue: - properties: - root: NodeId - nodes: map - FrontendBinaryTreeNodeValue: - properties: - nodeId: NodeId - val: optional - right: optional - left: optional - FrontendSinglyLinkedListValue: - properties: - head: NodeId - nodes: map - FrontendSinglyLinkedListNodeValue: - properties: - nodeId: NodeId - val: optional - next: optional - FrontendDoublyLinkedListValue: - properties: - head: NodeId - nodes: map - FrontendDoublyLinkedListNodeValue: - properties: - nodeId: NodeId - val: optional - next: optional - prev: optional - 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 - UserId: - type: string -", - }, - "langserver.yml": { - "absoluteFilepath": "/DUMMY_PATH", - "contents": { - "types": { - "LangServerRequest": { - "properties": { - "request": "any", - }, - }, - "LangServerResponse": { - "properties": { - "response": "any", - }, - }, - }, - }, - "rawContents": "types: - LangServerRequest: - properties: - request: any - LangServerResponse: - properties: - response: any -", - }, - "migration.yml": { - "absoluteFilepath": "/DUMMY_PATH", - "contents": { - "service": { - "auth": false, - "base-path": "", - "endpoints": { - "getAttemptedMigrations": { - "auth": true, - "method": "/all", - "path": "GET", - "response": "list", - }, - }, - }, - "types": { - "Migration": { - "properties": { - "name": "string", - "status": "MigrationStatus", - }, - }, - "MigrationStatus": { - "enum": [ - "RUNNING", - "FAILED", - "FINISHED", - ], - }, - }, - }, - "rawContents": "types: - MigrationStatus: - enum: - - RUNNING - - FAILED - - FINISHED - Migration: - properties: - name: string - status: MigrationStatus -service: - auth: false - base-path: '' - endpoints: - getAttemptedMigrations: - auth: true - path: GET - method: /all - response: list -", - }, - "playlist.yml": { - "absoluteFilepath": "/DUMMY_PATH", - "contents": { - "service": { - "auth": false, - "base-path": "", - "endpoints": { - "createPlaylist": { - "auth": true, - "method": "/create", - "path": "POST", - "response": "Playlist", - }, - "deletePlaylist": { - "auth": true, - "method": "/{playlistId}", - "path": "DELETE", - "response": undefined, - }, - "getPlaylist": { - "auth": true, - "method": "/{playlistId}", - "path": "GET", - "response": "Playlist", - }, - "getPlaylists": { - "auth": true, - "method": "/all", - "path": "GET", - "response": "list", - }, - "updatePlaylist": { - "auth": true, - "method": "/{playlistId}", - "path": "PUT", - "response": "Playlist", - }, - }, - }, - "types": { - "CreatePlaylistRequest": { - "properties": { - "name": "string", - "problems": "list", - }, - }, - "Playlist": { - "properties": { - "name": "string", - "ownerId": "commons.UserId", - "playlistId": "PlaylistId", - "problems": "list", - }, - }, - "PlaylistId": { - "docs": undefined, - "type": "string", - }, - "UpdatePlaylistRequest": { - "properties": { - "name": "string", - "problems": "list", - }, - }, - }, - }, - "rawContents": "types: - PlaylistId: - type: string - Playlist: - properties: - playlistId: PlaylistId - name: string - problems: list - ownerId: commons.UserId - CreatePlaylistRequest: - properties: - name: string - problems: list - UpdatePlaylistRequest: - properties: - name: string - problems: list -service: - auth: false - base-path: '' - endpoints: - createPlaylist: - auth: true - path: POST - method: /create - response: Playlist - getPlaylists: - auth: true - path: GET - method: /all - response: list - getPlaylist: - auth: true - path: GET - method: /{playlistId} - response: Playlist - updatePlaylist: - auth: true - path: PUT - method: /{playlistId} - response: Playlist - deletePlaylist: - auth: true - path: DELETE - method: /{playlistId} -", - }, - "playlistV2.yml": { - "absoluteFilepath": "/DUMMY_PATH", - "contents": { - "service": { - "auth": false, - "base-path": "", - "endpoints": { - "createPlaylist": { - "auth": true, - "method": "/create", - "path": "POST", - "response": "playlist.Playlist", - }, - "deletePlaylist": { - "auth": true, - "method": "/{playlistId}", - "path": "DELETE", - "response": undefined, - }, - "getPlaylist": { - "auth": true, - "method": "/{playlistId}", - "path": "GET", - "response": "playlist.Playlist", - }, - "getPlaylists": { - "auth": true, - "method": "/all", - "path": "GET", - "response": "list", - }, - "updatePlaylist": { - "auth": true, - "method": "/{playlistId}", - "path": "PUT", - "response": "playlist.Playlist", - }, - }, - }, - }, - "rawContents": "service: - auth: false - base-path: '' - endpoints: - createPlaylist: - auth: true - path: POST - method: /create - response: playlist.Playlist - getPlaylists: - auth: true - path: GET - method: /all - response: list - getPlaylist: - auth: true - path: GET - method: /{playlistId} - response: playlist.Playlist - updatePlaylist: - auth: true - path: PUT - method: /{playlistId} - response: playlist.Playlist - deletePlaylist: - auth: true - path: DELETE - method: /{playlistId} -", - }, - "problem.yml": { - "absoluteFilepath": "/DUMMY_PATH", - "contents": { - "service": { - "auth": false, - "base-path": "", - "endpoints": { - "createProblem": { - "auth": true, - "method": "/create", - "path": "POST", - "response": "CreateProblemResponse", - }, - "deleteProblem": { - "auth": true, - "method": "/delete/{problemId}", - "path": "DELETE", - "response": undefined, - }, - "getDefaultStarterFiles": { - "auth": true, - "method": "/default-starter-files", - "path": "POST", - "response": "GetDefaultStarterFilesResponse", - }, - "getExpectedResult": { - "auth": true, - "method": "/expected-result/{problemId}", - "path": "POST", - "response": "commons.TestCaseWithExpectedResult", - }, - "getLatestProblem": { - "auth": true, - "method": "/problem-info/{problemId}", - "path": "GET", - "response": "ProblemInfo", - }, - "getProblemVersion": { - "auth": true, - "method": "/problem-info/{problemId}/version/{problemVersion}", - "path": "GET", - "response": "ProblemInfo", - }, - "getProblems": { - "auth": true, - "method": "/problem-info", - "path": "GET", - "response": "list", - }, - "updateProblem": { - "auth": true, - "method": "/update/{problemId}", - "path": "POST", - "response": "UpdateProblemResponse", - }, - }, - }, - "types": { - "CreateProblemRequest": { - "properties": { - "files": "map", - "inputParams": "list", - "methodName": "string", - "outputType": "commons.VariableType", - "problemDescription": "ProblemDescription", - "problemName": "string", - "testcases": "list", - }, - }, - "GenericCreateProblemError": { - "properties": { - "message": "string", - "stacktrace": "string", - "type": "string", - }, - }, - "GetDefaultStarterFilesRequest": { - "properties": { - "inputParams": "list", - "methodName": "string", - "outputType": "commons.VariableType", - }, - }, - "GetDefaultStarterFilesResponse": { - "properties": { - "files": "map", - }, - }, - "ProblemDescription": { - "properties": { - "boards": "list", - }, - }, - "ProblemFiles": { - "properties": { - "readOnlyFiles": "list", - "solutionFile": "commons.FileInfo", - }, - }, - "ProblemInfo": { - "properties": { - "files": "map", - "inputParams": "list", - "methodName": "string", - "outputType": "commons.VariableType", - "problemDescription": "ProblemDescription", - "problemId": "commons.ProblemId", - "problemName": "string", - "problemVersion": "integer", - "supportsCustomTestCases": "boolean", - "testcases": "list", - }, - }, - "UpdateProblemResponse": { - "properties": { - "problemVersion": "integer", - }, - }, - "VariableTypeAndName": { - "properties": { - "name": "string", - "variableType": "commons.VariableType", - }, - }, - }, - }, - "rawContents": "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 - 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 - GenericCreateProblemError: - properties: - message: string - type: string - stacktrace: string - UpdateProblemResponse: - properties: - problemVersion: integer - GetDefaultStarterFilesRequest: - properties: - inputParams: list - outputType: commons.VariableType - methodName: string - GetDefaultStarterFilesResponse: - properties: - files: map -service: - auth: false - base-path: '' - endpoints: - getProblems: - auth: true - path: GET - method: /problem-info - response: list - getLatestProblem: - auth: true - path: GET - method: /problem-info/{problemId} - response: ProblemInfo - getProblemVersion: - auth: true - path: GET - method: /problem-info/{problemId}/version/{problemVersion} - response: ProblemInfo - getExpectedResult: - auth: true - path: POST - method: /expected-result/{problemId} - response: commons.TestCaseWithExpectedResult - createProblem: - auth: true - path: POST - method: /create - response: CreateProblemResponse - updateProblem: - auth: true - path: POST - method: /update/{problemId} - response: UpdateProblemResponse - deleteProblem: - auth: true - path: DELETE - method: /delete/{problemId} - getDefaultStarterFiles: - auth: true - path: POST - method: /default-starter-files - response: GetDefaultStarterFilesResponse -", - }, - "problemV2.yml": { - "absoluteFilepath": "/DUMMY_PATH", - "contents": { - "service": { - "auth": false, - "base-path": "", - "endpoints": { - "createProblem": { - "auth": true, - "method": "/create", - "path": "POST", - "response": "problem.CreateProblemResponse", - }, - "deleteProblem": { - "auth": true, - "method": "/delete/{problemId}", - "path": "DELETE", - "response": undefined, - }, - "getBasicSolutionFile": { - "auth": true, - "method": "/basic-solution-file", - "path": "POST", - "response": "GetBasicSolutionFileResponse", - }, - "getDefaultDirectoryForProblemFiles": { - "auth": true, - "method": "/default-problem-files-directory", - "path": "GET", - "response": "map", - }, - "getFunctionSignature": { - "auth": true, - "method": "/function-signature", - "path": "POST", - "response": "GetFunctionSignatureResponse", - }, - "getGeneratedTestCaseFile": { - "auth": true, - "method": "/generated-test-case-file", - "path": "POST", - "response": "map", - }, - "getGeneratedTestCaseTemplateFile": { - "auth": true, - "method": "/generated-test-case-template-file", - "path": "POST", - "response": "map", - }, - "getLatestProblem": { - "auth": true, - "method": "/problem-info/{problemId}", - "path": "GET", - "response": "ProblemInfoV2", - }, - "getLightweightProblems": { - "auth": true, - "method": "/lightweight-problem-info", - "path": "GET", - "response": "list", - }, - "getProblemVersion": { - "auth": true, - "method": "/problem-info/{problemId}/version/{problemVersion}", - "path": "GET", - "response": "ProblemInfoV2", - }, - "getProblems": { - "auth": true, - "method": "/problem-info", - "path": "GET", - "response": "list", - }, - "updateProblem": { - "auth": true, - "method": "/update/{problemId}", - "path": "POST", - "response": "problem.UpdateProblemResponse", - }, - }, - }, - "types": { - "BasicCustomFiles": { - "properties": { - "additionalFiles": "map", - "basicTestCaseTemplate": "BasicTestCaseTemplate", - "methodName": "string", - "signature": "NonVoidFunctionSignature", - }, - }, - "BasicTestCaseTemplate": { - "properties": { - "description": "TestCaseImplementationDescription", - "expectedValueParameterId": "ParameterId", - "name": "string", - "templateId": "TestCaseTemplateId", - }, - }, - "CreateProblemRequestV2": { - "properties": { - "customFiles": "CustomFiles", - "customTestCaseTemplates": "list", - "isPublic": "boolean", - "problemDescription": "problem.ProblemDescription", - "problemName": "string", - "supportedLanguages": "set", - "testcases": "list", - }, - }, - "DeepEqualityCorrectnessCheck": { - "properties": { - "expectedValueParameterId": "ParameterId", - }, - }, - "DefaultProvidedFile": { - "properties": { - "file": "FileInfoV2", - "relatedTypes": "list", - }, - }, - "FileInfoV2": { - "properties": { - "contents": "string", - "directory": "string", - "editable": "boolean", - "filename": "string", - }, - }, - "Files": { - "properties": { - "files": "list", - }, - }, - "FunctionImplementation": { - "properties": { - "impl": "string;", - "imports": "optional;", - }, - }, - "FunctionImplementationForMultipleLanguages": { - "properties": { - "codeByLanguage": "map", - }, - }, - "GeneratedFiles": { - "properties": { - "generatedTemplateFiles": "map", - "generatedTestCaseFiles": "map", - "other": "map", - }, - }, - "GetBasicSolutionFileRequest": { - "properties": { - "methodName": "string", - "signature": "NonVoidFunctionSignature", - }, - }, - "GetBasicSolutionFileResponse": { - "properties": { - "solutionFileByLanguage": "map", - }, - }, - "GetDefaultProvidedFilesResponse": { - "properties": { - "filesByLanguage": "map>", - }, - }, - "GetFunctionSignatureRequest": { - "properties": { - "functionSignature": "FunctionSignature", - }, - }, - "GetFunctionSignatureResponse": { - "properties": { - "functionByLanguage": "map", - }, - }, - "GetGeneratedTestCaseFileRequest": { - "properties": { - "template": "optional", - "testCase": "TestCaseV2", - }, - }, - "GetGeneratedTestCaseTemplateFileRequest": { - "properties": { - "template": "TestCaseTemplate", - }, - }, - "LightweightProblemInfoV2": { - "properties": { - "problemId": "commons.ProblemId", - "problemName": "string", - "problemVersion": "integer", - "variableTypes": "set", - }, - }, - "NonVoidFunctionDefinition": { - "properties": { - "code": "FunctionImplementationForMultipleLanguages", - "signature": "NonVoidFunctionSignature", - }, - }, - "NonVoidFunctionSignature": { - "properties": { - "parameters": "list", - "returnType": "commons.VariableType", - }, - }, - "Parameter": { - "properties": { - "name": "string", - "parameterId": "ParameterId", - "variableType": "commons.VariableType", - }, - }, - "ParameterId": { - "docs": undefined, - "type": "string", - }, - "ProblemInfoV2": { - "properties": { - "customFiles": "CustomFiles", - "customTestCaseTemplates": "list", - "generatedFiles": "GeneratedFiles", - "isPublic": "boolean", - "problemDescription": "problem.ProblemDescription", - "problemId": "commons.ProblemId", - "problemName": "string", - "problemVersion": "integer", - "supportedLanguages": "set", - "testcases": "list", - }, - }, - "TestCaseExpects": { - "properties": { - "expectedStdout": "optional", - }, - }, - "TestCaseId": { - "docs": undefined, - "type": "string", - }, - "TestCaseImplementation": { - "properties": { - "description": "TestCaseImplementationDescription", - "function": "TestCaseFunction", - }, - }, - "TestCaseImplementationDescription": { - "properties": { - "boards": "list", - }, - }, - "TestCaseMetadata": { - "properties": { - "hidden": "boolean", - "id": "TestCaseId", - "name": "string", - }, - }, - "TestCaseTemplate": { - "properties": { - "implementation": "TestCaseImplementation", - "name": "string", - "templateId": "TestCaseTemplateId", - }, - }, - "TestCaseTemplateId": { - "docs": undefined, - "type": "string", - }, - "TestCaseV2": { - "properties": { - "arguments": "map", - "expects": "optional", - "implementation": "TestCaseImplementationReference", - "metadata": "TestCaseMetadata", - }, - }, - "TestCaseWithActualResultImplementation": { - "properties": { - "assertCorrectnessCheck": "AssertCorrectnessCheck", - "getActualResult": "NonVoidFunctionDefinition", - }, - }, - "VoidFunctionDefinition": { - "properties": { - "code": "FunctionImplementationForMultipleLanguages", - "parameters": "list", - }, - }, - "VoidFunctionDefinitionThatTakesActualResult": { - "properties": { - "additionalParameters": "list", - "code": "FunctionImplementationForMultipleLanguages", - }, - }, - "VoidFunctionSignature": { - "properties": { - "parameters": "list", - }, - }, - "VoidFunctionSignatureThatTakesActualResult": { - "properties": { - "actualResultType": "commons.VariableType", - "parameters": "list", - }, - }, - }, - }, - "rawContents": "types: - TestCaseTemplateId: - type: string - TestCaseId: - type: string - ParameterId: - type: 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 - BasicTestCaseTemplate: - properties: - templateId: TestCaseTemplateId - name: string - description: TestCaseImplementationDescription - expectedValueParameterId: ParameterId - TestCaseTemplate: - properties: - templateId: TestCaseTemplateId - name: string - implementation: TestCaseImplementation - TestCaseImplementation: - properties: - description: TestCaseImplementationDescription - function: TestCaseFunction - 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 - DeepEqualityCorrectnessCheck: - properties: - expectedValueParameterId: ParameterId - VoidFunctionDefinitionThatTakesActualResult: - properties: - additionalParameters: list - code: FunctionImplementationForMultipleLanguages - TestCaseImplementationDescription: - properties: - boards: list - 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 - 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 - GetBasicSolutionFileRequest: - properties: - methodName: string - signature: NonVoidFunctionSignature - GetBasicSolutionFileResponse: - properties: - solutionFileByLanguage: map - GetFunctionSignatureRequest: - properties: - functionSignature: FunctionSignature - GetFunctionSignatureResponse: - properties: - functionByLanguage: map - GetDefaultProvidedFilesResponse: - properties: - filesByLanguage: map> - GetGeneratedTestCaseFileRequest: - properties: - template: optional - testCase: TestCaseV2 - GetGeneratedTestCaseTemplateFileRequest: - properties: - template: TestCaseTemplate -service: - auth: false - base-path: '' - endpoints: - getLightweightProblems: - auth: true - path: GET - method: /lightweight-problem-info - response: list - getProblems: - auth: true - path: GET - method: /problem-info - response: list - getLatestProblem: - auth: true - path: GET - method: /problem-info/{problemId} - response: ProblemInfoV2 - getProblemVersion: - auth: true - path: GET - method: /problem-info/{problemId}/version/{problemVersion} - response: ProblemInfoV2 - createProblem: - auth: true - path: POST - method: /create - response: problem.CreateProblemResponse - updateProblem: - auth: true - path: POST - method: /update/{problemId} - response: problem.UpdateProblemResponse - deleteProblem: - auth: true - path: DELETE - method: /delete/{problemId} - getFunctionSignature: - auth: true - path: POST - method: /function-signature - response: GetFunctionSignatureResponse - getBasicSolutionFile: - auth: true - path: POST - method: /basic-solution-file - response: GetBasicSolutionFileResponse - getDefaultDirectoryForProblemFiles: - auth: true - path: GET - method: /default-problem-files-directory - response: map - getGeneratedTestCaseFile: - auth: true - path: POST - method: /generated-test-case-file - response: map - getGeneratedTestCaseTemplateFile: - auth: true - path: POST - method: /generated-test-case-template-file - response: map -", - }, - "submission.yml": { - "absoluteFilepath": "/DUMMY_PATH", - "contents": { - "service": { - "auth": false, - "base-path": "", - "endpoints": { - "createExecutionSession": { - "auth": true, - "method": "/create-session/{language}", - "path": "POST", - "response": "ExecutionSessionResponse", - }, - "getExecutionSession": { - "auth": true, - "method": "/{sessionId}", - "path": "GET", - "response": "optional", - }, - "getExecutionSessionsState": { - "auth": true, - "method": "/execution-sessions-state", - "path": "GET", - "response": "ExecutionSessionsState", - }, - "getSubmissionState": { - "auth": true, - "method": "/{submissionId}", - "path": "GET", - "response": "SubmissionState", - }, - "getSubmissionStateV2": { - "auth": true, - "method": "/v2/{submissionId}", - "path": "GET", - "response": "SubmissionStateV2", - }, - "getTraceResponsesPage": { - "auth": true, - "method": "/trace-respose/{submissionId}/testCase/{testCaseId}", - "path": "POST", - "response": "TraceResponsesPage", - }, - "getTraceResponsesPageForWorkspace": { - "auth": true, - "method": "/workspace-trace-response/{submissionId}", - "path": "POST", - "response": "TraceResponsesPage", - }, - "getTraceResponsesV2Page": { - "auth": true, - "method": "/trace-response-v2/{submissionId}/testCase/{testCaseId}", - "path": "POST", - "response": "TraceResponsesPageV2", - }, - "getTraceResponsesV2PageForWorkspace": { - "auth": true, - "method": "/workspace-trace-response-v2/{submissionId}", - "path": "POST", - "response": "TraceResponsesPageV2", - }, - "getWorkspaceStarterFiles": { - "auth": true, - "method": "/get-workspace-starter-files", - "path": "GET", - "response": "WorkspaceStarterFilesResponse", - }, - "getWorkspaceStarterFilesV2": { - "auth": true, - "method": "/get-workspace-starter-files-v2", - "path": "GET", - "response": "WorkspaceStarterFilesResponseV2", - }, - "stopExecutionSession": { - "auth": true, - "method": "/stop/{sessionId}", - "path": "DELETE", - "response": undefined, - }, - }, - }, - "types": { - "BuildingExecutorResponse": { - "properties": { - "status": "ExecutionSessionStatus", - "submissionId": "SubmissionId", - }, - }, - "CompileError": { - "properties": { - "message": "string", - }, - }, - "CustomTestCasesUnsupported": { - "properties": { - "problemId": "commons.ProblemId", - "submissionId": "SubmissionId", - }, - }, - "ErroredResponse": { - "properties": { - "errorInfo": "ErrorInfo", - "submissionId": "SubmissionId", - }, - }, - "ExceptionInfo": { - "properties": { - "exceptionMessage": "string", - "exceptionStacktrace": "string", - "exceptionType": "string", - }, - }, - "ExecutionSessionResponse": { - "properties": { - "executionSessionUrl": "optional", - "language": "commons.Language", - "sessionId": "string", - "status": "ExecutionSessionStatus", - }, - }, - "ExecutionSessionState": { - "properties": { - "awsTaskId": "optional", - "isWarmInstance": "boolean", - "language": "commons.Language", - "lastTimeContacted": "optional", - "sessionId": "string", - "status": "ExecutionSessionStatus", - }, - }, - "ExecutionSessionStatus": { - "enum": [ - "CREATING_CONTAINER", - "PROVISIONING_CONTAINER", - "PENDING_CONTAINER", - "RUNNING_CONTAINER", - "LIVE_CONTAINER", - "FAILED_TO_LAUNCH", - ], - }, - "ExecutionSessionsState": { - "properties": { - "numWarmingInstances": "optional", - "states": "map", - "warmingSessionIds": "list", - }, - }, - "ExistingSubmissionExecuting": { - "properties": { - "submissionId": "SubmissionId", - }, - }, - "ExpressionLocation": { - "properties": { - "offset": "integer", - "start": "integer", - }, - }, - "FinishedResponse": { - "properties": { - "submissionId": "SubmissionId", - }, - }, - "GetTraceResponsesPageRequest": { - "properties": { - "offset": { - "type": "optional", - }, - }, - }, - "GradedResponse": { - "properties": { - "submissionId": "SubmissionId", - "testCases": "map", - }, - }, - "GradedResponseV2": { - "properties": { - "submissionId": "SubmissionId", - "testCases": "map", - }, - }, - "GradedTestCaseUpdate": { - "properties": { - "grade": "TestCaseGrade", - "testCaseId": "problemV2.TestCaseId", - }, - }, - "InitializeProblemRequest": { - "properties": { - "problemId": "commons.ProblemId", - "problemVersion": "optional", - }, - }, - "InternalError": { - "properties": { - "exceptionInfo": "ExceptionInfo", - }, - }, - "InvalidRequestResponse": { - "properties": { - "cause": "InvalidRequestCause", - "request": "SubmissionRequest", - }, - }, - "LightweightStackframeInformation": { - "properties": { - "numStackFrames": "integer", - "topStackFrameMethodName": "string", - }, - }, - "RecordedResponseNotification": { - "properties": { - "submissionId": "SubmissionId", - "testCaseId": "optional", - "traceResponsesSize": "integer", - }, - }, - "RecordedTestCaseUpdate": { - "properties": { - "testCaseId": "problemV2.TestCaseId", - "traceResponsesSize": "integer", - }, - }, - "RecordingResponseNotification": { - "properties": { - "lightweightStackInfo": "LightweightStackframeInformation", - "lineNumber": "integer", - "submissionId": "SubmissionId", - "testCaseId": "optional", - "tracedFile": "optional", - }, - }, - "RunningResponse": { - "properties": { - "state": "RunningSubmissionState", - "submissionId": "SubmissionId", - }, - }, - "RunningSubmissionState": { - "enum": [ - "QUEUEING_SUBMISSION", - "KILLING_HISTORICAL_SUBMISSIONS", - "WRITING_SUBMISSION_TO_FILE", - "COMPILING_SUBMISSION", - "RUNNING_SUBMISSION", - ], - }, - "RuntimeError": { - "properties": { - "message": "string", - }, - }, - "Scope": { - "properties": { - "variables": "map", - }, - }, - "ShareId": { - "docs": undefined, - "type": "string", - }, - "StackFrame": { - "properties": { - "lineNumber": "integer", - "methodName": "string", - "scopes": "list", - }, - }, - "StackInformation": { - "properties": { - "numStackFrames": "integer", - "topStackFrame": "optional", - }, - }, - "StderrResponse": { - "properties": { - "stderr": "string", - "submissionId": "SubmissionId", - }, - }, - "StdoutResponse": { - "properties": { - "stdout": "string", - "submissionId": "SubmissionId", - }, - }, - "StopRequest": { - "properties": { - "submissionId": "SubmissionId", - }, - }, - "StoppedResponse": { - "properties": { - "submissionId": "SubmissionId", - }, - }, - "SubmissionFileInfo": { - "properties": { - "contents": "string", - "directory": "string", - "filename": "string", - }, - }, - "SubmissionId": { - "docs": undefined, - "type": "string", - }, - "SubmissionIdNotFound": { - "properties": { - "missingSubmissionId": "SubmissionId", - }, - }, - "SubmissionState": { - "properties": { - "language": "commons.Language", - "submission": "string", - "submissionTypeState": "SubmissionTypeState", - "timeSubmitted": "optional", - }, - }, - "SubmissionStateV2": { - "properties": { - "language": "commons.Language", - "submissionFiles": "list", - "submissionStatus": "SubmissionStatusV2", - "timeSubmitted": "datetime", - }, - }, - "SubmissionTypeEnum": { - "enum": [ - "TEST", - ], - }, - "SubmitRequestV2": { - "properties": { - "language": "commons.Language", - "problemId": "commons.ProblemId", - "problemVersion": "optional", - "submissionFiles": "list", - "submissionId": "SubmissionId", - "userId": "optional", - }, - }, - "TerminatedResponse": { - "properties": {}, - }, - "TestCaseHiddenGrade": { - "properties": { - "passed": "boolean", - }, - }, - "TestCaseNonHiddenGrade": { - "properties": { - "actualResult": "optional", - "exception": "optional", - "passed": "boolean", - "stdout": "string", - }, - }, - "TestCaseResult": { - "properties": { - "actualResult": "ActualResult", - "expectedResult": "commons.VariableValue", - "passed": "boolean", - }, - }, - "TestCaseResultWithStdout": { - "properties": { - "result": "TestCaseResult", - "stdout": "string", - }, - }, - "TestSubmissionState": { - "properties": { - "customTestCases": "list", - "defaultTestCases": "list", - "problemId": "commons.ProblemId", - "status": "TestSubmissionStatus", - }, - }, - "TestSubmissionStatusV2": { - "properties": { - "problemId": "commons.ProblemId", - "problemInfo": "problemV2.ProblemInfoV2", - "problemVersion": "integer", - "updates": "list", - }, - }, - "TestSubmissionUpdate": { - "properties": { - "updateInfo": "TestSubmissionUpdateInfo", - "updateTime": "datetime", - }, - }, - "TraceResponse": { - "properties": { - "expressionLocation": "optional", - "lineNumber": "integer", - "returnValue": "optional", - "stack": "StackInformation", - "stdout": "optional", - "submissionId": "SubmissionId", - }, - }, - "TraceResponseV2": { - "properties": { - "expressionLocation": "optional", - "file": "TracedFile", - "lineNumber": "integer", - "returnValue": "optional", - "stack": "StackInformation", - "stdout": "optional", - "submissionId": "SubmissionId", - }, - }, - "TraceResponsesPage": { - "properties": { - "offset": { - "docs": "If present, use this to load subseqent pages. -The offset is the id of the next trace response to load. -", - "type": "optional", - }, - "traceResponses": "list", - }, - }, - "TraceResponsesPageV2": { - "properties": { - "offset": { - "docs": "If present, use this to load subseqent pages. -The offset is the id of the next trace response to load. -", - "type": "optional", - }, - "traceResponses": "list", - }, - }, - "TracedFile": { - "properties": { - "directory": "string", - "filename": "string", - }, - }, - "TracedTestCase": { - "properties": { - "result": "TestCaseResultWithStdout", - "traceResponsesSize": "integer", - }, - }, - "UnexpectedLanguageError": { - "properties": { - "actualLanguage": "commons.Language", - "expectedLanguage": "commons.Language", - }, - }, - "WorkspaceFiles": { - "properties": { - "mainFile": "commons.FileInfo", - "readOnlyFiles": "list", - }, - }, - "WorkspaceRanResponse": { - "properties": { - "runDetails": "WorkspaceRunDetails", - "submissionId": "SubmissionId", - }, - }, - "WorkspaceRunDetails": { - "properties": { - "exception": "optional", - "exceptionV2": "optional", - "stdout": "string", - }, - }, - "WorkspaceStarterFilesResponse": { - "properties": { - "files": "map", - }, - }, - "WorkspaceStarterFilesResponseV2": { - "properties": { - "filesByLanguage": "map", - }, - }, - "WorkspaceSubmissionState": { - "properties": { - "status": "WorkspaceSubmissionStatus", - }, - }, - "WorkspaceSubmissionStatusV2": { - "properties": { - "updates": "list", - }, - }, - "WorkspaceSubmissionUpdate": { - "properties": { - "updateInfo": "WorkspaceSubmissionUpdateInfo", - "updateTime": "datetime", - }, - }, - "WorkspaceSubmitRequest": { - "properties": { - "language": "commons.Language", - "submissionFiles": "list", - "submissionId": "SubmissionId", - "userId": "optional", - }, - }, - "WorkspaceTracedUpdate": { - "properties": { - "traceResponsesSize": "integer", - }, - }, - }, - }, - "rawContents": "types: - SubmissionId: - type: string - ShareId: - type: string - 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 - StopRequest: - properties: - submissionId: SubmissionId - 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 - 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 - 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 - ExceptionInfo: - properties: - exceptionType: string - exceptionMessage: string - exceptionStacktrace: string - InvalidRequestResponse: - properties: - request: SubmissionRequest - cause: InvalidRequestCause - 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 - - PROVISIONING_CONTAINER - - PENDING_CONTAINER - - RUNNING_CONTAINER - - LIVE_CONTAINER - - FAILED_TO_LAUNCH - SubmissionStateV2: - properties: - timeSubmitted: datetime - language: commons.Language - submissionFiles: list - submissionStatus: SubmissionStatusV2 - TestSubmissionStatusV2: - properties: - updates: list - problemId: commons.ProblemId - problemVersion: integer - problemInfo: problemV2.ProblemInfoV2 - WorkspaceSubmissionStatusV2: - properties: - updates: list - TestSubmissionUpdate: - properties: - updateTime: datetime - updateInfo: TestSubmissionUpdateInfo - WorkspaceSubmissionUpdate: - properties: - updateTime: datetime - updateInfo: WorkspaceSubmissionUpdateInfo - GradedTestCaseUpdate: - properties: - testCaseId: problemV2.TestCaseId - grade: TestCaseGrade - RecordedTestCaseUpdate: - properties: - testCaseId: problemV2.TestCaseId - traceResponsesSize: integer - WorkspaceTracedUpdate: - properties: - traceResponsesSize: integer - SubmissionState: - properties: - timeSubmitted: optional - submission: string - language: commons.Language - submissionTypeState: SubmissionTypeState - WorkspaceSubmissionState: - properties: - status: WorkspaceSubmissionStatus - TestSubmissionState: - properties: - problemId: commons.ProblemId - defaultTestCases: list - customTestCases: list - status: TestSubmissionStatus - 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 - ExecutionSessionsState: - properties: - states: map - numWarmingInstances: optional - warmingSessionIds: list - ExecutionSessionState: - properties: - lastTimeContacted: optional - sessionId: string - isWarmInstance: boolean - awsTaskId: optional - language: commons.Language - status: ExecutionSessionStatus -service: - auth: false - base-path: '' - endpoints: - createExecutionSession: - auth: true - path: POST - method: /create-session/{language} - response: ExecutionSessionResponse - getExecutionSession: - auth: true - path: GET - method: /{sessionId} - response: optional - stopExecutionSession: - auth: true - path: DELETE - method: /stop/{sessionId} - getExecutionSessionsState: - auth: true - path: GET - method: /execution-sessions-state - response: ExecutionSessionsState - getSubmissionState: - auth: true - path: GET - method: /{submissionId} - response: SubmissionState - getSubmissionStateV2: - auth: true - path: GET - method: /v2/{submissionId} - response: SubmissionStateV2 - getTraceResponsesPage: - auth: true - path: POST - method: /trace-respose/{submissionId}/testCase/{testCaseId} - response: TraceResponsesPage - getTraceResponsesV2Page: - auth: true - path: POST - method: /trace-response-v2/{submissionId}/testCase/{testCaseId} - response: TraceResponsesPageV2 - getTraceResponsesPageForWorkspace: - auth: true - path: POST - method: /workspace-trace-response/{submissionId} - response: TraceResponsesPage - getTraceResponsesV2PageForWorkspace: - auth: true - path: POST - method: /workspace-trace-response-v2/{submissionId} - response: TraceResponsesPageV2 - getWorkspaceStarterFiles: - auth: true - path: GET - method: /get-workspace-starter-files - response: WorkspaceStarterFilesResponse - getWorkspaceStarterFilesV2: - auth: true - path: GET - method: /get-workspace-starter-files-v2 - response: WorkspaceStarterFilesResponseV2 -", - }, - "sysprop.yml": { - "absoluteFilepath": "/DUMMY_PATH", - "contents": { - "service": { - "auth": false, - "base-path": "", - "endpoints": { - "getNumWarmInstances": { - "auth": true, - "method": "/num-warm-instances", - "path": "GET", - "response": "map", - }, - "setNumWarmInstances": { - "auth": true, - "method": "/num-warm-instances/{language}/{numWarmInstances}", - "path": "PUT", - "response": undefined, - }, - }, - }, - }, - "rawContents": "service: - auth: false - base-path: '' - endpoints: - setNumWarmInstances: - auth: true - path: PUT - method: /num-warm-instances/{language}/{numWarmInstances} - getNumWarmInstances: - auth: true - path: GET - method: /num-warm-instances - response: map -", - }, - }, - "packageMarkers": {}, - "rootApiFile": { - "contents": { - "error-discrimination": { - "strategy": "status-code", - }, - "name": "api", - }, - "defaultUrl": undefined, - "rawContents": "name: api -error-discrimination: - strategy: status-code -", - }, -} -`; diff --git a/packages/cli/api-importers/conjure/conjure-to-fern-tests/__test__/__snapshots__/trace.json b/packages/cli/api-importers/conjure/conjure-to-fern-tests/__test__/__snapshots__/trace.json new file mode 100644 index 00000000000..339af1f5821 --- /dev/null +++ b/packages/cli/api-importers/conjure/conjure-to-fern-tests/__test__/__snapshots__/trace.json @@ -0,0 +1,4191 @@ +{ + "absoluteFilePath": "/DUMMY_PATH", + "rootApiFile": { + "contents": { + "name": "api", + "error-discrimination": { + "strategy": "status-code" + } + }, + "rawContents": "name: api\nerror-discrimination:\n strategy: status-code\n" + }, + "namedDefinitionFiles": { + "Admin/__package__.yml": { + "absoluteFilepath": "/DUMMY_PATH", + "rawContents": "types:\n StoreTracedTestCaseRequest:\n properties:\n result: submission.TestCaseResultWithStdout\n traceResponses: list\n StoreTracedWorkspaceRequest:\n properties:\n workspaceRunDetails: submission.WorkspaceRunDetails\n traceResponses: list\nimports:\n submission: ../ExecutionSesssionManagement/__package__.yml\n problemV2: ../ProblemInfoServicV2/__package__.yml\nservice:\n auth: false\n base-path: ''\n endpoints:\n updateTestSubmissionStatus:\n auth: true\n path: /store-test-submission-status/{submissionId}\n method: POST\n path-parameters:\n submissionId: submission.SubmissionId\n sendTestSubmissionUpdate:\n auth: true\n path: /store-test-submission-status-v2/{submissionId}\n method: POST\n path-parameters:\n submissionId: submission.SubmissionId\n updateWorkspaceSubmissionStatus:\n auth: true\n path: /store-workspace-submission-status/{submissionId}\n method: POST\n path-parameters:\n submissionId: submission.SubmissionId\n sendWorkspaceSubmissionUpdate:\n auth: true\n path: /store-workspace-submission-status-v2/{submissionId}\n method: POST\n path-parameters:\n submissionId: submission.SubmissionId\n storeTracedTestCase:\n auth: true\n path: /store-test-trace/submission/{submissionId}/testCase/{testCaseId}\n method: POST\n path-parameters:\n submissionId: submission.SubmissionId\n testCaseId: string\n storeTracedTestCaseV2:\n auth: true\n path: /store-test-trace-v2/submission/{submissionId}/testCase/{testCaseId}\n method: POST\n path-parameters:\n submissionId: submission.SubmissionId\n testCaseId: problemV2.TestCaseId\n storeTracedWorkspace:\n auth: true\n path: /store-workspace-trace/submission/{submissionId}\n method: POST\n path-parameters:\n submissionId: submission.SubmissionId\n storeTracedWorkspaceV2:\n auth: true\n path: /store-workspace-trace-v2/submission/{submissionId}\n method: POST\n path-parameters:\n submissionId: submission.SubmissionId\n", + "contents": { + "types": { + "StoreTracedTestCaseRequest": { + "properties": { + "result": "submission.TestCaseResultWithStdout", + "traceResponses": "list" + } + }, + "StoreTracedWorkspaceRequest": { + "properties": { + "workspaceRunDetails": "submission.WorkspaceRunDetails", + "traceResponses": "list" + } + } + }, + "imports": { + "submission": "../ExecutionSesssionManagement/__package__.yml", + "problemV2": "../ProblemInfoServicV2/__package__.yml" + }, + "service": { + "auth": false, + "base-path": "", + "endpoints": { + "updateTestSubmissionStatus": { + "auth": true, + "path": "/store-test-submission-status/{submissionId}", + "method": "POST", + "path-parameters": { + "submissionId": "submission.SubmissionId" + } + }, + "sendTestSubmissionUpdate": { + "auth": true, + "path": "/store-test-submission-status-v2/{submissionId}", + "method": "POST", + "path-parameters": { + "submissionId": "submission.SubmissionId" + } + }, + "updateWorkspaceSubmissionStatus": { + "auth": true, + "path": "/store-workspace-submission-status/{submissionId}", + "method": "POST", + "path-parameters": { + "submissionId": "submission.SubmissionId" + } + }, + "sendWorkspaceSubmissionUpdate": { + "auth": true, + "path": "/store-workspace-submission-status-v2/{submissionId}", + "method": "POST", + "path-parameters": { + "submissionId": "submission.SubmissionId" + } + }, + "storeTracedTestCase": { + "auth": true, + "path": "/store-test-trace/submission/{submissionId}/testCase/{testCaseId}", + "method": "POST", + "path-parameters": { + "submissionId": "submission.SubmissionId", + "testCaseId": "string" + } + }, + "storeTracedTestCaseV2": { + "auth": true, + "path": "/store-test-trace-v2/submission/{submissionId}/testCase/{testCaseId}", + "method": "POST", + "path-parameters": { + "submissionId": "submission.SubmissionId", + "testCaseId": "problemV2.TestCaseId" + } + }, + "storeTracedWorkspace": { + "auth": true, + "path": "/store-workspace-trace/submission/{submissionId}", + "method": "POST", + "path-parameters": { + "submissionId": "submission.SubmissionId" + } + }, + "storeTracedWorkspaceV2": { + "auth": true, + "path": "/store-workspace-trace-v2/submission/{submissionId}", + "method": "POST", + "path-parameters": { + "submissionId": "submission.SubmissionId" + } + } + } + } + } + }, + "ExecutionSesssionManagement/__package__.yml": { + "absoluteFilepath": "/DUMMY_PATH", + "rawContents": "types:\n SubmissionId:\n type: string\n ShareId:\n type: string\n SubmissionRequest:\n discriminant: dummy\n union:\n initializeProblemRequest:\n type: InitializeProblemRequest\n key: initializeProblemRequest\n initializeWorkspaceRequest:\n type: commons.EmptyObject\n key: initializeWorkspaceRequest\n submitV2:\n type: SubmitRequestV2\n key: submitV2\n workspaceSubmit:\n type: WorkspaceSubmitRequest\n key: workspaceSubmit\n stop:\n type: StopRequest\n key: stop\n InitializeProblemRequest:\n properties:\n problemId: commons.ProblemId\n problemVersion: optional\n SubmitRequestV2:\n properties:\n submissionId: SubmissionId\n language: commons.Language\n submissionFiles: list\n problemId: commons.ProblemId\n problemVersion: optional\n userId: optional\n WorkspaceSubmitRequest:\n properties:\n submissionId: SubmissionId\n language: commons.Language\n submissionFiles: list\n userId: optional\n SubmissionFileInfo:\n properties:\n directory: string\n filename: string\n contents: string\n SubmissionTypeEnum:\n enum:\n - TEST\n StopRequest:\n properties:\n submissionId: SubmissionId\n SubmissionResponse:\n discriminant: dummy\n union:\n serverInitialized:\n type: commons.EmptyObject\n key: serverInitialized\n problemInitialized:\n type: commons.ProblemId\n key: problemInitialized\n workspaceInitialized:\n type: commons.EmptyObject\n key: workspaceInitialized\n serverErrored:\n type: ExceptionInfo\n key: serverErrored\n codeExecutionUpdate:\n type: CodeExecutionUpdate\n key: codeExecutionUpdate\n terminated:\n type: TerminatedResponse\n key: terminated\n CodeExecutionUpdate:\n discriminant: dummy\n union:\n buildingExecutor:\n type: BuildingExecutorResponse\n key: buildingExecutor\n running:\n type: RunningResponse\n key: running\n errored:\n type: ErroredResponse\n key: errored\n stopped:\n type: StoppedResponse\n key: stopped\n graded:\n type: GradedResponse\n key: graded\n gradedV2:\n type: GradedResponseV2\n key: gradedV2\n workspaceRan:\n type: WorkspaceRanResponse\n key: workspaceRan\n recording:\n type: RecordingResponseNotification\n key: recording\n recorded:\n type: RecordedResponseNotification\n key: recorded\n invalidRequest:\n type: InvalidRequestResponse\n key: invalidRequest\n finished:\n type: FinishedResponse\n key: finished\n BuildingExecutorResponse:\n properties:\n submissionId: SubmissionId\n status: ExecutionSessionStatus\n RunningResponse:\n properties:\n submissionId: SubmissionId\n state: RunningSubmissionState\n RunningSubmissionState:\n enum:\n - QUEUEING_SUBMISSION\n - KILLING_HISTORICAL_SUBMISSIONS\n - WRITING_SUBMISSION_TO_FILE\n - COMPILING_SUBMISSION\n - RUNNING_SUBMISSION\n ErroredResponse:\n properties:\n submissionId: SubmissionId\n errorInfo: ErrorInfo\n ErrorInfo:\n discriminant: dummy\n union:\n compileError:\n type: CompileError\n key: compileError\n runtimeError:\n type: RuntimeError\n key: runtimeError\n internalError:\n type: InternalError\n key: internalError\n CompileError:\n properties:\n message: string\n RuntimeError:\n properties:\n message: string\n InternalError:\n properties:\n exceptionInfo: ExceptionInfo\n StoppedResponse:\n properties:\n submissionId: SubmissionId\n WorkspaceRanResponse:\n properties:\n submissionId: SubmissionId\n runDetails: WorkspaceRunDetails\n WorkspaceRunDetails:\n properties:\n exceptionV2: optional\n exception: optional\n stdout: string\n GradedResponse:\n properties:\n submissionId: SubmissionId\n testCases: map\n GradedResponseV2:\n properties:\n submissionId: SubmissionId\n testCases: map\n TestCaseGrade:\n discriminant: dummy\n union:\n hidden:\n type: TestCaseHiddenGrade\n key: hidden\n nonHidden:\n type: TestCaseNonHiddenGrade\n key: nonHidden\n TestCaseHiddenGrade:\n properties:\n passed: boolean\n TestCaseNonHiddenGrade:\n properties:\n passed: boolean\n actualResult: optional\n exception: optional\n stdout: string\n RecordedResponseNotification:\n properties:\n submissionId: SubmissionId\n traceResponsesSize: integer\n testCaseId: optional\n RecordingResponseNotification:\n properties:\n submissionId: SubmissionId\n testCaseId: optional\n lineNumber: integer\n lightweightStackInfo: LightweightStackframeInformation\n tracedFile: optional\n LightweightStackframeInformation:\n properties:\n numStackFrames: integer\n topStackFrameMethodName: string\n TestCaseResultWithStdout:\n properties:\n result: TestCaseResult\n stdout: string\n TestCaseResult:\n properties:\n expectedResult: commons.VariableValue\n actualResult: ActualResult\n passed: boolean\n ActualResult:\n discriminant: dummy\n union:\n value:\n type: commons.VariableValue\n key: value\n exception:\n type: ExceptionInfo\n key: exception\n exceptionV2:\n type: ExceptionV2\n key: exceptionV2\n ExceptionV2:\n discriminant: dummy\n union:\n generic:\n type: ExceptionInfo\n key: generic\n timeout:\n type: commons.EmptyObject\n key: timeout\n ExceptionInfo:\n properties:\n exceptionType: string\n exceptionMessage: string\n exceptionStacktrace: string\n InvalidRequestResponse:\n properties:\n request: SubmissionRequest\n cause: InvalidRequestCause\n InvalidRequestCause:\n discriminant: dummy\n union:\n submissionIdNotFound:\n type: SubmissionIdNotFound\n key: submissionIdNotFound\n customTestCasesUnsupported:\n type: CustomTestCasesUnsupported\n key: customTestCasesUnsupported\n unexpectedLanguage:\n type: UnexpectedLanguageError\n key: unexpectedLanguage\n ExistingSubmissionExecuting:\n properties:\n submissionId: SubmissionId\n SubmissionIdNotFound:\n properties:\n missingSubmissionId: SubmissionId\n CustomTestCasesUnsupported:\n properties:\n problemId: commons.ProblemId\n submissionId: SubmissionId\n UnexpectedLanguageError:\n properties:\n expectedLanguage: commons.Language\n actualLanguage: commons.Language\n TerminatedResponse:\n properties: {}\n FinishedResponse:\n properties:\n submissionId: SubmissionId\n StdoutResponse:\n properties:\n submissionId: SubmissionId\n stdout: string\n StderrResponse:\n properties:\n submissionId: SubmissionId\n stderr: string\n TraceResponse:\n properties:\n submissionId: SubmissionId\n lineNumber: integer\n returnValue: optional\n expressionLocation: optional\n stack: StackInformation\n stdout: optional\n TraceResponseV2:\n properties:\n submissionId: SubmissionId\n lineNumber: integer\n file: TracedFile\n returnValue: optional\n expressionLocation: optional\n stack: StackInformation\n stdout: optional\n TracedFile:\n properties:\n filename: string\n directory: string\n ExpressionLocation:\n properties:\n start: integer\n offset: integer\n StackInformation:\n properties:\n numStackFrames: integer\n topStackFrame: optional\n StackFrame:\n properties:\n methodName: string\n lineNumber: integer\n scopes: list\n Scope:\n properties:\n variables: map\n ExecutionSessionResponse:\n properties:\n sessionId: string\n executionSessionUrl: optional\n language: commons.Language\n status: ExecutionSessionStatus\n ExecutionSessionStatus:\n enum:\n - CREATING_CONTAINER\n - PROVISIONING_CONTAINER\n - PENDING_CONTAINER\n - RUNNING_CONTAINER\n - LIVE_CONTAINER\n - FAILED_TO_LAUNCH\n SubmissionStateV2:\n properties:\n timeSubmitted: datetime\n language: commons.Language\n submissionFiles: list\n submissionStatus: SubmissionStatusV2\n SubmissionStatusV2:\n discriminant: dummy\n union:\n test:\n type: TestSubmissionStatusV2\n key: test\n workspace:\n type: WorkspaceSubmissionStatusV2\n key: workspace\n TestSubmissionStatusV2:\n properties:\n updates: list\n problemId: commons.ProblemId\n problemVersion: integer\n problemInfo: problemV2.ProblemInfoV2\n WorkspaceSubmissionStatusV2:\n properties:\n updates: list\n TestSubmissionUpdate:\n properties:\n updateTime: datetime\n updateInfo: TestSubmissionUpdateInfo\n TestSubmissionUpdateInfo:\n discriminant: dummy\n union:\n running:\n type: RunningSubmissionState\n key: running\n stopped:\n type: commons.EmptyObject\n key: stopped\n errored:\n type: ErrorInfo\n key: errored\n gradedTestCase:\n type: GradedTestCaseUpdate\n key: gradedTestCase\n recordedTestCase:\n type: RecordedTestCaseUpdate\n key: recordedTestCase\n finished:\n type: commons.EmptyObject\n key: finished\n WorkspaceSubmissionUpdate:\n properties:\n updateTime: datetime\n updateInfo: WorkspaceSubmissionUpdateInfo\n WorkspaceSubmissionUpdateInfo:\n discriminant: dummy\n union:\n running:\n type: RunningSubmissionState\n key: running\n ran:\n type: WorkspaceRunDetails\n key: ran\n stopped:\n type: commons.EmptyObject\n key: stopped\n traced:\n type: commons.EmptyObject\n key: traced\n tracedV2:\n type: WorkspaceTracedUpdate\n key: tracedV2\n errored:\n type: ErrorInfo\n key: errored\n finished:\n type: commons.EmptyObject\n key: finished\n GradedTestCaseUpdate:\n properties:\n testCaseId: problemV2.TestCaseId\n grade: TestCaseGrade\n RecordedTestCaseUpdate:\n properties:\n testCaseId: problemV2.TestCaseId\n traceResponsesSize: integer\n WorkspaceTracedUpdate:\n properties:\n traceResponsesSize: integer\n SubmissionState:\n properties:\n timeSubmitted: optional\n submission: string\n language: commons.Language\n submissionTypeState: SubmissionTypeState\n SubmissionTypeState:\n discriminant: dummy\n union:\n test:\n type: TestSubmissionState\n key: test\n workspace:\n type: WorkspaceSubmissionState\n key: workspace\n WorkspaceSubmissionState:\n properties:\n status: WorkspaceSubmissionStatus\n WorkspaceSubmissionStatus:\n discriminant: dummy\n union:\n stopped:\n type: commons.EmptyObject\n key: stopped\n errored:\n type: ErrorInfo\n key: errored\n running:\n type: RunningSubmissionState\n key: running\n ran:\n type: WorkspaceRunDetails\n key: ran\n traced:\n type: WorkspaceRunDetails\n key: traced\n TestSubmissionState:\n properties:\n problemId: commons.ProblemId\n defaultTestCases: list\n customTestCases: list\n status: TestSubmissionStatus\n TestSubmissionStatus:\n discriminant: dummy\n union:\n stopped:\n type: commons.EmptyObject\n key: stopped\n errored:\n type: ErrorInfo\n key: errored\n running:\n type: RunningSubmissionState\n key: running\n testCaseIdToState:\n type: map\n key: testCaseIdToState\n SubmissionStatusForTestCase:\n discriminant: dummy\n union:\n graded:\n type: TestCaseResultWithStdout\n key: graded\n gradedV2:\n type: TestCaseGrade\n key: gradedV2\n traced:\n type: TracedTestCase\n key: traced\n TracedTestCase:\n properties:\n result: TestCaseResultWithStdout\n traceResponsesSize: integer\n TraceResponsesPage:\n properties:\n offset:\n type: optional\n docs: |\n If present, use this to load subseqent pages.\n The offset is the id of the next trace response to load.\n traceResponses: list\n TraceResponsesPageV2:\n properties:\n offset:\n type: optional\n docs: |\n If present, use this to load subseqent pages.\n The offset is the id of the next trace response to load.\n traceResponses: list\n GetTraceResponsesPageRequest:\n properties:\n offset:\n type: optional\n WorkspaceStarterFilesResponse:\n properties:\n files: map\n WorkspaceStarterFilesResponseV2:\n properties:\n filesByLanguage: map\n WorkspaceFiles:\n properties:\n mainFile: commons.FileInfo\n readOnlyFiles: list\n ExecutionSessionsState:\n properties:\n states: map\n numWarmingInstances: optional\n warmingSessionIds: list\n ExecutionSessionState:\n properties:\n lastTimeContacted: optional\n sessionId: string\n isWarmInstance: boolean\n awsTaskId: optional\n language: commons.Language\n status: ExecutionSessionStatus\nimports:\n commons: ../commons/__package__.yml\n problemV2: ../ProblemInfoServicV2/__package__.yml\nservice:\n auth: false\n base-path: ''\n endpoints:\n createExecutionSession:\n auth: true\n path: /create-session/{language}\n method: POST\n response: ExecutionSessionResponse\n path-parameters:\n language: commons.Language\n getExecutionSession:\n auth: true\n path: /{sessionId}\n method: GET\n response: optional\n path-parameters:\n sessionId: string\n stopExecutionSession:\n auth: true\n path: /stop/{sessionId}\n method: DELETE\n path-parameters:\n sessionId: string\n getExecutionSessionsState:\n auth: true\n path: /execution-sessions-state\n method: GET\n response: ExecutionSessionsState\n", + "contents": { + "types": { + "SubmissionId": { + "type": "string" + }, + "ShareId": { + "type": "string" + }, + "SubmissionRequest": { + "discriminant": "dummy", + "union": { + "initializeProblemRequest": { + "type": "InitializeProblemRequest", + "key": "initializeProblemRequest" + }, + "initializeWorkspaceRequest": { + "type": "commons.EmptyObject", + "key": "initializeWorkspaceRequest" + }, + "submitV2": { + "type": "SubmitRequestV2", + "key": "submitV2" + }, + "workspaceSubmit": { + "type": "WorkspaceSubmitRequest", + "key": "workspaceSubmit" + }, + "stop": { + "type": "StopRequest", + "key": "stop" + } + } + }, + "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" + ] + }, + "StopRequest": { + "properties": { + "submissionId": "SubmissionId" + } + }, + "SubmissionResponse": { + "discriminant": "dummy", + "union": { + "serverInitialized": { + "type": "commons.EmptyObject", + "key": "serverInitialized" + }, + "problemInitialized": { + "type": "commons.ProblemId", + "key": "problemInitialized" + }, + "workspaceInitialized": { + "type": "commons.EmptyObject", + "key": "workspaceInitialized" + }, + "serverErrored": { + "type": "ExceptionInfo", + "key": "serverErrored" + }, + "codeExecutionUpdate": { + "type": "CodeExecutionUpdate", + "key": "codeExecutionUpdate" + }, + "terminated": { + "type": "TerminatedResponse", + "key": "terminated" + } + } + }, + "CodeExecutionUpdate": { + "discriminant": "dummy", + "union": { + "buildingExecutor": { + "type": "BuildingExecutorResponse", + "key": "buildingExecutor" + }, + "running": { + "type": "RunningResponse", + "key": "running" + }, + "errored": { + "type": "ErroredResponse", + "key": "errored" + }, + "stopped": { + "type": "StoppedResponse", + "key": "stopped" + }, + "graded": { + "type": "GradedResponse", + "key": "graded" + }, + "gradedV2": { + "type": "GradedResponseV2", + "key": "gradedV2" + }, + "workspaceRan": { + "type": "WorkspaceRanResponse", + "key": "workspaceRan" + }, + "recording": { + "type": "RecordingResponseNotification", + "key": "recording" + }, + "recorded": { + "type": "RecordedResponseNotification", + "key": "recorded" + }, + "invalidRequest": { + "type": "InvalidRequestResponse", + "key": "invalidRequest" + }, + "finished": { + "type": "FinishedResponse", + "key": "finished" + } + } + }, + "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": { + "discriminant": "dummy", + "union": { + "compileError": { + "type": "CompileError", + "key": "compileError" + }, + "runtimeError": { + "type": "RuntimeError", + "key": "runtimeError" + }, + "internalError": { + "type": "InternalError", + "key": "internalError" + } + } + }, + "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": { + "discriminant": "dummy", + "union": { + "hidden": { + "type": "TestCaseHiddenGrade", + "key": "hidden" + }, + "nonHidden": { + "type": "TestCaseNonHiddenGrade", + "key": "nonHidden" + } + } + }, + "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": { + "discriminant": "dummy", + "union": { + "value": { + "type": "commons.VariableValue", + "key": "value" + }, + "exception": { + "type": "ExceptionInfo", + "key": "exception" + }, + "exceptionV2": { + "type": "ExceptionV2", + "key": "exceptionV2" + } + } + }, + "ExceptionV2": { + "discriminant": "dummy", + "union": { + "generic": { + "type": "ExceptionInfo", + "key": "generic" + }, + "timeout": { + "type": "commons.EmptyObject", + "key": "timeout" + } + } + }, + "ExceptionInfo": { + "properties": { + "exceptionType": "string", + "exceptionMessage": "string", + "exceptionStacktrace": "string" + } + }, + "InvalidRequestResponse": { + "properties": { + "request": "SubmissionRequest", + "cause": "InvalidRequestCause" + } + }, + "InvalidRequestCause": { + "discriminant": "dummy", + "union": { + "submissionIdNotFound": { + "type": "SubmissionIdNotFound", + "key": "submissionIdNotFound" + }, + "customTestCasesUnsupported": { + "type": "CustomTestCasesUnsupported", + "key": "customTestCasesUnsupported" + }, + "unexpectedLanguage": { + "type": "UnexpectedLanguageError", + "key": "unexpectedLanguage" + } + } + }, + "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", + "PROVISIONING_CONTAINER", + "PENDING_CONTAINER", + "RUNNING_CONTAINER", + "LIVE_CONTAINER", + "FAILED_TO_LAUNCH" + ] + }, + "SubmissionStateV2": { + "properties": { + "timeSubmitted": "datetime", + "language": "commons.Language", + "submissionFiles": "list", + "submissionStatus": "SubmissionStatusV2" + } + }, + "SubmissionStatusV2": { + "discriminant": "dummy", + "union": { + "test": { + "type": "TestSubmissionStatusV2", + "key": "test" + }, + "workspace": { + "type": "WorkspaceSubmissionStatusV2", + "key": "workspace" + } + } + }, + "TestSubmissionStatusV2": { + "properties": { + "updates": "list", + "problemId": "commons.ProblemId", + "problemVersion": "integer", + "problemInfo": "problemV2.ProblemInfoV2" + } + }, + "WorkspaceSubmissionStatusV2": { + "properties": { + "updates": "list" + } + }, + "TestSubmissionUpdate": { + "properties": { + "updateTime": "datetime", + "updateInfo": "TestSubmissionUpdateInfo" + } + }, + "TestSubmissionUpdateInfo": { + "discriminant": "dummy", + "union": { + "running": { + "type": "RunningSubmissionState", + "key": "running" + }, + "stopped": { + "type": "commons.EmptyObject", + "key": "stopped" + }, + "errored": { + "type": "ErrorInfo", + "key": "errored" + }, + "gradedTestCase": { + "type": "GradedTestCaseUpdate", + "key": "gradedTestCase" + }, + "recordedTestCase": { + "type": "RecordedTestCaseUpdate", + "key": "recordedTestCase" + }, + "finished": { + "type": "commons.EmptyObject", + "key": "finished" + } + } + }, + "WorkspaceSubmissionUpdate": { + "properties": { + "updateTime": "datetime", + "updateInfo": "WorkspaceSubmissionUpdateInfo" + } + }, + "WorkspaceSubmissionUpdateInfo": { + "discriminant": "dummy", + "union": { + "running": { + "type": "RunningSubmissionState", + "key": "running" + }, + "ran": { + "type": "WorkspaceRunDetails", + "key": "ran" + }, + "stopped": { + "type": "commons.EmptyObject", + "key": "stopped" + }, + "traced": { + "type": "commons.EmptyObject", + "key": "traced" + }, + "tracedV2": { + "type": "WorkspaceTracedUpdate", + "key": "tracedV2" + }, + "errored": { + "type": "ErrorInfo", + "key": "errored" + }, + "finished": { + "type": "commons.EmptyObject", + "key": "finished" + } + } + }, + "GradedTestCaseUpdate": { + "properties": { + "testCaseId": "problemV2.TestCaseId", + "grade": "TestCaseGrade" + } + }, + "RecordedTestCaseUpdate": { + "properties": { + "testCaseId": "problemV2.TestCaseId", + "traceResponsesSize": "integer" + } + }, + "WorkspaceTracedUpdate": { + "properties": { + "traceResponsesSize": "integer" + } + }, + "SubmissionState": { + "properties": { + "timeSubmitted": "optional", + "submission": "string", + "language": "commons.Language", + "submissionTypeState": "SubmissionTypeState" + } + }, + "SubmissionTypeState": { + "discriminant": "dummy", + "union": { + "test": { + "type": "TestSubmissionState", + "key": "test" + }, + "workspace": { + "type": "WorkspaceSubmissionState", + "key": "workspace" + } + } + }, + "WorkspaceSubmissionState": { + "properties": { + "status": "WorkspaceSubmissionStatus" + } + }, + "WorkspaceSubmissionStatus": { + "discriminant": "dummy", + "union": { + "stopped": { + "type": "commons.EmptyObject", + "key": "stopped" + }, + "errored": { + "type": "ErrorInfo", + "key": "errored" + }, + "running": { + "type": "RunningSubmissionState", + "key": "running" + }, + "ran": { + "type": "WorkspaceRunDetails", + "key": "ran" + }, + "traced": { + "type": "WorkspaceRunDetails", + "key": "traced" + } + } + }, + "TestSubmissionState": { + "properties": { + "problemId": "commons.ProblemId", + "defaultTestCases": "list", + "customTestCases": "list", + "status": "TestSubmissionStatus" + } + }, + "TestSubmissionStatus": { + "discriminant": "dummy", + "union": { + "stopped": { + "type": "commons.EmptyObject", + "key": "stopped" + }, + "errored": { + "type": "ErrorInfo", + "key": "errored" + }, + "running": { + "type": "RunningSubmissionState", + "key": "running" + }, + "testCaseIdToState": { + "type": "map", + "key": "testCaseIdToState" + } + } + }, + "SubmissionStatusForTestCase": { + "discriminant": "dummy", + "union": { + "graded": { + "type": "TestCaseResultWithStdout", + "key": "graded" + }, + "gradedV2": { + "type": "TestCaseGrade", + "key": "gradedV2" + }, + "traced": { + "type": "TracedTestCase", + "key": "traced" + } + } + }, + "TracedTestCase": { + "properties": { + "result": "TestCaseResultWithStdout", + "traceResponsesSize": "integer" + } + }, + "TraceResponsesPage": { + "properties": { + "offset": { + "type": "optional", + "docs": "If present, use this to load subseqent pages.\nThe offset is the id of the next trace response to load.\n" + }, + "traceResponses": "list" + } + }, + "TraceResponsesPageV2": { + "properties": { + "offset": { + "type": "optional", + "docs": "If present, use this to load subseqent pages.\nThe offset is the id of the next trace response to load.\n" + }, + "traceResponses": "list" + } + }, + "GetTraceResponsesPageRequest": { + "properties": { + "offset": { + "type": "optional" + } + } + }, + "WorkspaceStarterFilesResponse": { + "properties": { + "files": "map" + } + }, + "WorkspaceStarterFilesResponseV2": { + "properties": { + "filesByLanguage": "map" + } + }, + "WorkspaceFiles": { + "properties": { + "mainFile": "commons.FileInfo", + "readOnlyFiles": "list" + } + }, + "ExecutionSessionsState": { + "properties": { + "states": "map", + "numWarmingInstances": "optional", + "warmingSessionIds": "list" + } + }, + "ExecutionSessionState": { + "properties": { + "lastTimeContacted": "optional", + "sessionId": "string", + "isWarmInstance": "boolean", + "awsTaskId": "optional", + "language": "commons.Language", + "status": "ExecutionSessionStatus" + } + } + }, + "imports": { + "commons": "../commons/__package__.yml", + "problemV2": "../ProblemInfoServicV2/__package__.yml" + }, + "service": { + "auth": false, + "base-path": "", + "endpoints": { + "createExecutionSession": { + "auth": true, + "path": "/create-session/{language}", + "method": "POST", + "response": "ExecutionSessionResponse", + "path-parameters": { + "language": "commons.Language" + } + }, + "getExecutionSession": { + "auth": true, + "path": "/{sessionId}", + "method": "GET", + "response": "optional", + "path-parameters": { + "sessionId": "string" + } + }, + "stopExecutionSession": { + "auth": true, + "path": "/stop/{sessionId}", + "method": "DELETE", + "path-parameters": { + "sessionId": "string" + } + }, + "getExecutionSessionsState": { + "auth": true, + "path": "/execution-sessions-state", + "method": "GET", + "response": "ExecutionSessionsState" + } + } + } + } + }, + "MigrationInfo/__package__.yml": { + "absoluteFilepath": "/DUMMY_PATH", + "rawContents": "types:\n MigrationStatus:\n enum:\n - RUNNING\n - FAILED\n - FINISHED\n Migration:\n properties:\n name: string\n status: MigrationStatus\nservice:\n auth: false\n base-path: ''\n endpoints:\n getAttemptedMigrations:\n auth: true\n path: /all\n method: GET\n response: list\n", + "contents": { + "types": { + "MigrationStatus": { + "enum": [ + "RUNNING", + "FAILED", + "FINISHED" + ] + }, + "Migration": { + "properties": { + "name": "string", + "status": "MigrationStatus" + } + } + }, + "service": { + "auth": false, + "base-path": "", + "endpoints": { + "getAttemptedMigrations": { + "auth": true, + "path": "/all", + "method": "GET", + "response": "list" + } + } + } + } + }, + "PlaylistCrud/__package__.yml": { + "absoluteFilepath": "/DUMMY_PATH", + "rawContents": "types:\n PlaylistId:\n type: string\n Playlist:\n properties:\n playlistId: PlaylistId\n name: string\n problems: list\n ownerId: commons.UserId\n CreatePlaylistRequest:\n properties:\n name: string\n problems: list\n UpdatePlaylistRequest:\n properties:\n name: string\n problems: list\nimports:\n commons: ../commons/__package__.yml\nservice:\n auth: false\n base-path: ''\n endpoints:\n createPlaylist:\n auth: true\n path: /create\n method: POST\n response: Playlist\n getPlaylists:\n auth: true\n path: /all\n method: GET\n response: list\n getPlaylist:\n auth: true\n path: /{playlistId}\n method: GET\n response: Playlist\n path-parameters:\n playlistId: PlaylistId\n updatePlaylist:\n auth: true\n path: /{playlistId}\n method: PUT\n response: Playlist\n path-parameters:\n playlistId: PlaylistId\n deletePlaylist:\n auth: true\n path: /{playlistId}\n method: DELETE\n path-parameters:\n playlistId: PlaylistId\n", + "contents": { + "types": { + "PlaylistId": { + "type": "string" + }, + "Playlist": { + "properties": { + "playlistId": "PlaylistId", + "name": "string", + "problems": "list", + "ownerId": "commons.UserId" + } + }, + "CreatePlaylistRequest": { + "properties": { + "name": "string", + "problems": "list" + } + }, + "UpdatePlaylistRequest": { + "properties": { + "name": "string", + "problems": "list" + } + } + }, + "imports": { + "commons": "../commons/__package__.yml" + }, + "service": { + "auth": false, + "base-path": "", + "endpoints": { + "createPlaylist": { + "auth": true, + "path": "/create", + "method": "POST", + "response": "Playlist" + }, + "getPlaylists": { + "auth": true, + "path": "/all", + "method": "GET", + "response": "list" + }, + "getPlaylist": { + "auth": true, + "path": "/{playlistId}", + "method": "GET", + "response": "Playlist", + "path-parameters": { + "playlistId": "PlaylistId" + } + }, + "updatePlaylist": { + "auth": true, + "path": "/{playlistId}", + "method": "PUT", + "response": "Playlist", + "path-parameters": { + "playlistId": "PlaylistId" + } + }, + "deletePlaylist": { + "auth": true, + "path": "/{playlistId}", + "method": "DELETE", + "path-parameters": { + "playlistId": "PlaylistId" + } + } + } + } + } + }, + "PlaylistCrudServiceV2/__package__.yml": { + "absoluteFilepath": "/DUMMY_PATH", + "rawContents": "imports:\n commons: ../commons/__package__.yml\n playlist: ../PlaylistCrud/__package__.yml\nservice:\n auth: false\n base-path: ''\n endpoints:\n createPlaylist:\n auth: true\n path: /create\n method: POST\n response: playlist.Playlist\n getPlaylists:\n auth: true\n path: /all\n method: GET\n response: list\n getPlaylist:\n auth: true\n path: /{playlistId}\n method: GET\n response: playlist.Playlist\n path-parameters:\n playlistId: playlist.PlaylistId\n updatePlaylist:\n auth: true\n path: /{playlistId}\n method: PUT\n response: playlist.Playlist\n path-parameters:\n playlistId: playlist.PlaylistId\n deletePlaylist:\n auth: true\n path: /{playlistId}\n method: DELETE\n path-parameters:\n playlistId: playlist.PlaylistId\n", + "contents": { + "imports": { + "commons": "../commons/__package__.yml", + "playlist": "../PlaylistCrud/__package__.yml" + }, + "service": { + "auth": false, + "base-path": "", + "endpoints": { + "createPlaylist": { + "auth": true, + "path": "/create", + "method": "POST", + "response": "playlist.Playlist" + }, + "getPlaylists": { + "auth": true, + "path": "/all", + "method": "GET", + "response": "list" + }, + "getPlaylist": { + "auth": true, + "path": "/{playlistId}", + "method": "GET", + "response": "playlist.Playlist", + "path-parameters": { + "playlistId": "playlist.PlaylistId" + } + }, + "updatePlaylist": { + "auth": true, + "path": "/{playlistId}", + "method": "PUT", + "response": "playlist.Playlist", + "path-parameters": { + "playlistId": "playlist.PlaylistId" + } + }, + "deletePlaylist": { + "auth": true, + "path": "/{playlistId}", + "method": "DELETE", + "path-parameters": { + "playlistId": "playlist.PlaylistId" + } + } + } + } + } + }, + "ProblemCrud/__package__.yml": { + "absoluteFilepath": "/DUMMY_PATH", + "rawContents": "types:\n ProblemInfo:\n properties:\n problemId: commons.ProblemId\n problemDescription: ProblemDescription\n problemName: string\n problemVersion: integer\n files: map\n inputParams: list\n outputType: commons.VariableType\n testcases: list\n methodName: string\n supportsCustomTestCases: boolean\n ProblemDescription:\n properties:\n boards: list\n ProblemDescriptionBoard:\n discriminant: dummy\n union:\n html:\n type: string\n key: html\n variable:\n type: commons.VariableValue\n key: variable\n testCaseId:\n type: string\n key: testCaseId\n ProblemFiles:\n properties:\n solutionFile: commons.FileInfo\n readOnlyFiles: list\n VariableTypeAndName:\n properties:\n variableType: commons.VariableType\n name: string\n CreateProblemRequest:\n properties:\n problemName: string\n problemDescription: ProblemDescription\n files: map\n inputParams: list\n outputType: commons.VariableType\n testcases: list\n methodName: string\n CreateProblemResponse:\n discriminant: dummy\n union:\n success:\n type: commons.ProblemId\n key: success\n error:\n type: CreateProblemError\n key: error\n CreateProblemError:\n discriminant: dummy\n union:\n generic:\n type: GenericCreateProblemError\n key: generic\n GenericCreateProblemError:\n properties:\n message: string\n type: string\n stacktrace: string\n UpdateProblemResponse:\n properties:\n problemVersion: integer\n GetDefaultStarterFilesRequest:\n properties:\n inputParams: list\n outputType: commons.VariableType\n methodName: string\n GetDefaultStarterFilesResponse:\n properties:\n files: map\nimports:\n commons: ../commons/__package__.yml\nservice:\n auth: false\n base-path: ''\n endpoints:\n createProblem:\n auth: true\n path: /create\n method: POST\n response: CreateProblemResponse\n updateProblem:\n auth: true\n path: /update/{problemId}\n method: POST\n response: UpdateProblemResponse\n path-parameters:\n problemId: commons.ProblemId\n deleteProblem:\n auth: true\n path: /delete/{problemId}\n method: DELETE\n path-parameters:\n problemId: commons.ProblemId\n getDefaultStarterFiles:\n auth: true\n path: /default-starter-files\n method: POST\n response: GetDefaultStarterFilesResponse\n", + "contents": { + "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": { + "discriminant": "dummy", + "union": { + "html": { + "type": "string", + "key": "html" + }, + "variable": { + "type": "commons.VariableValue", + "key": "variable" + }, + "testCaseId": { + "type": "string", + "key": "testCaseId" + } + } + }, + "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": { + "discriminant": "dummy", + "union": { + "success": { + "type": "commons.ProblemId", + "key": "success" + }, + "error": { + "type": "CreateProblemError", + "key": "error" + } + } + }, + "CreateProblemError": { + "discriminant": "dummy", + "union": { + "generic": { + "type": "GenericCreateProblemError", + "key": "generic" + } + } + }, + "GenericCreateProblemError": { + "properties": { + "message": "string", + "type": "string", + "stacktrace": "string" + } + }, + "UpdateProblemResponse": { + "properties": { + "problemVersion": "integer" + } + }, + "GetDefaultStarterFilesRequest": { + "properties": { + "inputParams": "list", + "outputType": "commons.VariableType", + "methodName": "string" + } + }, + "GetDefaultStarterFilesResponse": { + "properties": { + "files": "map" + } + } + }, + "imports": { + "commons": "../commons/__package__.yml" + }, + "service": { + "auth": false, + "base-path": "", + "endpoints": { + "createProblem": { + "auth": true, + "path": "/create", + "method": "POST", + "response": "CreateProblemResponse" + }, + "updateProblem": { + "auth": true, + "path": "/update/{problemId}", + "method": "POST", + "response": "UpdateProblemResponse", + "path-parameters": { + "problemId": "commons.ProblemId" + } + }, + "deleteProblem": { + "auth": true, + "path": "/delete/{problemId}", + "method": "DELETE", + "path-parameters": { + "problemId": "commons.ProblemId" + } + }, + "getDefaultStarterFiles": { + "auth": true, + "path": "/default-starter-files", + "method": "POST", + "response": "GetDefaultStarterFilesResponse" + } + } + } + } + }, + "ProblemCrudServiceV2/__package__.yml": { + "absoluteFilepath": "/DUMMY_PATH", + "rawContents": "types:\n TestCaseTemplateId:\n type: string\n TestCaseId:\n type: string\n ParameterId:\n type: string\n ProblemInfoV2:\n properties:\n problemId: commons.ProblemId\n problemDescription: problem.ProblemDescription\n problemName: string\n problemVersion: integer\n supportedLanguages: set\n customFiles: CustomFiles\n generatedFiles: GeneratedFiles\n customTestCaseTemplates: list\n testcases: list\n isPublic: boolean\n LightweightProblemInfoV2:\n properties:\n problemId: commons.ProblemId\n problemName: string\n problemVersion: integer\n variableTypes: set\n CreateProblemRequestV2:\n properties:\n problemName: string\n problemDescription: problem.ProblemDescription\n customFiles: CustomFiles\n customTestCaseTemplates: list\n testcases: list\n supportedLanguages: set\n isPublic: boolean\n TestCaseV2:\n properties:\n metadata: TestCaseMetadata\n implementation: TestCaseImplementationReference\n arguments: map\n expects: optional\n TestCaseExpects:\n properties:\n expectedStdout: optional\n TestCaseImplementationReference:\n discriminant: dummy\n union:\n templateId:\n type: TestCaseTemplateId\n key: templateId\n implementation:\n type: TestCaseImplementation\n key: implementation\n BasicTestCaseTemplate:\n properties:\n templateId: TestCaseTemplateId\n name: string\n description: TestCaseImplementationDescription\n expectedValueParameterId: ParameterId\n TestCaseTemplate:\n properties:\n templateId: TestCaseTemplateId\n name: string\n implementation: TestCaseImplementation\n TestCaseImplementation:\n properties:\n description: TestCaseImplementationDescription\n function: TestCaseFunction\n TestCaseFunction:\n discriminant: dummy\n union:\n withActualResult:\n type: TestCaseWithActualResultImplementation\n key: withActualResult\n custom:\n type: VoidFunctionDefinition\n key: custom\n TestCaseWithActualResultImplementation:\n properties:\n getActualResult: NonVoidFunctionDefinition\n assertCorrectnessCheck: AssertCorrectnessCheck\n VoidFunctionDefinition:\n properties:\n parameters: list\n code: FunctionImplementationForMultipleLanguages\n Parameter:\n properties:\n parameterId: ParameterId\n name: string\n variableType: commons.VariableType\n NonVoidFunctionDefinition:\n properties:\n signature: NonVoidFunctionSignature\n code: FunctionImplementationForMultipleLanguages\n VoidFunctionSignature:\n properties:\n parameters: list\n NonVoidFunctionSignature:\n properties:\n parameters: list\n returnType: commons.VariableType\n VoidFunctionSignatureThatTakesActualResult:\n properties:\n parameters: list\n actualResultType: commons.VariableType\n AssertCorrectnessCheck:\n discriminant: dummy\n union:\n deepEquality:\n type: DeepEqualityCorrectnessCheck\n key: deepEquality\n custom:\n type: VoidFunctionDefinitionThatTakesActualResult\n key: custom\n DeepEqualityCorrectnessCheck:\n properties:\n expectedValueParameterId: ParameterId\n VoidFunctionDefinitionThatTakesActualResult:\n properties:\n additionalParameters: list\n code: FunctionImplementationForMultipleLanguages\n TestCaseImplementationDescription:\n properties:\n boards: list\n TestCaseImplementationDescriptionBoard:\n discriminant: dummy\n union:\n html:\n type: string\n key: html\n paramId:\n type: ParameterId\n key: paramId\n TestCaseMetadata:\n properties:\n id: TestCaseId\n name: string\n hidden: boolean\n FunctionImplementationForMultipleLanguages:\n properties:\n codeByLanguage: map\n FunctionImplementation:\n properties:\n impl: string;\n imports: optional;\n GeneratedFiles:\n properties:\n generatedTestCaseFiles: map\n generatedTemplateFiles: map\n other: map\n CustomFiles:\n discriminant: dummy\n union:\n basic:\n type: BasicCustomFiles\n key: basic\n custom:\n type: map\n key: custom\n BasicCustomFiles:\n properties:\n methodName: string\n signature: NonVoidFunctionSignature\n additionalFiles: map\n basicTestCaseTemplate: BasicTestCaseTemplate\n Files:\n properties:\n files: list\n FileInfoV2:\n properties:\n filename: string\n directory: string\n contents: string\n editable: boolean\n DefaultProvidedFile:\n properties:\n file: FileInfoV2\n relatedTypes: list\n GetBasicSolutionFileRequest:\n properties:\n methodName: string\n signature: NonVoidFunctionSignature\n GetBasicSolutionFileResponse:\n properties:\n solutionFileByLanguage: map\n GetFunctionSignatureRequest:\n properties:\n functionSignature: FunctionSignature\n FunctionSignature:\n discriminant: dummy\n union:\n void:\n type: VoidFunctionSignature\n key: void\n nonVoid:\n type: NonVoidFunctionSignature\n key: nonVoid\n voidThatTakesActualResult:\n type: VoidFunctionSignatureThatTakesActualResult\n key: voidThatTakesActualResult\n GetFunctionSignatureResponse:\n properties:\n functionByLanguage: map\n GetDefaultProvidedFilesResponse:\n properties:\n filesByLanguage: map>\n GetGeneratedTestCaseFileRequest:\n properties:\n template: optional\n testCase: TestCaseV2\n GetGeneratedTestCaseTemplateFileRequest:\n properties:\n template: TestCaseTemplate\nimports:\n commons: ../commons/__package__.yml\n problem: ../ProblemInfo/__package__.yml\nservice:\n auth: false\n base-path: ''\n endpoints:\n createProblem:\n auth: true\n path: /create\n method: POST\n response: problem.CreateProblemResponse\n updateProblem:\n auth: true\n path: /update/{problemId}\n method: POST\n response: problem.UpdateProblemResponse\n path-parameters:\n problemId: commons.ProblemId\n deleteProblem:\n auth: true\n path: /delete/{problemId}\n method: DELETE\n path-parameters:\n problemId: commons.ProblemId\n getFunctionSignature:\n auth: true\n path: /function-signature\n method: POST\n response: GetFunctionSignatureResponse\n getBasicSolutionFile:\n auth: true\n path: /basic-solution-file\n method: POST\n response: GetBasicSolutionFileResponse\n getDefaultDirectoryForProblemFiles:\n auth: true\n path: /default-problem-files-directory\n method: GET\n response: map\n getGeneratedTestCaseFile:\n auth: true\n path: /generated-test-case-file\n method: POST\n response: map\n getGeneratedTestCaseTemplateFile:\n auth: true\n path: /generated-test-case-template-file\n method: POST\n response: map\n", + "contents": { + "types": { + "TestCaseTemplateId": { + "type": "string" + }, + "TestCaseId": { + "type": "string" + }, + "ParameterId": { + "type": "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": { + "discriminant": "dummy", + "union": { + "templateId": { + "type": "TestCaseTemplateId", + "key": "templateId" + }, + "implementation": { + "type": "TestCaseImplementation", + "key": "implementation" + } + } + }, + "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": { + "discriminant": "dummy", + "union": { + "withActualResult": { + "type": "TestCaseWithActualResultImplementation", + "key": "withActualResult" + }, + "custom": { + "type": "VoidFunctionDefinition", + "key": "custom" + } + } + }, + "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": { + "discriminant": "dummy", + "union": { + "deepEquality": { + "type": "DeepEqualityCorrectnessCheck", + "key": "deepEquality" + }, + "custom": { + "type": "VoidFunctionDefinitionThatTakesActualResult", + "key": "custom" + } + } + }, + "DeepEqualityCorrectnessCheck": { + "properties": { + "expectedValueParameterId": "ParameterId" + } + }, + "VoidFunctionDefinitionThatTakesActualResult": { + "properties": { + "additionalParameters": "list", + "code": "FunctionImplementationForMultipleLanguages" + } + }, + "TestCaseImplementationDescription": { + "properties": { + "boards": "list" + } + }, + "TestCaseImplementationDescriptionBoard": { + "discriminant": "dummy", + "union": { + "html": { + "type": "string", + "key": "html" + }, + "paramId": { + "type": "ParameterId", + "key": "paramId" + } + } + }, + "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": { + "discriminant": "dummy", + "union": { + "basic": { + "type": "BasicCustomFiles", + "key": "basic" + }, + "custom": { + "type": "map", + "key": "custom" + } + } + }, + "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" + } + }, + "GetBasicSolutionFileRequest": { + "properties": { + "methodName": "string", + "signature": "NonVoidFunctionSignature" + } + }, + "GetBasicSolutionFileResponse": { + "properties": { + "solutionFileByLanguage": "map" + } + }, + "GetFunctionSignatureRequest": { + "properties": { + "functionSignature": "FunctionSignature" + } + }, + "FunctionSignature": { + "discriminant": "dummy", + "union": { + "void": { + "type": "VoidFunctionSignature", + "key": "void" + }, + "nonVoid": { + "type": "NonVoidFunctionSignature", + "key": "nonVoid" + }, + "voidThatTakesActualResult": { + "type": "VoidFunctionSignatureThatTakesActualResult", + "key": "voidThatTakesActualResult" + } + } + }, + "GetFunctionSignatureResponse": { + "properties": { + "functionByLanguage": "map" + } + }, + "GetDefaultProvidedFilesResponse": { + "properties": { + "filesByLanguage": "map>" + } + }, + "GetGeneratedTestCaseFileRequest": { + "properties": { + "template": "optional", + "testCase": "TestCaseV2" + } + }, + "GetGeneratedTestCaseTemplateFileRequest": { + "properties": { + "template": "TestCaseTemplate" + } + } + }, + "imports": { + "commons": "../commons/__package__.yml", + "problem": "../ProblemInfo/__package__.yml" + }, + "service": { + "auth": false, + "base-path": "", + "endpoints": { + "createProblem": { + "auth": true, + "path": "/create", + "method": "POST", + "response": "problem.CreateProblemResponse" + }, + "updateProblem": { + "auth": true, + "path": "/update/{problemId}", + "method": "POST", + "response": "problem.UpdateProblemResponse", + "path-parameters": { + "problemId": "commons.ProblemId" + } + }, + "deleteProblem": { + "auth": true, + "path": "/delete/{problemId}", + "method": "DELETE", + "path-parameters": { + "problemId": "commons.ProblemId" + } + }, + "getFunctionSignature": { + "auth": true, + "path": "/function-signature", + "method": "POST", + "response": "GetFunctionSignatureResponse" + }, + "getBasicSolutionFile": { + "auth": true, + "path": "/basic-solution-file", + "method": "POST", + "response": "GetBasicSolutionFileResponse" + }, + "getDefaultDirectoryForProblemFiles": { + "auth": true, + "path": "/default-problem-files-directory", + "method": "GET", + "response": "map" + }, + "getGeneratedTestCaseFile": { + "auth": true, + "path": "/generated-test-case-file", + "method": "POST", + "response": "map" + }, + "getGeneratedTestCaseTemplateFile": { + "auth": true, + "path": "/generated-test-case-template-file", + "method": "POST", + "response": "map" + } + } + } + } + }, + "ProblemInfo/__package__.yml": { + "absoluteFilepath": "/DUMMY_PATH", + "rawContents": "types:\n ProblemInfo:\n properties:\n problemId: commons.ProblemId\n problemDescription: ProblemDescription\n problemName: string\n problemVersion: integer\n files: map\n inputParams: list\n outputType: commons.VariableType\n testcases: list\n methodName: string\n supportsCustomTestCases: boolean\n ProblemDescription:\n properties:\n boards: list\n ProblemDescriptionBoard:\n discriminant: dummy\n union:\n html:\n type: string\n key: html\n variable:\n type: commons.VariableValue\n key: variable\n testCaseId:\n type: string\n key: testCaseId\n ProblemFiles:\n properties:\n solutionFile: commons.FileInfo\n readOnlyFiles: list\n VariableTypeAndName:\n properties:\n variableType: commons.VariableType\n name: string\n CreateProblemRequest:\n properties:\n problemName: string\n problemDescription: ProblemDescription\n files: map\n inputParams: list\n outputType: commons.VariableType\n testcases: list\n methodName: string\n CreateProblemResponse:\n discriminant: dummy\n union:\n success:\n type: commons.ProblemId\n key: success\n error:\n type: CreateProblemError\n key: error\n CreateProblemError:\n discriminant: dummy\n union:\n generic:\n type: GenericCreateProblemError\n key: generic\n GenericCreateProblemError:\n properties:\n message: string\n type: string\n stacktrace: string\n UpdateProblemResponse:\n properties:\n problemVersion: integer\n GetDefaultStarterFilesRequest:\n properties:\n inputParams: list\n outputType: commons.VariableType\n methodName: string\n GetDefaultStarterFilesResponse:\n properties:\n files: map\nimports:\n commons: ../commons/__package__.yml\nservice:\n auth: false\n base-path: ''\n endpoints:\n getProblems:\n auth: true\n path: /problem-info\n method: GET\n response: list\n getLatestProblem:\n auth: true\n path: /problem-info/{problemId}\n method: GET\n response: ProblemInfo\n path-parameters:\n problemId: commons.ProblemId\n getProblemVersion:\n auth: true\n path: /problem-info/{problemId}/version/{problemVersion}\n method: GET\n response: ProblemInfo\n path-parameters:\n problemId: commons.ProblemId\n problemVersion: integer\n getExpectedResult:\n auth: true\n path: /expected-result/{problemId}\n method: POST\n response: commons.TestCaseWithExpectedResult\n path-parameters:\n problemId: commons.ProblemId\n", + "contents": { + "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": { + "discriminant": "dummy", + "union": { + "html": { + "type": "string", + "key": "html" + }, + "variable": { + "type": "commons.VariableValue", + "key": "variable" + }, + "testCaseId": { + "type": "string", + "key": "testCaseId" + } + } + }, + "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": { + "discriminant": "dummy", + "union": { + "success": { + "type": "commons.ProblemId", + "key": "success" + }, + "error": { + "type": "CreateProblemError", + "key": "error" + } + } + }, + "CreateProblemError": { + "discriminant": "dummy", + "union": { + "generic": { + "type": "GenericCreateProblemError", + "key": "generic" + } + } + }, + "GenericCreateProblemError": { + "properties": { + "message": "string", + "type": "string", + "stacktrace": "string" + } + }, + "UpdateProblemResponse": { + "properties": { + "problemVersion": "integer" + } + }, + "GetDefaultStarterFilesRequest": { + "properties": { + "inputParams": "list", + "outputType": "commons.VariableType", + "methodName": "string" + } + }, + "GetDefaultStarterFilesResponse": { + "properties": { + "files": "map" + } + } + }, + "imports": { + "commons": "../commons/__package__.yml" + }, + "service": { + "auth": false, + "base-path": "", + "endpoints": { + "getProblems": { + "auth": true, + "path": "/problem-info", + "method": "GET", + "response": "list" + }, + "getLatestProblem": { + "auth": true, + "path": "/problem-info/{problemId}", + "method": "GET", + "response": "ProblemInfo", + "path-parameters": { + "problemId": "commons.ProblemId" + } + }, + "getProblemVersion": { + "auth": true, + "path": "/problem-info/{problemId}/version/{problemVersion}", + "method": "GET", + "response": "ProblemInfo", + "path-parameters": { + "problemId": "commons.ProblemId", + "problemVersion": "integer" + } + }, + "getExpectedResult": { + "auth": true, + "path": "/expected-result/{problemId}", + "method": "POST", + "response": "commons.TestCaseWithExpectedResult", + "path-parameters": { + "problemId": "commons.ProblemId" + } + } + } + } + } + }, + "ProblemInfoServicV2/__package__.yml": { + "absoluteFilepath": "/DUMMY_PATH", + "rawContents": "types:\n TestCaseTemplateId:\n type: string\n TestCaseId:\n type: string\n ParameterId:\n type: string\n ProblemInfoV2:\n properties:\n problemId: commons.ProblemId\n problemDescription: problem.ProblemDescription\n problemName: string\n problemVersion: integer\n supportedLanguages: set\n customFiles: CustomFiles\n generatedFiles: GeneratedFiles\n customTestCaseTemplates: list\n testcases: list\n isPublic: boolean\n LightweightProblemInfoV2:\n properties:\n problemId: commons.ProblemId\n problemName: string\n problemVersion: integer\n variableTypes: set\n CreateProblemRequestV2:\n properties:\n problemName: string\n problemDescription: problem.ProblemDescription\n customFiles: CustomFiles\n customTestCaseTemplates: list\n testcases: list\n supportedLanguages: set\n isPublic: boolean\n TestCaseV2:\n properties:\n metadata: TestCaseMetadata\n implementation: TestCaseImplementationReference\n arguments: map\n expects: optional\n TestCaseExpects:\n properties:\n expectedStdout: optional\n TestCaseImplementationReference:\n discriminant: dummy\n union:\n templateId:\n type: TestCaseTemplateId\n key: templateId\n implementation:\n type: TestCaseImplementation\n key: implementation\n BasicTestCaseTemplate:\n properties:\n templateId: TestCaseTemplateId\n name: string\n description: TestCaseImplementationDescription\n expectedValueParameterId: ParameterId\n TestCaseTemplate:\n properties:\n templateId: TestCaseTemplateId\n name: string\n implementation: TestCaseImplementation\n TestCaseImplementation:\n properties:\n description: TestCaseImplementationDescription\n function: TestCaseFunction\n TestCaseFunction:\n discriminant: dummy\n union:\n withActualResult:\n type: TestCaseWithActualResultImplementation\n key: withActualResult\n custom:\n type: VoidFunctionDefinition\n key: custom\n TestCaseWithActualResultImplementation:\n properties:\n getActualResult: NonVoidFunctionDefinition\n assertCorrectnessCheck: AssertCorrectnessCheck\n VoidFunctionDefinition:\n properties:\n parameters: list\n code: FunctionImplementationForMultipleLanguages\n Parameter:\n properties:\n parameterId: ParameterId\n name: string\n variableType: commons.VariableType\n NonVoidFunctionDefinition:\n properties:\n signature: NonVoidFunctionSignature\n code: FunctionImplementationForMultipleLanguages\n VoidFunctionSignature:\n properties:\n parameters: list\n NonVoidFunctionSignature:\n properties:\n parameters: list\n returnType: commons.VariableType\n VoidFunctionSignatureThatTakesActualResult:\n properties:\n parameters: list\n actualResultType: commons.VariableType\n AssertCorrectnessCheck:\n discriminant: dummy\n union:\n deepEquality:\n type: DeepEqualityCorrectnessCheck\n key: deepEquality\n custom:\n type: VoidFunctionDefinitionThatTakesActualResult\n key: custom\n DeepEqualityCorrectnessCheck:\n properties:\n expectedValueParameterId: ParameterId\n VoidFunctionDefinitionThatTakesActualResult:\n properties:\n additionalParameters: list\n code: FunctionImplementationForMultipleLanguages\n TestCaseImplementationDescription:\n properties:\n boards: list\n TestCaseImplementationDescriptionBoard:\n discriminant: dummy\n union:\n html:\n type: string\n key: html\n paramId:\n type: ParameterId\n key: paramId\n TestCaseMetadata:\n properties:\n id: TestCaseId\n name: string\n hidden: boolean\n FunctionImplementationForMultipleLanguages:\n properties:\n codeByLanguage: map\n FunctionImplementation:\n properties:\n impl: string;\n imports: optional;\n GeneratedFiles:\n properties:\n generatedTestCaseFiles: map\n generatedTemplateFiles: map\n other: map\n CustomFiles:\n discriminant: dummy\n union:\n basic:\n type: BasicCustomFiles\n key: basic\n custom:\n type: map\n key: custom\n BasicCustomFiles:\n properties:\n methodName: string\n signature: NonVoidFunctionSignature\n additionalFiles: map\n basicTestCaseTemplate: BasicTestCaseTemplate\n Files:\n properties:\n files: list\n FileInfoV2:\n properties:\n filename: string\n directory: string\n contents: string\n editable: boolean\n DefaultProvidedFile:\n properties:\n file: FileInfoV2\n relatedTypes: list\n GetBasicSolutionFileRequest:\n properties:\n methodName: string\n signature: NonVoidFunctionSignature\n GetBasicSolutionFileResponse:\n properties:\n solutionFileByLanguage: map\n GetFunctionSignatureRequest:\n properties:\n functionSignature: FunctionSignature\n FunctionSignature:\n discriminant: dummy\n union:\n void:\n type: VoidFunctionSignature\n key: void\n nonVoid:\n type: NonVoidFunctionSignature\n key: nonVoid\n voidThatTakesActualResult:\n type: VoidFunctionSignatureThatTakesActualResult\n key: voidThatTakesActualResult\n GetFunctionSignatureResponse:\n properties:\n functionByLanguage: map\n GetDefaultProvidedFilesResponse:\n properties:\n filesByLanguage: map>\n GetGeneratedTestCaseFileRequest:\n properties:\n template: optional\n testCase: TestCaseV2\n GetGeneratedTestCaseTemplateFileRequest:\n properties:\n template: TestCaseTemplate\nimports:\n commons: ../commons/__package__.yml\n problem: ../ProblemInfo/__package__.yml\nservice:\n auth: false\n base-path: ''\n endpoints:\n getLightweightProblems:\n auth: true\n path: /lightweight-problem-info\n method: GET\n response: list\n getProblems:\n auth: true\n path: /problem-info\n method: GET\n response: list\n getLatestProblem:\n auth: true\n path: /problem-info/{problemId}\n method: GET\n response: ProblemInfoV2\n path-parameters:\n problemId: commons.ProblemId\n getProblemVersion:\n auth: true\n path: /problem-info/{problemId}/version/{problemVersion}\n method: GET\n response: ProblemInfoV2\n path-parameters:\n problemId: commons.ProblemId\n problemVersion: integer\n", + "contents": { + "types": { + "TestCaseTemplateId": { + "type": "string" + }, + "TestCaseId": { + "type": "string" + }, + "ParameterId": { + "type": "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": { + "discriminant": "dummy", + "union": { + "templateId": { + "type": "TestCaseTemplateId", + "key": "templateId" + }, + "implementation": { + "type": "TestCaseImplementation", + "key": "implementation" + } + } + }, + "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": { + "discriminant": "dummy", + "union": { + "withActualResult": { + "type": "TestCaseWithActualResultImplementation", + "key": "withActualResult" + }, + "custom": { + "type": "VoidFunctionDefinition", + "key": "custom" + } + } + }, + "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": { + "discriminant": "dummy", + "union": { + "deepEquality": { + "type": "DeepEqualityCorrectnessCheck", + "key": "deepEquality" + }, + "custom": { + "type": "VoidFunctionDefinitionThatTakesActualResult", + "key": "custom" + } + } + }, + "DeepEqualityCorrectnessCheck": { + "properties": { + "expectedValueParameterId": "ParameterId" + } + }, + "VoidFunctionDefinitionThatTakesActualResult": { + "properties": { + "additionalParameters": "list", + "code": "FunctionImplementationForMultipleLanguages" + } + }, + "TestCaseImplementationDescription": { + "properties": { + "boards": "list" + } + }, + "TestCaseImplementationDescriptionBoard": { + "discriminant": "dummy", + "union": { + "html": { + "type": "string", + "key": "html" + }, + "paramId": { + "type": "ParameterId", + "key": "paramId" + } + } + }, + "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": { + "discriminant": "dummy", + "union": { + "basic": { + "type": "BasicCustomFiles", + "key": "basic" + }, + "custom": { + "type": "map", + "key": "custom" + } + } + }, + "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" + } + }, + "GetBasicSolutionFileRequest": { + "properties": { + "methodName": "string", + "signature": "NonVoidFunctionSignature" + } + }, + "GetBasicSolutionFileResponse": { + "properties": { + "solutionFileByLanguage": "map" + } + }, + "GetFunctionSignatureRequest": { + "properties": { + "functionSignature": "FunctionSignature" + } + }, + "FunctionSignature": { + "discriminant": "dummy", + "union": { + "void": { + "type": "VoidFunctionSignature", + "key": "void" + }, + "nonVoid": { + "type": "NonVoidFunctionSignature", + "key": "nonVoid" + }, + "voidThatTakesActualResult": { + "type": "VoidFunctionSignatureThatTakesActualResult", + "key": "voidThatTakesActualResult" + } + } + }, + "GetFunctionSignatureResponse": { + "properties": { + "functionByLanguage": "map" + } + }, + "GetDefaultProvidedFilesResponse": { + "properties": { + "filesByLanguage": "map>" + } + }, + "GetGeneratedTestCaseFileRequest": { + "properties": { + "template": "optional", + "testCase": "TestCaseV2" + } + }, + "GetGeneratedTestCaseTemplateFileRequest": { + "properties": { + "template": "TestCaseTemplate" + } + } + }, + "imports": { + "commons": "../commons/__package__.yml", + "problem": "../ProblemInfo/__package__.yml" + }, + "service": { + "auth": false, + "base-path": "", + "endpoints": { + "getLightweightProblems": { + "auth": true, + "path": "/lightweight-problem-info", + "method": "GET", + "response": "list" + }, + "getProblems": { + "auth": true, + "path": "/problem-info", + "method": "GET", + "response": "list" + }, + "getLatestProblem": { + "auth": true, + "path": "/problem-info/{problemId}", + "method": "GET", + "response": "ProblemInfoV2", + "path-parameters": { + "problemId": "commons.ProblemId" + } + }, + "getProblemVersion": { + "auth": true, + "path": "/problem-info/{problemId}/version/{problemVersion}", + "method": "GET", + "response": "ProblemInfoV2", + "path-parameters": { + "problemId": "commons.ProblemId", + "problemVersion": "integer" + } + } + } + } + } + }, + "SubmissionInfo/__package__.yml": { + "absoluteFilepath": "/DUMMY_PATH", + "rawContents": "types:\n SubmissionId:\n type: string\n ShareId:\n type: string\n SubmissionRequest:\n discriminant: dummy\n union:\n initializeProblemRequest:\n type: InitializeProblemRequest\n key: initializeProblemRequest\n initializeWorkspaceRequest:\n type: commons.EmptyObject\n key: initializeWorkspaceRequest\n submitV2:\n type: SubmitRequestV2\n key: submitV2\n workspaceSubmit:\n type: WorkspaceSubmitRequest\n key: workspaceSubmit\n stop:\n type: StopRequest\n key: stop\n InitializeProblemRequest:\n properties:\n problemId: commons.ProblemId\n problemVersion: optional\n SubmitRequestV2:\n properties:\n submissionId: SubmissionId\n language: commons.Language\n submissionFiles: list\n problemId: commons.ProblemId\n problemVersion: optional\n userId: optional\n WorkspaceSubmitRequest:\n properties:\n submissionId: SubmissionId\n language: commons.Language\n submissionFiles: list\n userId: optional\n SubmissionFileInfo:\n properties:\n directory: string\n filename: string\n contents: string\n SubmissionTypeEnum:\n enum:\n - TEST\n StopRequest:\n properties:\n submissionId: SubmissionId\n SubmissionResponse:\n discriminant: dummy\n union:\n serverInitialized:\n type: commons.EmptyObject\n key: serverInitialized\n problemInitialized:\n type: commons.ProblemId\n key: problemInitialized\n workspaceInitialized:\n type: commons.EmptyObject\n key: workspaceInitialized\n serverErrored:\n type: ExceptionInfo\n key: serverErrored\n codeExecutionUpdate:\n type: CodeExecutionUpdate\n key: codeExecutionUpdate\n terminated:\n type: TerminatedResponse\n key: terminated\n CodeExecutionUpdate:\n discriminant: dummy\n union:\n buildingExecutor:\n type: BuildingExecutorResponse\n key: buildingExecutor\n running:\n type: RunningResponse\n key: running\n errored:\n type: ErroredResponse\n key: errored\n stopped:\n type: StoppedResponse\n key: stopped\n graded:\n type: GradedResponse\n key: graded\n gradedV2:\n type: GradedResponseV2\n key: gradedV2\n workspaceRan:\n type: WorkspaceRanResponse\n key: workspaceRan\n recording:\n type: RecordingResponseNotification\n key: recording\n recorded:\n type: RecordedResponseNotification\n key: recorded\n invalidRequest:\n type: InvalidRequestResponse\n key: invalidRequest\n finished:\n type: FinishedResponse\n key: finished\n BuildingExecutorResponse:\n properties:\n submissionId: SubmissionId\n status: ExecutionSessionStatus\n RunningResponse:\n properties:\n submissionId: SubmissionId\n state: RunningSubmissionState\n RunningSubmissionState:\n enum:\n - QUEUEING_SUBMISSION\n - KILLING_HISTORICAL_SUBMISSIONS\n - WRITING_SUBMISSION_TO_FILE\n - COMPILING_SUBMISSION\n - RUNNING_SUBMISSION\n ErroredResponse:\n properties:\n submissionId: SubmissionId\n errorInfo: ErrorInfo\n ErrorInfo:\n discriminant: dummy\n union:\n compileError:\n type: CompileError\n key: compileError\n runtimeError:\n type: RuntimeError\n key: runtimeError\n internalError:\n type: InternalError\n key: internalError\n CompileError:\n properties:\n message: string\n RuntimeError:\n properties:\n message: string\n InternalError:\n properties:\n exceptionInfo: ExceptionInfo\n StoppedResponse:\n properties:\n submissionId: SubmissionId\n WorkspaceRanResponse:\n properties:\n submissionId: SubmissionId\n runDetails: WorkspaceRunDetails\n WorkspaceRunDetails:\n properties:\n exceptionV2: optional\n exception: optional\n stdout: string\n GradedResponse:\n properties:\n submissionId: SubmissionId\n testCases: map\n GradedResponseV2:\n properties:\n submissionId: SubmissionId\n testCases: map\n TestCaseGrade:\n discriminant: dummy\n union:\n hidden:\n type: TestCaseHiddenGrade\n key: hidden\n nonHidden:\n type: TestCaseNonHiddenGrade\n key: nonHidden\n TestCaseHiddenGrade:\n properties:\n passed: boolean\n TestCaseNonHiddenGrade:\n properties:\n passed: boolean\n actualResult: optional\n exception: optional\n stdout: string\n RecordedResponseNotification:\n properties:\n submissionId: SubmissionId\n traceResponsesSize: integer\n testCaseId: optional\n RecordingResponseNotification:\n properties:\n submissionId: SubmissionId\n testCaseId: optional\n lineNumber: integer\n lightweightStackInfo: LightweightStackframeInformation\n tracedFile: optional\n LightweightStackframeInformation:\n properties:\n numStackFrames: integer\n topStackFrameMethodName: string\n TestCaseResultWithStdout:\n properties:\n result: TestCaseResult\n stdout: string\n TestCaseResult:\n properties:\n expectedResult: commons.VariableValue\n actualResult: ActualResult\n passed: boolean\n ActualResult:\n discriminant: dummy\n union:\n value:\n type: commons.VariableValue\n key: value\n exception:\n type: ExceptionInfo\n key: exception\n exceptionV2:\n type: ExceptionV2\n key: exceptionV2\n ExceptionV2:\n discriminant: dummy\n union:\n generic:\n type: ExceptionInfo\n key: generic\n timeout:\n type: commons.EmptyObject\n key: timeout\n ExceptionInfo:\n properties:\n exceptionType: string\n exceptionMessage: string\n exceptionStacktrace: string\n InvalidRequestResponse:\n properties:\n request: SubmissionRequest\n cause: InvalidRequestCause\n InvalidRequestCause:\n discriminant: dummy\n union:\n submissionIdNotFound:\n type: SubmissionIdNotFound\n key: submissionIdNotFound\n customTestCasesUnsupported:\n type: CustomTestCasesUnsupported\n key: customTestCasesUnsupported\n unexpectedLanguage:\n type: UnexpectedLanguageError\n key: unexpectedLanguage\n ExistingSubmissionExecuting:\n properties:\n submissionId: SubmissionId\n SubmissionIdNotFound:\n properties:\n missingSubmissionId: SubmissionId\n CustomTestCasesUnsupported:\n properties:\n problemId: commons.ProblemId\n submissionId: SubmissionId\n UnexpectedLanguageError:\n properties:\n expectedLanguage: commons.Language\n actualLanguage: commons.Language\n TerminatedResponse:\n properties: {}\n FinishedResponse:\n properties:\n submissionId: SubmissionId\n StdoutResponse:\n properties:\n submissionId: SubmissionId\n stdout: string\n StderrResponse:\n properties:\n submissionId: SubmissionId\n stderr: string\n TraceResponse:\n properties:\n submissionId: SubmissionId\n lineNumber: integer\n returnValue: optional\n expressionLocation: optional\n stack: StackInformation\n stdout: optional\n TraceResponseV2:\n properties:\n submissionId: SubmissionId\n lineNumber: integer\n file: TracedFile\n returnValue: optional\n expressionLocation: optional\n stack: StackInformation\n stdout: optional\n TracedFile:\n properties:\n filename: string\n directory: string\n ExpressionLocation:\n properties:\n start: integer\n offset: integer\n StackInformation:\n properties:\n numStackFrames: integer\n topStackFrame: optional\n StackFrame:\n properties:\n methodName: string\n lineNumber: integer\n scopes: list\n Scope:\n properties:\n variables: map\n ExecutionSessionResponse:\n properties:\n sessionId: string\n executionSessionUrl: optional\n language: commons.Language\n status: ExecutionSessionStatus\n ExecutionSessionStatus:\n enum:\n - CREATING_CONTAINER\n - PROVISIONING_CONTAINER\n - PENDING_CONTAINER\n - RUNNING_CONTAINER\n - LIVE_CONTAINER\n - FAILED_TO_LAUNCH\n SubmissionStateV2:\n properties:\n timeSubmitted: datetime\n language: commons.Language\n submissionFiles: list\n submissionStatus: SubmissionStatusV2\n SubmissionStatusV2:\n discriminant: dummy\n union:\n test:\n type: TestSubmissionStatusV2\n key: test\n workspace:\n type: WorkspaceSubmissionStatusV2\n key: workspace\n TestSubmissionStatusV2:\n properties:\n updates: list\n problemId: commons.ProblemId\n problemVersion: integer\n problemInfo: problemV2.ProblemInfoV2\n WorkspaceSubmissionStatusV2:\n properties:\n updates: list\n TestSubmissionUpdate:\n properties:\n updateTime: datetime\n updateInfo: TestSubmissionUpdateInfo\n TestSubmissionUpdateInfo:\n discriminant: dummy\n union:\n running:\n type: RunningSubmissionState\n key: running\n stopped:\n type: commons.EmptyObject\n key: stopped\n errored:\n type: ErrorInfo\n key: errored\n gradedTestCase:\n type: GradedTestCaseUpdate\n key: gradedTestCase\n recordedTestCase:\n type: RecordedTestCaseUpdate\n key: recordedTestCase\n finished:\n type: commons.EmptyObject\n key: finished\n WorkspaceSubmissionUpdate:\n properties:\n updateTime: datetime\n updateInfo: WorkspaceSubmissionUpdateInfo\n WorkspaceSubmissionUpdateInfo:\n discriminant: dummy\n union:\n running:\n type: RunningSubmissionState\n key: running\n ran:\n type: WorkspaceRunDetails\n key: ran\n stopped:\n type: commons.EmptyObject\n key: stopped\n traced:\n type: commons.EmptyObject\n key: traced\n tracedV2:\n type: WorkspaceTracedUpdate\n key: tracedV2\n errored:\n type: ErrorInfo\n key: errored\n finished:\n type: commons.EmptyObject\n key: finished\n GradedTestCaseUpdate:\n properties:\n testCaseId: problemV2.TestCaseId\n grade: TestCaseGrade\n RecordedTestCaseUpdate:\n properties:\n testCaseId: problemV2.TestCaseId\n traceResponsesSize: integer\n WorkspaceTracedUpdate:\n properties:\n traceResponsesSize: integer\n SubmissionState:\n properties:\n timeSubmitted: optional\n submission: string\n language: commons.Language\n submissionTypeState: SubmissionTypeState\n SubmissionTypeState:\n discriminant: dummy\n union:\n test:\n type: TestSubmissionState\n key: test\n workspace:\n type: WorkspaceSubmissionState\n key: workspace\n WorkspaceSubmissionState:\n properties:\n status: WorkspaceSubmissionStatus\n WorkspaceSubmissionStatus:\n discriminant: dummy\n union:\n stopped:\n type: commons.EmptyObject\n key: stopped\n errored:\n type: ErrorInfo\n key: errored\n running:\n type: RunningSubmissionState\n key: running\n ran:\n type: WorkspaceRunDetails\n key: ran\n traced:\n type: WorkspaceRunDetails\n key: traced\n TestSubmissionState:\n properties:\n problemId: commons.ProblemId\n defaultTestCases: list\n customTestCases: list\n status: TestSubmissionStatus\n TestSubmissionStatus:\n discriminant: dummy\n union:\n stopped:\n type: commons.EmptyObject\n key: stopped\n errored:\n type: ErrorInfo\n key: errored\n running:\n type: RunningSubmissionState\n key: running\n testCaseIdToState:\n type: map\n key: testCaseIdToState\n SubmissionStatusForTestCase:\n discriminant: dummy\n union:\n graded:\n type: TestCaseResultWithStdout\n key: graded\n gradedV2:\n type: TestCaseGrade\n key: gradedV2\n traced:\n type: TracedTestCase\n key: traced\n TracedTestCase:\n properties:\n result: TestCaseResultWithStdout\n traceResponsesSize: integer\n TraceResponsesPage:\n properties:\n offset:\n type: optional\n docs: |\n If present, use this to load subseqent pages.\n The offset is the id of the next trace response to load.\n traceResponses: list\n TraceResponsesPageV2:\n properties:\n offset:\n type: optional\n docs: |\n If present, use this to load subseqent pages.\n The offset is the id of the next trace response to load.\n traceResponses: list\n GetTraceResponsesPageRequest:\n properties:\n offset:\n type: optional\n WorkspaceStarterFilesResponse:\n properties:\n files: map\n WorkspaceStarterFilesResponseV2:\n properties:\n filesByLanguage: map\n WorkspaceFiles:\n properties:\n mainFile: commons.FileInfo\n readOnlyFiles: list\n ExecutionSessionsState:\n properties:\n states: map\n numWarmingInstances: optional\n warmingSessionIds: list\n ExecutionSessionState:\n properties:\n lastTimeContacted: optional\n sessionId: string\n isWarmInstance: boolean\n awsTaskId: optional\n language: commons.Language\n status: ExecutionSessionStatus\nimports:\n commons: ../commons/__package__.yml\n problemV2: ../ProblemInfoServicV2/__package__.yml\nservice:\n auth: false\n base-path: ''\n endpoints:\n getSubmissionState:\n auth: true\n path: /{submissionId}\n method: GET\n response: SubmissionState\n path-parameters:\n submissionId: SubmissionId\n getSubmissionStateV2:\n auth: true\n path: /v2/{submissionId}\n method: GET\n response: SubmissionStateV2\n path-parameters:\n submissionId: SubmissionId\n getTraceResponsesPage:\n auth: true\n path: /trace-respose/{submissionId}/testCase/{testCaseId}\n method: POST\n response: TraceResponsesPage\n path-parameters:\n submissionId: SubmissionId\n testCaseId: string\n getTraceResponsesV2Page:\n auth: true\n path: /trace-response-v2/{submissionId}/testCase/{testCaseId}\n method: POST\n response: TraceResponsesPageV2\n path-parameters:\n submissionId: SubmissionId\n testCaseId: problemV2.TestCaseId\n getTraceResponsesPageForWorkspace:\n auth: true\n path: /workspace-trace-response/{submissionId}\n method: POST\n response: TraceResponsesPage\n path-parameters:\n submissionId: SubmissionId\n getTraceResponsesV2PageForWorkspace:\n auth: true\n path: /workspace-trace-response-v2/{submissionId}\n method: POST\n response: TraceResponsesPageV2\n path-parameters:\n submissionId: SubmissionId\n", + "contents": { + "types": { + "SubmissionId": { + "type": "string" + }, + "ShareId": { + "type": "string" + }, + "SubmissionRequest": { + "discriminant": "dummy", + "union": { + "initializeProblemRequest": { + "type": "InitializeProblemRequest", + "key": "initializeProblemRequest" + }, + "initializeWorkspaceRequest": { + "type": "commons.EmptyObject", + "key": "initializeWorkspaceRequest" + }, + "submitV2": { + "type": "SubmitRequestV2", + "key": "submitV2" + }, + "workspaceSubmit": { + "type": "WorkspaceSubmitRequest", + "key": "workspaceSubmit" + }, + "stop": { + "type": "StopRequest", + "key": "stop" + } + } + }, + "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" + ] + }, + "StopRequest": { + "properties": { + "submissionId": "SubmissionId" + } + }, + "SubmissionResponse": { + "discriminant": "dummy", + "union": { + "serverInitialized": { + "type": "commons.EmptyObject", + "key": "serverInitialized" + }, + "problemInitialized": { + "type": "commons.ProblemId", + "key": "problemInitialized" + }, + "workspaceInitialized": { + "type": "commons.EmptyObject", + "key": "workspaceInitialized" + }, + "serverErrored": { + "type": "ExceptionInfo", + "key": "serverErrored" + }, + "codeExecutionUpdate": { + "type": "CodeExecutionUpdate", + "key": "codeExecutionUpdate" + }, + "terminated": { + "type": "TerminatedResponse", + "key": "terminated" + } + } + }, + "CodeExecutionUpdate": { + "discriminant": "dummy", + "union": { + "buildingExecutor": { + "type": "BuildingExecutorResponse", + "key": "buildingExecutor" + }, + "running": { + "type": "RunningResponse", + "key": "running" + }, + "errored": { + "type": "ErroredResponse", + "key": "errored" + }, + "stopped": { + "type": "StoppedResponse", + "key": "stopped" + }, + "graded": { + "type": "GradedResponse", + "key": "graded" + }, + "gradedV2": { + "type": "GradedResponseV2", + "key": "gradedV2" + }, + "workspaceRan": { + "type": "WorkspaceRanResponse", + "key": "workspaceRan" + }, + "recording": { + "type": "RecordingResponseNotification", + "key": "recording" + }, + "recorded": { + "type": "RecordedResponseNotification", + "key": "recorded" + }, + "invalidRequest": { + "type": "InvalidRequestResponse", + "key": "invalidRequest" + }, + "finished": { + "type": "FinishedResponse", + "key": "finished" + } + } + }, + "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": { + "discriminant": "dummy", + "union": { + "compileError": { + "type": "CompileError", + "key": "compileError" + }, + "runtimeError": { + "type": "RuntimeError", + "key": "runtimeError" + }, + "internalError": { + "type": "InternalError", + "key": "internalError" + } + } + }, + "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": { + "discriminant": "dummy", + "union": { + "hidden": { + "type": "TestCaseHiddenGrade", + "key": "hidden" + }, + "nonHidden": { + "type": "TestCaseNonHiddenGrade", + "key": "nonHidden" + } + } + }, + "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": { + "discriminant": "dummy", + "union": { + "value": { + "type": "commons.VariableValue", + "key": "value" + }, + "exception": { + "type": "ExceptionInfo", + "key": "exception" + }, + "exceptionV2": { + "type": "ExceptionV2", + "key": "exceptionV2" + } + } + }, + "ExceptionV2": { + "discriminant": "dummy", + "union": { + "generic": { + "type": "ExceptionInfo", + "key": "generic" + }, + "timeout": { + "type": "commons.EmptyObject", + "key": "timeout" + } + } + }, + "ExceptionInfo": { + "properties": { + "exceptionType": "string", + "exceptionMessage": "string", + "exceptionStacktrace": "string" + } + }, + "InvalidRequestResponse": { + "properties": { + "request": "SubmissionRequest", + "cause": "InvalidRequestCause" + } + }, + "InvalidRequestCause": { + "discriminant": "dummy", + "union": { + "submissionIdNotFound": { + "type": "SubmissionIdNotFound", + "key": "submissionIdNotFound" + }, + "customTestCasesUnsupported": { + "type": "CustomTestCasesUnsupported", + "key": "customTestCasesUnsupported" + }, + "unexpectedLanguage": { + "type": "UnexpectedLanguageError", + "key": "unexpectedLanguage" + } + } + }, + "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", + "PROVISIONING_CONTAINER", + "PENDING_CONTAINER", + "RUNNING_CONTAINER", + "LIVE_CONTAINER", + "FAILED_TO_LAUNCH" + ] + }, + "SubmissionStateV2": { + "properties": { + "timeSubmitted": "datetime", + "language": "commons.Language", + "submissionFiles": "list", + "submissionStatus": "SubmissionStatusV2" + } + }, + "SubmissionStatusV2": { + "discriminant": "dummy", + "union": { + "test": { + "type": "TestSubmissionStatusV2", + "key": "test" + }, + "workspace": { + "type": "WorkspaceSubmissionStatusV2", + "key": "workspace" + } + } + }, + "TestSubmissionStatusV2": { + "properties": { + "updates": "list", + "problemId": "commons.ProblemId", + "problemVersion": "integer", + "problemInfo": "problemV2.ProblemInfoV2" + } + }, + "WorkspaceSubmissionStatusV2": { + "properties": { + "updates": "list" + } + }, + "TestSubmissionUpdate": { + "properties": { + "updateTime": "datetime", + "updateInfo": "TestSubmissionUpdateInfo" + } + }, + "TestSubmissionUpdateInfo": { + "discriminant": "dummy", + "union": { + "running": { + "type": "RunningSubmissionState", + "key": "running" + }, + "stopped": { + "type": "commons.EmptyObject", + "key": "stopped" + }, + "errored": { + "type": "ErrorInfo", + "key": "errored" + }, + "gradedTestCase": { + "type": "GradedTestCaseUpdate", + "key": "gradedTestCase" + }, + "recordedTestCase": { + "type": "RecordedTestCaseUpdate", + "key": "recordedTestCase" + }, + "finished": { + "type": "commons.EmptyObject", + "key": "finished" + } + } + }, + "WorkspaceSubmissionUpdate": { + "properties": { + "updateTime": "datetime", + "updateInfo": "WorkspaceSubmissionUpdateInfo" + } + }, + "WorkspaceSubmissionUpdateInfo": { + "discriminant": "dummy", + "union": { + "running": { + "type": "RunningSubmissionState", + "key": "running" + }, + "ran": { + "type": "WorkspaceRunDetails", + "key": "ran" + }, + "stopped": { + "type": "commons.EmptyObject", + "key": "stopped" + }, + "traced": { + "type": "commons.EmptyObject", + "key": "traced" + }, + "tracedV2": { + "type": "WorkspaceTracedUpdate", + "key": "tracedV2" + }, + "errored": { + "type": "ErrorInfo", + "key": "errored" + }, + "finished": { + "type": "commons.EmptyObject", + "key": "finished" + } + } + }, + "GradedTestCaseUpdate": { + "properties": { + "testCaseId": "problemV2.TestCaseId", + "grade": "TestCaseGrade" + } + }, + "RecordedTestCaseUpdate": { + "properties": { + "testCaseId": "problemV2.TestCaseId", + "traceResponsesSize": "integer" + } + }, + "WorkspaceTracedUpdate": { + "properties": { + "traceResponsesSize": "integer" + } + }, + "SubmissionState": { + "properties": { + "timeSubmitted": "optional", + "submission": "string", + "language": "commons.Language", + "submissionTypeState": "SubmissionTypeState" + } + }, + "SubmissionTypeState": { + "discriminant": "dummy", + "union": { + "test": { + "type": "TestSubmissionState", + "key": "test" + }, + "workspace": { + "type": "WorkspaceSubmissionState", + "key": "workspace" + } + } + }, + "WorkspaceSubmissionState": { + "properties": { + "status": "WorkspaceSubmissionStatus" + } + }, + "WorkspaceSubmissionStatus": { + "discriminant": "dummy", + "union": { + "stopped": { + "type": "commons.EmptyObject", + "key": "stopped" + }, + "errored": { + "type": "ErrorInfo", + "key": "errored" + }, + "running": { + "type": "RunningSubmissionState", + "key": "running" + }, + "ran": { + "type": "WorkspaceRunDetails", + "key": "ran" + }, + "traced": { + "type": "WorkspaceRunDetails", + "key": "traced" + } + } + }, + "TestSubmissionState": { + "properties": { + "problemId": "commons.ProblemId", + "defaultTestCases": "list", + "customTestCases": "list", + "status": "TestSubmissionStatus" + } + }, + "TestSubmissionStatus": { + "discriminant": "dummy", + "union": { + "stopped": { + "type": "commons.EmptyObject", + "key": "stopped" + }, + "errored": { + "type": "ErrorInfo", + "key": "errored" + }, + "running": { + "type": "RunningSubmissionState", + "key": "running" + }, + "testCaseIdToState": { + "type": "map", + "key": "testCaseIdToState" + } + } + }, + "SubmissionStatusForTestCase": { + "discriminant": "dummy", + "union": { + "graded": { + "type": "TestCaseResultWithStdout", + "key": "graded" + }, + "gradedV2": { + "type": "TestCaseGrade", + "key": "gradedV2" + }, + "traced": { + "type": "TracedTestCase", + "key": "traced" + } + } + }, + "TracedTestCase": { + "properties": { + "result": "TestCaseResultWithStdout", + "traceResponsesSize": "integer" + } + }, + "TraceResponsesPage": { + "properties": { + "offset": { + "type": "optional", + "docs": "If present, use this to load subseqent pages.\nThe offset is the id of the next trace response to load.\n" + }, + "traceResponses": "list" + } + }, + "TraceResponsesPageV2": { + "properties": { + "offset": { + "type": "optional", + "docs": "If present, use this to load subseqent pages.\nThe offset is the id of the next trace response to load.\n" + }, + "traceResponses": "list" + } + }, + "GetTraceResponsesPageRequest": { + "properties": { + "offset": { + "type": "optional" + } + } + }, + "WorkspaceStarterFilesResponse": { + "properties": { + "files": "map" + } + }, + "WorkspaceStarterFilesResponseV2": { + "properties": { + "filesByLanguage": "map" + } + }, + "WorkspaceFiles": { + "properties": { + "mainFile": "commons.FileInfo", + "readOnlyFiles": "list" + } + }, + "ExecutionSessionsState": { + "properties": { + "states": "map", + "numWarmingInstances": "optional", + "warmingSessionIds": "list" + } + }, + "ExecutionSessionState": { + "properties": { + "lastTimeContacted": "optional", + "sessionId": "string", + "isWarmInstance": "boolean", + "awsTaskId": "optional", + "language": "commons.Language", + "status": "ExecutionSessionStatus" + } + } + }, + "imports": { + "commons": "../commons/__package__.yml", + "problemV2": "../ProblemInfoServicV2/__package__.yml" + }, + "service": { + "auth": false, + "base-path": "", + "endpoints": { + "getSubmissionState": { + "auth": true, + "path": "/{submissionId}", + "method": "GET", + "response": "SubmissionState", + "path-parameters": { + "submissionId": "SubmissionId" + } + }, + "getSubmissionStateV2": { + "auth": true, + "path": "/v2/{submissionId}", + "method": "GET", + "response": "SubmissionStateV2", + "path-parameters": { + "submissionId": "SubmissionId" + } + }, + "getTraceResponsesPage": { + "auth": true, + "path": "/trace-respose/{submissionId}/testCase/{testCaseId}", + "method": "POST", + "response": "TraceResponsesPage", + "path-parameters": { + "submissionId": "SubmissionId", + "testCaseId": "string" + } + }, + "getTraceResponsesV2Page": { + "auth": true, + "path": "/trace-response-v2/{submissionId}/testCase/{testCaseId}", + "method": "POST", + "response": "TraceResponsesPageV2", + "path-parameters": { + "submissionId": "SubmissionId", + "testCaseId": "problemV2.TestCaseId" + } + }, + "getTraceResponsesPageForWorkspace": { + "auth": true, + "path": "/workspace-trace-response/{submissionId}", + "method": "POST", + "response": "TraceResponsesPage", + "path-parameters": { + "submissionId": "SubmissionId" + } + }, + "getTraceResponsesV2PageForWorkspace": { + "auth": true, + "path": "/workspace-trace-response-v2/{submissionId}", + "method": "POST", + "response": "TraceResponsesPageV2", + "path-parameters": { + "submissionId": "SubmissionId" + } + } + } + } + } + }, + "SysPropCrud/__package__.yml": { + "absoluteFilepath": "/DUMMY_PATH", + "rawContents": "imports:\n commons: ../commons/__package__.yml\nservice:\n auth: false\n base-path: ''\n endpoints:\n setNumWarmInstances:\n auth: true\n path: /num-warm-instances/{language}/{numWarmInstances}\n method: PUT\n path-parameters:\n language: commons.Language\n numWarmInstances: integer\n getNumWarmInstances:\n auth: true\n path: /num-warm-instances\n method: GET\n response: map\n", + "contents": { + "imports": { + "commons": "../commons/__package__.yml" + }, + "service": { + "auth": false, + "base-path": "", + "endpoints": { + "setNumWarmInstances": { + "auth": true, + "path": "/num-warm-instances/{language}/{numWarmInstances}", + "method": "PUT", + "path-parameters": { + "language": "commons.Language", + "numWarmInstances": "integer" + } + }, + "getNumWarmInstances": { + "auth": true, + "path": "/num-warm-instances", + "method": "GET", + "response": "map" + } + } + } + } + }, + "WorkspaceInfo/__package__.yml": { + "absoluteFilepath": "/DUMMY_PATH", + "rawContents": "types:\n SubmissionId:\n type: string\n ShareId:\n type: string\n SubmissionRequest:\n discriminant: dummy\n union:\n initializeProblemRequest:\n type: InitializeProblemRequest\n key: initializeProblemRequest\n initializeWorkspaceRequest:\n type: commons.EmptyObject\n key: initializeWorkspaceRequest\n submitV2:\n type: SubmitRequestV2\n key: submitV2\n workspaceSubmit:\n type: WorkspaceSubmitRequest\n key: workspaceSubmit\n stop:\n type: StopRequest\n key: stop\n InitializeProblemRequest:\n properties:\n problemId: commons.ProblemId\n problemVersion: optional\n SubmitRequestV2:\n properties:\n submissionId: SubmissionId\n language: commons.Language\n submissionFiles: list\n problemId: commons.ProblemId\n problemVersion: optional\n userId: optional\n WorkspaceSubmitRequest:\n properties:\n submissionId: SubmissionId\n language: commons.Language\n submissionFiles: list\n userId: optional\n SubmissionFileInfo:\n properties:\n directory: string\n filename: string\n contents: string\n SubmissionTypeEnum:\n enum:\n - TEST\n StopRequest:\n properties:\n submissionId: SubmissionId\n SubmissionResponse:\n discriminant: dummy\n union:\n serverInitialized:\n type: commons.EmptyObject\n key: serverInitialized\n problemInitialized:\n type: commons.ProblemId\n key: problemInitialized\n workspaceInitialized:\n type: commons.EmptyObject\n key: workspaceInitialized\n serverErrored:\n type: ExceptionInfo\n key: serverErrored\n codeExecutionUpdate:\n type: CodeExecutionUpdate\n key: codeExecutionUpdate\n terminated:\n type: TerminatedResponse\n key: terminated\n CodeExecutionUpdate:\n discriminant: dummy\n union:\n buildingExecutor:\n type: BuildingExecutorResponse\n key: buildingExecutor\n running:\n type: RunningResponse\n key: running\n errored:\n type: ErroredResponse\n key: errored\n stopped:\n type: StoppedResponse\n key: stopped\n graded:\n type: GradedResponse\n key: graded\n gradedV2:\n type: GradedResponseV2\n key: gradedV2\n workspaceRan:\n type: WorkspaceRanResponse\n key: workspaceRan\n recording:\n type: RecordingResponseNotification\n key: recording\n recorded:\n type: RecordedResponseNotification\n key: recorded\n invalidRequest:\n type: InvalidRequestResponse\n key: invalidRequest\n finished:\n type: FinishedResponse\n key: finished\n BuildingExecutorResponse:\n properties:\n submissionId: SubmissionId\n status: ExecutionSessionStatus\n RunningResponse:\n properties:\n submissionId: SubmissionId\n state: RunningSubmissionState\n RunningSubmissionState:\n enum:\n - QUEUEING_SUBMISSION\n - KILLING_HISTORICAL_SUBMISSIONS\n - WRITING_SUBMISSION_TO_FILE\n - COMPILING_SUBMISSION\n - RUNNING_SUBMISSION\n ErroredResponse:\n properties:\n submissionId: SubmissionId\n errorInfo: ErrorInfo\n ErrorInfo:\n discriminant: dummy\n union:\n compileError:\n type: CompileError\n key: compileError\n runtimeError:\n type: RuntimeError\n key: runtimeError\n internalError:\n type: InternalError\n key: internalError\n CompileError:\n properties:\n message: string\n RuntimeError:\n properties:\n message: string\n InternalError:\n properties:\n exceptionInfo: ExceptionInfo\n StoppedResponse:\n properties:\n submissionId: SubmissionId\n WorkspaceRanResponse:\n properties:\n submissionId: SubmissionId\n runDetails: WorkspaceRunDetails\n WorkspaceRunDetails:\n properties:\n exceptionV2: optional\n exception: optional\n stdout: string\n GradedResponse:\n properties:\n submissionId: SubmissionId\n testCases: map\n GradedResponseV2:\n properties:\n submissionId: SubmissionId\n testCases: map\n TestCaseGrade:\n discriminant: dummy\n union:\n hidden:\n type: TestCaseHiddenGrade\n key: hidden\n nonHidden:\n type: TestCaseNonHiddenGrade\n key: nonHidden\n TestCaseHiddenGrade:\n properties:\n passed: boolean\n TestCaseNonHiddenGrade:\n properties:\n passed: boolean\n actualResult: optional\n exception: optional\n stdout: string\n RecordedResponseNotification:\n properties:\n submissionId: SubmissionId\n traceResponsesSize: integer\n testCaseId: optional\n RecordingResponseNotification:\n properties:\n submissionId: SubmissionId\n testCaseId: optional\n lineNumber: integer\n lightweightStackInfo: LightweightStackframeInformation\n tracedFile: optional\n LightweightStackframeInformation:\n properties:\n numStackFrames: integer\n topStackFrameMethodName: string\n TestCaseResultWithStdout:\n properties:\n result: TestCaseResult\n stdout: string\n TestCaseResult:\n properties:\n expectedResult: commons.VariableValue\n actualResult: ActualResult\n passed: boolean\n ActualResult:\n discriminant: dummy\n union:\n value:\n type: commons.VariableValue\n key: value\n exception:\n type: ExceptionInfo\n key: exception\n exceptionV2:\n type: ExceptionV2\n key: exceptionV2\n ExceptionV2:\n discriminant: dummy\n union:\n generic:\n type: ExceptionInfo\n key: generic\n timeout:\n type: commons.EmptyObject\n key: timeout\n ExceptionInfo:\n properties:\n exceptionType: string\n exceptionMessage: string\n exceptionStacktrace: string\n InvalidRequestResponse:\n properties:\n request: SubmissionRequest\n cause: InvalidRequestCause\n InvalidRequestCause:\n discriminant: dummy\n union:\n submissionIdNotFound:\n type: SubmissionIdNotFound\n key: submissionIdNotFound\n customTestCasesUnsupported:\n type: CustomTestCasesUnsupported\n key: customTestCasesUnsupported\n unexpectedLanguage:\n type: UnexpectedLanguageError\n key: unexpectedLanguage\n ExistingSubmissionExecuting:\n properties:\n submissionId: SubmissionId\n SubmissionIdNotFound:\n properties:\n missingSubmissionId: SubmissionId\n CustomTestCasesUnsupported:\n properties:\n problemId: commons.ProblemId\n submissionId: SubmissionId\n UnexpectedLanguageError:\n properties:\n expectedLanguage: commons.Language\n actualLanguage: commons.Language\n TerminatedResponse:\n properties: {}\n FinishedResponse:\n properties:\n submissionId: SubmissionId\n StdoutResponse:\n properties:\n submissionId: SubmissionId\n stdout: string\n StderrResponse:\n properties:\n submissionId: SubmissionId\n stderr: string\n TraceResponse:\n properties:\n submissionId: SubmissionId\n lineNumber: integer\n returnValue: optional\n expressionLocation: optional\n stack: StackInformation\n stdout: optional\n TraceResponseV2:\n properties:\n submissionId: SubmissionId\n lineNumber: integer\n file: TracedFile\n returnValue: optional\n expressionLocation: optional\n stack: StackInformation\n stdout: optional\n TracedFile:\n properties:\n filename: string\n directory: string\n ExpressionLocation:\n properties:\n start: integer\n offset: integer\n StackInformation:\n properties:\n numStackFrames: integer\n topStackFrame: optional\n StackFrame:\n properties:\n methodName: string\n lineNumber: integer\n scopes: list\n Scope:\n properties:\n variables: map\n ExecutionSessionResponse:\n properties:\n sessionId: string\n executionSessionUrl: optional\n language: commons.Language\n status: ExecutionSessionStatus\n ExecutionSessionStatus:\n enum:\n - CREATING_CONTAINER\n - PROVISIONING_CONTAINER\n - PENDING_CONTAINER\n - RUNNING_CONTAINER\n - LIVE_CONTAINER\n - FAILED_TO_LAUNCH\n SubmissionStateV2:\n properties:\n timeSubmitted: datetime\n language: commons.Language\n submissionFiles: list\n submissionStatus: SubmissionStatusV2\n SubmissionStatusV2:\n discriminant: dummy\n union:\n test:\n type: TestSubmissionStatusV2\n key: test\n workspace:\n type: WorkspaceSubmissionStatusV2\n key: workspace\n TestSubmissionStatusV2:\n properties:\n updates: list\n problemId: commons.ProblemId\n problemVersion: integer\n problemInfo: problemV2.ProblemInfoV2\n WorkspaceSubmissionStatusV2:\n properties:\n updates: list\n TestSubmissionUpdate:\n properties:\n updateTime: datetime\n updateInfo: TestSubmissionUpdateInfo\n TestSubmissionUpdateInfo:\n discriminant: dummy\n union:\n running:\n type: RunningSubmissionState\n key: running\n stopped:\n type: commons.EmptyObject\n key: stopped\n errored:\n type: ErrorInfo\n key: errored\n gradedTestCase:\n type: GradedTestCaseUpdate\n key: gradedTestCase\n recordedTestCase:\n type: RecordedTestCaseUpdate\n key: recordedTestCase\n finished:\n type: commons.EmptyObject\n key: finished\n WorkspaceSubmissionUpdate:\n properties:\n updateTime: datetime\n updateInfo: WorkspaceSubmissionUpdateInfo\n WorkspaceSubmissionUpdateInfo:\n discriminant: dummy\n union:\n running:\n type: RunningSubmissionState\n key: running\n ran:\n type: WorkspaceRunDetails\n key: ran\n stopped:\n type: commons.EmptyObject\n key: stopped\n traced:\n type: commons.EmptyObject\n key: traced\n tracedV2:\n type: WorkspaceTracedUpdate\n key: tracedV2\n errored:\n type: ErrorInfo\n key: errored\n finished:\n type: commons.EmptyObject\n key: finished\n GradedTestCaseUpdate:\n properties:\n testCaseId: problemV2.TestCaseId\n grade: TestCaseGrade\n RecordedTestCaseUpdate:\n properties:\n testCaseId: problemV2.TestCaseId\n traceResponsesSize: integer\n WorkspaceTracedUpdate:\n properties:\n traceResponsesSize: integer\n SubmissionState:\n properties:\n timeSubmitted: optional\n submission: string\n language: commons.Language\n submissionTypeState: SubmissionTypeState\n SubmissionTypeState:\n discriminant: dummy\n union:\n test:\n type: TestSubmissionState\n key: test\n workspace:\n type: WorkspaceSubmissionState\n key: workspace\n WorkspaceSubmissionState:\n properties:\n status: WorkspaceSubmissionStatus\n WorkspaceSubmissionStatus:\n discriminant: dummy\n union:\n stopped:\n type: commons.EmptyObject\n key: stopped\n errored:\n type: ErrorInfo\n key: errored\n running:\n type: RunningSubmissionState\n key: running\n ran:\n type: WorkspaceRunDetails\n key: ran\n traced:\n type: WorkspaceRunDetails\n key: traced\n TestSubmissionState:\n properties:\n problemId: commons.ProblemId\n defaultTestCases: list\n customTestCases: list\n status: TestSubmissionStatus\n TestSubmissionStatus:\n discriminant: dummy\n union:\n stopped:\n type: commons.EmptyObject\n key: stopped\n errored:\n type: ErrorInfo\n key: errored\n running:\n type: RunningSubmissionState\n key: running\n testCaseIdToState:\n type: map\n key: testCaseIdToState\n SubmissionStatusForTestCase:\n discriminant: dummy\n union:\n graded:\n type: TestCaseResultWithStdout\n key: graded\n gradedV2:\n type: TestCaseGrade\n key: gradedV2\n traced:\n type: TracedTestCase\n key: traced\n TracedTestCase:\n properties:\n result: TestCaseResultWithStdout\n traceResponsesSize: integer\n TraceResponsesPage:\n properties:\n offset:\n type: optional\n docs: |\n If present, use this to load subseqent pages.\n The offset is the id of the next trace response to load.\n traceResponses: list\n TraceResponsesPageV2:\n properties:\n offset:\n type: optional\n docs: |\n If present, use this to load subseqent pages.\n The offset is the id of the next trace response to load.\n traceResponses: list\n GetTraceResponsesPageRequest:\n properties:\n offset:\n type: optional\n WorkspaceStarterFilesResponse:\n properties:\n files: map\n WorkspaceStarterFilesResponseV2:\n properties:\n filesByLanguage: map\n WorkspaceFiles:\n properties:\n mainFile: commons.FileInfo\n readOnlyFiles: list\n ExecutionSessionsState:\n properties:\n states: map\n numWarmingInstances: optional\n warmingSessionIds: list\n ExecutionSessionState:\n properties:\n lastTimeContacted: optional\n sessionId: string\n isWarmInstance: boolean\n awsTaskId: optional\n language: commons.Language\n status: ExecutionSessionStatus\nimports:\n commons: ../commons/__package__.yml\n problemV2: ../ProblemInfoServicV2/__package__.yml\nservice:\n auth: false\n base-path: ''\n endpoints:\n getWorkspaceStarterFiles:\n auth: true\n path: /get-workspace-starter-files\n method: GET\n response: WorkspaceStarterFilesResponse\n getWorkspaceStarterFilesV2:\n auth: true\n path: /get-workspace-starter-files-v2\n method: GET\n response: WorkspaceStarterFilesResponseV2\n", + "contents": { + "types": { + "SubmissionId": { + "type": "string" + }, + "ShareId": { + "type": "string" + }, + "SubmissionRequest": { + "discriminant": "dummy", + "union": { + "initializeProblemRequest": { + "type": "InitializeProblemRequest", + "key": "initializeProblemRequest" + }, + "initializeWorkspaceRequest": { + "type": "commons.EmptyObject", + "key": "initializeWorkspaceRequest" + }, + "submitV2": { + "type": "SubmitRequestV2", + "key": "submitV2" + }, + "workspaceSubmit": { + "type": "WorkspaceSubmitRequest", + "key": "workspaceSubmit" + }, + "stop": { + "type": "StopRequest", + "key": "stop" + } + } + }, + "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" + ] + }, + "StopRequest": { + "properties": { + "submissionId": "SubmissionId" + } + }, + "SubmissionResponse": { + "discriminant": "dummy", + "union": { + "serverInitialized": { + "type": "commons.EmptyObject", + "key": "serverInitialized" + }, + "problemInitialized": { + "type": "commons.ProblemId", + "key": "problemInitialized" + }, + "workspaceInitialized": { + "type": "commons.EmptyObject", + "key": "workspaceInitialized" + }, + "serverErrored": { + "type": "ExceptionInfo", + "key": "serverErrored" + }, + "codeExecutionUpdate": { + "type": "CodeExecutionUpdate", + "key": "codeExecutionUpdate" + }, + "terminated": { + "type": "TerminatedResponse", + "key": "terminated" + } + } + }, + "CodeExecutionUpdate": { + "discriminant": "dummy", + "union": { + "buildingExecutor": { + "type": "BuildingExecutorResponse", + "key": "buildingExecutor" + }, + "running": { + "type": "RunningResponse", + "key": "running" + }, + "errored": { + "type": "ErroredResponse", + "key": "errored" + }, + "stopped": { + "type": "StoppedResponse", + "key": "stopped" + }, + "graded": { + "type": "GradedResponse", + "key": "graded" + }, + "gradedV2": { + "type": "GradedResponseV2", + "key": "gradedV2" + }, + "workspaceRan": { + "type": "WorkspaceRanResponse", + "key": "workspaceRan" + }, + "recording": { + "type": "RecordingResponseNotification", + "key": "recording" + }, + "recorded": { + "type": "RecordedResponseNotification", + "key": "recorded" + }, + "invalidRequest": { + "type": "InvalidRequestResponse", + "key": "invalidRequest" + }, + "finished": { + "type": "FinishedResponse", + "key": "finished" + } + } + }, + "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": { + "discriminant": "dummy", + "union": { + "compileError": { + "type": "CompileError", + "key": "compileError" + }, + "runtimeError": { + "type": "RuntimeError", + "key": "runtimeError" + }, + "internalError": { + "type": "InternalError", + "key": "internalError" + } + } + }, + "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": { + "discriminant": "dummy", + "union": { + "hidden": { + "type": "TestCaseHiddenGrade", + "key": "hidden" + }, + "nonHidden": { + "type": "TestCaseNonHiddenGrade", + "key": "nonHidden" + } + } + }, + "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": { + "discriminant": "dummy", + "union": { + "value": { + "type": "commons.VariableValue", + "key": "value" + }, + "exception": { + "type": "ExceptionInfo", + "key": "exception" + }, + "exceptionV2": { + "type": "ExceptionV2", + "key": "exceptionV2" + } + } + }, + "ExceptionV2": { + "discriminant": "dummy", + "union": { + "generic": { + "type": "ExceptionInfo", + "key": "generic" + }, + "timeout": { + "type": "commons.EmptyObject", + "key": "timeout" + } + } + }, + "ExceptionInfo": { + "properties": { + "exceptionType": "string", + "exceptionMessage": "string", + "exceptionStacktrace": "string" + } + }, + "InvalidRequestResponse": { + "properties": { + "request": "SubmissionRequest", + "cause": "InvalidRequestCause" + } + }, + "InvalidRequestCause": { + "discriminant": "dummy", + "union": { + "submissionIdNotFound": { + "type": "SubmissionIdNotFound", + "key": "submissionIdNotFound" + }, + "customTestCasesUnsupported": { + "type": "CustomTestCasesUnsupported", + "key": "customTestCasesUnsupported" + }, + "unexpectedLanguage": { + "type": "UnexpectedLanguageError", + "key": "unexpectedLanguage" + } + } + }, + "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", + "PROVISIONING_CONTAINER", + "PENDING_CONTAINER", + "RUNNING_CONTAINER", + "LIVE_CONTAINER", + "FAILED_TO_LAUNCH" + ] + }, + "SubmissionStateV2": { + "properties": { + "timeSubmitted": "datetime", + "language": "commons.Language", + "submissionFiles": "list", + "submissionStatus": "SubmissionStatusV2" + } + }, + "SubmissionStatusV2": { + "discriminant": "dummy", + "union": { + "test": { + "type": "TestSubmissionStatusV2", + "key": "test" + }, + "workspace": { + "type": "WorkspaceSubmissionStatusV2", + "key": "workspace" + } + } + }, + "TestSubmissionStatusV2": { + "properties": { + "updates": "list", + "problemId": "commons.ProblemId", + "problemVersion": "integer", + "problemInfo": "problemV2.ProblemInfoV2" + } + }, + "WorkspaceSubmissionStatusV2": { + "properties": { + "updates": "list" + } + }, + "TestSubmissionUpdate": { + "properties": { + "updateTime": "datetime", + "updateInfo": "TestSubmissionUpdateInfo" + } + }, + "TestSubmissionUpdateInfo": { + "discriminant": "dummy", + "union": { + "running": { + "type": "RunningSubmissionState", + "key": "running" + }, + "stopped": { + "type": "commons.EmptyObject", + "key": "stopped" + }, + "errored": { + "type": "ErrorInfo", + "key": "errored" + }, + "gradedTestCase": { + "type": "GradedTestCaseUpdate", + "key": "gradedTestCase" + }, + "recordedTestCase": { + "type": "RecordedTestCaseUpdate", + "key": "recordedTestCase" + }, + "finished": { + "type": "commons.EmptyObject", + "key": "finished" + } + } + }, + "WorkspaceSubmissionUpdate": { + "properties": { + "updateTime": "datetime", + "updateInfo": "WorkspaceSubmissionUpdateInfo" + } + }, + "WorkspaceSubmissionUpdateInfo": { + "discriminant": "dummy", + "union": { + "running": { + "type": "RunningSubmissionState", + "key": "running" + }, + "ran": { + "type": "WorkspaceRunDetails", + "key": "ran" + }, + "stopped": { + "type": "commons.EmptyObject", + "key": "stopped" + }, + "traced": { + "type": "commons.EmptyObject", + "key": "traced" + }, + "tracedV2": { + "type": "WorkspaceTracedUpdate", + "key": "tracedV2" + }, + "errored": { + "type": "ErrorInfo", + "key": "errored" + }, + "finished": { + "type": "commons.EmptyObject", + "key": "finished" + } + } + }, + "GradedTestCaseUpdate": { + "properties": { + "testCaseId": "problemV2.TestCaseId", + "grade": "TestCaseGrade" + } + }, + "RecordedTestCaseUpdate": { + "properties": { + "testCaseId": "problemV2.TestCaseId", + "traceResponsesSize": "integer" + } + }, + "WorkspaceTracedUpdate": { + "properties": { + "traceResponsesSize": "integer" + } + }, + "SubmissionState": { + "properties": { + "timeSubmitted": "optional", + "submission": "string", + "language": "commons.Language", + "submissionTypeState": "SubmissionTypeState" + } + }, + "SubmissionTypeState": { + "discriminant": "dummy", + "union": { + "test": { + "type": "TestSubmissionState", + "key": "test" + }, + "workspace": { + "type": "WorkspaceSubmissionState", + "key": "workspace" + } + } + }, + "WorkspaceSubmissionState": { + "properties": { + "status": "WorkspaceSubmissionStatus" + } + }, + "WorkspaceSubmissionStatus": { + "discriminant": "dummy", + "union": { + "stopped": { + "type": "commons.EmptyObject", + "key": "stopped" + }, + "errored": { + "type": "ErrorInfo", + "key": "errored" + }, + "running": { + "type": "RunningSubmissionState", + "key": "running" + }, + "ran": { + "type": "WorkspaceRunDetails", + "key": "ran" + }, + "traced": { + "type": "WorkspaceRunDetails", + "key": "traced" + } + } + }, + "TestSubmissionState": { + "properties": { + "problemId": "commons.ProblemId", + "defaultTestCases": "list", + "customTestCases": "list", + "status": "TestSubmissionStatus" + } + }, + "TestSubmissionStatus": { + "discriminant": "dummy", + "union": { + "stopped": { + "type": "commons.EmptyObject", + "key": "stopped" + }, + "errored": { + "type": "ErrorInfo", + "key": "errored" + }, + "running": { + "type": "RunningSubmissionState", + "key": "running" + }, + "testCaseIdToState": { + "type": "map", + "key": "testCaseIdToState" + } + } + }, + "SubmissionStatusForTestCase": { + "discriminant": "dummy", + "union": { + "graded": { + "type": "TestCaseResultWithStdout", + "key": "graded" + }, + "gradedV2": { + "type": "TestCaseGrade", + "key": "gradedV2" + }, + "traced": { + "type": "TracedTestCase", + "key": "traced" + } + } + }, + "TracedTestCase": { + "properties": { + "result": "TestCaseResultWithStdout", + "traceResponsesSize": "integer" + } + }, + "TraceResponsesPage": { + "properties": { + "offset": { + "type": "optional", + "docs": "If present, use this to load subseqent pages.\nThe offset is the id of the next trace response to load.\n" + }, + "traceResponses": "list" + } + }, + "TraceResponsesPageV2": { + "properties": { + "offset": { + "type": "optional", + "docs": "If present, use this to load subseqent pages.\nThe offset is the id of the next trace response to load.\n" + }, + "traceResponses": "list" + } + }, + "GetTraceResponsesPageRequest": { + "properties": { + "offset": { + "type": "optional" + } + } + }, + "WorkspaceStarterFilesResponse": { + "properties": { + "files": "map" + } + }, + "WorkspaceStarterFilesResponseV2": { + "properties": { + "filesByLanguage": "map" + } + }, + "WorkspaceFiles": { + "properties": { + "mainFile": "commons.FileInfo", + "readOnlyFiles": "list" + } + }, + "ExecutionSessionsState": { + "properties": { + "states": "map", + "numWarmingInstances": "optional", + "warmingSessionIds": "list" + } + }, + "ExecutionSessionState": { + "properties": { + "lastTimeContacted": "optional", + "sessionId": "string", + "isWarmInstance": "boolean", + "awsTaskId": "optional", + "language": "commons.Language", + "status": "ExecutionSessionStatus" + } + } + }, + "imports": { + "commons": "../commons/__package__.yml", + "problemV2": "../ProblemInfoServicV2/__package__.yml" + }, + "service": { + "auth": false, + "base-path": "", + "endpoints": { + "getWorkspaceStarterFiles": { + "auth": true, + "path": "/get-workspace-starter-files", + "method": "GET", + "response": "WorkspaceStarterFilesResponse" + }, + "getWorkspaceStarterFilesV2": { + "auth": true, + "path": "/get-workspace-starter-files-v2", + "method": "GET", + "response": "WorkspaceStarterFilesResponseV2" + } + } + } + } + }, + "commons/__package__.yml": { + "absoluteFilepath": "/DUMMY_PATH", + "rawContents": "types:\n EmptyObject:\n properties: {}\n ProblemId:\n type: string\n NodeId:\n type: string\n VariableType:\n discriminant: dummy\n union:\n integerType:\n type: EmptyObject\n key: integerType\n doubleType:\n type: EmptyObject\n key: doubleType\n booleanType:\n type: EmptyObject\n key: booleanType\n stringType:\n type: EmptyObject\n key: stringType\n charType:\n type: EmptyObject\n key: charType\n listType:\n type: ListType\n key: listType\n mapType:\n type: MapType\n key: mapType\n binaryTreeType:\n type: EmptyObject\n key: binaryTreeType\n singlyLinkedListType:\n type: EmptyObject\n key: singlyLinkedListType\n doublyLinkedListType:\n type: EmptyObject\n key: doublyLinkedListType\n ListType:\n properties:\n valueType: VariableType\n isFixedLength:\n docs: >-\n Whether this list is fixed-size (for languages that supports\n fixed-size lists). Defaults to false.\n type: optional\n MapType:\n properties:\n keyType: VariableType\n valueType: VariableType\n VariableValue:\n discriminant: dummy\n union:\n integerValue:\n type: integer\n key: integerValue\n booleanValue:\n type: boolean\n key: booleanValue\n doubleValue:\n type: double\n key: doubleValue\n stringValue:\n type: string\n key: stringValue\n charValue:\n type: string\n key: charValue\n mapValue:\n type: MapValue\n key: mapValue\n listValue:\n type: list\n key: listValue\n binaryTreeValue:\n type: BinaryTreeValue\n key: binaryTreeValue\n singlyLinkedListValue:\n type: SinglyLinkedListValue\n key: singlyLinkedListValue\n doublyLinkedListValue:\n type: DoublyLinkedListValue\n key: doublyLinkedListValue\n nullValue:\n type: EmptyObject\n key: nullValue\n FrontendVariableValue:\n discriminant: dummy\n union:\n integerValue:\n type: integer\n key: integerValue\n booleanValue:\n type: boolean\n key: booleanValue\n doubleValue:\n type: double\n key: doubleValue\n stringValue:\n type: string\n key: stringValue\n charValue:\n type: string\n key: charValue\n mapValue:\n type: FrontendMapValue\n key: mapValue\n listValue:\n type: list\n key: listValue\n binaryTreeValue:\n type: FrontendBinaryTreeValue\n key: binaryTreeValue\n singlyLinkedListValue:\n type: FrontendSinglyLinkedListValue\n key: singlyLinkedListValue\n doublyLinkedListValue:\n type: FrontendDoublyLinkedListValue\n key: doublyLinkedListValue\n nullValue:\n type: EmptyObject\n key: nullValue\n DebugVariableValue:\n discriminant: dummy\n union:\n integerValue:\n type: integer\n key: integerValue\n booleanValue:\n type: boolean\n key: booleanValue\n doubleValue:\n type: double\n key: doubleValue\n stringValue:\n type: string\n key: stringValue\n charValue:\n type: string\n key: charValue\n mapValue:\n type: DebugMapValue\n key: mapValue\n listValue:\n type: list\n key: listValue\n binaryTreeNodeValue:\n type: BinaryTreeNodeAndTreeValue\n key: binaryTreeNodeValue\n singlyLinkedListNodeValue:\n type: SinglyLinkedListNodeAndListValue\n key: singlyLinkedListNodeValue\n doublyLinkedListNodeValue:\n type: DoublyLinkedListNodeAndListValue\n key: doublyLinkedListNodeValue\n undefinedValue:\n type: EmptyObject\n key: undefinedValue\n nullValue:\n type: EmptyObject\n key: nullValue\n genericValue:\n type: GenericValue\n key: genericValue\n GenericValue:\n properties:\n stringifiedType: optional\n stringifiedValue: string\n MapValue:\n properties:\n keyValuePairs: list\n KeyValuePair:\n properties:\n key: VariableValue\n value: VariableValue\n BinaryTreeValue:\n properties:\n root: optional\n nodes: map\n BinaryTreeNodeValue:\n properties:\n nodeId: NodeId\n val: double\n right: optional\n left: optional\n BinaryTreeNodeAndTreeValue:\n properties:\n nodeId: NodeId\n fullTree: BinaryTreeValue\n SinglyLinkedListValue:\n properties:\n head: optional\n nodes: map\n SinglyLinkedListNodeValue:\n properties:\n nodeId: NodeId\n val: double\n next: optional\n SinglyLinkedListNodeAndListValue:\n properties:\n nodeId: NodeId\n fullList: SinglyLinkedListValue\n DoublyLinkedListValue:\n properties:\n head: optional\n nodes: map\n DoublyLinkedListNodeValue:\n properties:\n nodeId: NodeId\n val: double\n next: optional\n prev: optional\n DoublyLinkedListNodeAndListValue:\n properties:\n nodeId: NodeId\n fullList: DoublyLinkedListValue\n FrontendMapValue:\n properties:\n keyValuePairs: list\n FrontendKeyValuePair:\n properties:\n key: FrontendVariableValue\n value: FrontendVariableValue\n FrontendBinaryTreeValue:\n properties:\n root: NodeId\n nodes: map\n FrontendBinaryTreeNodeValue:\n properties:\n nodeId: NodeId\n val: optional\n right: optional\n left: optional\n FrontendSinglyLinkedListValue:\n properties:\n head: NodeId\n nodes: map\n FrontendSinglyLinkedListNodeValue:\n properties:\n nodeId: NodeId\n val: optional\n next: optional\n FrontendDoublyLinkedListValue:\n properties:\n head: NodeId\n nodes: map\n FrontendDoublyLinkedListNodeValue:\n properties:\n nodeId: NodeId\n val: optional\n next: optional\n prev: optional\n DebugMapValue:\n properties:\n keyValuePairs: list\n DebugKeyValuePairs:\n properties:\n key: DebugVariableValue\n value: DebugVariableValue\n TestCase:\n properties:\n id: string\n params: list\n TestCaseWithExpectedResult:\n properties:\n testCase: TestCase\n expectedResult: VariableValue\n FileInfo:\n properties:\n filename: string\n contents: string\n Language:\n enum:\n - JAVA\n - JAVASCRIPT\n - PYTHON\n UserId:\n type: string\n", + "contents": { + "types": { + "EmptyObject": { + "properties": {} + }, + "ProblemId": { + "type": "string" + }, + "NodeId": { + "type": "string" + }, + "VariableType": { + "discriminant": "dummy", + "union": { + "integerType": { + "type": "EmptyObject", + "key": "integerType" + }, + "doubleType": { + "type": "EmptyObject", + "key": "doubleType" + }, + "booleanType": { + "type": "EmptyObject", + "key": "booleanType" + }, + "stringType": { + "type": "EmptyObject", + "key": "stringType" + }, + "charType": { + "type": "EmptyObject", + "key": "charType" + }, + "listType": { + "type": "ListType", + "key": "listType" + }, + "mapType": { + "type": "MapType", + "key": "mapType" + }, + "binaryTreeType": { + "type": "EmptyObject", + "key": "binaryTreeType" + }, + "singlyLinkedListType": { + "type": "EmptyObject", + "key": "singlyLinkedListType" + }, + "doublyLinkedListType": { + "type": "EmptyObject", + "key": "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": { + "discriminant": "dummy", + "union": { + "integerValue": { + "type": "integer", + "key": "integerValue" + }, + "booleanValue": { + "type": "boolean", + "key": "booleanValue" + }, + "doubleValue": { + "type": "double", + "key": "doubleValue" + }, + "stringValue": { + "type": "string", + "key": "stringValue" + }, + "charValue": { + "type": "string", + "key": "charValue" + }, + "mapValue": { + "type": "MapValue", + "key": "mapValue" + }, + "listValue": { + "type": "list", + "key": "listValue" + }, + "binaryTreeValue": { + "type": "BinaryTreeValue", + "key": "binaryTreeValue" + }, + "singlyLinkedListValue": { + "type": "SinglyLinkedListValue", + "key": "singlyLinkedListValue" + }, + "doublyLinkedListValue": { + "type": "DoublyLinkedListValue", + "key": "doublyLinkedListValue" + }, + "nullValue": { + "type": "EmptyObject", + "key": "nullValue" + } + } + }, + "FrontendVariableValue": { + "discriminant": "dummy", + "union": { + "integerValue": { + "type": "integer", + "key": "integerValue" + }, + "booleanValue": { + "type": "boolean", + "key": "booleanValue" + }, + "doubleValue": { + "type": "double", + "key": "doubleValue" + }, + "stringValue": { + "type": "string", + "key": "stringValue" + }, + "charValue": { + "type": "string", + "key": "charValue" + }, + "mapValue": { + "type": "FrontendMapValue", + "key": "mapValue" + }, + "listValue": { + "type": "list", + "key": "listValue" + }, + "binaryTreeValue": { + "type": "FrontendBinaryTreeValue", + "key": "binaryTreeValue" + }, + "singlyLinkedListValue": { + "type": "FrontendSinglyLinkedListValue", + "key": "singlyLinkedListValue" + }, + "doublyLinkedListValue": { + "type": "FrontendDoublyLinkedListValue", + "key": "doublyLinkedListValue" + }, + "nullValue": { + "type": "EmptyObject", + "key": "nullValue" + } + } + }, + "DebugVariableValue": { + "discriminant": "dummy", + "union": { + "integerValue": { + "type": "integer", + "key": "integerValue" + }, + "booleanValue": { + "type": "boolean", + "key": "booleanValue" + }, + "doubleValue": { + "type": "double", + "key": "doubleValue" + }, + "stringValue": { + "type": "string", + "key": "stringValue" + }, + "charValue": { + "type": "string", + "key": "charValue" + }, + "mapValue": { + "type": "DebugMapValue", + "key": "mapValue" + }, + "listValue": { + "type": "list", + "key": "listValue" + }, + "binaryTreeNodeValue": { + "type": "BinaryTreeNodeAndTreeValue", + "key": "binaryTreeNodeValue" + }, + "singlyLinkedListNodeValue": { + "type": "SinglyLinkedListNodeAndListValue", + "key": "singlyLinkedListNodeValue" + }, + "doublyLinkedListNodeValue": { + "type": "DoublyLinkedListNodeAndListValue", + "key": "doublyLinkedListNodeValue" + }, + "undefinedValue": { + "type": "EmptyObject", + "key": "undefinedValue" + }, + "nullValue": { + "type": "EmptyObject", + "key": "nullValue" + }, + "genericValue": { + "type": "GenericValue", + "key": "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" + } + }, + "FrontendMapValue": { + "properties": { + "keyValuePairs": "list" + } + }, + "FrontendKeyValuePair": { + "properties": { + "key": "FrontendVariableValue", + "value": "FrontendVariableValue" + } + }, + "FrontendBinaryTreeValue": { + "properties": { + "root": "NodeId", + "nodes": "map" + } + }, + "FrontendBinaryTreeNodeValue": { + "properties": { + "nodeId": "NodeId", + "val": "optional", + "right": "optional", + "left": "optional" + } + }, + "FrontendSinglyLinkedListValue": { + "properties": { + "head": "NodeId", + "nodes": "map" + } + }, + "FrontendSinglyLinkedListNodeValue": { + "properties": { + "nodeId": "NodeId", + "val": "optional", + "next": "optional" + } + }, + "FrontendDoublyLinkedListValue": { + "properties": { + "head": "NodeId", + "nodes": "map" + } + }, + "FrontendDoublyLinkedListNodeValue": { + "properties": { + "nodeId": "NodeId", + "val": "optional", + "next": "optional", + "prev": "optional" + } + }, + "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" + ] + }, + "UserId": { + "type": "string" + } + } + } + }, + "langserver/__package__.yml": { + "absoluteFilepath": "/DUMMY_PATH", + "rawContents": "types:\n LangServerRequest:\n properties:\n request: unknown\n LangServerResponse:\n properties:\n response: unknown\n", + "contents": { + "types": { + "LangServerRequest": { + "properties": { + "request": "unknown" + } + }, + "LangServerResponse": { + "properties": { + "response": "unknown" + } + } + } + } + }, + "__package__.yml": { + "absoluteFilepath": "/DUMMY_PATH", + "rawContents": "{}\n", + "contents": {} + } + }, + "packageMarkers": {}, + "importedDefinitions": {} +} \ No newline at end of file diff --git a/packages/cli/api-importers/conjure/conjure-to-fern-tests/__test__/conjure.test.ts b/packages/cli/api-importers/conjure/conjure-to-fern-tests/__test__/conjure.test.ts index cf7652e1495..9aa67bf8ba9 100644 --- a/packages/cli/api-importers/conjure/conjure-to-fern-tests/__test__/conjure.test.ts +++ b/packages/cli/api-importers/conjure/conjure-to-fern-tests/__test__/conjure.test.ts @@ -35,7 +35,9 @@ describe("ir", () => { ); } // eslint-disable-next-line jest/no-standalone-expect - expect(await workspace.workspace.getDefinition({ context })).toMatchSnapshot(); + expect( + JSON.stringify(await workspace.workspace.getDefinition({ context }), undefined, 2) + ).toMatchFileSnapshot(`__snapshots__/${fixture.name}.json`); }, 90_000 ); diff --git a/packages/cli/api-importers/conjure/conjure-to-fern/package.json b/packages/cli/api-importers/conjure/conjure-to-fern/package.json index f0c84987cb8..a94c8a2cd6b 100644 --- a/packages/cli/api-importers/conjure/conjure-to-fern/package.json +++ b/packages/cli/api-importers/conjure/conjure-to-fern/package.json @@ -31,6 +31,8 @@ "@fern-api/conjure-sdk": "workspace:*", "@fern-api/importer-commons": "workspace:*", "@fern-api/fs-utils": "workspace:*", + "@fern-api/core-utils": "workspace:*", + "@fern-api/fern-definition-schema": "workspace:*", "js-yaml": "^4.1.0" }, "devDependencies": { diff --git a/packages/cli/api-importers/conjure/conjure-to-fern/src/ConjureImporter.ts b/packages/cli/api-importers/conjure/conjure-to-fern/src/ConjureImporter.ts index 617e1542752..0e8c18db31d 100644 --- a/packages/cli/api-importers/conjure/conjure-to-fern/src/ConjureImporter.ts +++ b/packages/cli/api-importers/conjure/conjure-to-fern/src/ConjureImporter.ts @@ -1,102 +1,240 @@ -import { AbsoluteFilePath, RelativeFilePath } from "@fern-api/fs-utils"; -import { - ConjureTypeDeclaration, - DefinitionFile, - ConjureAliasDeclaration, - ConjureObjectDeclaration, - ConjureEnumDeclaration -} from "@fern-api/conjure-sdk"; +import { AbsoluteFilePath, dirname, join, RelativeFilePath, relativize, getFilename } from "@fern-api/fs-utils"; +import { DefinitionFile } from "@fern-api/conjure-sdk"; import { APIDefinitionImporter, FernDefinitionBuilderImpl } from "@fern-api/importer-commons"; -import { listConjureFiles } from "./listConjureFiles"; +import { visitConjureTypeDeclaration } from "./utils/visitConjureTypeDeclaration"; +import { parseEndpointLocator, removeSuffix } from "@fern-api/core-utils"; +import { listConjureFiles } from "./utils/listConjureFiles"; +import { RawSchemas } from "@fern-api/fern-definition-schema"; export declare namespace ConjureImporter { interface Args { absolutePathToConjureFolder: AbsoluteFilePath; + authOverrides?: RawSchemas.WithAuthSchema; + environmentOverrides?: RawSchemas.WithEnvironmentsSchema; + globalHeaderOverrides?: RawSchemas.WithHeadersSchema; } } export class ConjureImporter extends APIDefinitionImporter { private fernDefinitionBuilder = new FernDefinitionBuilderImpl(false); + private conjureFilepathToFernFilepath: Record = {}; - public async import({ absolutePathToConjureFolder }: ConjureImporter.Args): Promise { - await visitAllConjureDefinitionFiles(absolutePathToConjureFolder, (filepath, definition) => { - for (const [import_, importedFilepath] of Object.entries(definition.imports ?? {})) { - this.fernDefinitionBuilder.addImport({ - file: filepath, - fileToImport: RelativeFilePath.of(importedFilepath), - alias: import_ + public async import({ + absolutePathToConjureFolder, + authOverrides, + environmentOverrides, + globalHeaderOverrides + }: ConjureImporter.Args): Promise { + if (authOverrides != null) { + for (const [name, declaration] of Object.entries(authOverrides["auth-schemes"] ?? {})) { + this.fernDefinitionBuilder.addAuthScheme({ + name, + schema: declaration }); } + if (authOverrides.auth != null) { + this.fernDefinitionBuilder.setAuth(authOverrides.auth); + } + } + + await visitAllConjureDefinitionFiles(absolutePathToConjureFolder, (absoluteFilepath, filepath, definition) => { + for (const [serviceName, _] of Object.entries(definition.services ?? {})) { + const unsuffixedServiceName = removeSuffix({ value: serviceName, suffix: "Service" }); + this.conjureFilepathToFernFilepath[filepath] = RelativeFilePath.of( + `${unsuffixedServiceName}/__package__.yml` + ); + return; + } + + const filename = getFilename(filepath); + const filenameWithoutExtension = filename?.split(".")[0]; + if (filenameWithoutExtension != null) { + this.conjureFilepathToFernFilepath[filepath] = RelativeFilePath.of( + `${filenameWithoutExtension}/__package__.yml` + ); + } + }); + + await visitAllConjureDefinitionFiles(absolutePathToConjureFolder, (absoluteFilepath, filepath, definition) => { + if (definition.services == null || Object.keys(definition.services ?? {}).length === 0) { + const fernFilePath = this.conjureFilepathToFernFilepath[filepath]; + if (fernFilePath == null) { + throw new Error(`Failed to find corresponding fern filepath for conjure file ${filepath}`); + } + + for (const [import_, importedFilepath] of Object.entries(definition.types?.conjureImports ?? {})) { + const fernFileToImport = this.getFernFileToImport({ + absoluteFilePathToConjureFile: absoluteFilepath, + absoluteFilePathToConjureFolder: absolutePathToConjureFolder, + importFilePath: RelativeFilePath.of(importedFilepath) + }); + this.fernDefinitionBuilder.addImport({ + file: fernFilePath, + fileToImport: RelativeFilePath.of(fernFileToImport), + alias: import_ + }); + } + this.importAllTypes({ conjureFile: definition, fernFilePath }); + + return; + } + + for (const [serviceName, serviceDeclaration] of Object.entries(definition.services)) { + const unsuffixedServiceName = removeSuffix({ value: serviceName, suffix: "Service" }); + const fernFilePath = RelativeFilePath.of(`${unsuffixedServiceName}/__package__.yml`); + + this.importAllTypes({ conjureFile: definition, fernFilePath }); + + for (const [import_, importedFilepath] of Object.entries(definition.types?.conjureImports ?? {})) { + const fernFileToImport = this.getFernFileToImport({ + absoluteFilePathToConjureFile: absoluteFilepath, + absoluteFilePathToConjureFolder: absolutePathToConjureFolder, + importFilePath: RelativeFilePath.of(importedFilepath) + }); + this.fernDefinitionBuilder.addImport({ + file: fernFilePath, + fileToImport: RelativeFilePath.of(fernFileToImport), + alias: import_ + }); + } + + for (const [endpointName, endpointDeclaration] of Object.entries(serviceDeclaration.endpoints ?? {})) { + const endpointLocator = parseEndpointLocator(endpointDeclaration.http); + + if (endpointLocator.type === "failure") { + this.context?.logger.error(`Failed to parse ${endpointDeclaration.http}. Skipping.`); + continue; + } + + const endpoint: RawSchemas.HttpEndpointSchema = { + auth: true, + path: endpointLocator.path, + method: endpointLocator.method, + response: endpointDeclaration.returns + }; + + const pathParameters: Record = {}; + if (endpointDeclaration.args != null) { + for (const pathParameter of endpointLocator.pathParameters) { + const pathParameterType = endpointDeclaration.args[pathParameter]; + if (pathParameterType == null) { + throw new Error( + `Failed to find path parameter ${pathParameter} in ${endpointDeclaration.http}` + ); + } + pathParameters[pathParameter] = + typeof pathParameterType === "string" + ? pathParameterType + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + { type: pathParameterType.type as any }; + } + } + + if (Object.entries(pathParameters).length > 0) { + endpoint["path-parameters"] = pathParameters; + } - for (const [typeName, typeDeclaration] of Object.entries(definition.types?.definitions?.objects ?? {})) { - if (isAlias(typeDeclaration)) { - this.fernDefinitionBuilder.addType(filepath, { + this.fernDefinitionBuilder.addEndpoint(fernFilePath, { + name: endpointName, + schema: endpoint, + source: undefined + }); + } + } + }); + return this.fernDefinitionBuilder.build(); + } + + private importAllTypes({ + conjureFile, + fernFilePath + }: { + conjureFile: DefinitionFile; + fernFilePath: RelativeFilePath; + }): void { + for (const [typeName, typeDeclaration] of Object.entries(conjureFile.types?.definitions?.objects ?? {})) { + visitConjureTypeDeclaration(typeDeclaration, { + alias: (value) => { + this.fernDefinitionBuilder.addType(fernFilePath, { name: typeName, schema: { - type: typeDeclaration.alias, - docs: typeDeclaration.docs + type: value.alias, + docs: value.docs } }); - } else if (isObject(typeDeclaration)) { - this.fernDefinitionBuilder.addType(filepath, { + }, + object: (value) => { + this.fernDefinitionBuilder.addType(fernFilePath, { name: typeName, schema: { - properties: typeDeclaration.fields + properties: value.fields } }); - } else if (isEnum(typeDeclaration)) { - this.fernDefinitionBuilder.addType(filepath, { + }, + enum: (value) => { + this.fernDefinitionBuilder.addType(fernFilePath, { name: typeName, schema: { - enum: typeDeclaration.values + enum: value.values } }); - } - } - - for (const [serviceName, serviceDeclaration] of Object.entries(definition.services ?? {})) { - for (const [endpointName, endpointDeclaration] of Object.entries(serviceDeclaration.endpoints ?? {})) { - const splitConjurePath = endpointDeclaration.http.split(" "); - const method = splitConjurePath[1]; - const path = splitConjurePath[0]; - if (method == null || path == null) { - break; - } - this.fernDefinitionBuilder.addEndpoint(filepath, { - name: endpointName, + }, + union: (value) => { + this.fernDefinitionBuilder.addType(fernFilePath, { + name: typeName, schema: { - auth: true, - path, - // eslint-disable-next-line @typescript-eslint/no-explicit-any - method: method as any, - response: endpointDeclaration.returns - }, - source: undefined + discriminant: "dummy", + union: Object.fromEntries( + Object.entries(value.union).map(([key, reference]) => { + return [ + key, + { type: typeof reference === "string" ? reference : reference.type, key } + ]; + }) + ) + } }); } - } - }); - return this.fernDefinitionBuilder.build(); + }); + } + } + + private getFernFileToImport({ + absoluteFilePathToConjureFile, + importFilePath, + absoluteFilePathToConjureFolder + }: { + absoluteFilePathToConjureFile: AbsoluteFilePath; + importFilePath: RelativeFilePath; + absoluteFilePathToConjureFolder: AbsoluteFilePath; + }): RelativeFilePath { + const absoluteFilePathToImportedFile = join( + dirname(absoluteFilePathToConjureFile), + RelativeFilePath.of(importFilePath) + ); + const relativeFilePathToImportedFile = relativize( + absoluteFilePathToConjureFolder, + absoluteFilePathToImportedFile + ); + const correspondingFernFilePath = this.conjureFilepathToFernFilepath[relativeFilePathToImportedFile]; + if (correspondingFernFilePath == null) { + throw new Error( + `Failed to find corresponding fern filepath for conjure file ${relativeFilePathToImportedFile}` + ); + } + return correspondingFernFilePath; } } export async function visitAllConjureDefinitionFiles( absolutePathToConjureFolder: AbsoluteFilePath, - visitor: (filepath: RelativeFilePath, definitionFile: DefinitionFile) => void | Promise + visitor: ( + absoluteFilepath: AbsoluteFilePath, + filepath: RelativeFilePath, + definitionFile: DefinitionFile + ) => void | Promise ): Promise { for (const conjureFile of await listConjureFiles(absolutePathToConjureFolder, "{yml,yaml}")) { - await visitor(conjureFile.relativeFilepath, conjureFile.fileContents); + await visitor(conjureFile.absoluteFilepath, conjureFile.relativeFilepath, conjureFile.fileContents); } } - -function isAlias(type: ConjureTypeDeclaration): type is ConjureAliasDeclaration { - return (type as ConjureAliasDeclaration)?.alias != null; -} - -function isEnum(type: ConjureTypeDeclaration): type is ConjureEnumDeclaration { - return (type as ConjureEnumDeclaration)?.values != null; -} - -function isObject(type: ConjureTypeDeclaration): type is ConjureObjectDeclaration { - return (type as ConjureObjectDeclaration)?.fields != null; -} diff --git a/packages/cli/api-importers/conjure/conjure-to-fern/src/listConjureFiles.ts b/packages/cli/api-importers/conjure/conjure-to-fern/src/utils/listConjureFiles.ts similarity index 72% rename from packages/cli/api-importers/conjure/conjure-to-fern/src/listConjureFiles.ts rename to packages/cli/api-importers/conjure/conjure-to-fern/src/utils/listConjureFiles.ts index cae6194000b..d8bc34a39f3 100644 --- a/packages/cli/api-importers/conjure/conjure-to-fern/src/listConjureFiles.ts +++ b/packages/cli/api-importers/conjure/conjure-to-fern/src/utils/listConjureFiles.ts @@ -31,7 +31,18 @@ async function createConjureFile({ relativeFilepath: RelativeFilePath; absoluteFilepath: AbsoluteFilePath; }): Promise { - const rawContents = (await readFile(absoluteFilepath)).toString(); + const rawContents = (await readFile(absoluteFilepath)) + .toString() + .replaceAll(": rid", ": string") + .replaceAll("", "") + .replaceAll("rid>", "string>") + .replaceAll(": safelong", ": long") + .replaceAll("", "") + .replaceAll("safelong>", "long>") + .replaceAll(": binary", ": file") + .replaceAll(": any", ": unknown") + .replaceAll("", "") + .replaceAll("any>", "unknown>"); return { relativeFilepath, absoluteFilepath, diff --git a/packages/cli/api-importers/conjure/conjure-to-fern/src/utils/visitConjureTypeDeclaration.ts b/packages/cli/api-importers/conjure/conjure-to-fern/src/utils/visitConjureTypeDeclaration.ts new file mode 100644 index 00000000000..53481a7ce4c --- /dev/null +++ b/packages/cli/api-importers/conjure/conjure-to-fern/src/utils/visitConjureTypeDeclaration.ts @@ -0,0 +1,50 @@ +import { + ConjureAliasDeclaration, + ConjureEnumDeclaration, + ConjureObjectDeclaration, + ConjureTypeDeclaration, + ConjureUnionDeclaration +} from "@fern-api/conjure-sdk"; +import { assertNever } from "@fern-api//core-utils"; + +export interface ConjureTypeDeclarationVisitor { + alias: (value: ConjureAliasDeclaration) => R; + enum: (value: ConjureEnumDeclaration) => R; + object: (value: ConjureObjectDeclaration) => R; + union: (value: ConjureUnionDeclaration) => R; +} + +export function visitConjureTypeDeclaration( + declaration: ConjureTypeDeclaration, + visitor: ConjureTypeDeclarationVisitor +): R { + if (isAlias(declaration)) { + return visitor.alias(declaration); + } + if (isEnum(declaration)) { + return visitor.enum(declaration); + } + if (isObject(declaration)) { + return visitor.object(declaration); + } + if (isUnion(declaration)) { + return visitor.union(declaration); + } + assertNever(declaration); +} + +export function isAlias(type: ConjureTypeDeclaration): type is ConjureAliasDeclaration { + return (type as ConjureAliasDeclaration)?.alias != null; +} + +export function isEnum(type: ConjureTypeDeclaration): type is ConjureEnumDeclaration { + return (type as ConjureEnumDeclaration)?.values != null; +} + +export function isObject(type: ConjureTypeDeclaration): type is ConjureObjectDeclaration { + return (type as ConjureObjectDeclaration)?.fields != null; +} + +export function isUnion(type: ConjureTypeDeclaration): type is ConjureUnionDeclaration { + return (type as ConjureUnionDeclaration)?.union != null; +} diff --git a/packages/cli/api-importers/conjure/conjure-to-fern/tsconfig.json b/packages/cli/api-importers/conjure/conjure-to-fern/tsconfig.json index 93e5a9e35b3..5757d3061f2 100644 --- a/packages/cli/api-importers/conjure/conjure-to-fern/tsconfig.json +++ b/packages/cli/api-importers/conjure/conjure-to-fern/tsconfig.json @@ -5,5 +5,7 @@ "references": [ { "path": "../conjure-sdk" }, { "path": "../../commons" }, + { "path": "../../../../commons/core-utils" }, + { "path": "../../../fern-definition/schema" }, ] } diff --git a/packages/cli/cli/src/commands/write-definition/writeDefinitionForWorkspaces.ts b/packages/cli/cli/src/commands/write-definition/writeDefinitionForWorkspaces.ts index 84e8a97912e..ed4896af2e4 100644 --- a/packages/cli/cli/src/commands/write-definition/writeDefinitionForWorkspaces.ts +++ b/packages/cli/cli/src/commands/write-definition/writeDefinitionForWorkspaces.ts @@ -22,10 +22,13 @@ export async function writeDefinitionForWorkspaces({ await Promise.all( project.apiWorkspaces.map(async (workspace) => { await cliContext.runTaskForWorkspace(workspace, async (context) => { - if (workspace instanceof OSSWorkspace) { - await writeDefinitionForOpenAPIWorkspace({ workspace, context, sdkLanguage }); - } else if (workspace instanceof FernWorkspace) { + if (workspace instanceof FernWorkspace) { await writeDefinitionForFernWorkspace({ workspace, context }); + } else { + await writeDefinitionForNonFernWorkspace({ + workspace: await workspace.toFernWorkspace({ context }), + context + }); } }); }) @@ -56,22 +59,19 @@ async function writeDefinitionForFernWorkspace({ } } -async function writeDefinitionForOpenAPIWorkspace({ +async function writeDefinitionForNonFernWorkspace({ workspace, - context, - sdkLanguage + context }: { - workspace: OSSWorkspace; + workspace: FernWorkspace; context: TaskContext; - sdkLanguage: generatorsYml.GenerationLanguage | undefined; }): Promise { - const fernWorkspace = await workspace.toFernWorkspace({ context }); const absolutePathToOutputDirectory = join( workspace.absoluteFilePath, RelativeFilePath.of(`.${DEFINITION_DIRECTORY}`) ); await writeFernDefinition({ - definition: fernWorkspace.definition, + definition: workspace.definition, absolutePathToOutputDirectory }); context.logger.info( @@ -86,6 +86,29 @@ async function writeFernDefinition({ definition: FernDefinition; absolutePathToOutputDirectory: AbsoluteFilePath; }): Promise { + const sortKeys = (a: string, b: string): number => { + const customOrder: Record = { + imports: 0, + types: 1, + services: 2 + }; + + const orderA = a in customOrder ? customOrder[a] : Object.keys(customOrder).length; + const orderB = b in customOrder ? customOrder[b] : Object.keys(customOrder).length; + + if (orderA == null) { + return -1; + } else if (orderB == null) { + return 1; + } else if (orderA !== orderB) { + return orderA - orderB; + } + + // If both keys have the same custom order (or are both not in the custom order), + // sort alphabetically + return a.localeCompare(b); + }; + if (await doesPathExist(absolutePathToOutputDirectory)) { await rmdir(absolutePathToOutputDirectory, { recursive: true }); } @@ -94,20 +117,20 @@ async function writeFernDefinition({ await mkdir(absolutePathToOutputDirectory, { recursive: true }); await writeFile( join(absolutePathToOutputDirectory, RelativeFilePath.of(ROOT_API_FILENAME)), - yaml.dump(definition.rootApiFile.contents) + yaml.dump(definition.rootApiFile.contents, { sortKeys }) ); // write __package__.ymls for (const [relativePath, packageMarker] of Object.entries(definition.packageMarkers)) { const absoluteFilepath = join(absolutePathToOutputDirectory, RelativeFilePath.of(relativePath)); await mkdir(dirname(absoluteFilepath), { recursive: true }); - await writeFile(absoluteFilepath, yaml.dump(packageMarker.contents)); + await writeFile(absoluteFilepath, yaml.dump(packageMarker.contents, { sortKeys })); } // write named definition files for (const [relativePath, definitionFile] of Object.entries(definition.namedDefinitionFiles)) { const absoluteFilepath = join(absolutePathToOutputDirectory, RelativeFilePath.of(relativePath)); await mkdir(dirname(absoluteFilepath), { recursive: true }); - await writeFile(absoluteFilepath, yaml.dump(definitionFile.contents)); + await writeFile(absoluteFilepath, yaml.dump(definitionFile.contents, { sortKeys })); } } diff --git a/packages/cli/cli/versions.yml b/packages/cli/cli/versions.yml index 8da2caba0d9..def4af83812 100644 --- a/packages/cli/cli/versions.yml +++ b/packages/cli/cli/versions.yml @@ -1,3 +1,9 @@ +- changelogEntry: + - summary: Several improvements to the conjure importer. + type: fix + irVersion: 53 + version: 0.44.11 + - changelogEntry: - summary: | API update now supports consuming the API origin from spec V2 configurations. diff --git a/packages/cli/configuration/src/generators-yml/convertGeneratorsConfiguration.ts b/packages/cli/configuration/src/generators-yml/convertGeneratorsConfiguration.ts index 93a8540d52a..db6d4ecf301 100644 --- a/packages/cli/configuration/src/generators-yml/convertGeneratorsConfiguration.ts +++ b/packages/cli/configuration/src/generators-yml/convertGeneratorsConfiguration.ts @@ -265,10 +265,33 @@ async function parseApiConfigurationV2Schema({ apiConfiguration: APIConfigurationV2Schema; rawConfiguration: GeneratorsConfigurationSchema; }): Promise { + const partialConfig = { + "auth-schemes": + apiConfiguration.auth != null + ? Object.fromEntries( + Object.entries(rawConfiguration["auth-schemes"] ?? {}).filter(([name, _]) => { + if (apiConfiguration.auth == null) { + return false; + } + return visitRawApiAuth(apiConfiguration.auth, { + any: (any) => { + return any.any.includes(name); + }, + single: (single) => { + return single === name; + } + }); + }) + ) + : undefined, + ...apiConfiguration + }; + if (isConjureSchema(apiConfiguration.specs)) { return { type: "conjure", - pathToConjureDefinition: apiConfiguration.specs.conjure + pathToConjureDefinition: apiConfiguration.specs.conjure, + ...partialConfig }; } @@ -303,28 +326,6 @@ async function parseApiConfigurationV2Schema({ } } - const partialConfig = { - "auth-schemes": - apiConfiguration.auth != null - ? Object.fromEntries( - Object.entries(rawConfiguration["auth-schemes"] ?? {}).filter(([name, _]) => { - if (apiConfiguration.auth == null) { - return false; - } - return visitRawApiAuth(apiConfiguration.auth, { - any: (any) => { - return any.any.includes(name); - }, - single: (single) => { - return single === name; - } - }); - }) - ) - : undefined, - ...apiConfiguration - }; - // No namespaces if (Object.keys(namespacedDefinitions).length === 0) { return { diff --git a/packages/cli/docs-preview/src/previewDocs.ts b/packages/cli/docs-preview/src/previewDocs.ts index 963874dc16d..f2e5b848138 100644 --- a/packages/cli/docs-preview/src/previewDocs.ts +++ b/packages/cli/docs-preview/src/previewDocs.ts @@ -127,7 +127,7 @@ class ReferencedAPICollector { } catch (e) { // Print Error const err = e as Error; - this.context.logger.error(`Failed to read referenced API: ${err?.message}`); + this.context.logger.error(`Failed to read referenced API: ${err?.message} ${err?.stack}`); if (err.stack != null) { this.context.logger.error(err?.stack); } diff --git a/packages/cli/ete-tests/src/tests/write-definition/__snapshots__/writeDefinition.test.ts.snap b/packages/cli/ete-tests/src/tests/write-definition/__snapshots__/writeDefinition.test.ts.snap index 65a526c646b..8b4ad2eba33 100644 --- a/packages/cli/ete-tests/src/tests/write-definition/__snapshots__/writeDefinition.test.ts.snap +++ b/packages/cli/ete-tests/src/tests/write-definition/__snapshots__/writeDefinition.test.ts.snap @@ -4,6 +4,12 @@ exports[`validate > petstore 1`] = ` [ { "contents": "types: + Error: + properties: + code: integer + message: string + source: + openapi: openapi/openapi.yml Pet: properties: id: long @@ -12,24 +18,18 @@ exports[`validate > petstore 1`] = ` source: openapi: openapi/openapi.yml Pets: list - Error: - properties: - code: integer - message: string - source: - openapi: openapi/openapi.yml ", "name": "__package__.yml", "type": "file", }, { - "contents": "name: api -error-discrimination: - strategy: status-code + "contents": "default-environment: Default display-name: Swagger Petstore environments: Default: http://petstore.swagger.io/v1 -default-environment: Default +error-discrimination: + strategy: status-code +name: api ", "name": "api.yml", "type": "file", @@ -41,45 +41,36 @@ service: auth: false base-path: '' endpoints: - listPets: + createPets: + auth: false + display-name: Create a pet + examples: + - {} + method: POST path: /pets - method: GET + listPets: auth: false display-name: List all pets + examples: + - response: + body: + - id: 1000000 + name: name + tag: tag + method: GET + path: /pets request: name: ListPetsRequest query-parameters: limit: - type: optional docs: How many items to return at one time (max 100) + type: optional response: docs: A paged array of pets type: root.Pets - examples: - - response: - body: - - id: 1000000 - name: name - tag: tag - createPets: - path: /pets - method: POST - auth: false - display-name: Create a pet - examples: - - {} showPetById: - path: /pets/{petId} - method: GET auth: false - path-parameters: - petId: - type: string - docs: The id of the pet to retrieve display-name: Info for a specific pet - response: - docs: Expected response to a valid request - type: root.Pet examples: - path-parameters: petId: petId @@ -88,6 +79,15 @@ service: id: 1000000 name: name tag: tag + method: GET + path: /pets/{petId} + path-parameters: + petId: + docs: The id of the pet to retrieve + type: string + response: + docs: Expected response to a valid request + type: root.Pet source: openapi: openapi/openapi.yml ", @@ -101,6 +101,12 @@ exports[`validate header overrides > header-overrides 1`] = ` [ { "contents": "types: + Error: + properties: + code: integer + message: string + source: + openapi: openapi/openapi.yml Pet: properties: id: long @@ -109,26 +115,20 @@ exports[`validate header overrides > header-overrides 1`] = ` source: openapi: openapi/openapi.yml Pets: list - Error: - properties: - code: integer - message: string - source: - openapi: openapi/openapi.yml ", "name": "__package__.yml", "type": "file", }, { - "contents": "name: api -error-discrimination: - strategy: status-code + "contents": "default-environment: Default display-name: Swagger Petstore environments: Default: http://petstore.swagger.io/v1 -default-environment: Default +error-discrimination: + strategy: status-code headers: X-Dummy-Header: optional +name: api ", "name": "api.yml", "type": "file", @@ -140,45 +140,36 @@ service: auth: false base-path: '' endpoints: - listPets: + createPets: + auth: false + display-name: Create a pet + examples: + - {} + method: POST path: /pets - method: GET + listPets: auth: false display-name: List all pets + examples: + - response: + body: + - id: 1000000 + name: name + tag: tag + method: GET + path: /pets request: name: ListPetsRequest query-parameters: limit: - type: optional docs: How many items to return at one time (max 100) + type: optional response: docs: A paged array of pets type: root.Pets - examples: - - response: - body: - - id: 1000000 - name: name - tag: tag - createPets: - path: /pets - method: POST - auth: false - display-name: Create a pet - examples: - - {} showPetById: - path: /pets/{petId} - method: GET auth: false - path-parameters: - petId: - type: string - docs: The id of the pet to retrieve display-name: Info for a specific pet - response: - docs: Expected response to a valid request - type: root.Pet examples: - path-parameters: petId: petId @@ -187,6 +178,15 @@ service: id: 1000000 name: name tag: tag + method: GET + path: /pets/{petId} + path-parameters: + petId: + docs: The id of the pet to retrieve + type: string + response: + docs: Expected response to a valid request + type: root.Pet source: openapi: openapi/openapi.yml ", @@ -202,10 +202,10 @@ exports[`validate namespaced API > namespaced 1`] = ` "contents": "types: OauthScope: enum: - - value: read - docs: Read access - - value: write - docs: Write access + - docs: Read access + value: read + - docs: Write access + value: write source: openapi: openapi/trains/openapi.yml ", @@ -213,17 +213,17 @@ exports[`validate namespaced API > namespaced 1`] = ` "type": "file", }, { - "contents": "name: api -error-discrimination: - strategy: status-code -display-name: Train Travel API -default-environment: Production -environments: - Production: https://api.example.com + "contents": "auth: BearerAuthScheme auth-schemes: BearerAuthScheme: scheme: bearer -auth: BearerAuthScheme +default-environment: Production +display-name: Train Travel API +environments: + Production: https://api.example.com +error-discrimination: + strategy: status-code +name: api ", "name": "api.yml", "type": "file", @@ -232,21 +232,21 @@ auth: BearerAuthScheme "contents": [ { "contents": "types: + Error: + properties: + code: integer + message: string + source: + openapi: openapi/petstore/openapi.yml Pet: properties: id: long + messages: optional name: string tag: optional - messages: optional source: openapi: openapi/petstore/openapi.yml Pets: list - Error: - properties: - code: integer - message: string - source: - openapi: openapi/petstore/openapi.yml V2ChatMessages: docs: > A list of chat messages in chronological order, representing a @@ -268,57 +268,57 @@ service: auth: false base-path: '' endpoints: - listPets: + createPets: + auth: false + display-name: Create a pet + examples: + - {} + method: POST path: /pets - method: GET + listPets: auth: false display-name: List all pets + examples: + - response: + body: + - id: 1000000 + messages: + - key: value + name: name + tag: tag + method: GET + path: /pets request: name: ListPetsRequest query-parameters: limit: - type: optional docs: How many items to return at one time (max 100) + type: optional response: docs: A paged array of pets type: neopetsRoot.Pets - examples: - - response: - body: - - id: 1000000 - name: name - tag: tag - messages: - - key: value - createPets: - path: /pets - method: POST - auth: false - display-name: Create a pet - examples: - - {} showPetById: - path: /pets/{petId} - method: GET auth: false - path-parameters: - petId: - type: string - docs: The id of the pet to retrieve display-name: Info for a specific pet - response: - docs: Expected response to a valid request - type: neopetsRoot.Pet examples: - path-parameters: petId: petId response: body: id: 1000000 - name: name - tag: tag messages: - key: value + name: name + tag: tag + method: GET + path: /pets/{petId} + path-parameters: + petId: + docs: The id of the pet to retrieve + type: string + response: + docs: Expected response to a valid request + type: neopetsRoot.Pet source: openapi: openapi/petstore/openapi.yml ", @@ -332,87 +332,13 @@ service: { "contents": [ { - "contents": "channel: - path: marketDataV1 - auth: false - path-parameters: - symbol: - type: string - docs: > - Symbols are formatted as CCY1CCY2 where prices are in CCY2 and - quantities are in CCY1. To read more click - [here](https://docs.sandbox.gemini.com/websocket-api/#symbols-and-minimums). - query-parameters: - heartbeat: - type: optional - docs: >- - Optionally add this parameter and set to true to receive a heartbeat - every 5 seconds - top_of_book: - type: optional - docs: >- - If absent or false, receive full order book depth; if present and true, - receive top of book only. Only applies to bids and offers. - bids: - type: optional - docs: Include bids in change events - offers: - type: optional - docs: Include asks in change events - trades: - type: optional - docs: Include trade events - auctions: - type: optional - docs: Include auction events - messages: {} - examples: - - messages: [] -types: - Market: - discriminated: false - union: - - Heartbeat - - Update - source: - openapi: asyncapi/sample.yml - Heartbeat: - properties: - type: literal<"heartbeat"> - extends: - - Default - source: - openapi: asyncapi/sample.yml - Update: - properties: - type: literal<"update"> - eventId: - type: integer - docs: >- - A monotonically increasing sequence number indicating when this change - occurred. These numbers are persistent and consistent between market - data connections. - events: Events - timestamp: - type: double - docs: >- - The timestamp in seconds for this group of events (included for - compatibility reasons). We recommend using the timestampms field - instead. - timestampms: - type: double - docs: The timestamp in milliseconds for this group of events. - extends: - - Default - source: - openapi: asyncapi/sample.yml + "contents": "types: Default: docs: >- This object is always part of the payload. In case of type=heartbeat, these are the only fields. properties: socket_sequence: - type: integer docs: >- zero-indexed monotonic increasing sequence number attached to each message sent - if there is a gap in this sequence, you have missed a @@ -420,291 +346,210 @@ types: messages will share a single increasing sequence. See [Sequence Numbers](https://docs.sandbox.gemini.com/websocket-api/#sequence-numbers) for more information. + type: integer source: openapi: asyncapi/sample.yml - EventsItemType: - enum: - - trade - - change - - value: auction, block_trade - name: AuctionBlockTrade - source: - openapi: asyncapi/sample.yml - EventsItemSide: - enum: - - bid - - side - source: - openapi: asyncapi/sample.yml - EventsItemReason: - enum: - - place - - trade - - cancel - - initial + Events: docs: >- - Indicates why the change has occurred. initial is for the initial response - message, which will show the entire existing state of the order book. - source: - openapi: asyncapi/sample.yml + Either a change to the order book, or the indication that a trade has + occurred. + type: list EventsItem: properties: - type: optional - price: + delta: + docs: >- + The quantity changed. May be negative, if an order is filled or + canceled. For initial messages, delta will equal remaining. type: optional + price: docs: The price of this order book entry. + type: optional validation: multipleOf: 0.01 - side: optional reason: - type: optional docs: >- Indicates why the change has occurred. initial is for the initial response message, which will show the entire existing state of the order book. + type: optional remaining: - type: optional docs: >- The quantity remaining at that price level after this change occurred. May be zero if all orders at this price level have been filled or canceled. - delta: type: optional - docs: >- - The quantity changed. May be negative, if an order is filled or - canceled. For initial messages, delta will equal remaining. + side: optional + type: optional source: openapi: asyncapi/sample.yml - Events: + EventsItemReason: docs: >- - Either a change to the order book, or the indication that a trade has - occurred. - type: list -", - "name": "__package__.yml", - "type": "file", - }, - ], - "name": "stream", - "type": "directory", - }, - { - "contents": [ - { - "contents": "errors: - BadRequestError: - status-code: 400 - type: Problem - docs: Bad Request - examples: - - value: - type: https://example.com/errors/bad-request - title: Bad Request - status: 400 - detail: The request is invalid or missing required parameters. - UnauthorizedError: - status-code: 401 - type: Problem - docs: Unauthorized - examples: - - value: - type: https://example.com/errors/unauthorized - title: Unauthorized - status: 401 - detail: You do not have the necessary permissions. - ForbiddenError: - status-code: 403 - type: Problem - docs: Forbidden - examples: - - value: - type: https://example.com/errors/forbidden - title: Forbidden - status: 403 - detail: Access is forbidden with the provided credentials. - TooManyRequestsError: - status-code: 429 - type: Problem - docs: Too Many Requests - examples: - - value: - type: https://example.com/errors/too-many-requests - title: Too Many Requests - status: 429 - detail: You have exceeded the rate limit. - InternalServerError: - status-code: 500 - type: Problem - docs: Internal Server Error - examples: - - value: - type: https://example.com/errors/internal-server-error - title: Internal Server Error - status: 500 - detail: An unexpected error occurred. - NotFoundError: - status-code: 404 - type: Problem - docs: Not Found - examples: - - value: - type: https://example.com/errors/not-found - title: Not Found - status: 404 - detail: The requested resource was not found. - ConflictError: - status-code: 409 - type: Problem - docs: Conflict - examples: - - value: - type: https://example.com/errors/conflict - title: Conflict - status: 409 - detail: There is a conflict with an existing resource. -types: - Pet: - properties: - id: long - name: string + Indicates why the change has occurred. initial is for the initial response + message, which will show the entire existing state of the order book. + enum: + - place + - trade + - cancel + - initial source: - openapi: openapi/trains/openapi.yml - Station: - properties: - id: - type: string - docs: Unique identifier for the station. - validation: - format: uuid - name: - type: string - docs: The name of the station - address: - type: string - docs: The address of the station. - country_code: - type: string - docs: The country code of the station. - timezone: - type: optional - docs: >- - The timezone of the station in the [IANA Time Zone Database - format](https://www.iana.org/time-zones). - messages: optional - pet: optional + openapi: asyncapi/sample.yml + EventsItemSide: + enum: + - bid + - side source: - openapi: openapi/trains/openapi.yml - LinksSelf: - properties: - self: - type: optional - validation: - format: uri + openapi: asyncapi/sample.yml + EventsItemType: + enum: + - trade + - change + - name: AuctionBlockTrade + value: auction, block_trade source: - openapi: openapi/trains/openapi.yml - LinksPagination: + openapi: asyncapi/sample.yml + Heartbeat: + extends: + - Default properties: - next: - type: optional - validation: - format: uri - prev: - type: optional - validation: - format: uri + type: literal<"heartbeat"> source: - openapi: openapi/trains/openapi.yml - Problem: - properties: - type: - type: optional - docs: A URI reference that identifies the problem type - title: - type: optional - docs: A short, human-readable summary of the problem type - detail: - type: optional - docs: >- - A human-readable explanation specific to this occurrence of the - problem - instance: - type: optional - docs: A URI reference that identifies the specific occurrence of the problem - status: - type: optional - docs: The HTTP status code + openapi: asyncapi/sample.yml + Market: + discriminated: false source: - openapi: openapi/trains/openapi.yml - Trip: + openapi: asyncapi/sample.yml + union: + - Heartbeat + - Update + Update: + extends: + - Default properties: - id: - type: optional - docs: Unique identifier for the trip - validation: - format: uuid - origin: - type: optional - docs: The starting station of the trip - destination: - type: optional - docs: The destination station of the trip - departure_time: - type: optional - docs: The date and time when the trip departs - arrival_time: - type: optional - docs: The date and time when the trip arrives - operator: - type: optional - docs: The name of the operator of the trip - price: - type: optional - docs: The cost of the trip - bicycles_allowed: - type: optional - docs: Indicates whether bicycles are allowed on the trip - dogs_allowed: - type: optional - docs: Indicates whether dogs are allowed on the trip + eventId: + docs: >- + A monotonically increasing sequence number indicating when this change + occurred. These numbers are persistent and consistent between market + data connections. + type: integer + events: Events + timestamp: + docs: >- + The timestamp in seconds for this group of events (included for + compatibility reasons). We recommend using the timestampms field + instead. + type: double + timestampms: + docs: The timestamp in milliseconds for this group of events. + type: double + type: literal<"update"> source: - openapi: openapi/trains/openapi.yml + openapi: asyncapi/sample.yml +channel: + auth: false + examples: + - messages: [] + messages: {} + path: marketDataV1 + path-parameters: + symbol: + docs: > + Symbols are formatted as CCY1CCY2 where prices are in CCY2 and + quantities are in CCY1. To read more click + [here](https://docs.sandbox.gemini.com/websocket-api/#symbols-and-minimums). + type: string + query-parameters: + auctions: + docs: Include auction events + type: optional + bids: + docs: Include bids in change events + type: optional + heartbeat: + docs: >- + Optionally add this parameter and set to true to receive a heartbeat + every 5 seconds + type: optional + offers: + docs: Include asks in change events + type: optional + top_of_book: + docs: >- + If absent or false, receive full order book depth; if present and true, + receive top of book only. Only applies to bids and offers. + type: optional + trades: + docs: Include trade events + type: optional +", + "name": "__package__.yml", + "type": "file", + }, + ], + "name": "stream", + "type": "directory", + }, + { + "contents": [ + { + "contents": "types: Booking: properties: + has_bicycle: + docs: Indicates whether the passenger has a bicycle. + type: optional + has_dog: + docs: Indicates whether the passenger has a dog. + type: optional id: - type: optional docs: Unique identifier for the booking + type: optional validation: format: uuid - trip_id: + passenger_name: + docs: Name of the passenger type: optional + trip_id: docs: Identifier of the booked trip + type: optional validation: format: uuid - passenger_name: - type: optional - docs: Name of the passenger - has_bicycle: - type: optional - docs: Indicates whether the passenger has a bicycle. - has_dog: - type: optional - docs: Indicates whether the passenger has a dog. source: openapi: openapi/trains/openapi.yml - WrapperCollection: - docs: >- - This is a generic request/response wrapper which contains both data and - links which serve as hypermedia controls (HATEOAS). + BookingPayment: properties: - data: - type: optional>> - docs: The wrapper for a collection is an array of objects. - links: - type: optional> - docs: A set of hypermedia links which serve as controls for the client. + amount: + docs: >- + Amount intended to be collected by this payment. A positive decimal + figure describing the amount to be collected. + type: optional + currency: + docs: >- + Three-letter [ISO currency + code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. + type: optional + id: + docs: >- + Unique identifier for the payment. This will be a unique identifier + for the payment, and is used to reference the payment in other + objects. + type: optional + validation: + format: uuid + source: + docs: >- + The payment source to take the payment from. This can be a card or a + bank account. Some of these properties will be hidden on read to + protect PII leaking. + type: optional + status: + docs: The status of the payment, one of \`pending\`, \`succeeded\`, or \`failed\`. + type: optional source: openapi: openapi/trains/openapi.yml BookingPaymentCurrency: + docs: >- + Three-letter [ISO currency + code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. enum: - bam - bgn @@ -714,145 +559,216 @@ types: - nok - sek - try + source: + openapi: openapi/trains/openapi.yml + BookingPaymentSource: + base-properties: {} + discriminant: object docs: >- - Three-letter [ISO currency - code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. + The payment source to take the payment from. This can be a card or a bank + account. Some of these properties will be hidden on read to protect PII + leaking. source: openapi: openapi/trains/openapi.yml - Card: - docs: A card (debit or credit) to take payment from. + union: + bank_account: + docs: >- + A bank account to take payment from. Must be able to make payments in + the currency specified in the payment. + type: BookingPaymentSourceBankAccount + card: + docs: A card (debit or credit) to take payment from. + type: Card + BookingPaymentSourceBankAccount: + docs: >- + A bank account to take payment from. Must be able to make payments in the + currency specified in the payment. properties: - name: + account_type: + docs: >- + The type of entity that holds the account. This can be either + \`individual\` or \`company\`. + type: BookingPaymentSourceBankAccountAccountType + bank_name: + docs: The name of the bank associated with the routing number. type: string - docs: Cardholder's full name as it appears on the card. + country: + docs: Two-letter country code (ISO 3166-1 alpha-2). + type: string + name: string number: + docs: >- + The account number for the bank account, in string form. Must be a + current account. type: string + sort_code: docs: >- - The card number, as a string without any separators. On read all but - the last four digits will be masked for security. + The sort code for the bank account, in string form. Must be a + six-digit number. + type: optional + source: + openapi: openapi/trains/openapi.yml + BookingPaymentSourceBankAccountAccountType: + docs: >- + The type of entity that holds the account. This can be either \`individual\` + or \`company\`. + enum: + - individual + - company + source: + openapi: openapi/trains/openapi.yml + BookingPaymentStatus: + docs: The status of the payment, one of \`pending\`, \`succeeded\`, or \`failed\`. + enum: + - pending + - succeeded + - failed + source: + openapi: openapi/trains/openapi.yml + Card: + docs: A card (debit or credit) to take payment from. + properties: + address_city: + type: optional + address_country: string + address_line1: + type: optional + address_line2: + type: optional + address_post_code: + type: optional cvc: - type: integer docs: >- Card security code, 3 or 4 digits usually found on the back of the card. + type: integer exp_month: - type: long docs: Two-digit number representing the card's expiration month. - exp_year: type: long + exp_year: docs: Four-digit number representing the card's expiration year. - address_line1: - type: optional - address_line2: - type: optional - address_city: - type: optional - address_country: string - address_post_code: + type: long + name: + docs: Cardholder's full name as it appears on the card. + type: string + number: + docs: >- + The card number, as a string without any separators. On read all but + the last four digits will be masked for security. + type: string + source: + openapi: openapi/trains/openapi.yml + LinksBooking: + properties: + booking: type: optional + validation: + format: uri source: openapi: openapi/trains/openapi.yml - BookingPaymentSourceBankAccountAccountType: - enum: - - individual - - company - docs: >- - The type of entity that holds the account. This can be either \`individual\` - or \`company\`. + LinksPagination: + properties: + next: + type: optional + validation: + format: uri + prev: + type: optional + validation: + format: uri source: openapi: openapi/trains/openapi.yml - BookingPaymentSourceBankAccount: - docs: >- - A bank account to take payment from. Must be able to make payments in the - currency specified in the payment. + LinksSelf: properties: - name: string - number: - type: string - docs: >- - The account number for the bank account, in string form. Must be a - current account. - sort_code: + self: type: optional - docs: >- - The sort code for the bank account, in string form. Must be a - six-digit number. - account_type: - type: BookingPaymentSourceBankAccountAccountType - docs: >- - The type of entity that holds the account. This can be either - \`individual\` or \`company\`. - bank_name: - type: string - docs: The name of the bank associated with the routing number. - country: - type: string - docs: Two-letter country code (ISO 3166-1 alpha-2). + validation: + format: uri source: openapi: openapi/trains/openapi.yml - BookingPaymentSource: - discriminant: object - base-properties: {} - docs: >- - The payment source to take the payment from. This can be a card or a bank - account. Some of these properties will be hidden on read to protect PII - leaking. - union: - card: - type: Card - docs: A card (debit or credit) to take payment from. - bank_account: - type: BookingPaymentSourceBankAccount - docs: >- - A bank account to take payment from. Must be able to make payments in - the currency specified in the payment. + Pet: + properties: + id: long + name: string source: openapi: openapi/trains/openapi.yml - BookingPaymentStatus: - enum: - - pending - - succeeded - - failed - docs: The status of the payment, one of \`pending\`, \`succeeded\`, or \`failed\`. + Problem: + properties: + detail: + docs: >- + A human-readable explanation specific to this occurrence of the + problem + type: optional + instance: + docs: A URI reference that identifies the specific occurrence of the problem + type: optional + status: + docs: The HTTP status code + type: optional + title: + docs: A short, human-readable summary of the problem type + type: optional + type: + docs: A URI reference that identifies the problem type + type: optional source: openapi: openapi/trains/openapi.yml - BookingPayment: + Station: properties: + address: + docs: The address of the station. + type: string + country_code: + docs: The country code of the station. + type: string id: - type: optional - docs: >- - Unique identifier for the payment. This will be a unique identifier - for the payment, and is used to reference the payment in other - objects. + docs: Unique identifier for the station. + type: string validation: format: uuid - amount: - type: optional - docs: >- - Amount intended to be collected by this payment. A positive decimal - figure describing the amount to be collected. - currency: - type: optional - docs: >- - Three-letter [ISO currency - code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. - source: - type: optional + messages: optional + name: + docs: The name of the station + type: string + pet: optional + timezone: docs: >- - The payment source to take the payment from. This can be a card or a - bank account. Some of these properties will be hidden on read to - protect PII leaking. - status: - type: optional - docs: The status of the payment, one of \`pending\`, \`succeeded\`, or \`failed\`. + The timezone of the station in the [IANA Time Zone Database + format](https://www.iana.org/time-zones). + type: optional source: openapi: openapi/trains/openapi.yml - LinksBooking: + Trip: properties: - booking: + arrival_time: + docs: The date and time when the trip arrives + type: optional + bicycles_allowed: + docs: Indicates whether bicycles are allowed on the trip + type: optional + departure_time: + docs: The date and time when the trip departs + type: optional + destination: + docs: The destination station of the trip + type: optional + dogs_allowed: + docs: Indicates whether dogs are allowed on the trip + type: optional + id: + docs: Unique identifier for the trip type: optional validation: - format: uri + format: uuid + operator: + docs: The name of the operator of the trip + type: optional + origin: + docs: The starting station of the trip + type: optional + price: + docs: The cost of the trip + type: optional source: openapi: openapi/trains/openapi.yml V2ChatMessages: @@ -865,6 +781,90 @@ types: more about messages and roles in [the Chat API guide](https://docs.cohere.com/docs/chat-api). type: list + WrapperCollection: + docs: >- + This is a generic request/response wrapper which contains both data and + links which serve as hypermedia controls (HATEOAS). + properties: + data: + docs: The wrapper for a collection is an array of objects. + type: optional>> + links: + docs: A set of hypermedia links which serve as controls for the client. + type: optional> + source: + openapi: openapi/trains/openapi.yml +errors: + BadRequestError: + docs: Bad Request + examples: + - value: + detail: The request is invalid or missing required parameters. + status: 400 + title: Bad Request + type: https://example.com/errors/bad-request + status-code: 400 + type: Problem + ConflictError: + docs: Conflict + examples: + - value: + detail: There is a conflict with an existing resource. + status: 409 + title: Conflict + type: https://example.com/errors/conflict + status-code: 409 + type: Problem + ForbiddenError: + docs: Forbidden + examples: + - value: + detail: Access is forbidden with the provided credentials. + status: 403 + title: Forbidden + type: https://example.com/errors/forbidden + status-code: 403 + type: Problem + InternalServerError: + docs: Internal Server Error + examples: + - value: + detail: An unexpected error occurred. + status: 500 + title: Internal Server Error + type: https://example.com/errors/internal-server-error + status-code: 500 + type: Problem + NotFoundError: + docs: Not Found + examples: + - value: + detail: The requested resource was not found. + status: 404 + title: Not Found + type: https://example.com/errors/not-found + status-code: 404 + type: Problem + TooManyRequestsError: + docs: Too Many Requests + examples: + - value: + detail: You have exceeded the rate limit. + status: 429 + title: Too Many Requests + type: https://example.com/errors/too-many-requests + status-code: 429 + type: Problem + UnauthorizedError: + docs: Unauthorized + examples: + - value: + detail: You do not have the necessary permissions. + status: 401 + title: Unauthorized + type: https://example.com/errors/unauthorized + status-code: 401 + type: Problem ", "name": "__package__.yml", "type": "file", @@ -873,116 +873,98 @@ types: "contents": "imports: trainsRoot: __package__.yml types: - GetBookingsResponseLinks: - properties: {} + CreateBookingResponse: extends: - - trainsRoot.LinksSelf - - trainsRoot.LinksPagination - source: - openapi: openapi/trains/openapi.yml - GetBookingsResponse: + - trainsRoot.Booking properties: - data: optional> - links: optional + links: optional source: openapi: openapi/trains/openapi.yml - CreateBookingResponse: - properties: - links: optional + GetBookingResponse: extends: - trainsRoot.Booking + properties: + links: optional source: openapi: openapi/trains/openapi.yml - GetBookingResponse: + GetBookingsResponse: properties: - links: optional + data: optional> + links: optional + source: + openapi: openapi/trains/openapi.yml + GetBookingsResponseLinks: extends: - - trainsRoot.Booking + - trainsRoot.LinksSelf + - trainsRoot.LinksPagination + properties: {} source: openapi: openapi/trains/openapi.yml +docs: | + Create and manage bookings for train trips, including passenger details + and optional extras. service: auth: false base-path: '' + display-name: Bookings endpoints: - get-bookings: - path: /bookings - method: GET + create-booking: auth: true - docs: Returns a list of all trip bookings by the authenticated user. - display-name: List existing bookings - response: - docs: A list of bookings - type: GetBookingsResponse + display-name: Create a booking + docs: >- + A booking is a temporary hold on a trip. It is not confirmed until the + payment is processed. errors: - trainsRoot.BadRequestError - trainsRoot.UnauthorizedError - - trainsRoot.ForbiddenError + - trainsRoot.NotFoundError + - trainsRoot.ConflictError - trainsRoot.TooManyRequestsError - trainsRoot.InternalServerError examples: - - response: + - request: {} + response: body: - data: - - id: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e - trip_id: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e - passenger_name: John Doe - has_bicycle: true - has_dog: true - - id: b2e783e1-c824-4d63-b37a-d8d698862f1d - trip_id: b2e783e1-c824-4d63-b37a-d8d698862f1d - passenger_name: Jane Smith - has_bicycle: false - has_dog: false + has_bicycle: true + has_dog: true + id: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e links: - next: https://api.example.com/bookings?page=2 - prev: prev - self: https://api.example.com/bookings - create-booking: - path: /bookings + self: >- + https://api.example.com/bookings/efdbb9d1-02c2-4bc3-afb7-6788d8782b1e + passenger_name: John Doe + trip_id: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e method: POST - auth: true - docs: >- - A booking is a temporary hold on a trip. It is not confirmed until the - payment is processed. - display-name: Create a booking + path: /bookings request: body: trainsRoot.Booking content-type: application/json response: docs: Booking successful type: CreateBookingResponse + delete-booking: + auth: true + display-name: Delete a booking + docs: Deletes a booking, cancelling the hold on the trip. errors: - trainsRoot.BadRequestError - trainsRoot.UnauthorizedError + - trainsRoot.ForbiddenError - trainsRoot.NotFoundError - - trainsRoot.ConflictError - trainsRoot.TooManyRequestsError - trainsRoot.InternalServerError examples: - - request: {} - response: - body: - id: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e - trip_id: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e - passenger_name: John Doe - has_bicycle: true - has_dog: true - links: - self: >- - https://api.example.com/bookings/efdbb9d1-02c2-4bc3-afb7-6788d8782b1e - get-booking: + - path-parameters: + bookingId: 1725ff48-ab45-4bb5-9d02-88745177dedb + method: DELETE path: /bookings/{bookingId} - method: GET - auth: true - docs: Returns the details of a specific booking. path-parameters: bookingId: - type: string docs: The ID of the booking to retrieve. + type: string + get-booking: + auth: true display-name: Get a booking - response: - docs: The booking details - type: GetBookingResponse + docs: Returns the details of a specific booking. errors: - trainsRoot.BadRequestError - trainsRoot.UnauthorizedError @@ -995,40 +977,58 @@ service: bookingId: 1725ff48-ab45-4bb5-9d02-88745177dedb response: body: - id: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e - trip_id: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e - passenger_name: John Doe has_bicycle: true has_dog: true + id: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e links: self: >- https://api.example.com/bookings/1725ff48-ab45-4bb5-9d02-88745177dedb - delete-booking: + passenger_name: John Doe + trip_id: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e + method: GET path: /bookings/{bookingId} - method: DELETE - auth: true - docs: Deletes a booking, cancelling the hold on the trip. path-parameters: bookingId: - type: string docs: The ID of the booking to retrieve. - display-name: Delete a booking + type: string + response: + docs: The booking details + type: GetBookingResponse + get-bookings: + auth: true + display-name: List existing bookings + docs: Returns a list of all trip bookings by the authenticated user. errors: - trainsRoot.BadRequestError - trainsRoot.UnauthorizedError - trainsRoot.ForbiddenError - - trainsRoot.NotFoundError - trainsRoot.TooManyRequestsError - trainsRoot.InternalServerError examples: - - path-parameters: - bookingId: 1725ff48-ab45-4bb5-9d02-88745177dedb + - response: + body: + data: + - has_bicycle: true + has_dog: true + id: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e + passenger_name: John Doe + trip_id: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e + - has_bicycle: false + has_dog: false + id: b2e783e1-c824-4d63-b37a-d8d698862f1d + passenger_name: Jane Smith + trip_id: b2e783e1-c824-4d63-b37a-d8d698862f1d + links: + next: https://api.example.com/bookings?page=2 + prev: prev + self: https://api.example.com/bookings + method: GET + path: /bookings + response: + docs: A list of bookings + type: GetBookingsResponse source: openapi: openapi/trains/openapi.yml - display-name: Bookings -docs: | - Create and manage bookings for train trips, including passenger details - and optional extras. ", "name": "bookings.yml", "type": "file", @@ -1038,34 +1038,30 @@ docs: | trainsRoot: __package__.yml types: CreateBookingPaymentResponse: - properties: - links: optional extends: - trainsRoot.BookingPayment + properties: + links: optional source: openapi: openapi/trains/openapi.yml +docs: | + Pay for bookings using a card or bank account, and view payment + status and history. + + > warn + > Bookings usually expire within 1 hour so you'll need to make your payment + > before the expiry date service: auth: false base-path: '' + display-name: Payments endpoints: create-booking-payment: - path: /bookings/{bookingId}/payment - method: POST auth: true + display-name: Pay for a Booking docs: >- A payment is an attempt to pay for the booking, which will confirm the booking for the user and enable them to get their tickets. - path-parameters: - bookingId: - type: string - docs: The ID of the booking to pay for. - display-name: Pay for a Booking - request: - body: trainsRoot.BookingPayment - content-type: application/json - response: - docs: Payment successful - type: CreateBookingPaymentResponse errors: - trainsRoot.BadRequestError - trainsRoot.UnauthorizedError @@ -1080,38 +1076,38 @@ service: amount: 49.99 currency: gbp source: - object: card - name: J. Doe - number: '4242424242424242' - cvc: 123 - exp_month: 12 - exp_year: 2025 - address_line1: 123 Fake Street - address_line2: 4th Floor address_city: London address_country: gb + address_line1: 123 Fake Street + address_line2: 4th Floor address_post_code: N12 9XX + cvc: 123 + exp_month: 12 + exp_year: 2025 + name: J. Doe + number: '4242424242424242' + object: card response: body: - id: 2e3b4f5a-6b7c-8d9e-0f1a-2b3c4d5e6f7a amount: 49.99 currency: gbp + id: 2e3b4f5a-6b7c-8d9e-0f1a-2b3c4d5e6f7a + links: + booking: >- + https://api.example.com/bookings/1725ff48-ab45-4bb5-9d02-88745177dedb/payment source: - object: card - name: J. Doe - number: '************4242' - cvc: 123 - exp_month: 12 - exp_year: 2025 - address_line1: source - address_line2: source address_city: source address_country: gb + address_line1: source + address_line2: source address_post_code: N12 9XX + cvc: 123 + exp_month: 12 + exp_year: 2025 + name: J. Doe + number: '************4242' + object: card status: succeeded - links: - booking: >- - https://api.example.com/bookings/1725ff48-ab45-4bb5-9d02-88745177dedb/payment - name: Bank Account Payment path-parameters: bookingId: 1725ff48-ab45-4bb5-9d02-88745177dedb @@ -1119,34 +1115,34 @@ service: amount: 100.5 currency: gbp source: - object: bank_account - name: J. Doe - number: '00012345' - sort_code: '000123' account_type: individual bank_name: Starling Bank country: gb + name: J. Doe + number: '00012345' + object: bank_account + sort_code: '000123' response: body: - id: 2e3b4f5a-6b7c-8d9e-0f1a-2b3c4d5e6f7a amount: 49.99 currency: gbp + id: 2e3b4f5a-6b7c-8d9e-0f1a-2b3c4d5e6f7a + links: + booking: >- + https://api.example.com/bookings/1725ff48-ab45-4bb5-9d02-88745177dedb/payment source: - object: card - name: J. Doe - number: '************4242' - cvc: 123 - exp_month: 12 - exp_year: 2025 - address_line1: source - address_line2: source address_city: source address_country: gb + address_line1: source + address_line2: source address_post_code: N12 9XX + cvc: 123 + exp_month: 12 + exp_year: 2025 + name: J. Doe + number: '************4242' + object: card status: succeeded - links: - booking: >- - https://api.example.com/bookings/1725ff48-ab45-4bb5-9d02-88745177dedb/payment - name: Card Payment 2 path-parameters: bookingId: 1725ff48-ab45-4bb5-9d02-88745177dedb @@ -1154,38 +1150,38 @@ service: amount: 49.99 currency: gbp source: - object: card - name: J. Doe - number: '4242424242424242' - cvc: 123 - exp_month: 12 - exp_year: 2025 - address_line1: 123 Fake Street - address_line2: 4th Floor address_city: London address_country: gb + address_line1: 123 Fake Street + address_line2: 4th Floor address_post_code: N12 9XX + cvc: 123 + exp_month: 12 + exp_year: 2025 + name: J. Doe + number: '4242424242424242' + object: card response: body: - id: 2e3b4f5a-6b7c-8d9e-0f1a-2b3c4d5e6f7a amount: 49.99 currency: gbp + id: 2e3b4f5a-6b7c-8d9e-0f1a-2b3c4d5e6f7a + links: + booking: >- + https://api.example.com/bookings/1725ff48-ab45-4bb5-9d02-88745177dedb/payment source: - object: card - name: J. Doe - number: '************4242' - cvc: 123 - exp_month: 12 - exp_year: 2025 - address_line1: source - address_line2: source address_city: source address_country: gb + address_line1: source + address_line2: source address_post_code: N12 9XX + cvc: 123 + exp_month: 12 + exp_year: 2025 + name: J. Doe + number: '************4242' + object: card status: succeeded - links: - booking: >- - https://api.example.com/bookings/1725ff48-ab45-4bb5-9d02-88745177dedb/payment - name: Bank Account Payment 2 path-parameters: bookingId: 1725ff48-ab45-4bb5-9d02-88745177dedb @@ -1193,44 +1189,48 @@ service: amount: 49.99 currency: gbp source: - object: card - name: J. Doe - number: '4242424242424242' - cvc: 123 - exp_month: 12 - exp_year: 2025 - address_line1: 123 Fake Street - address_line2: 4th Floor address_city: London address_country: gb + address_line1: 123 Fake Street + address_line2: 4th Floor address_post_code: N12 9XX + cvc: 123 + exp_month: 12 + exp_year: 2025 + name: J. Doe + number: '4242424242424242' + object: card response: body: - id: 2e3b4f5a-6b7c-8d9e-0f1a-2b3c4d5e6f7a amount: 100.5 currency: gbp + id: 2e3b4f5a-6b7c-8d9e-0f1a-2b3c4d5e6f7a + links: + booking: >- + https://api.example.com/bookings/1725ff48-ab45-4bb5-9d02-88745177dedb source: - object: bank_account - name: J. Doe - number: '*********2345' - sort_code: '000123' account_type: individual bank_name: Starling Bank country: gb + name: J. Doe + number: '*********2345' + object: bank_account + sort_code: '000123' status: succeeded - links: - booking: >- - https://api.example.com/bookings/1725ff48-ab45-4bb5-9d02-88745177dedb + method: POST + path: /bookings/{bookingId}/payment + path-parameters: + bookingId: + docs: The ID of the booking to pay for. + type: string + request: + body: trainsRoot.BookingPayment + content-type: application/json + response: + docs: Payment successful + type: CreateBookingPaymentResponse source: openapi: openapi/trains/openapi.yml - display-name: Payments -docs: | - Pay for bookings using a card or bank account, and view payment - status and history. - - > warn - > Bookings usually expire within 1 hour so you'll need to make your payment - > before the expiry date ", "name": "payments.yml", "type": "file", @@ -1239,32 +1239,31 @@ docs: | "contents": "imports: trainsRoot: __package__.yml types: - GetStationsResponseLinks: - properties: {} - extends: - - trainsRoot.LinksSelf - - trainsRoot.LinksPagination - source: - openapi: openapi/trains/openapi.yml GetStationsResponse: properties: data: optional> links: optional source: openapi: openapi/trains/openapi.yml + GetStationsResponseLinks: + extends: + - trainsRoot.LinksSelf + - trainsRoot.LinksPagination + properties: {} + source: + openapi: openapi/trains/openapi.yml +docs: | + Find and filter train stations across Europe, including their location + and local timezone. service: auth: false base-path: '' + display-name: Stations endpoints: get-stations: - path: /stations - method: GET auth: true - docs: Returns a list of all train stations in the system. display-name: Get a list of train stations - response: - docs: A list of train stations - type: GetStationsResponse + docs: Returns a list of all train stations in the system. errors: - trainsRoot.BadRequestError - trainsRoot.UnauthorizedError @@ -1275,32 +1274,33 @@ service: - response: body: data: - - id: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e - name: Berlin Hauptbahnhof - address: Invalidenstraße 10557 Berlin, Germany + - address: Invalidenstraße 10557 Berlin, Germany country_code: DE - timezone: Europe/Berlin + id: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e + name: Berlin Hauptbahnhof pet: id: 1000000 name: name - - id: b2e783e1-c824-4d63-b37a-d8d698862f1d - name: Paris Gare du Nord - address: 18 Rue de Dunkerque 75010 Paris, France + timezone: Europe/Berlin + - address: 18 Rue de Dunkerque 75010 Paris, France country_code: FR - timezone: Europe/Paris + id: b2e783e1-c824-4d63-b37a-d8d698862f1d + name: Paris Gare du Nord pet: id: 1000000 name: name + timezone: Europe/Paris links: next: https://api.example.com/stations?page=3 prev: https://api.example.com/stations?page=1 self: https://api.example.com/stations&page=2 + method: GET + path: /stations + response: + docs: A list of train stations + type: GetStationsResponse source: openapi: openapi/trains/openapi.yml - display-name: Stations -docs: | - Find and filter train stations across Europe, including their location - and local timezone. ", "name": "stations.yml", "type": "file", @@ -1309,39 +1309,39 @@ docs: | "contents": "imports: trainsRoot: __package__.yml types: - NewBookingPayloadLinks: - properties: {} - extends: - - trainsRoot.LinksSelf - - trainsRoot.LinksPagination - source: - openapi: openapi/trains/openapi.yml NewBookingPayload: + extends: + - trainsRoot.Booking properties: links: optional + source: + openapi: openapi/trains/openapi.yml + NewBookingPayloadLinks: extends: - - trainsRoot.Booking + - trainsRoot.LinksSelf + - trainsRoot.LinksPagination + properties: {} source: openapi: openapi/trains/openapi.yml webhooks: new-booking: - method: POST display-name: New Booking - headers: {} - payload: NewBookingPayload + docs: > + Subscribe to new bookings being created, to update integrations for your + users. Related data is available via the links provided in the request. examples: - payload: - id: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e - trip_id: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e - passenger_name: John Doe has_bicycle: true has_dog: true + id: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e links: self: >- https://api.example.com/bookings/1725ff48-ab45-4bb5-9d02-88745177dedb - docs: > - Subscribe to new bookings being created, to update integrations for your - users. Related data is available via the links provided in the request. + passenger_name: John Doe + trip_id: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e + headers: {} + method: POST + payload: NewBookingPayload ", "name": "trains.yml", "type": "file", @@ -1350,55 +1350,34 @@ webhooks: "contents": "imports: trainsRoot: __package__.yml types: - GetTripsResponseLinks: - properties: {} - extends: - - trainsRoot.LinksSelf - - trainsRoot.LinksPagination - source: - openapi: openapi/trains/openapi.yml GetTripsResponse: properties: data: optional> links: optional source: openapi: openapi/trains/openapi.yml + GetTripsResponseLinks: + extends: + - trainsRoot.LinksSelf + - trainsRoot.LinksPagination + properties: {} + source: + openapi: openapi/trains/openapi.yml +docs: | + Timetables and routes for train trips between stations, including pricing + and availability. service: auth: false base-path: '' + display-name: Trips endpoints: get-trips: - path: /trips - method: GET auth: true + display-name: Get available train trips docs: >- Returns a list of available train trips between the specified origin and destination stations on the given date, and allows for filtering by bicycle and dog allowances. - display-name: Get available train trips - request: - name: GetTripsRequest - query-parameters: - origin: - type: string - docs: The ID of the origin station - destination: - type: string - docs: The ID of the destination station - date: - type: datetime - docs: >- - The date and time of the trip in ISO 8601 format in origin - station's timezone. - bicycles: - type: optional - docs: Only return trips where bicycles are known to be allowed - dogs: - type: optional - docs: Only return trips where dogs are known to be allowed - response: - docs: A list of available train trips - type: GetTripsResponse errors: - trainsRoot.BadRequestError - trainsRoot.UnauthorizedError @@ -1407,42 +1386,63 @@ service: - trainsRoot.InternalServerError examples: - query-parameters: - origin: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e - destination: b2e783e1-c824-4d63-b37a-d8d698862f1d date: '2024-02-01T09:00:00Z' + destination: b2e783e1-c824-4d63-b37a-d8d698862f1d + origin: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e response: body: data: - - id: ea399ba1-6d95-433f-92d1-83f67b775594 - origin: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e - destination: b2e783e1-c824-4d63-b37a-d8d698862f1d + - arrival_time: '2024-02-01T16:00:00Z' + bicycles_allowed: true departure_time: '2024-02-01T10:00:00Z' - arrival_time: '2024-02-01T16:00:00Z' + destination: b2e783e1-c824-4d63-b37a-d8d698862f1d + dogs_allowed: true + id: ea399ba1-6d95-433f-92d1-83f67b775594 operator: Deutsche Bahn + origin: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e price: 50 + - arrival_time: '2024-02-01T18:00:00Z' bicycles_allowed: true - dogs_allowed: true - - id: 4d67459c-af07-40bb-bb12-178dbb88e09f - origin: b2e783e1-c824-4d63-b37a-d8d698862f1d - destination: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e departure_time: '2024-02-01T12:00:00Z' - arrival_time: '2024-02-01T18:00:00Z' + destination: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e + dogs_allowed: true + id: 4d67459c-af07-40bb-bb12-178dbb88e09f operator: SNCF + origin: b2e783e1-c824-4d63-b37a-d8d698862f1d price: 50 - bicycles_allowed: true - dogs_allowed: true links: next: >- https://api.example.com/trips?origin=efdbb9d1-02c2-4bc3-afb7-6788d8782b1e&destination=b2e783e1-c824-4d63-b37a-d8d698862f1d&date=2024-02-01&page=2 prev: prev self: >- https://api.example.com/trips?origin=efdbb9d1-02c2-4bc3-afb7-6788d8782b1e&destination=b2e783e1-c824-4d63-b37a-d8d698862f1d&date=2024-02-01 + method: GET + path: /trips + request: + name: GetTripsRequest + query-parameters: + bicycles: + docs: Only return trips where bicycles are known to be allowed + type: optional + date: + docs: >- + The date and time of the trip in ISO 8601 format in origin + station's timezone. + type: datetime + destination: + docs: The ID of the destination station + type: string + dogs: + docs: Only return trips where dogs are known to be allowed + type: optional + origin: + docs: The ID of the origin station + type: string + response: + docs: A list of available train trips + type: GetTripsResponse source: openapi: openapi/trains/openapi.yml - display-name: Trips -docs: | - Timetables and routes for train trips between stations, including pricing - and availability. ", "name": "trips.yml", "type": "file", @@ -1463,19 +1463,19 @@ exports[`validate namespaced API from Cohere > namespaced-fleshedout 1`] = ` "type": "file", }, { - "contents": "name: api -error-discrimination: - strategy: status-code -display-name: API Reference -default-environment: Production -environments: - Production: https://api.cohere.com + "contents": "auth: BearerAuthScheme auth-schemes: BearerAuthScheme: scheme: bearer token: env: CO_API_KEY -auth: BearerAuthScheme +default-environment: Production +display-name: API Reference +environments: + Production: https://api.cohere.com +error-discrimination: + strategy: status-code +name: api ", "name": "api.yml", "type": "file", @@ -1484,11 +1484,12 @@ auth: BearerAuthScheme "contents": [ { "contents": "types: + BadRequestErrorBody: + properties: + data: optional + source: + openapi: openapi/cohere.yaml ChatRequestPromptTruncation: - enum: - - 'OFF' - - AUTO - - AUTO_PRESERVE_ORDER docs: > Defaults to \`AUTO\` when \`connectors\` are specified and \`OFF\` in all other cases. @@ -1519,13 +1520,13 @@ auth: BearerAuthScheme Compatible Deployments: - AUTO: Cohere Platform Only - AUTO_PRESERVE_ORDER: Azure, AWS Sagemaker/Bedrock, Private Deployments + enum: + - 'OFF' + - AUTO + - AUTO_PRESERVE_ORDER source: openapi: openapi/cohere.yaml ChatRequestSafetyMode: - enum: - - CONTEXTUAL - - STRICT - - NONE docs: > Used to select the [safety instruction](/docs/safety-modes) inserted into the prompt. Defaults to \`CONTEXTUAL\`. @@ -1544,14 +1545,13 @@ auth: BearerAuthScheme Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments + enum: + - CONTEXTUAL + - STRICT + - NONE source: openapi: openapi/cohere.yaml - BadRequestErrorBody: - properties: - data: optional - source: - openapi: openapi/cohere.yaml - UnauthorizedErrorBody: + ClientClosedRequestErrorBody: properties: data: optional source: @@ -1561,50 +1561,48 @@ auth: BearerAuthScheme data: optional source: openapi: openapi/cohere.yaml - NotFoundErrorBody: + GatewayTimeoutErrorBody: properties: data: optional source: openapi: openapi/cohere.yaml - UnprocessableEntityErrorBody: + InternalServerErrorBody: properties: data: optional source: openapi: openapi/cohere.yaml - TooManyRequestsErrorBody: + NotFoundErrorBody: properties: data: optional source: openapi: openapi/cohere.yaml - ClientClosedRequestErrorBody: + NotImplementedErrorBody: properties: data: optional source: openapi: openapi/cohere.yaml - InternalServerErrorBody: + ServiceUnavailableErrorBody: properties: data: optional source: openapi: openapi/cohere.yaml - NotImplementedErrorBody: + TooManyRequestsErrorBody: properties: data: optional source: openapi: openapi/cohere.yaml - ServiceUnavailableErrorBody: + UnauthorizedErrorBody: properties: data: optional source: openapi: openapi/cohere.yaml - GatewayTimeoutErrorBody: + UnprocessableEntityErrorBody: properties: data: optional source: openapi: openapi/cohere.yaml errors: BadRequestError: - status-code: 400 - type: unknown docs: > This error is returned when the request is not well formed. This could be because: @@ -1613,19 +1611,16 @@ errors: - The request contains an invalid combination of fields examples: - value: {} - UnauthorizedError: - status-code: 401 + status-code: 400 type: unknown - docs: > - This error indicates that the operation attempted to be performed is not - allowed. This could be because: - - The api token is invalid - - The user does not have the necessary permissions + ClientClosedRequestError: + docs: | + This error is returned when a request is cancelled by the user. examples: - value: {} - ForbiddenError: - status-code: 403 + status-code: 499 type: unknown + ForbiddenError: docs: > This error indicates that the operation attempted to be performed is not allowed. This could be because: @@ -1633,143 +1628,186 @@ errors: - The user does not have the necessary permissions examples: - value: {} - NotFoundError: - status-code: 404 - type: unknown - docs: > - This error is returned when a resource is not found. This could be - because: - - The endpoint does not exist - - The resource does not exist eg model id, dataset id - examples: - - value: {} - UnprocessableEntityError: - status-code: 422 + status-code: 403 type: unknown + GatewayTimeoutError: docs: > - This error is returned when the request is not well formed. This could be - because: - - JSON is invalid - - The request is missing required fields - - The request contains an invalid combination of fields - examples: - - value: {} - TooManyRequestsError: - status-code: 429 - type: unknown - docs: Too many requests + This error is returned when a request to the server times out. This could + be due to: + - An internal services taking too long to respond examples: - value: {} - ClientClosedRequestError: - status-code: 499 + status-code: 504 type: unknown + InternalServerError: docs: | - This error is returned when a request is cancelled by the user. + This error is returned when an uncategorised internal server error occurs. examples: - value: {} - InternalServerError: status-code: 500 type: unknown - docs: | - This error is returned when an uncategorised internal server error occurs. + NotFoundError: + docs: > + This error is returned when a resource is not found. This could be + because: + - The endpoint does not exist + - The resource does not exist eg model id, dataset id examples: - value: {} - NotImplementedError: - status-code: 501 + status-code: 404 type: unknown + NotImplementedError: docs: | This error is returned when the requested feature is not implemented. examples: - value: {} - ServiceUnavailableError: - status-code: 503 + status-code: 501 type: unknown + ServiceUnavailableError: docs: > This error is returned when the service is unavailable. This could be due to: - Too many users trying to access the service at the same time examples: - value: {} - GatewayTimeoutError: - status-code: 504 + status-code: 503 + type: unknown + TooManyRequestsError: + docs: Too many requests + examples: + - value: {} + status-code: 429 type: unknown + UnauthorizedError: docs: > - This error is returned when a request to the server times out. This could - be due to: - - An internal services taking too long to respond + This error indicates that the operation attempted to be performed is not + allowed. This could be because: + - The api token is invalid + - The user does not have the necessary permissions + examples: + - value: {} + status-code: 401 + type: unknown + UnprocessableEntityError: + docs: > + This error is returned when the request is not well formed. This could be + because: + - JSON is invalid + - The request is missing required fields + - The request contains an invalid combination of fields examples: - value: {} + status-code: 422 + type: unknown service: auth: false base-path: '' endpoints: chat: - path: /v1/chat - method: POST + audiences: + - public auth: true + display-name: Chat docs: > Generates a text response to a user message. To learn how to use the Chat API and RAG follow our [Text Generation guides](https://docs.cohere.com/docs/chat-api). - display-name: Chat + errors: + - BadRequestError + - UnauthorizedError + - ForbiddenError + - NotFoundError + - UnprocessableEntityError + - TooManyRequestsError + - ClientClosedRequestError + - InternalServerError + - NotImplementedError + - ServiceUnavailableError + - GatewayTimeoutError + examples: + - request: + message: message + response: + body: + - string + method: POST + path: /v1/chat request: - name: ChatRequest - headers: - Accepts: - type: optional> - name: accepts - docs: > - Pass text/event-stream to receive the streamed response as - server-sent events. The default is \`\\n\` delimited events. body: properties: - message: - type: string + chat_history: + audiences: + - public docs: > - Text input for the model to respond to. + A list of previous messages between the user and the model, + giving the model conversational context for responding to the + user's \`message\`. + + + Each item represents a single message in the chat history, + excluding the current user turn. It has two properties: \`role\` + and \`message\`. The \`role\` identifies the sender (\`CHATBOT\`, + \`SYSTEM\`, or \`USER\`), while the \`message\` contains the text + content. + + + The chat_history parameter should not be used for \`SYSTEM\` + messages in most cases. Instead, to add a \`SYSTEM\` role message + at the beginning of a conversation, the \`preamble\` parameter + should be used. Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments + type: optional> + conversation_id: audiences: - public - model: - type: optional docs: > - Defaults to \`command-r-plus-08-2024\`. + An alternative to \`chat_history\`. - The name of a compatible [Cohere - model](https://docs.cohere.com/docs/models) or the ID of a - [fine-tuned](https://docs.cohere.com/docs/chat-fine-tuning) - model. + Providing a \`conversation_id\` creates or resumes a persisted + conversation with the specified ID. The ID can be any non empty + string. - Compatible Deployments: Cohere Platform, Private Deployments + Compatible Deployments: Cohere Platform + type: optional + force_single_step: audiences: - public - stream: + docs: Forces the chat to be single step. Defaults to \`false\`. type: optional + message: + audiences: + - public docs: > - Defaults to \`false\`. + Text input for the model to respond to. - When \`true\`, the response will be a JSON stream of events. The - final event will contain the complete response, and will have an - \`event_type\` of \`"stream-end"\`. + Compatible Deployments: Cohere Platform, Azure, AWS + Sagemaker/Bedrock, Private Deployments + type: string + model: + audiences: + - public + docs: > + Defaults to \`command-r-plus-08-2024\`. - Streaming is beneficial for user interfaces that render the - contents of the response piece by piece, as it gets generated. + The name of a compatible [Cohere + model](https://docs.cohere.com/docs/models) or the ID of a + [fine-tuned](https://docs.cohere.com/docs/chat-fine-tuning) + model. - Compatible Deployments: Cohere Platform, Azure, AWS - Sagemaker/Bedrock, Private Deployments + Compatible Deployments: Cohere Platform, Private Deployments + type: optional + preamble: audiences: - public - preamble: - type: optional docs: > When specified, the default Cohere preamble will be replaced with the provided one. Preambles are a part of the prompt used @@ -1786,49 +1824,10 @@ service: Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - audiences: - - public - chat_history: - type: optional> - docs: > - A list of previous messages between the user and the model, - giving the model conversational context for responding to the - user's \`message\`. - - - Each item represents a single message in the chat history, - excluding the current user turn. It has two properties: \`role\` - and \`message\`. The \`role\` identifies the sender (\`CHATBOT\`, - \`SYSTEM\`, or \`USER\`), while the \`message\` contains the text - content. - - - The chat_history parameter should not be used for \`SYSTEM\` - messages in most cases. Instead, to add a \`SYSTEM\` role message - at the beginning of a conversation, the \`preamble\` parameter - should be used. - - - Compatible Deployments: Cohere Platform, Azure, AWS - Sagemaker/Bedrock, Private Deployments - audiences: - - public - conversation_id: type: optional - docs: > - An alternative to \`chat_history\`. - - - Providing a \`conversation_id\` creates or resumes a persisted - conversation with the specified ID. The ID can be any non empty - string. - - - Compatible Deployments: Cohere Platform + prompt_truncation: audiences: - public - prompt_truncation: - type: optional docs: > Defaults to \`AUTO\` when \`connectors\` are specified and \`OFF\` in all other cases. @@ -1860,15 +1859,11 @@ service: Compatible Deployments: - AUTO: Cohere Platform Only - AUTO_PRESERVE_ORDER: Azure, AWS Sagemaker/Bedrock, Private Deployments + type: optional + safety_mode: audiences: - public - force_single_step: - type: optional - docs: Forces the chat to be single step. Defaults to \`false\`. - audiences: - - public - safety_mode: - type: optional + availability: pre-release docs: > Used to select the [safety instruction](/docs/safety-modes) inserted into the prompt. Defaults to \`CONTEXTUAL\`. @@ -1881,40 +1876,45 @@ service: \`tools\`, \`tool_results\` and \`documents\` parameters. - **Note**: This parameter is only compatible with models [Command - R 08-2024](/docs/command-r#august-2024-release), [Command R+ - 08-2024](/docs/command-r-plus#august-2024-release) and newer. + **Note**: This parameter is only compatible with models [Command + R 08-2024](/docs/command-r#august-2024-release), [Command R+ + 08-2024](/docs/command-r-plus#august-2024-release) and newer. + + + Compatible Deployments: Cohere Platform, Azure, AWS + Sagemaker/Bedrock, Private Deployments + type: optional + stream: + audiences: + - public + docs: > + Defaults to \`false\`. + + + When \`true\`, the response will be a JSON stream of events. The + final event will contain the complete response, and will have an + \`event_type\` of \`"stream-end"\`. + + + Streaming is beneficial for user interfaces that render the + contents of the response piece by piece, as it gets generated. Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - audiences: - - public - availability: pre-release + type: optional content-type: application/json + headers: + Accepts: + docs: > + Pass text/event-stream to receive the streamed response as + server-sent events. The default is \`\\n\` delimited events. + name: accepts + type: optional> + name: ChatRequest response: docs: OK type: list - errors: - - BadRequestError - - UnauthorizedError - - ForbiddenError - - NotFoundError - - UnprocessableEntityError - - TooManyRequestsError - - ClientClosedRequestError - - InternalServerError - - NotImplementedError - - ServiceUnavailableError - - GatewayTimeoutError - examples: - - request: - message: message - response: - body: - - string - audiences: - - public source: openapi: openapi/cohere.yaml ", @@ -1934,7 +1934,7 @@ service: data: optional source: openapi: openapi/cohere-v2.yaml - UnauthorizedErrorBody: + ClientClosedRequestErrorBody: properties: data: optional source: @@ -1944,50 +1944,48 @@ service: data: optional source: openapi: openapi/cohere-v2.yaml - NotFoundErrorBody: + GatewayTimeoutErrorBody: properties: data: optional source: openapi: openapi/cohere-v2.yaml - UnprocessableEntityErrorBody: + InternalServerErrorBody: properties: data: optional source: openapi: openapi/cohere-v2.yaml - TooManyRequestsErrorBody: + NotFoundErrorBody: properties: data: optional source: openapi: openapi/cohere-v2.yaml - ClientClosedRequestErrorBody: + NotImplementedErrorBody: properties: data: optional source: openapi: openapi/cohere-v2.yaml - InternalServerErrorBody: + ServiceUnavailableErrorBody: properties: data: optional source: openapi: openapi/cohere-v2.yaml - NotImplementedErrorBody: + TooManyRequestsErrorBody: properties: data: optional source: openapi: openapi/cohere-v2.yaml - ServiceUnavailableErrorBody: + UnauthorizedErrorBody: properties: data: optional source: openapi: openapi/cohere-v2.yaml - GatewayTimeoutErrorBody: + UnprocessableEntityErrorBody: properties: data: optional source: openapi: openapi/cohere-v2.yaml errors: BadRequestError: - status-code: 400 - type: unknown docs: > This error is returned when the request is not well formed. This could be because: @@ -1996,19 +1994,16 @@ errors: - The request contains an invalid combination of fields examples: - value: {} - UnauthorizedError: - status-code: 401 + status-code: 400 type: unknown - docs: > - This error indicates that the operation attempted to be performed is not - allowed. This could be because: - - The api token is invalid - - The user does not have the necessary permissions + ClientClosedRequestError: + docs: | + This error is returned when a request is cancelled by the user. examples: - value: {} - ForbiddenError: - status-code: 403 + status-code: 499 type: unknown + ForbiddenError: docs: > This error indicates that the operation attempted to be performed is not allowed. This could be because: @@ -2016,83 +2011,86 @@ errors: - The user does not have the necessary permissions examples: - value: {} - NotFoundError: - status-code: 404 - type: unknown - docs: > - This error is returned when a resource is not found. This could be - because: - - The endpoint does not exist - - The resource does not exist eg model id, dataset id - examples: - - value: {} - UnprocessableEntityError: - status-code: 422 + status-code: 403 type: unknown + GatewayTimeoutError: docs: > - This error is returned when the request is not well formed. This could be - because: - - JSON is invalid - - The request is missing required fields - - The request contains an invalid combination of fields - examples: - - value: {} - TooManyRequestsError: - status-code: 429 - type: unknown - docs: Too many requests + This error is returned when a request to the server times out. This could + be due to: + - An internal services taking too long to respond examples: - value: {} - ClientClosedRequestError: - status-code: 499 + status-code: 504 type: unknown + InternalServerError: docs: | - This error is returned when a request is cancelled by the user. + This error is returned when an uncategorised internal server error occurs. examples: - value: {} - InternalServerError: status-code: 500 type: unknown - docs: | - This error is returned when an uncategorised internal server error occurs. + NotFoundError: + docs: > + This error is returned when a resource is not found. This could be + because: + - The endpoint does not exist + - The resource does not exist eg model id, dataset id examples: - value: {} - NotImplementedError: - status-code: 501 + status-code: 404 type: unknown + NotImplementedError: docs: | This error is returned when the requested feature is not implemented. examples: - value: {} - ServiceUnavailableError: - status-code: 503 + status-code: 501 type: unknown + ServiceUnavailableError: docs: > This error is returned when the service is unavailable. This could be due to: - Too many users trying to access the service at the same time examples: - value: {} - GatewayTimeoutError: - status-code: 504 + status-code: 503 + type: unknown + TooManyRequestsError: + docs: Too many requests + examples: + - value: {} + status-code: 429 type: unknown + UnauthorizedError: docs: > - This error is returned when a request to the server times out. This could - be due to: - - An internal services taking too long to respond + This error indicates that the operation attempted to be performed is not + allowed. This could be because: + - The api token is invalid + - The user does not have the necessary permissions examples: - value: {} + status-code: 401 + type: unknown + UnprocessableEntityError: + docs: > + This error is returned when the request is not well formed. This could be + because: + - JSON is invalid + - The request is missing required fields + - The request contains an invalid combination of fields + examples: + - value: {} + status-code: 422 + type: unknown ", "name": "__package__.yml", "type": "file", }, { - "contents": "types: + "contents": "imports: + v2Root: __package__.yml +types: V2ChatRequestSafetyMode: - enum: - - CONTEXTUAL - - STRICT - - NONE docs: > Used to select the [safety instruction](/docs/safety-modes) inserted into the prompt. Defaults to \`CONTEXTUAL\`. @@ -2111,43 +2109,72 @@ errors: Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments + enum: + - CONTEXTUAL + - STRICT + - NONE source: openapi: openapi/cohere-v2.yaml -imports: - v2Root: __package__.yml service: auth: false base-path: '' endpoints: chat: - path: /v2/chat - method: POST + audiences: + - v2-beta auth: true + display-name: Chat with the model docs: > Generates a message from the model in response to a provided conversation. To learn how to use the Chat API with Streaming and RAG follow our Text Generation guides. - display-name: Chat with the model + errors: + - v2Root.BadRequestError + - v2Root.UnauthorizedError + - v2Root.ForbiddenError + - v2Root.NotFoundError + - v2Root.UnprocessableEntityError + - v2Root.TooManyRequestsError + - v2Root.ClientClosedRequestError + - v2Root.InternalServerError + - v2Root.NotImplementedError + - v2Root.ServiceUnavailableError + - v2Root.GatewayTimeoutError + examples: + - request: + model: model + response: + body: + - string + method: POST + path: /v2/chat request: - name: V2ChatRequest body: properties: + documents: + docs: > + A list of relevant documents that the model can cite to generate + a more accurate reply. Each document is either a string or + document object with content and metadata. + type: optional> + max_tokens: + docs: > + The maximum number of tokens the model will generate as part of + the response. Note: Setting a low value may result in incomplete + generations. + type: optional model: - type: string docs: >- The name of a compatible [Cohere model](https://docs.cohere.com/docs/models) (such as command-r or command-r-plus) or the ID of a [fine-tuned](https://docs.cohere.com/docs/chat-fine-tuning) model. - documents: - type: optional> - docs: > - A list of relevant documents that the model can cite to generate - a more accurate reply. Each document is either a string or - document object with content and metadata. + type: string + return_prompt: + docs: Whether to return the prompt in the response. + type: optional safety_mode: - type: optional docs: > Used to select the [safety instruction](/docs/safety-modes) inserted into the prompt. Defaults to \`CONTEXTUAL\`. @@ -2167,22 +2194,16 @@ service: Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - max_tokens: - type: optional - docs: > - The maximum number of tokens the model will generate as part of - the response. Note: Setting a low value may result in incomplete - generations. + type: optional stop_sequences: - type: optional> docs: > A list of up to 5 strings that the model will use to stop generation. If the model generates a string that matches any of the strings in the list, it will stop generating tokens and return the generated text up to that point not including the stop sequence. + type: optional> temperature: - type: optional docs: > Defaults to \`0.3\`. @@ -2194,33 +2215,12 @@ service: Randomness can be further maximized by increasing the value of the \`p\` parameter. - return_prompt: - type: optional - docs: Whether to return the prompt in the response. + type: optional content-type: application/json + name: V2ChatRequest response: docs: OK type: list - errors: - - v2Root.BadRequestError - - v2Root.UnauthorizedError - - v2Root.ForbiddenError - - v2Root.NotFoundError - - v2Root.UnprocessableEntityError - - v2Root.TooManyRequestsError - - v2Root.ClientClosedRequestError - - v2Root.InternalServerError - - v2Root.NotImplementedError - - v2Root.ServiceUnavailableError - - v2Root.GatewayTimeoutError - examples: - - request: - model: model - response: - body: - - string - audiences: - - v2-beta source: openapi: openapi/cohere-v2.yaml ", diff --git a/packages/cli/ete-tests/src/tests/write-definition/fixtures/header-overrides/fern/.definition/__package__.yml b/packages/cli/ete-tests/src/tests/write-definition/fixtures/header-overrides/fern/.definition/__package__.yml index 4f2c9816dd5..2a50910519a 100644 --- a/packages/cli/ete-tests/src/tests/write-definition/fixtures/header-overrides/fern/.definition/__package__.yml +++ b/packages/cli/ete-tests/src/tests/write-definition/fixtures/header-overrides/fern/.definition/__package__.yml @@ -1,4 +1,10 @@ types: + Error: + properties: + code: integer + message: string + source: + openapi: openapi/openapi.yml Pet: properties: id: long @@ -7,9 +13,3 @@ types: source: openapi: openapi/openapi.yml Pets: list - Error: - properties: - code: integer - message: string - source: - openapi: openapi/openapi.yml diff --git a/packages/cli/ete-tests/src/tests/write-definition/fixtures/header-overrides/fern/.definition/api.yml b/packages/cli/ete-tests/src/tests/write-definition/fixtures/header-overrides/fern/.definition/api.yml index 83ac41e9b2d..63bdc0012de 100644 --- a/packages/cli/ete-tests/src/tests/write-definition/fixtures/header-overrides/fern/.definition/api.yml +++ b/packages/cli/ete-tests/src/tests/write-definition/fixtures/header-overrides/fern/.definition/api.yml @@ -1,9 +1,9 @@ -name: api -error-discrimination: - strategy: status-code +default-environment: Default display-name: Swagger Petstore environments: Default: http://petstore.swagger.io/v1 -default-environment: Default +error-discrimination: + strategy: status-code headers: X-Dummy-Header: optional +name: api diff --git a/packages/cli/ete-tests/src/tests/write-definition/fixtures/header-overrides/fern/.definition/pets.yml b/packages/cli/ete-tests/src/tests/write-definition/fixtures/header-overrides/fern/.definition/pets.yml index ddf187ef9e0..6a039b73ec2 100644 --- a/packages/cli/ete-tests/src/tests/write-definition/fixtures/header-overrides/fern/.definition/pets.yml +++ b/packages/cli/ete-tests/src/tests/write-definition/fixtures/header-overrides/fern/.definition/pets.yml @@ -4,45 +4,36 @@ service: auth: false base-path: '' endpoints: - listPets: + createPets: + auth: false + display-name: Create a pet + examples: + - {} + method: POST path: /pets - method: GET + listPets: auth: false display-name: List all pets + examples: + - response: + body: + - id: 1000000 + name: name + tag: tag + method: GET + path: /pets request: name: ListPetsRequest query-parameters: limit: - type: optional docs: How many items to return at one time (max 100) + type: optional response: docs: A paged array of pets type: root.Pets - examples: - - response: - body: - - id: 1000000 - name: name - tag: tag - createPets: - path: /pets - method: POST - auth: false - display-name: Create a pet - examples: - - {} showPetById: - path: /pets/{petId} - method: GET auth: false - path-parameters: - petId: - type: string - docs: The id of the pet to retrieve display-name: Info for a specific pet - response: - docs: Expected response to a valid request - type: root.Pet examples: - path-parameters: petId: petId @@ -51,5 +42,14 @@ service: id: 1000000 name: name tag: tag + method: GET + path: /pets/{petId} + path-parameters: + petId: + docs: The id of the pet to retrieve + type: string + response: + docs: Expected response to a valid request + type: root.Pet source: openapi: openapi/openapi.yml diff --git a/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced-fleshedout/fern/.definition/api.yml b/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced-fleshedout/fern/.definition/api.yml index 9f1a3a3f976..d799f02baaa 100644 --- a/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced-fleshedout/fern/.definition/api.yml +++ b/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced-fleshedout/fern/.definition/api.yml @@ -1,13 +1,13 @@ -name: api -error-discrimination: - strategy: status-code -display-name: API Reference -default-environment: Production -environments: - Production: https://api.cohere.com +auth: BearerAuthScheme auth-schemes: BearerAuthScheme: scheme: bearer token: env: CO_API_KEY -auth: BearerAuthScheme +default-environment: Production +display-name: API Reference +environments: + Production: https://api.cohere.com +error-discrimination: + strategy: status-code +name: api diff --git a/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced-fleshedout/fern/.definition/v1/__package__.yml b/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced-fleshedout/fern/.definition/v1/__package__.yml index 053e15c114d..72f57996285 100644 --- a/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced-fleshedout/fern/.definition/v1/__package__.yml +++ b/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced-fleshedout/fern/.definition/v1/__package__.yml @@ -1,9 +1,10 @@ types: + BadRequestErrorBody: + properties: + data: optional + source: + openapi: openapi/cohere.yaml ChatRequestPromptTruncation: - enum: - - 'OFF' - - AUTO - - AUTO_PRESERVE_ORDER docs: > Defaults to `AUTO` when `connectors` are specified and `OFF` in all other cases. @@ -34,13 +35,13 @@ types: Compatible Deployments: - AUTO: Cohere Platform Only - AUTO_PRESERVE_ORDER: Azure, AWS Sagemaker/Bedrock, Private Deployments + enum: + - 'OFF' + - AUTO + - AUTO_PRESERVE_ORDER source: openapi: openapi/cohere.yaml ChatRequestSafetyMode: - enum: - - CONTEXTUAL - - STRICT - - NONE docs: > Used to select the [safety instruction](/docs/safety-modes) inserted into the prompt. Defaults to `CONTEXTUAL`. @@ -59,14 +60,13 @@ types: Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments + enum: + - CONTEXTUAL + - STRICT + - NONE source: openapi: openapi/cohere.yaml - BadRequestErrorBody: - properties: - data: optional - source: - openapi: openapi/cohere.yaml - UnauthorizedErrorBody: + ClientClosedRequestErrorBody: properties: data: optional source: @@ -76,50 +76,48 @@ types: data: optional source: openapi: openapi/cohere.yaml - NotFoundErrorBody: + GatewayTimeoutErrorBody: properties: data: optional source: openapi: openapi/cohere.yaml - UnprocessableEntityErrorBody: + InternalServerErrorBody: properties: data: optional source: openapi: openapi/cohere.yaml - TooManyRequestsErrorBody: + NotFoundErrorBody: properties: data: optional source: openapi: openapi/cohere.yaml - ClientClosedRequestErrorBody: + NotImplementedErrorBody: properties: data: optional source: openapi: openapi/cohere.yaml - InternalServerErrorBody: + ServiceUnavailableErrorBody: properties: data: optional source: openapi: openapi/cohere.yaml - NotImplementedErrorBody: + TooManyRequestsErrorBody: properties: data: optional source: openapi: openapi/cohere.yaml - ServiceUnavailableErrorBody: + UnauthorizedErrorBody: properties: data: optional source: openapi: openapi/cohere.yaml - GatewayTimeoutErrorBody: + UnprocessableEntityErrorBody: properties: data: optional source: openapi: openapi/cohere.yaml errors: BadRequestError: - status-code: 400 - type: unknown docs: > This error is returned when the request is not well formed. This could be because: @@ -128,19 +126,16 @@ errors: - The request contains an invalid combination of fields examples: - value: {} - UnauthorizedError: - status-code: 401 + status-code: 400 type: unknown - docs: > - This error indicates that the operation attempted to be performed is not - allowed. This could be because: - - The api token is invalid - - The user does not have the necessary permissions + ClientClosedRequestError: + docs: | + This error is returned when a request is cancelled by the user. examples: - value: {} - ForbiddenError: - status-code: 403 + status-code: 499 type: unknown + ForbiddenError: docs: > This error indicates that the operation attempted to be performed is not allowed. This could be because: @@ -148,143 +143,186 @@ errors: - The user does not have the necessary permissions examples: - value: {} - NotFoundError: - status-code: 404 - type: unknown - docs: > - This error is returned when a resource is not found. This could be - because: - - The endpoint does not exist - - The resource does not exist eg model id, dataset id - examples: - - value: {} - UnprocessableEntityError: - status-code: 422 + status-code: 403 type: unknown + GatewayTimeoutError: docs: > - This error is returned when the request is not well formed. This could be - because: - - JSON is invalid - - The request is missing required fields - - The request contains an invalid combination of fields - examples: - - value: {} - TooManyRequestsError: - status-code: 429 - type: unknown - docs: Too many requests + This error is returned when a request to the server times out. This could + be due to: + - An internal services taking too long to respond examples: - value: {} - ClientClosedRequestError: - status-code: 499 + status-code: 504 type: unknown + InternalServerError: docs: | - This error is returned when a request is cancelled by the user. + This error is returned when an uncategorised internal server error occurs. examples: - value: {} - InternalServerError: status-code: 500 type: unknown - docs: | - This error is returned when an uncategorised internal server error occurs. + NotFoundError: + docs: > + This error is returned when a resource is not found. This could be + because: + - The endpoint does not exist + - The resource does not exist eg model id, dataset id examples: - value: {} - NotImplementedError: - status-code: 501 + status-code: 404 type: unknown + NotImplementedError: docs: | This error is returned when the requested feature is not implemented. examples: - value: {} - ServiceUnavailableError: - status-code: 503 + status-code: 501 type: unknown + ServiceUnavailableError: docs: > This error is returned when the service is unavailable. This could be due to: - Too many users trying to access the service at the same time examples: - value: {} - GatewayTimeoutError: - status-code: 504 + status-code: 503 type: unknown + TooManyRequestsError: + docs: Too many requests + examples: + - value: {} + status-code: 429 + type: unknown + UnauthorizedError: docs: > - This error is returned when a request to the server times out. This could - be due to: - - An internal services taking too long to respond + This error indicates that the operation attempted to be performed is not + allowed. This could be because: + - The api token is invalid + - The user does not have the necessary permissions examples: - value: {} + status-code: 401 + type: unknown + UnprocessableEntityError: + docs: > + This error is returned when the request is not well formed. This could be + because: + - JSON is invalid + - The request is missing required fields + - The request contains an invalid combination of fields + examples: + - value: {} + status-code: 422 + type: unknown service: auth: false base-path: '' endpoints: chat: - path: /v1/chat - method: POST + audiences: + - public auth: true + display-name: Chat docs: > Generates a text response to a user message. To learn how to use the Chat API and RAG follow our [Text Generation guides](https://docs.cohere.com/docs/chat-api). - display-name: Chat + errors: + - BadRequestError + - UnauthorizedError + - ForbiddenError + - NotFoundError + - UnprocessableEntityError + - TooManyRequestsError + - ClientClosedRequestError + - InternalServerError + - NotImplementedError + - ServiceUnavailableError + - GatewayTimeoutError + examples: + - request: + message: message + response: + body: + - string + method: POST + path: /v1/chat request: - name: ChatRequest - headers: - Accepts: - type: optional> - name: accepts - docs: > - Pass text/event-stream to receive the streamed response as - server-sent events. The default is `\n` delimited events. body: properties: - message: - type: string + chat_history: + audiences: + - public docs: > - Text input for the model to respond to. + A list of previous messages between the user and the model, + giving the model conversational context for responding to the + user's `message`. + + + Each item represents a single message in the chat history, + excluding the current user turn. It has two properties: `role` + and `message`. The `role` identifies the sender (`CHATBOT`, + `SYSTEM`, or `USER`), while the `message` contains the text + content. + + + The chat_history parameter should not be used for `SYSTEM` + messages in most cases. Instead, to add a `SYSTEM` role message + at the beginning of a conversation, the `preamble` parameter + should be used. Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments + type: optional> + conversation_id: audiences: - public - model: - type: optional docs: > - Defaults to `command-r-plus-08-2024`. + An alternative to `chat_history`. - The name of a compatible [Cohere - model](https://docs.cohere.com/docs/models) or the ID of a - [fine-tuned](https://docs.cohere.com/docs/chat-fine-tuning) - model. + Providing a `conversation_id` creates or resumes a persisted + conversation with the specified ID. The ID can be any non empty + string. - Compatible Deployments: Cohere Platform, Private Deployments + Compatible Deployments: Cohere Platform + type: optional + force_single_step: audiences: - public - stream: + docs: Forces the chat to be single step. Defaults to `false`. type: optional + message: + audiences: + - public docs: > - Defaults to `false`. + Text input for the model to respond to. - When `true`, the response will be a JSON stream of events. The - final event will contain the complete response, and will have an - `event_type` of `"stream-end"`. + Compatible Deployments: Cohere Platform, Azure, AWS + Sagemaker/Bedrock, Private Deployments + type: string + model: + audiences: + - public + docs: > + Defaults to `command-r-plus-08-2024`. - Streaming is beneficial for user interfaces that render the - contents of the response piece by piece, as it gets generated. + The name of a compatible [Cohere + model](https://docs.cohere.com/docs/models) or the ID of a + [fine-tuned](https://docs.cohere.com/docs/chat-fine-tuning) + model. - Compatible Deployments: Cohere Platform, Azure, AWS - Sagemaker/Bedrock, Private Deployments + Compatible Deployments: Cohere Platform, Private Deployments + type: optional + preamble: audiences: - public - preamble: - type: optional docs: > When specified, the default Cohere preamble will be replaced with the provided one. Preambles are a part of the prompt used @@ -301,49 +339,10 @@ service: Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - audiences: - - public - chat_history: - type: optional> - docs: > - A list of previous messages between the user and the model, - giving the model conversational context for responding to the - user's `message`. - - - Each item represents a single message in the chat history, - excluding the current user turn. It has two properties: `role` - and `message`. The `role` identifies the sender (`CHATBOT`, - `SYSTEM`, or `USER`), while the `message` contains the text - content. - - - The chat_history parameter should not be used for `SYSTEM` - messages in most cases. Instead, to add a `SYSTEM` role message - at the beginning of a conversation, the `preamble` parameter - should be used. - - - Compatible Deployments: Cohere Platform, Azure, AWS - Sagemaker/Bedrock, Private Deployments - audiences: - - public - conversation_id: type: optional - docs: > - An alternative to `chat_history`. - - - Providing a `conversation_id` creates or resumes a persisted - conversation with the specified ID. The ID can be any non empty - string. - - - Compatible Deployments: Cohere Platform + prompt_truncation: audiences: - public - prompt_truncation: - type: optional docs: > Defaults to `AUTO` when `connectors` are specified and `OFF` in all other cases. @@ -375,15 +374,11 @@ service: Compatible Deployments: - AUTO: Cohere Platform Only - AUTO_PRESERVE_ORDER: Azure, AWS Sagemaker/Bedrock, Private Deployments + type: optional + safety_mode: audiences: - public - force_single_step: - type: optional - docs: Forces the chat to be single step. Defaults to `false`. - audiences: - - public - safety_mode: - type: optional + availability: pre-release docs: > Used to select the [safety instruction](/docs/safety-modes) inserted into the prompt. Defaults to `CONTEXTUAL`. @@ -403,32 +398,37 @@ service: Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments + type: optional + stream: audiences: - public - availability: pre-release + docs: > + Defaults to `false`. + + + When `true`, the response will be a JSON stream of events. The + final event will contain the complete response, and will have an + `event_type` of `"stream-end"`. + + + Streaming is beneficial for user interfaces that render the + contents of the response piece by piece, as it gets generated. + + + Compatible Deployments: Cohere Platform, Azure, AWS + Sagemaker/Bedrock, Private Deployments + type: optional content-type: application/json + headers: + Accepts: + docs: > + Pass text/event-stream to receive the streamed response as + server-sent events. The default is `\n` delimited events. + name: accepts + type: optional> + name: ChatRequest response: docs: OK type: list - errors: - - BadRequestError - - UnauthorizedError - - ForbiddenError - - NotFoundError - - UnprocessableEntityError - - TooManyRequestsError - - ClientClosedRequestError - - InternalServerError - - NotImplementedError - - ServiceUnavailableError - - GatewayTimeoutError - examples: - - request: - message: message - response: - body: - - string - audiences: - - public source: openapi: openapi/cohere.yaml diff --git a/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced-fleshedout/fern/.definition/v2/__package__.yml b/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced-fleshedout/fern/.definition/v2/__package__.yml index 5467ef82edc..2362add6cf5 100644 --- a/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced-fleshedout/fern/.definition/v2/__package__.yml +++ b/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced-fleshedout/fern/.definition/v2/__package__.yml @@ -4,7 +4,7 @@ types: data: optional source: openapi: openapi/cohere-v2.yaml - UnauthorizedErrorBody: + ClientClosedRequestErrorBody: properties: data: optional source: @@ -14,50 +14,48 @@ types: data: optional source: openapi: openapi/cohere-v2.yaml - NotFoundErrorBody: + GatewayTimeoutErrorBody: properties: data: optional source: openapi: openapi/cohere-v2.yaml - UnprocessableEntityErrorBody: + InternalServerErrorBody: properties: data: optional source: openapi: openapi/cohere-v2.yaml - TooManyRequestsErrorBody: + NotFoundErrorBody: properties: data: optional source: openapi: openapi/cohere-v2.yaml - ClientClosedRequestErrorBody: + NotImplementedErrorBody: properties: data: optional source: openapi: openapi/cohere-v2.yaml - InternalServerErrorBody: + ServiceUnavailableErrorBody: properties: data: optional source: openapi: openapi/cohere-v2.yaml - NotImplementedErrorBody: + TooManyRequestsErrorBody: properties: data: optional source: openapi: openapi/cohere-v2.yaml - ServiceUnavailableErrorBody: + UnauthorizedErrorBody: properties: data: optional source: openapi: openapi/cohere-v2.yaml - GatewayTimeoutErrorBody: + UnprocessableEntityErrorBody: properties: data: optional source: openapi: openapi/cohere-v2.yaml errors: BadRequestError: - status-code: 400 - type: unknown docs: > This error is returned when the request is not well formed. This could be because: @@ -66,19 +64,16 @@ errors: - The request contains an invalid combination of fields examples: - value: {} - UnauthorizedError: - status-code: 401 + status-code: 400 type: unknown - docs: > - This error indicates that the operation attempted to be performed is not - allowed. This could be because: - - The api token is invalid - - The user does not have the necessary permissions + ClientClosedRequestError: + docs: | + This error is returned when a request is cancelled by the user. examples: - value: {} - ForbiddenError: - status-code: 403 + status-code: 499 type: unknown + ForbiddenError: docs: > This error indicates that the operation attempted to be performed is not allowed. This could be because: @@ -86,69 +81,74 @@ errors: - The user does not have the necessary permissions examples: - value: {} - NotFoundError: - status-code: 404 - type: unknown - docs: > - This error is returned when a resource is not found. This could be - because: - - The endpoint does not exist - - The resource does not exist eg model id, dataset id - examples: - - value: {} - UnprocessableEntityError: - status-code: 422 + status-code: 403 type: unknown + GatewayTimeoutError: docs: > - This error is returned when the request is not well formed. This could be - because: - - JSON is invalid - - The request is missing required fields - - The request contains an invalid combination of fields - examples: - - value: {} - TooManyRequestsError: - status-code: 429 - type: unknown - docs: Too many requests + This error is returned when a request to the server times out. This could + be due to: + - An internal services taking too long to respond examples: - value: {} - ClientClosedRequestError: - status-code: 499 + status-code: 504 type: unknown + InternalServerError: docs: | - This error is returned when a request is cancelled by the user. + This error is returned when an uncategorised internal server error occurs. examples: - value: {} - InternalServerError: status-code: 500 type: unknown - docs: | - This error is returned when an uncategorised internal server error occurs. + NotFoundError: + docs: > + This error is returned when a resource is not found. This could be + because: + - The endpoint does not exist + - The resource does not exist eg model id, dataset id examples: - value: {} - NotImplementedError: - status-code: 501 + status-code: 404 type: unknown + NotImplementedError: docs: | This error is returned when the requested feature is not implemented. examples: - value: {} - ServiceUnavailableError: - status-code: 503 + status-code: 501 type: unknown + ServiceUnavailableError: docs: > This error is returned when the service is unavailable. This could be due to: - Too many users trying to access the service at the same time examples: - value: {} - GatewayTimeoutError: - status-code: 504 + status-code: 503 + type: unknown + TooManyRequestsError: + docs: Too many requests + examples: + - value: {} + status-code: 429 type: unknown + UnauthorizedError: docs: > - This error is returned when a request to the server times out. This could - be due to: - - An internal services taking too long to respond + This error indicates that the operation attempted to be performed is not + allowed. This could be because: + - The api token is invalid + - The user does not have the necessary permissions + examples: + - value: {} + status-code: 401 + type: unknown + UnprocessableEntityError: + docs: > + This error is returned when the request is not well formed. This could be + because: + - JSON is invalid + - The request is missing required fields + - The request contains an invalid combination of fields examples: - value: {} + status-code: 422 + type: unknown diff --git a/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced-fleshedout/fern/.definition/v2/v2.yml b/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced-fleshedout/fern/.definition/v2/v2.yml index d62ade7b82d..84867e5da86 100644 --- a/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced-fleshedout/fern/.definition/v2/v2.yml +++ b/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced-fleshedout/fern/.definition/v2/v2.yml @@ -1,9 +1,7 @@ +imports: + v2Root: __package__.yml types: V2ChatRequestSafetyMode: - enum: - - CONTEXTUAL - - STRICT - - NONE docs: > Used to select the [safety instruction](/docs/safety-modes) inserted into the prompt. Defaults to `CONTEXTUAL`. @@ -22,43 +20,72 @@ types: Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments + enum: + - CONTEXTUAL + - STRICT + - NONE source: openapi: openapi/cohere-v2.yaml -imports: - v2Root: __package__.yml service: auth: false base-path: '' endpoints: chat: - path: /v2/chat - method: POST + audiences: + - v2-beta auth: true + display-name: Chat with the model docs: > Generates a message from the model in response to a provided conversation. To learn how to use the Chat API with Streaming and RAG follow our Text Generation guides. - display-name: Chat with the model + errors: + - v2Root.BadRequestError + - v2Root.UnauthorizedError + - v2Root.ForbiddenError + - v2Root.NotFoundError + - v2Root.UnprocessableEntityError + - v2Root.TooManyRequestsError + - v2Root.ClientClosedRequestError + - v2Root.InternalServerError + - v2Root.NotImplementedError + - v2Root.ServiceUnavailableError + - v2Root.GatewayTimeoutError + examples: + - request: + model: model + response: + body: + - string + method: POST + path: /v2/chat request: - name: V2ChatRequest body: properties: + documents: + docs: > + A list of relevant documents that the model can cite to generate + a more accurate reply. Each document is either a string or + document object with content and metadata. + type: optional> + max_tokens: + docs: > + The maximum number of tokens the model will generate as part of + the response. Note: Setting a low value may result in incomplete + generations. + type: optional model: - type: string docs: >- The name of a compatible [Cohere model](https://docs.cohere.com/docs/models) (such as command-r or command-r-plus) or the ID of a [fine-tuned](https://docs.cohere.com/docs/chat-fine-tuning) model. - documents: - type: optional> - docs: > - A list of relevant documents that the model can cite to generate - a more accurate reply. Each document is either a string or - document object with content and metadata. + type: string + return_prompt: + docs: Whether to return the prompt in the response. + type: optional safety_mode: - type: optional docs: > Used to select the [safety instruction](/docs/safety-modes) inserted into the prompt. Defaults to `CONTEXTUAL`. @@ -78,22 +105,16 @@ service: Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments - max_tokens: - type: optional - docs: > - The maximum number of tokens the model will generate as part of - the response. Note: Setting a low value may result in incomplete - generations. + type: optional stop_sequences: - type: optional> docs: > A list of up to 5 strings that the model will use to stop generation. If the model generates a string that matches any of the strings in the list, it will stop generating tokens and return the generated text up to that point not including the stop sequence. + type: optional> temperature: - type: optional docs: > Defaults to `0.3`. @@ -105,32 +126,11 @@ service: Randomness can be further maximized by increasing the value of the `p` parameter. - return_prompt: - type: optional - docs: Whether to return the prompt in the response. + type: optional content-type: application/json + name: V2ChatRequest response: docs: OK type: list - errors: - - v2Root.BadRequestError - - v2Root.UnauthorizedError - - v2Root.ForbiddenError - - v2Root.NotFoundError - - v2Root.UnprocessableEntityError - - v2Root.TooManyRequestsError - - v2Root.ClientClosedRequestError - - v2Root.InternalServerError - - v2Root.NotImplementedError - - v2Root.ServiceUnavailableError - - v2Root.GatewayTimeoutError - examples: - - request: - model: model - response: - body: - - string - audiences: - - v2-beta source: openapi: openapi/cohere-v2.yaml diff --git a/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/__package__.yml b/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/__package__.yml index 2c5c9465071..af604adfe2d 100644 --- a/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/__package__.yml +++ b/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/__package__.yml @@ -1,9 +1,9 @@ types: OauthScope: enum: - - value: read - docs: Read access - - value: write - docs: Write access + - docs: Read access + value: read + - docs: Write access + value: write source: openapi: openapi/trains/openapi.yml diff --git a/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/api.yml b/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/api.yml index 05d3c90ddb5..ea139f642cf 100644 --- a/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/api.yml +++ b/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/api.yml @@ -1,11 +1,11 @@ -name: api -error-discrimination: - strategy: status-code -display-name: Train Travel API -default-environment: Production -environments: - Production: https://api.example.com +auth: BearerAuthScheme auth-schemes: BearerAuthScheme: scheme: bearer -auth: BearerAuthScheme +default-environment: Production +display-name: Train Travel API +environments: + Production: https://api.example.com +error-discrimination: + strategy: status-code +name: api diff --git a/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/neopets/__package__.yml b/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/neopets/__package__.yml index 5fb19659243..6edc1d2139e 100644 --- a/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/neopets/__package__.yml +++ b/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/neopets/__package__.yml @@ -1,19 +1,19 @@ types: + Error: + properties: + code: integer + message: string + source: + openapi: openapi/petstore/openapi.yml Pet: properties: id: long + messages: optional name: string tag: optional - messages: optional source: openapi: openapi/petstore/openapi.yml Pets: list - Error: - properties: - code: integer - message: string - source: - openapi: openapi/petstore/openapi.yml V2ChatMessages: docs: > A list of chat messages in chronological order, representing a diff --git a/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/neopets/pets.yml b/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/neopets/pets.yml index a35ccbfe331..f37bca6741f 100644 --- a/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/neopets/pets.yml +++ b/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/neopets/pets.yml @@ -4,56 +4,56 @@ service: auth: false base-path: '' endpoints: - listPets: + createPets: + auth: false + display-name: Create a pet + examples: + - {} + method: POST path: /pets - method: GET + listPets: auth: false display-name: List all pets + examples: + - response: + body: + - id: 1000000 + messages: + - key: value + name: name + tag: tag + method: GET + path: /pets request: name: ListPetsRequest query-parameters: limit: - type: optional docs: How many items to return at one time (max 100) + type: optional response: docs: A paged array of pets type: neopetsRoot.Pets - examples: - - response: - body: - - id: 1000000 - name: name - tag: tag - messages: - - key: value - createPets: - path: /pets - method: POST - auth: false - display-name: Create a pet - examples: - - {} showPetById: - path: /pets/{petId} - method: GET auth: false - path-parameters: - petId: - type: string - docs: The id of the pet to retrieve display-name: Info for a specific pet - response: - docs: Expected response to a valid request - type: neopetsRoot.Pet examples: - path-parameters: petId: petId response: body: id: 1000000 - name: name - tag: tag messages: - key: value + name: name + tag: tag + method: GET + path: /pets/{petId} + path-parameters: + petId: + docs: The id of the pet to retrieve + type: string + response: + docs: Expected response to a valid request + type: neopetsRoot.Pet source: openapi: openapi/petstore/openapi.yml diff --git a/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/stream/__package__.yml b/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/stream/__package__.yml index 4bc5957d93b..561105e7a85 100644 --- a/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/stream/__package__.yml +++ b/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/stream/__package__.yml @@ -1,84 +1,10 @@ -channel: - path: marketDataV1 - auth: false - path-parameters: - symbol: - type: string - docs: > - Symbols are formatted as CCY1CCY2 where prices are in CCY2 and - quantities are in CCY1. To read more click - [here](https://docs.sandbox.gemini.com/websocket-api/#symbols-and-minimums). - query-parameters: - heartbeat: - type: optional - docs: >- - Optionally add this parameter and set to true to receive a heartbeat - every 5 seconds - top_of_book: - type: optional - docs: >- - If absent or false, receive full order book depth; if present and true, - receive top of book only. Only applies to bids and offers. - bids: - type: optional - docs: Include bids in change events - offers: - type: optional - docs: Include asks in change events - trades: - type: optional - docs: Include trade events - auctions: - type: optional - docs: Include auction events - messages: {} - examples: - - messages: [] types: - Market: - discriminated: false - union: - - Heartbeat - - Update - source: - openapi: asyncapi/sample.yml - Heartbeat: - properties: - type: literal<"heartbeat"> - extends: - - Default - source: - openapi: asyncapi/sample.yml - Update: - properties: - type: literal<"update"> - eventId: - type: integer - docs: >- - A monotonically increasing sequence number indicating when this change - occurred. These numbers are persistent and consistent between market - data connections. - events: Events - timestamp: - type: double - docs: >- - The timestamp in seconds for this group of events (included for - compatibility reasons). We recommend using the timestampms field - instead. - timestampms: - type: double - docs: The timestamp in milliseconds for this group of events. - extends: - - Default - source: - openapi: asyncapi/sample.yml Default: docs: >- This object is always part of the payload. In case of type=heartbeat, these are the only fields. properties: socket_sequence: - type: integer docs: >- zero-indexed monotonic increasing sequence number attached to each message sent - if there is a gap in this sequence, you have missed a @@ -86,63 +12,137 @@ types: messages will share a single increasing sequence. See [Sequence Numbers](https://docs.sandbox.gemini.com/websocket-api/#sequence-numbers) for more information. + type: integer source: openapi: asyncapi/sample.yml - EventsItemType: - enum: - - trade - - change - - value: auction, block_trade - name: AuctionBlockTrade - source: - openapi: asyncapi/sample.yml - EventsItemSide: - enum: - - bid - - side - source: - openapi: asyncapi/sample.yml - EventsItemReason: - enum: - - place - - trade - - cancel - - initial + Events: docs: >- - Indicates why the change has occurred. initial is for the initial response - message, which will show the entire existing state of the order book. - source: - openapi: asyncapi/sample.yml + Either a change to the order book, or the indication that a trade has + occurred. + type: list EventsItem: properties: - type: optional - price: + delta: + docs: >- + The quantity changed. May be negative, if an order is filled or + canceled. For initial messages, delta will equal remaining. type: optional + price: docs: The price of this order book entry. + type: optional validation: multipleOf: 0.01 - side: optional reason: - type: optional docs: >- Indicates why the change has occurred. initial is for the initial response message, which will show the entire existing state of the order book. + type: optional remaining: - type: optional docs: >- The quantity remaining at that price level after this change occurred. May be zero if all orders at this price level have been filled or canceled. - delta: type: optional - docs: >- - The quantity changed. May be negative, if an order is filled or - canceled. For initial messages, delta will equal remaining. + side: optional + type: optional source: openapi: asyncapi/sample.yml - Events: + EventsItemReason: docs: >- - Either a change to the order book, or the indication that a trade has - occurred. - type: list + Indicates why the change has occurred. initial is for the initial response + message, which will show the entire existing state of the order book. + enum: + - place + - trade + - cancel + - initial + source: + openapi: asyncapi/sample.yml + EventsItemSide: + enum: + - bid + - side + source: + openapi: asyncapi/sample.yml + EventsItemType: + enum: + - trade + - change + - name: AuctionBlockTrade + value: auction, block_trade + source: + openapi: asyncapi/sample.yml + Heartbeat: + extends: + - Default + properties: + type: literal<"heartbeat"> + source: + openapi: asyncapi/sample.yml + Market: + discriminated: false + source: + openapi: asyncapi/sample.yml + union: + - Heartbeat + - Update + Update: + extends: + - Default + properties: + eventId: + docs: >- + A monotonically increasing sequence number indicating when this change + occurred. These numbers are persistent and consistent between market + data connections. + type: integer + events: Events + timestamp: + docs: >- + The timestamp in seconds for this group of events (included for + compatibility reasons). We recommend using the timestampms field + instead. + type: double + timestampms: + docs: The timestamp in milliseconds for this group of events. + type: double + type: literal<"update"> + source: + openapi: asyncapi/sample.yml +channel: + auth: false + examples: + - messages: [] + messages: {} + path: marketDataV1 + path-parameters: + symbol: + docs: > + Symbols are formatted as CCY1CCY2 where prices are in CCY2 and + quantities are in CCY1. To read more click + [here](https://docs.sandbox.gemini.com/websocket-api/#symbols-and-minimums). + type: string + query-parameters: + auctions: + docs: Include auction events + type: optional + bids: + docs: Include bids in change events + type: optional + heartbeat: + docs: >- + Optionally add this parameter and set to true to receive a heartbeat + every 5 seconds + type: optional + offers: + docs: Include asks in change events + type: optional + top_of_book: + docs: >- + If absent or false, receive full order book depth; if present and true, + receive top of book only. Only applies to bids and offers. + type: optional + trades: + docs: Include trade events + type: optional diff --git a/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/trains/__package__.yml b/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/trains/__package__.yml index 4ce641d4112..8b7bfc0ee5e 100644 --- a/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/trains/__package__.yml +++ b/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/trains/__package__.yml @@ -1,217 +1,62 @@ -errors: - BadRequestError: - status-code: 400 - type: Problem - docs: Bad Request - examples: - - value: - type: https://example.com/errors/bad-request - title: Bad Request - status: 400 - detail: The request is invalid or missing required parameters. - UnauthorizedError: - status-code: 401 - type: Problem - docs: Unauthorized - examples: - - value: - type: https://example.com/errors/unauthorized - title: Unauthorized - status: 401 - detail: You do not have the necessary permissions. - ForbiddenError: - status-code: 403 - type: Problem - docs: Forbidden - examples: - - value: - type: https://example.com/errors/forbidden - title: Forbidden - status: 403 - detail: Access is forbidden with the provided credentials. - TooManyRequestsError: - status-code: 429 - type: Problem - docs: Too Many Requests - examples: - - value: - type: https://example.com/errors/too-many-requests - title: Too Many Requests - status: 429 - detail: You have exceeded the rate limit. - InternalServerError: - status-code: 500 - type: Problem - docs: Internal Server Error - examples: - - value: - type: https://example.com/errors/internal-server-error - title: Internal Server Error - status: 500 - detail: An unexpected error occurred. - NotFoundError: - status-code: 404 - type: Problem - docs: Not Found - examples: - - value: - type: https://example.com/errors/not-found - title: Not Found - status: 404 - detail: The requested resource was not found. - ConflictError: - status-code: 409 - type: Problem - docs: Conflict - examples: - - value: - type: https://example.com/errors/conflict - title: Conflict - status: 409 - detail: There is a conflict with an existing resource. types: - Pet: - properties: - id: long - name: string - source: - openapi: openapi/trains/openapi.yml - Station: + Booking: properties: + has_bicycle: + docs: Indicates whether the passenger has a bicycle. + type: optional + has_dog: + docs: Indicates whether the passenger has a dog. + type: optional id: - type: string - docs: Unique identifier for the station. - validation: - format: uuid - name: - type: string - docs: The name of the station - address: - type: string - docs: The address of the station. - country_code: - type: string - docs: The country code of the station. - timezone: - type: optional - docs: >- - The timezone of the station in the [IANA Time Zone Database - format](https://www.iana.org/time-zones). - messages: optional - pet: optional - source: - openapi: openapi/trains/openapi.yml - LinksSelf: - properties: - self: + docs: Unique identifier for the booking type: optional validation: - format: uri - source: - openapi: openapi/trains/openapi.yml - LinksPagination: - properties: - next: + format: uuid + passenger_name: + docs: Name of the passenger type: optional - validation: - format: uri - prev: + trip_id: + docs: Identifier of the booked trip type: optional validation: - format: uri + format: uuid source: openapi: openapi/trains/openapi.yml - Problem: + BookingPayment: properties: - type: - type: optional - docs: A URI reference that identifies the problem type - title: - type: optional - docs: A short, human-readable summary of the problem type - detail: - type: optional + amount: docs: >- - A human-readable explanation specific to this occurrence of the - problem - instance: - type: optional - docs: A URI reference that identifies the specific occurrence of the problem - status: - type: optional - docs: The HTTP status code - source: - openapi: openapi/trains/openapi.yml - Trip: - properties: - id: - type: optional - docs: Unique identifier for the trip - validation: - format: uuid - origin: - type: optional - docs: The starting station of the trip - destination: - type: optional - docs: The destination station of the trip - departure_time: - type: optional - docs: The date and time when the trip departs - arrival_time: - type: optional - docs: The date and time when the trip arrives - operator: - type: optional - docs: The name of the operator of the trip - price: + Amount intended to be collected by this payment. A positive decimal + figure describing the amount to be collected. type: optional - docs: The cost of the trip - bicycles_allowed: - type: optional - docs: Indicates whether bicycles are allowed on the trip - dogs_allowed: - type: optional - docs: Indicates whether dogs are allowed on the trip - source: - openapi: openapi/trains/openapi.yml - Booking: - properties: + currency: + docs: >- + Three-letter [ISO currency + code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. + type: optional id: + docs: >- + Unique identifier for the payment. This will be a unique identifier + for the payment, and is used to reference the payment in other + objects. type: optional - docs: Unique identifier for the booking - validation: - format: uuid - trip_id: - type: optional - docs: Identifier of the booked trip validation: format: uuid - passenger_name: - type: optional - docs: Name of the passenger - has_bicycle: - type: optional - docs: Indicates whether the passenger has a bicycle. - has_dog: - type: optional - docs: Indicates whether the passenger has a dog. - source: - openapi: openapi/trains/openapi.yml - WrapperCollection: - docs: >- - This is a generic request/response wrapper which contains both data and - links which serve as hypermedia controls (HATEOAS). - properties: - data: - type: optional>> - docs: The wrapper for a collection is an array of objects. - links: - type: optional> - docs: A set of hypermedia links which serve as controls for the client. + source: + docs: >- + The payment source to take the payment from. This can be a card or a + bank account. Some of these properties will be hidden on read to + protect PII leaking. + type: optional + status: + docs: The status of the payment, one of `pending`, `succeeded`, or `failed`. + type: optional source: openapi: openapi/trains/openapi.yml BookingPaymentCurrency: + docs: >- + Three-letter [ISO currency + code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. enum: - bam - bgn @@ -221,145 +66,216 @@ types: - nok - sek - try + source: + openapi: openapi/trains/openapi.yml + BookingPaymentSource: + base-properties: {} + discriminant: object docs: >- - Three-letter [ISO currency - code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. + The payment source to take the payment from. This can be a card or a bank + account. Some of these properties will be hidden on read to protect PII + leaking. source: openapi: openapi/trains/openapi.yml - Card: - docs: A card (debit or credit) to take payment from. + union: + bank_account: + docs: >- + A bank account to take payment from. Must be able to make payments in + the currency specified in the payment. + type: BookingPaymentSourceBankAccount + card: + docs: A card (debit or credit) to take payment from. + type: Card + BookingPaymentSourceBankAccount: + docs: >- + A bank account to take payment from. Must be able to make payments in the + currency specified in the payment. properties: - name: + account_type: + docs: >- + The type of entity that holds the account. This can be either + `individual` or `company`. + type: BookingPaymentSourceBankAccountAccountType + bank_name: + docs: The name of the bank associated with the routing number. type: string - docs: Cardholder's full name as it appears on the card. + country: + docs: Two-letter country code (ISO 3166-1 alpha-2). + type: string + name: string number: + docs: >- + The account number for the bank account, in string form. Must be a + current account. type: string + sort_code: docs: >- - The card number, as a string without any separators. On read all but - the last four digits will be masked for security. + The sort code for the bank account, in string form. Must be a + six-digit number. + type: optional + source: + openapi: openapi/trains/openapi.yml + BookingPaymentSourceBankAccountAccountType: + docs: >- + The type of entity that holds the account. This can be either `individual` + or `company`. + enum: + - individual + - company + source: + openapi: openapi/trains/openapi.yml + BookingPaymentStatus: + docs: The status of the payment, one of `pending`, `succeeded`, or `failed`. + enum: + - pending + - succeeded + - failed + source: + openapi: openapi/trains/openapi.yml + Card: + docs: A card (debit or credit) to take payment from. + properties: + address_city: + type: optional + address_country: string + address_line1: + type: optional + address_line2: + type: optional + address_post_code: + type: optional cvc: - type: integer docs: >- Card security code, 3 or 4 digits usually found on the back of the card. + type: integer exp_month: - type: long docs: Two-digit number representing the card's expiration month. - exp_year: type: long + exp_year: docs: Four-digit number representing the card's expiration year. - address_line1: - type: optional - address_line2: + type: long + name: + docs: Cardholder's full name as it appears on the card. + type: string + number: + docs: >- + The card number, as a string without any separators. On read all but + the last four digits will be masked for security. + type: string + source: + openapi: openapi/trains/openapi.yml + LinksBooking: + properties: + booking: type: optional - address_city: + validation: + format: uri + source: + openapi: openapi/trains/openapi.yml + LinksPagination: + properties: + next: type: optional - address_country: string - address_post_code: + validation: + format: uri + prev: type: optional + validation: + format: uri source: openapi: openapi/trains/openapi.yml - BookingPaymentSourceBankAccountAccountType: - enum: - - individual - - company - docs: >- - The type of entity that holds the account. This can be either `individual` - or `company`. + LinksSelf: + properties: + self: + type: optional + validation: + format: uri source: openapi: openapi/trains/openapi.yml - BookingPaymentSourceBankAccount: - docs: >- - A bank account to take payment from. Must be able to make payments in the - currency specified in the payment. + Pet: properties: + id: long name: string - number: - type: string - docs: >- - The account number for the bank account, in string form. Must be a - current account. - sort_code: - type: optional - docs: >- - The sort code for the bank account, in string form. Must be a - six-digit number. - account_type: - type: BookingPaymentSourceBankAccountAccountType - docs: >- - The type of entity that holds the account. This can be either - `individual` or `company`. - bank_name: - type: string - docs: The name of the bank associated with the routing number. - country: - type: string - docs: Two-letter country code (ISO 3166-1 alpha-2). source: openapi: openapi/trains/openapi.yml - BookingPaymentSource: - discriminant: object - base-properties: {} - docs: >- - The payment source to take the payment from. This can be a card or a bank - account. Some of these properties will be hidden on read to protect PII - leaking. - union: - card: - type: Card - docs: A card (debit or credit) to take payment from. - bank_account: - type: BookingPaymentSourceBankAccount + Problem: + properties: + detail: docs: >- - A bank account to take payment from. Must be able to make payments in - the currency specified in the payment. - source: - openapi: openapi/trains/openapi.yml - BookingPaymentStatus: - enum: - - pending - - succeeded - - failed - docs: The status of the payment, one of `pending`, `succeeded`, or `failed`. + A human-readable explanation specific to this occurrence of the + problem + type: optional + instance: + docs: A URI reference that identifies the specific occurrence of the problem + type: optional + status: + docs: The HTTP status code + type: optional + title: + docs: A short, human-readable summary of the problem type + type: optional + type: + docs: A URI reference that identifies the problem type + type: optional source: openapi: openapi/trains/openapi.yml - BookingPayment: + Station: properties: + address: + docs: The address of the station. + type: string + country_code: + docs: The country code of the station. + type: string id: - type: optional - docs: >- - Unique identifier for the payment. This will be a unique identifier - for the payment, and is used to reference the payment in other - objects. + docs: Unique identifier for the station. + type: string validation: format: uuid - amount: - type: optional - docs: >- - Amount intended to be collected by this payment. A positive decimal - figure describing the amount to be collected. - currency: - type: optional - docs: >- - Three-letter [ISO currency - code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. - source: - type: optional + messages: optional + name: + docs: The name of the station + type: string + pet: optional + timezone: docs: >- - The payment source to take the payment from. This can be a card or a - bank account. Some of these properties will be hidden on read to - protect PII leaking. - status: - type: optional - docs: The status of the payment, one of `pending`, `succeeded`, or `failed`. + The timezone of the station in the [IANA Time Zone Database + format](https://www.iana.org/time-zones). + type: optional source: openapi: openapi/trains/openapi.yml - LinksBooking: + Trip: properties: - booking: + arrival_time: + docs: The date and time when the trip arrives + type: optional + bicycles_allowed: + docs: Indicates whether bicycles are allowed on the trip + type: optional + departure_time: + docs: The date and time when the trip departs + type: optional + destination: + docs: The destination station of the trip + type: optional + dogs_allowed: + docs: Indicates whether dogs are allowed on the trip + type: optional + id: + docs: Unique identifier for the trip type: optional validation: - format: uri + format: uuid + operator: + docs: The name of the operator of the trip + type: optional + origin: + docs: The starting station of the trip + type: optional + price: + docs: The cost of the trip + type: optional source: openapi: openapi/trains/openapi.yml V2ChatMessages: @@ -372,3 +288,87 @@ types: more about messages and roles in [the Chat API guide](https://docs.cohere.com/docs/chat-api). type: list + WrapperCollection: + docs: >- + This is a generic request/response wrapper which contains both data and + links which serve as hypermedia controls (HATEOAS). + properties: + data: + docs: The wrapper for a collection is an array of objects. + type: optional>> + links: + docs: A set of hypermedia links which serve as controls for the client. + type: optional> + source: + openapi: openapi/trains/openapi.yml +errors: + BadRequestError: + docs: Bad Request + examples: + - value: + detail: The request is invalid or missing required parameters. + status: 400 + title: Bad Request + type: https://example.com/errors/bad-request + status-code: 400 + type: Problem + ConflictError: + docs: Conflict + examples: + - value: + detail: There is a conflict with an existing resource. + status: 409 + title: Conflict + type: https://example.com/errors/conflict + status-code: 409 + type: Problem + ForbiddenError: + docs: Forbidden + examples: + - value: + detail: Access is forbidden with the provided credentials. + status: 403 + title: Forbidden + type: https://example.com/errors/forbidden + status-code: 403 + type: Problem + InternalServerError: + docs: Internal Server Error + examples: + - value: + detail: An unexpected error occurred. + status: 500 + title: Internal Server Error + type: https://example.com/errors/internal-server-error + status-code: 500 + type: Problem + NotFoundError: + docs: Not Found + examples: + - value: + detail: The requested resource was not found. + status: 404 + title: Not Found + type: https://example.com/errors/not-found + status-code: 404 + type: Problem + TooManyRequestsError: + docs: Too Many Requests + examples: + - value: + detail: You have exceeded the rate limit. + status: 429 + title: Too Many Requests + type: https://example.com/errors/too-many-requests + status-code: 429 + type: Problem + UnauthorizedError: + docs: Unauthorized + examples: + - value: + detail: You do not have the necessary permissions. + status: 401 + title: Unauthorized + type: https://example.com/errors/unauthorized + status-code: 401 + type: Problem diff --git a/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/trains/bookings.yml b/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/trains/bookings.yml index 6eaf81ce29b..90e9b9995f8 100644 --- a/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/trains/bookings.yml +++ b/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/trains/bookings.yml @@ -1,116 +1,98 @@ imports: trainsRoot: __package__.yml types: - GetBookingsResponseLinks: - properties: {} + CreateBookingResponse: extends: - - trainsRoot.LinksSelf - - trainsRoot.LinksPagination - source: - openapi: openapi/trains/openapi.yml - GetBookingsResponse: + - trainsRoot.Booking properties: - data: optional> - links: optional + links: optional source: openapi: openapi/trains/openapi.yml - CreateBookingResponse: - properties: - links: optional + GetBookingResponse: extends: - trainsRoot.Booking + properties: + links: optional source: openapi: openapi/trains/openapi.yml - GetBookingResponse: + GetBookingsResponse: properties: - links: optional + data: optional> + links: optional + source: + openapi: openapi/trains/openapi.yml + GetBookingsResponseLinks: extends: - - trainsRoot.Booking + - trainsRoot.LinksSelf + - trainsRoot.LinksPagination + properties: {} source: openapi: openapi/trains/openapi.yml +docs: | + Create and manage bookings for train trips, including passenger details + and optional extras. service: auth: false base-path: '' + display-name: Bookings endpoints: - get-bookings: - path: /bookings - method: GET + create-booking: auth: true - docs: Returns a list of all trip bookings by the authenticated user. - display-name: List existing bookings - response: - docs: A list of bookings - type: GetBookingsResponse + display-name: Create a booking + docs: >- + A booking is a temporary hold on a trip. It is not confirmed until the + payment is processed. errors: - trainsRoot.BadRequestError - trainsRoot.UnauthorizedError - - trainsRoot.ForbiddenError + - trainsRoot.NotFoundError + - trainsRoot.ConflictError - trainsRoot.TooManyRequestsError - trainsRoot.InternalServerError examples: - - response: + - request: {} + response: body: - data: - - id: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e - trip_id: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e - passenger_name: John Doe - has_bicycle: true - has_dog: true - - id: b2e783e1-c824-4d63-b37a-d8d698862f1d - trip_id: b2e783e1-c824-4d63-b37a-d8d698862f1d - passenger_name: Jane Smith - has_bicycle: false - has_dog: false + has_bicycle: true + has_dog: true + id: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e links: - next: https://api.example.com/bookings?page=2 - prev: prev - self: https://api.example.com/bookings - create-booking: - path: /bookings + self: >- + https://api.example.com/bookings/efdbb9d1-02c2-4bc3-afb7-6788d8782b1e + passenger_name: John Doe + trip_id: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e method: POST - auth: true - docs: >- - A booking is a temporary hold on a trip. It is not confirmed until the - payment is processed. - display-name: Create a booking + path: /bookings request: body: trainsRoot.Booking content-type: application/json response: docs: Booking successful type: CreateBookingResponse + delete-booking: + auth: true + display-name: Delete a booking + docs: Deletes a booking, cancelling the hold on the trip. errors: - trainsRoot.BadRequestError - trainsRoot.UnauthorizedError + - trainsRoot.ForbiddenError - trainsRoot.NotFoundError - - trainsRoot.ConflictError - trainsRoot.TooManyRequestsError - trainsRoot.InternalServerError examples: - - request: {} - response: - body: - id: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e - trip_id: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e - passenger_name: John Doe - has_bicycle: true - has_dog: true - links: - self: >- - https://api.example.com/bookings/efdbb9d1-02c2-4bc3-afb7-6788d8782b1e - get-booking: + - path-parameters: + bookingId: 1725ff48-ab45-4bb5-9d02-88745177dedb + method: DELETE path: /bookings/{bookingId} - method: GET - auth: true - docs: Returns the details of a specific booking. path-parameters: bookingId: - type: string docs: The ID of the booking to retrieve. + type: string + get-booking: + auth: true display-name: Get a booking - response: - docs: The booking details - type: GetBookingResponse + docs: Returns the details of a specific booking. errors: - trainsRoot.BadRequestError - trainsRoot.UnauthorizedError @@ -123,37 +105,55 @@ service: bookingId: 1725ff48-ab45-4bb5-9d02-88745177dedb response: body: - id: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e - trip_id: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e - passenger_name: John Doe has_bicycle: true has_dog: true + id: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e links: self: >- https://api.example.com/bookings/1725ff48-ab45-4bb5-9d02-88745177dedb - delete-booking: + passenger_name: John Doe + trip_id: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e + method: GET path: /bookings/{bookingId} - method: DELETE - auth: true - docs: Deletes a booking, cancelling the hold on the trip. path-parameters: bookingId: - type: string docs: The ID of the booking to retrieve. - display-name: Delete a booking + type: string + response: + docs: The booking details + type: GetBookingResponse + get-bookings: + auth: true + display-name: List existing bookings + docs: Returns a list of all trip bookings by the authenticated user. errors: - trainsRoot.BadRequestError - trainsRoot.UnauthorizedError - trainsRoot.ForbiddenError - - trainsRoot.NotFoundError - trainsRoot.TooManyRequestsError - trainsRoot.InternalServerError examples: - - path-parameters: - bookingId: 1725ff48-ab45-4bb5-9d02-88745177dedb + - response: + body: + data: + - has_bicycle: true + has_dog: true + id: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e + passenger_name: John Doe + trip_id: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e + - has_bicycle: false + has_dog: false + id: b2e783e1-c824-4d63-b37a-d8d698862f1d + passenger_name: Jane Smith + trip_id: b2e783e1-c824-4d63-b37a-d8d698862f1d + links: + next: https://api.example.com/bookings?page=2 + prev: prev + self: https://api.example.com/bookings + method: GET + path: /bookings + response: + docs: A list of bookings + type: GetBookingsResponse source: openapi: openapi/trains/openapi.yml - display-name: Bookings -docs: | - Create and manage bookings for train trips, including passenger details - and optional extras. diff --git a/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/trains/payments.yml b/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/trains/payments.yml index b68b86da391..018cf5b3286 100644 --- a/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/trains/payments.yml +++ b/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/trains/payments.yml @@ -2,34 +2,30 @@ imports: trainsRoot: __package__.yml types: CreateBookingPaymentResponse: - properties: - links: optional extends: - trainsRoot.BookingPayment + properties: + links: optional source: openapi: openapi/trains/openapi.yml +docs: | + Pay for bookings using a card or bank account, and view payment + status and history. + + > warn + > Bookings usually expire within 1 hour so you'll need to make your payment + > before the expiry date service: auth: false base-path: '' + display-name: Payments endpoints: create-booking-payment: - path: /bookings/{bookingId}/payment - method: POST auth: true + display-name: Pay for a Booking docs: >- A payment is an attempt to pay for the booking, which will confirm the booking for the user and enable them to get their tickets. - path-parameters: - bookingId: - type: string - docs: The ID of the booking to pay for. - display-name: Pay for a Booking - request: - body: trainsRoot.BookingPayment - content-type: application/json - response: - docs: Payment successful - type: CreateBookingPaymentResponse errors: - trainsRoot.BadRequestError - trainsRoot.UnauthorizedError @@ -44,38 +40,38 @@ service: amount: 49.99 currency: gbp source: - object: card - name: J. Doe - number: '4242424242424242' - cvc: 123 - exp_month: 12 - exp_year: 2025 - address_line1: 123 Fake Street - address_line2: 4th Floor address_city: London address_country: gb + address_line1: 123 Fake Street + address_line2: 4th Floor address_post_code: N12 9XX + cvc: 123 + exp_month: 12 + exp_year: 2025 + name: J. Doe + number: '4242424242424242' + object: card response: body: - id: 2e3b4f5a-6b7c-8d9e-0f1a-2b3c4d5e6f7a amount: 49.99 currency: gbp + id: 2e3b4f5a-6b7c-8d9e-0f1a-2b3c4d5e6f7a + links: + booking: >- + https://api.example.com/bookings/1725ff48-ab45-4bb5-9d02-88745177dedb/payment source: - object: card - name: J. Doe - number: '************4242' - cvc: 123 - exp_month: 12 - exp_year: 2025 - address_line1: source - address_line2: source address_city: source address_country: gb + address_line1: source + address_line2: source address_post_code: N12 9XX + cvc: 123 + exp_month: 12 + exp_year: 2025 + name: J. Doe + number: '************4242' + object: card status: succeeded - links: - booking: >- - https://api.example.com/bookings/1725ff48-ab45-4bb5-9d02-88745177dedb/payment - name: Bank Account Payment path-parameters: bookingId: 1725ff48-ab45-4bb5-9d02-88745177dedb @@ -83,34 +79,34 @@ service: amount: 100.5 currency: gbp source: - object: bank_account - name: J. Doe - number: '00012345' - sort_code: '000123' account_type: individual bank_name: Starling Bank country: gb + name: J. Doe + number: '00012345' + object: bank_account + sort_code: '000123' response: body: - id: 2e3b4f5a-6b7c-8d9e-0f1a-2b3c4d5e6f7a amount: 49.99 currency: gbp + id: 2e3b4f5a-6b7c-8d9e-0f1a-2b3c4d5e6f7a + links: + booking: >- + https://api.example.com/bookings/1725ff48-ab45-4bb5-9d02-88745177dedb/payment source: - object: card - name: J. Doe - number: '************4242' - cvc: 123 - exp_month: 12 - exp_year: 2025 - address_line1: source - address_line2: source address_city: source address_country: gb + address_line1: source + address_line2: source address_post_code: N12 9XX + cvc: 123 + exp_month: 12 + exp_year: 2025 + name: J. Doe + number: '************4242' + object: card status: succeeded - links: - booking: >- - https://api.example.com/bookings/1725ff48-ab45-4bb5-9d02-88745177dedb/payment - name: Card Payment 2 path-parameters: bookingId: 1725ff48-ab45-4bb5-9d02-88745177dedb @@ -118,38 +114,38 @@ service: amount: 49.99 currency: gbp source: - object: card - name: J. Doe - number: '4242424242424242' - cvc: 123 - exp_month: 12 - exp_year: 2025 - address_line1: 123 Fake Street - address_line2: 4th Floor address_city: London address_country: gb + address_line1: 123 Fake Street + address_line2: 4th Floor address_post_code: N12 9XX + cvc: 123 + exp_month: 12 + exp_year: 2025 + name: J. Doe + number: '4242424242424242' + object: card response: body: - id: 2e3b4f5a-6b7c-8d9e-0f1a-2b3c4d5e6f7a amount: 49.99 currency: gbp + id: 2e3b4f5a-6b7c-8d9e-0f1a-2b3c4d5e6f7a + links: + booking: >- + https://api.example.com/bookings/1725ff48-ab45-4bb5-9d02-88745177dedb/payment source: - object: card - name: J. Doe - number: '************4242' - cvc: 123 - exp_month: 12 - exp_year: 2025 - address_line1: source - address_line2: source address_city: source address_country: gb + address_line1: source + address_line2: source address_post_code: N12 9XX + cvc: 123 + exp_month: 12 + exp_year: 2025 + name: J. Doe + number: '************4242' + object: card status: succeeded - links: - booking: >- - https://api.example.com/bookings/1725ff48-ab45-4bb5-9d02-88745177dedb/payment - name: Bank Account Payment 2 path-parameters: bookingId: 1725ff48-ab45-4bb5-9d02-88745177dedb @@ -157,41 +153,45 @@ service: amount: 49.99 currency: gbp source: - object: card - name: J. Doe - number: '4242424242424242' - cvc: 123 - exp_month: 12 - exp_year: 2025 - address_line1: 123 Fake Street - address_line2: 4th Floor address_city: London address_country: gb + address_line1: 123 Fake Street + address_line2: 4th Floor address_post_code: N12 9XX + cvc: 123 + exp_month: 12 + exp_year: 2025 + name: J. Doe + number: '4242424242424242' + object: card response: body: - id: 2e3b4f5a-6b7c-8d9e-0f1a-2b3c4d5e6f7a amount: 100.5 currency: gbp + id: 2e3b4f5a-6b7c-8d9e-0f1a-2b3c4d5e6f7a + links: + booking: >- + https://api.example.com/bookings/1725ff48-ab45-4bb5-9d02-88745177dedb source: - object: bank_account - name: J. Doe - number: '*********2345' - sort_code: '000123' account_type: individual bank_name: Starling Bank country: gb + name: J. Doe + number: '*********2345' + object: bank_account + sort_code: '000123' status: succeeded - links: - booking: >- - https://api.example.com/bookings/1725ff48-ab45-4bb5-9d02-88745177dedb + method: POST + path: /bookings/{bookingId}/payment + path-parameters: + bookingId: + docs: The ID of the booking to pay for. + type: string + request: + body: trainsRoot.BookingPayment + content-type: application/json + response: + docs: Payment successful + type: CreateBookingPaymentResponse source: openapi: openapi/trains/openapi.yml - display-name: Payments -docs: | - Pay for bookings using a card or bank account, and view payment - status and history. - - > warn - > Bookings usually expire within 1 hour so you'll need to make your payment - > before the expiry date diff --git a/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/trains/stations.yml b/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/trains/stations.yml index dbf4662a376..429aa747e6b 100644 --- a/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/trains/stations.yml +++ b/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/trains/stations.yml @@ -1,32 +1,31 @@ imports: trainsRoot: __package__.yml types: - GetStationsResponseLinks: - properties: {} - extends: - - trainsRoot.LinksSelf - - trainsRoot.LinksPagination - source: - openapi: openapi/trains/openapi.yml GetStationsResponse: properties: data: optional> links: optional source: openapi: openapi/trains/openapi.yml + GetStationsResponseLinks: + extends: + - trainsRoot.LinksSelf + - trainsRoot.LinksPagination + properties: {} + source: + openapi: openapi/trains/openapi.yml +docs: | + Find and filter train stations across Europe, including their location + and local timezone. service: auth: false base-path: '' + display-name: Stations endpoints: get-stations: - path: /stations - method: GET auth: true - docs: Returns a list of all train stations in the system. display-name: Get a list of train stations - response: - docs: A list of train stations - type: GetStationsResponse + docs: Returns a list of all train stations in the system. errors: - trainsRoot.BadRequestError - trainsRoot.UnauthorizedError @@ -37,29 +36,30 @@ service: - response: body: data: - - id: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e - name: Berlin Hauptbahnhof - address: Invalidenstraße 10557 Berlin, Germany + - address: Invalidenstraße 10557 Berlin, Germany country_code: DE - timezone: Europe/Berlin + id: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e + name: Berlin Hauptbahnhof pet: id: 1000000 name: name - - id: b2e783e1-c824-4d63-b37a-d8d698862f1d - name: Paris Gare du Nord - address: 18 Rue de Dunkerque 75010 Paris, France + timezone: Europe/Berlin + - address: 18 Rue de Dunkerque 75010 Paris, France country_code: FR - timezone: Europe/Paris + id: b2e783e1-c824-4d63-b37a-d8d698862f1d + name: Paris Gare du Nord pet: id: 1000000 name: name + timezone: Europe/Paris links: next: https://api.example.com/stations?page=3 prev: https://api.example.com/stations?page=1 self: https://api.example.com/stations&page=2 + method: GET + path: /stations + response: + docs: A list of train stations + type: GetStationsResponse source: openapi: openapi/trains/openapi.yml - display-name: Stations -docs: | - Find and filter train stations across Europe, including their location - and local timezone. diff --git a/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/trains/trains.yml b/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/trains/trains.yml index 5571477a675..09da79328ca 100644 --- a/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/trains/trains.yml +++ b/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/trains/trains.yml @@ -1,36 +1,36 @@ imports: trainsRoot: __package__.yml types: - NewBookingPayloadLinks: - properties: {} - extends: - - trainsRoot.LinksSelf - - trainsRoot.LinksPagination - source: - openapi: openapi/trains/openapi.yml NewBookingPayload: + extends: + - trainsRoot.Booking properties: links: optional + source: + openapi: openapi/trains/openapi.yml + NewBookingPayloadLinks: extends: - - trainsRoot.Booking + - trainsRoot.LinksSelf + - trainsRoot.LinksPagination + properties: {} source: openapi: openapi/trains/openapi.yml webhooks: new-booking: - method: POST display-name: New Booking - headers: {} - payload: NewBookingPayload + docs: > + Subscribe to new bookings being created, to update integrations for your + users. Related data is available via the links provided in the request. examples: - payload: - id: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e - trip_id: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e - passenger_name: John Doe has_bicycle: true has_dog: true + id: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e links: self: >- https://api.example.com/bookings/1725ff48-ab45-4bb5-9d02-88745177dedb - docs: > - Subscribe to new bookings being created, to update integrations for your - users. Related data is available via the links provided in the request. + passenger_name: John Doe + trip_id: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e + headers: {} + method: POST + payload: NewBookingPayload diff --git a/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/trains/trips.yml b/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/trains/trips.yml index 2a45c5ae8ad..b1dd048ebe5 100644 --- a/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/trains/trips.yml +++ b/packages/cli/ete-tests/src/tests/write-definition/fixtures/namespaced/fern/.definition/trains/trips.yml @@ -1,55 +1,34 @@ imports: trainsRoot: __package__.yml types: - GetTripsResponseLinks: - properties: {} - extends: - - trainsRoot.LinksSelf - - trainsRoot.LinksPagination - source: - openapi: openapi/trains/openapi.yml GetTripsResponse: properties: data: optional> links: optional source: openapi: openapi/trains/openapi.yml + GetTripsResponseLinks: + extends: + - trainsRoot.LinksSelf + - trainsRoot.LinksPagination + properties: {} + source: + openapi: openapi/trains/openapi.yml +docs: | + Timetables and routes for train trips between stations, including pricing + and availability. service: auth: false base-path: '' + display-name: Trips endpoints: get-trips: - path: /trips - method: GET auth: true + display-name: Get available train trips docs: >- Returns a list of available train trips between the specified origin and destination stations on the given date, and allows for filtering by bicycle and dog allowances. - display-name: Get available train trips - request: - name: GetTripsRequest - query-parameters: - origin: - type: string - docs: The ID of the origin station - destination: - type: string - docs: The ID of the destination station - date: - type: datetime - docs: >- - The date and time of the trip in ISO 8601 format in origin - station's timezone. - bicycles: - type: optional - docs: Only return trips where bicycles are known to be allowed - dogs: - type: optional - docs: Only return trips where dogs are known to be allowed - response: - docs: A list of available train trips - type: GetTripsResponse errors: - trainsRoot.BadRequestError - trainsRoot.UnauthorizedError @@ -58,39 +37,60 @@ service: - trainsRoot.InternalServerError examples: - query-parameters: - origin: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e - destination: b2e783e1-c824-4d63-b37a-d8d698862f1d date: '2024-02-01T09:00:00Z' + destination: b2e783e1-c824-4d63-b37a-d8d698862f1d + origin: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e response: body: data: - - id: ea399ba1-6d95-433f-92d1-83f67b775594 - origin: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e - destination: b2e783e1-c824-4d63-b37a-d8d698862f1d + - arrival_time: '2024-02-01T16:00:00Z' + bicycles_allowed: true departure_time: '2024-02-01T10:00:00Z' - arrival_time: '2024-02-01T16:00:00Z' + destination: b2e783e1-c824-4d63-b37a-d8d698862f1d + dogs_allowed: true + id: ea399ba1-6d95-433f-92d1-83f67b775594 operator: Deutsche Bahn + origin: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e price: 50 + - arrival_time: '2024-02-01T18:00:00Z' bicycles_allowed: true - dogs_allowed: true - - id: 4d67459c-af07-40bb-bb12-178dbb88e09f - origin: b2e783e1-c824-4d63-b37a-d8d698862f1d - destination: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e departure_time: '2024-02-01T12:00:00Z' - arrival_time: '2024-02-01T18:00:00Z' + destination: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e + dogs_allowed: true + id: 4d67459c-af07-40bb-bb12-178dbb88e09f operator: SNCF + origin: b2e783e1-c824-4d63-b37a-d8d698862f1d price: 50 - bicycles_allowed: true - dogs_allowed: true links: next: >- https://api.example.com/trips?origin=efdbb9d1-02c2-4bc3-afb7-6788d8782b1e&destination=b2e783e1-c824-4d63-b37a-d8d698862f1d&date=2024-02-01&page=2 prev: prev self: >- https://api.example.com/trips?origin=efdbb9d1-02c2-4bc3-afb7-6788d8782b1e&destination=b2e783e1-c824-4d63-b37a-d8d698862f1d&date=2024-02-01 + method: GET + path: /trips + request: + name: GetTripsRequest + query-parameters: + bicycles: + docs: Only return trips where bicycles are known to be allowed + type: optional + date: + docs: >- + The date and time of the trip in ISO 8601 format in origin + station's timezone. + type: datetime + destination: + docs: The ID of the destination station + type: string + dogs: + docs: Only return trips where dogs are known to be allowed + type: optional + origin: + docs: The ID of the origin station + type: string + response: + docs: A list of available train trips + type: GetTripsResponse source: openapi: openapi/trains/openapi.yml - display-name: Trips -docs: | - Timetables and routes for train trips between stations, including pricing - and availability. diff --git a/packages/cli/ete-tests/src/tests/write-definition/fixtures/petstore/fern/.definition/__package__.yml b/packages/cli/ete-tests/src/tests/write-definition/fixtures/petstore/fern/.definition/__package__.yml index 4f2c9816dd5..2a50910519a 100644 --- a/packages/cli/ete-tests/src/tests/write-definition/fixtures/petstore/fern/.definition/__package__.yml +++ b/packages/cli/ete-tests/src/tests/write-definition/fixtures/petstore/fern/.definition/__package__.yml @@ -1,4 +1,10 @@ types: + Error: + properties: + code: integer + message: string + source: + openapi: openapi/openapi.yml Pet: properties: id: long @@ -7,9 +13,3 @@ types: source: openapi: openapi/openapi.yml Pets: list - Error: - properties: - code: integer - message: string - source: - openapi: openapi/openapi.yml diff --git a/packages/cli/ete-tests/src/tests/write-definition/fixtures/petstore/fern/.definition/api.yml b/packages/cli/ete-tests/src/tests/write-definition/fixtures/petstore/fern/.definition/api.yml index 54a9219768f..42c1503557c 100644 --- a/packages/cli/ete-tests/src/tests/write-definition/fixtures/petstore/fern/.definition/api.yml +++ b/packages/cli/ete-tests/src/tests/write-definition/fixtures/petstore/fern/.definition/api.yml @@ -1,7 +1,7 @@ -name: api -error-discrimination: - strategy: status-code +default-environment: Default display-name: Swagger Petstore environments: Default: http://petstore.swagger.io/v1 -default-environment: Default +error-discrimination: + strategy: status-code +name: api diff --git a/packages/cli/ete-tests/src/tests/write-definition/fixtures/petstore/fern/.definition/pets.yml b/packages/cli/ete-tests/src/tests/write-definition/fixtures/petstore/fern/.definition/pets.yml index ddf187ef9e0..6a039b73ec2 100644 --- a/packages/cli/ete-tests/src/tests/write-definition/fixtures/petstore/fern/.definition/pets.yml +++ b/packages/cli/ete-tests/src/tests/write-definition/fixtures/petstore/fern/.definition/pets.yml @@ -4,45 +4,36 @@ service: auth: false base-path: '' endpoints: - listPets: + createPets: + auth: false + display-name: Create a pet + examples: + - {} + method: POST path: /pets - method: GET + listPets: auth: false display-name: List all pets + examples: + - response: + body: + - id: 1000000 + name: name + tag: tag + method: GET + path: /pets request: name: ListPetsRequest query-parameters: limit: - type: optional docs: How many items to return at one time (max 100) + type: optional response: docs: A paged array of pets type: root.Pets - examples: - - response: - body: - - id: 1000000 - name: name - tag: tag - createPets: - path: /pets - method: POST - auth: false - display-name: Create a pet - examples: - - {} showPetById: - path: /pets/{petId} - method: GET auth: false - path-parameters: - petId: - type: string - docs: The id of the pet to retrieve display-name: Info for a specific pet - response: - docs: Expected response to a valid request - type: root.Pet examples: - path-parameters: petId: petId @@ -51,5 +42,14 @@ service: id: 1000000 name: name tag: tag + method: GET + path: /pets/{petId} + path-parameters: + petId: + docs: The id of the pet to retrieve + type: string + response: + docs: Expected response to a valid request + type: root.Pet source: openapi: openapi/openapi.yml diff --git a/packages/cli/lazy-fern-workspace/src/ConjureWorkspace.ts b/packages/cli/lazy-fern-workspace/src/ConjureWorkspace.ts index 2c0b1dea8a8..d8921730b32 100644 --- a/packages/cli/lazy-fern-workspace/src/ConjureWorkspace.ts +++ b/packages/cli/lazy-fern-workspace/src/ConjureWorkspace.ts @@ -46,7 +46,19 @@ export class ConjureWorkspace extends AbstractAPIWorkspace { const conjure = new ConjureImporter(context); - const definition = await conjure.import({ absolutePathToConjureFolder: this.absolutePathToConjureFolder }); + const definition = await conjure.import({ + absolutePathToConjureFolder: this.absolutePathToConjureFolder, + authOverrides: + this.generatorsConfiguration?.api?.auth != null ? { ...this.generatorsConfiguration?.api } : undefined, + environmentOverrides: + this.generatorsConfiguration?.api?.environments != null + ? { ...this.generatorsConfiguration?.api } + : undefined, + globalHeaderOverrides: + this.generatorsConfiguration?.api?.headers != null + ? { ...this.generatorsConfiguration?.api } + : undefined + }); return { // these files doesn't live on disk, so there's no absolute filepath absoluteFilePath: AbsoluteFilePath.of("/DUMMY_PATH"), diff --git a/packages/commons/core-utils/src/__tests__/parseEndpointLocator.test.ts b/packages/commons/core-utils/src/__tests__/parseEndpointLocator.test.ts new file mode 100644 index 00000000000..cdb4b6b967b --- /dev/null +++ b/packages/commons/core-utils/src/__tests__/parseEndpointLocator.test.ts @@ -0,0 +1,16 @@ +import { parseEndpointLocator } from "../parseEndpointLocator"; + +describe("parseEndpointLocator", () => { + it("simple", () => { + const result = parseEndpointLocator("POST /users/{userId}"); + expect(result.type).toEqual("success"); + + if (result.type !== "success") { + throw new Error("Failed to parse"); + } + + expect(result.method).toEqual("POST"); + expect(result.path).toEqual("/users/{userId}"); + expect(result.pathParameters).toContain("userId"); + }); +}); diff --git a/packages/commons/core-utils/src/__tests__/removeSuffix.test.ts b/packages/commons/core-utils/src/__tests__/removeSuffix.test.ts new file mode 100644 index 00000000000..d8ee50be314 --- /dev/null +++ b/packages/commons/core-utils/src/__tests__/removeSuffix.test.ts @@ -0,0 +1,13 @@ +import { removeSuffix } from "../removeSuffix"; + +describe("parseEndpointLocator", () => { + it("simple", () => { + const result = removeSuffix({ value: "UserService", suffix: "Service" }); + expect(result).toEqual("User"); + }); + + it("suffix not present", () => { + const result = removeSuffix({ value: "UserService", suffix: "Services" }); + expect(result).toEqual("UserService"); + }); +}); diff --git a/packages/commons/core-utils/src/index.ts b/packages/commons/core-utils/src/index.ts index 0297972c6b4..c448ee37478 100644 --- a/packages/commons/core-utils/src/index.ts +++ b/packages/commons/core-utils/src/index.ts @@ -24,3 +24,5 @@ export type { WithoutQuestionMarks } from "./withoutQuestionMarks"; export { mergeWithOverrides } from "./mergeWithOverrides"; export { titleCase } from "./titleCase"; export { stripLeadingSlash } from "./stripLeadingSlash"; +export { parseEndpointLocator } from "./parseEndpointLocator"; +export { removeSuffix } from "./removeSuffix"; diff --git a/packages/commons/core-utils/src/parseEndpointLocator.ts b/packages/commons/core-utils/src/parseEndpointLocator.ts new file mode 100644 index 00000000000..91716d9f77d --- /dev/null +++ b/packages/commons/core-utils/src/parseEndpointLocator.ts @@ -0,0 +1,56 @@ +export declare namespace ParseEndpointLocator { + type Result = FailedResult | SuccessResult; + + interface FailedResult { + type: "failure"; + message: string; + } + + interface SuccessResult { + type: "success"; + method: "POST" | "GET" | "PUT" | "PATCH" | "DELETE"; + path: string; + pathParameters: Set; + } +} + +/** + * Parses an endpoint locator like `POST /users` or `GET /users/{userId}` + * @param input a string containing the Http method and path (e.g. `GET /users/{userId}`) + * @returns + */ +export function parseEndpointLocator(input: string): ParseEndpointLocator.Result { + const [method, path] = input.split(" "); + + if (!method || !["POST", "GET", "PUT", "PATCH", "DELETE"].includes(method)) { + return { + type: "failure", + message: `${input} contains invalid method ${method}` + }; + } + + if (!path) { + return { + type: "failure", + message: `${input} contains no path ${path}` + }; + } + + const pathParameters = new Set(); + const paramRegex = /{([^}]+)}/g; + let match; + + while ((match = paramRegex.exec(path)) != null) { + const maybePathParm = match[1]; + if (maybePathParm != null) { + pathParameters.add(maybePathParm); + } + } + + return { + type: "success", + method: method as ParseEndpointLocator.SuccessResult["method"], + path, + pathParameters + }; +} diff --git a/packages/commons/core-utils/src/removeSuffix.ts b/packages/commons/core-utils/src/removeSuffix.ts new file mode 100644 index 00000000000..8a972a569f3 --- /dev/null +++ b/packages/commons/core-utils/src/removeSuffix.ts @@ -0,0 +1,6 @@ +export function removeSuffix({ value, suffix }: { value: string; suffix: string }): string { + if (value.endsWith(suffix)) { + return value.substring(0, value.length - suffix.length); + } + return value; +} diff --git a/packages/commons/fs-utils/src/getFilename.ts b/packages/commons/fs-utils/src/getFilename.ts new file mode 100644 index 00000000000..a76dea73b53 --- /dev/null +++ b/packages/commons/fs-utils/src/getFilename.ts @@ -0,0 +1,14 @@ +import { AbsoluteFilePath } from "./AbsoluteFilePath"; +import { RelativeFilePath } from "./RelativeFilePath"; + +export function getFilename(path: RelativeFilePath | AbsoluteFilePath): RelativeFilePath | undefined { + if (!path.includes(".")) { + return undefined; + } + const segments = path.split("/"); + const finalSegment = segments[segments.length - 1]; + if (finalSegment == null) { + return undefined; + } + return RelativeFilePath.of(finalSegment); +} diff --git a/packages/commons/fs-utils/src/index.ts b/packages/commons/fs-utils/src/index.ts index 2f89ce61c7e..bc4558a4219 100644 --- a/packages/commons/fs-utils/src/index.ts +++ b/packages/commons/fs-utils/src/index.ts @@ -27,3 +27,4 @@ export { convertToFernHostRelativeFilePath } from "./osPathConverter"; export { getAllFilesInDirectory } from "./getAllFilesInDirectory"; +export { getFilename } from "./getFilename"; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 97e9129843e..c3197f7b88e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -174,9 +174,6 @@ importers: specifier: ^3.0.3 version: 3.0.3 devDependencies: - '@types/jest': - specifier: ^29.5.12 - version: 29.5.12 '@types/js-yaml': specifier: ^4.0.8 version: 4.0.8 @@ -3052,6 +3049,12 @@ importers: '@fern-api/conjure-sdk': specifier: workspace:* version: link:../conjure-sdk + '@fern-api/core-utils': + specifier: workspace:* + version: link:../../../../commons/core-utils + '@fern-api/fern-definition-schema': + specifier: workspace:* + version: link:../../../fern-definition/schema '@fern-api/fs-utils': specifier: workspace:* version: link:../../../../commons/fs-utils