From 95e2d2e9e45e61f8ad07f52125b4a0169a88dd6b Mon Sep 17 00:00:00 2001 From: "devin-ai-integration[bot]" <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Thu, 18 Jun 2026 02:14:18 +0530 Subject: [PATCH 1/7] fix(go): reference cycle-relocated types from the correct package in generated SDK (#16553) * fix(go): reference cycle-relocated types from the correct package in generated SDK * chore(go): remove stray debug logging from v1 generator output loop * fix(go): apply cycle-breaking type relocations to host-side dynamic snippets * chore: re-trigger CI --------- Co-authored-by: naman.anand --- .../base/src/cli/AbstractGoGeneratorCli.ts | 60 +- generators/go/internal/generator/cycle.go | 3 + .../go/internal/generator/file_writer.go | 36 +- generators/go/internal/generator/generator.go | 59 +- .../fix-trace-relocated-type-references.yml | 10 + ...fix-go-dynamic-snippet-relocated-types.yml | 8 + .../docker-utils/src/runDocker.ts | 5 +- .../src/ContainerExecutionEnvironment.ts | 12 +- .../src/NativeExecutionEnvironment.ts | 16 +- .../ReusableContainerExecutionEnvironment.ts | 11 +- .../src/applyTypeRelocations.ts | 80 + .../local-workspace-runner/src/constants.ts | 18 + .../src/runGenerator.ts | 11 + seed/go-sdk/seed.yml | 1 - seed/go-sdk/trace/.fern/metadata.json | 12 + seed/go-sdk/trace/.github/workflows/ci.yml | 62 + seed/go-sdk/trace/CONTRIBUTING.md | 143 + seed/go-sdk/trace/README.md | 211 + seed/go-sdk/trace/admin.go | 264 + seed/go-sdk/trace/admin/client.go | 184 + seed/go-sdk/trace/admin/raw_client.go | 390 + seed/go-sdk/trace/admin_test.go | 250 + seed/go-sdk/trace/client/client.go | 55 + seed/go-sdk/trace/client/client_test.go | 45 + seed/go-sdk/trace/common/common.go | 2142 ++ seed/go-sdk/trace/common/common_test.go | 3387 ++++ seed/go-sdk/trace/common/v2/common.go | 3024 +++ seed/go-sdk/trace/common/v2/common_test.go | 6036 ++++++ seed/go-sdk/trace/commons.go | 1355 ++ seed/go-sdk/trace/commons_test.go | 2279 +++ seed/go-sdk/trace/core/api_error.go | 47 + seed/go-sdk/trace/core/http.go | 15 + seed/go-sdk/trace/core/request_option.go | 189 + .../dynamic-snippets/example0/snippet.go | 22 + .../dynamic-snippets/example1/snippet.go | 31 + .../dynamic-snippets/example10/snippet.go | 28 + .../dynamic-snippets/example11/snippet.go | 27 + .../dynamic-snippets/example12/snippet.go | 43 + .../dynamic-snippets/example13/snippet.go | 40 + .../dynamic-snippets/example14/snippet.go | 24 + .../dynamic-snippets/example15/snippet.go | 24 + .../dynamic-snippets/example16/snippet.go | 24 + .../dynamic-snippets/example17/snippet.go | 34 + .../dynamic-snippets/example18/snippet.go | 34 + .../dynamic-snippets/example19/snippet.go | 24 + .../dynamic-snippets/example2/snippet.go | 34 + .../dynamic-snippets/example20/snippet.go | 92 + .../dynamic-snippets/example21/snippet.go | 93 + .../dynamic-snippets/example22/snippet.go | 23 + .../dynamic-snippets/example23/snippet.go | 45 + .../dynamic-snippets/example24/snippet.go | 24 + .../dynamic-snippets/example25/snippet.go | 23 + .../dynamic-snippets/example26/snippet.go | 23 + .../dynamic-snippets/example27/snippet.go | 22 + .../dynamic-snippets/example28/snippet.go | 25 + .../dynamic-snippets/example29/snippet.go | 22 + .../dynamic-snippets/example3/snippet.go | 31 + .../dynamic-snippets/example30/snippet.go | 22 + .../dynamic-snippets/example31/snippet.go | 22 + .../dynamic-snippets/example32/snippet.go | 23 + .../dynamic-snippets/example33/snippet.go | 24 + .../dynamic-snippets/example34/snippet.go | 22 + .../dynamic-snippets/example35/snippet.go | 22 + .../dynamic-snippets/example36/snippet.go | 23 + .../dynamic-snippets/example37/snippet.go | 24 + .../dynamic-snippets/example4/snippet.go | 34 + .../dynamic-snippets/example5/snippet.go | 110 + .../dynamic-snippets/example6/snippet.go | 105 + .../dynamic-snippets/example7/snippet.go | 113 + .../dynamic-snippets/example8/snippet.go | 104 + .../dynamic-snippets/example9/snippet.go | 22 + seed/go-sdk/trace/environments.go | 13 + seed/go-sdk/trace/error_codes.go | 21 + seed/go-sdk/trace/errors.go | 44 + seed/go-sdk/trace/file_param.go | 41 + seed/go-sdk/trace/go.mod | 16 + seed/go-sdk/trace/go.sum | 12 + seed/go-sdk/trace/homepage/client.go | 65 + seed/go-sdk/trace/homepage/raw_client.go | 113 + seed/go-sdk/trace/internal/caller.go | 304 + seed/go-sdk/trace/internal/caller_test.go | 705 + seed/go-sdk/trace/internal/error_decoder.go | 64 + .../trace/internal/error_decoder_test.go | 59 + seed/go-sdk/trace/internal/explicit_fields.go | 116 + .../trace/internal/explicit_fields_test.go | 645 + .../go-sdk/trace/internal/extra_properties.go | 141 + .../trace/internal/extra_properties_test.go | 228 + seed/go-sdk/trace/internal/http.go | 71 + seed/go-sdk/trace/internal/query.go | 358 + seed/go-sdk/trace/internal/query_test.go | 395 + seed/go-sdk/trace/internal/retrier.go | 263 + seed/go-sdk/trace/internal/retrier_test.go | 352 + seed/go-sdk/trace/internal/stringer.go | 13 + seed/go-sdk/trace/internal/time.go | 205 + seed/go-sdk/trace/lang_server.go | 178 + seed/go-sdk/trace/lang_server_test.go | 296 + seed/go-sdk/trace/migration.go | 162 + seed/go-sdk/trace/migration/client.go | 51 + seed/go-sdk/trace/migration/raw_client.go | 75 + seed/go-sdk/trace/migration_test.go | 296 + seed/go-sdk/trace/option/request_option.go | 117 + seed/go-sdk/trace/playlist.go | 592 + seed/go-sdk/trace/playlist/client.go | 132 + seed/go-sdk/trace/playlist/raw_client.go | 278 + seed/go-sdk/trace/playlist_test.go | 1144 ++ seed/go-sdk/trace/pointer.go | 137 + seed/go-sdk/trace/pointer_test.go | 211 + seed/go-sdk/trace/problem.go | 1219 ++ seed/go-sdk/trace/problem/client.go | 106 + seed/go-sdk/trace/problem/raw_client.go | 206 + seed/go-sdk/trace/problem_test.go | 2594 +++ seed/go-sdk/trace/reference.md | 2524 +++ seed/go-sdk/trace/snippet-templates.json | 0 seed/go-sdk/trace/snippet.json | 389 + seed/go-sdk/trace/submission.go | 9389 +++++++++ seed/go-sdk/trace/submission/client.go | 101 + seed/go-sdk/trace/submission/doc.go | 4 + seed/go-sdk/trace/submission/raw_client.go | 204 + seed/go-sdk/trace/submission_test.go | 16717 ++++++++++++++++ seed/go-sdk/trace/sysprop/client.go | 67 + seed/go-sdk/trace/sysprop/raw_client.go | 117 + seed/go-sdk/trace/v2/client/client.go | 54 + seed/go-sdk/trace/v2/client/raw_client.go | 70 + seed/go-sdk/trace/v2/error_codes.go | 9 + seed/go-sdk/trace/v2/problem.go | 1295 ++ seed/go-sdk/trace/v2/problem/client.go | 103 + seed/go-sdk/trace/v2/problem/raw_client.go | 205 + seed/go-sdk/trace/v2/problem_test.go | 2696 +++ seed/go-sdk/trace/v2/v3/client/client.go | 32 + seed/go-sdk/trace/v2/v3/error_codes.go | 9 + seed/go-sdk/trace/v2/v3/problem.go | 4307 ++++ seed/go-sdk/trace/v2/v3/problem/client.go | 102 + seed/go-sdk/trace/v2/v3/problem/raw_client.go | 204 + seed/go-sdk/trace/v2/v3/problem_test.go | 8720 ++++++++ 134 files changed, 81245 insertions(+), 13 deletions(-) create mode 100644 generators/go/sdk/changes/unreleased/fix-trace-relocated-type-references.yml create mode 100644 packages/cli/cli/changes/unreleased/fix-go-dynamic-snippet-relocated-types.yml create mode 100644 packages/cli/generation/local-generation/local-workspace-runner/src/applyTypeRelocations.ts create mode 100644 seed/go-sdk/trace/.fern/metadata.json create mode 100644 seed/go-sdk/trace/.github/workflows/ci.yml create mode 100644 seed/go-sdk/trace/CONTRIBUTING.md create mode 100644 seed/go-sdk/trace/README.md create mode 100644 seed/go-sdk/trace/admin.go create mode 100644 seed/go-sdk/trace/admin/client.go create mode 100644 seed/go-sdk/trace/admin/raw_client.go create mode 100644 seed/go-sdk/trace/admin_test.go create mode 100644 seed/go-sdk/trace/client/client.go create mode 100644 seed/go-sdk/trace/client/client_test.go create mode 100644 seed/go-sdk/trace/common/common.go create mode 100644 seed/go-sdk/trace/common/common_test.go create mode 100644 seed/go-sdk/trace/common/v2/common.go create mode 100644 seed/go-sdk/trace/common/v2/common_test.go create mode 100644 seed/go-sdk/trace/commons.go create mode 100644 seed/go-sdk/trace/commons_test.go create mode 100644 seed/go-sdk/trace/core/api_error.go create mode 100644 seed/go-sdk/trace/core/http.go create mode 100644 seed/go-sdk/trace/core/request_option.go create mode 100644 seed/go-sdk/trace/dynamic-snippets/example0/snippet.go create mode 100644 seed/go-sdk/trace/dynamic-snippets/example1/snippet.go create mode 100644 seed/go-sdk/trace/dynamic-snippets/example10/snippet.go create mode 100644 seed/go-sdk/trace/dynamic-snippets/example11/snippet.go create mode 100644 seed/go-sdk/trace/dynamic-snippets/example12/snippet.go create mode 100644 seed/go-sdk/trace/dynamic-snippets/example13/snippet.go create mode 100644 seed/go-sdk/trace/dynamic-snippets/example14/snippet.go create mode 100644 seed/go-sdk/trace/dynamic-snippets/example15/snippet.go create mode 100644 seed/go-sdk/trace/dynamic-snippets/example16/snippet.go create mode 100644 seed/go-sdk/trace/dynamic-snippets/example17/snippet.go create mode 100644 seed/go-sdk/trace/dynamic-snippets/example18/snippet.go create mode 100644 seed/go-sdk/trace/dynamic-snippets/example19/snippet.go create mode 100644 seed/go-sdk/trace/dynamic-snippets/example2/snippet.go create mode 100644 seed/go-sdk/trace/dynamic-snippets/example20/snippet.go create mode 100644 seed/go-sdk/trace/dynamic-snippets/example21/snippet.go create mode 100644 seed/go-sdk/trace/dynamic-snippets/example22/snippet.go create mode 100644 seed/go-sdk/trace/dynamic-snippets/example23/snippet.go create mode 100644 seed/go-sdk/trace/dynamic-snippets/example24/snippet.go create mode 100644 seed/go-sdk/trace/dynamic-snippets/example25/snippet.go create mode 100644 seed/go-sdk/trace/dynamic-snippets/example26/snippet.go create mode 100644 seed/go-sdk/trace/dynamic-snippets/example27/snippet.go create mode 100644 seed/go-sdk/trace/dynamic-snippets/example28/snippet.go create mode 100644 seed/go-sdk/trace/dynamic-snippets/example29/snippet.go create mode 100644 seed/go-sdk/trace/dynamic-snippets/example3/snippet.go create mode 100644 seed/go-sdk/trace/dynamic-snippets/example30/snippet.go create mode 100644 seed/go-sdk/trace/dynamic-snippets/example31/snippet.go create mode 100644 seed/go-sdk/trace/dynamic-snippets/example32/snippet.go create mode 100644 seed/go-sdk/trace/dynamic-snippets/example33/snippet.go create mode 100644 seed/go-sdk/trace/dynamic-snippets/example34/snippet.go create mode 100644 seed/go-sdk/trace/dynamic-snippets/example35/snippet.go create mode 100644 seed/go-sdk/trace/dynamic-snippets/example36/snippet.go create mode 100644 seed/go-sdk/trace/dynamic-snippets/example37/snippet.go create mode 100644 seed/go-sdk/trace/dynamic-snippets/example4/snippet.go create mode 100644 seed/go-sdk/trace/dynamic-snippets/example5/snippet.go create mode 100644 seed/go-sdk/trace/dynamic-snippets/example6/snippet.go create mode 100644 seed/go-sdk/trace/dynamic-snippets/example7/snippet.go create mode 100644 seed/go-sdk/trace/dynamic-snippets/example8/snippet.go create mode 100644 seed/go-sdk/trace/dynamic-snippets/example9/snippet.go create mode 100644 seed/go-sdk/trace/environments.go create mode 100644 seed/go-sdk/trace/error_codes.go create mode 100644 seed/go-sdk/trace/errors.go create mode 100644 seed/go-sdk/trace/file_param.go create mode 100644 seed/go-sdk/trace/go.mod create mode 100644 seed/go-sdk/trace/go.sum create mode 100644 seed/go-sdk/trace/homepage/client.go create mode 100644 seed/go-sdk/trace/homepage/raw_client.go create mode 100644 seed/go-sdk/trace/internal/caller.go create mode 100644 seed/go-sdk/trace/internal/caller_test.go create mode 100644 seed/go-sdk/trace/internal/error_decoder.go create mode 100644 seed/go-sdk/trace/internal/error_decoder_test.go create mode 100644 seed/go-sdk/trace/internal/explicit_fields.go create mode 100644 seed/go-sdk/trace/internal/explicit_fields_test.go create mode 100644 seed/go-sdk/trace/internal/extra_properties.go create mode 100644 seed/go-sdk/trace/internal/extra_properties_test.go create mode 100644 seed/go-sdk/trace/internal/http.go create mode 100644 seed/go-sdk/trace/internal/query.go create mode 100644 seed/go-sdk/trace/internal/query_test.go create mode 100644 seed/go-sdk/trace/internal/retrier.go create mode 100644 seed/go-sdk/trace/internal/retrier_test.go create mode 100644 seed/go-sdk/trace/internal/stringer.go create mode 100644 seed/go-sdk/trace/internal/time.go create mode 100644 seed/go-sdk/trace/lang_server.go create mode 100644 seed/go-sdk/trace/lang_server_test.go create mode 100644 seed/go-sdk/trace/migration.go create mode 100644 seed/go-sdk/trace/migration/client.go create mode 100644 seed/go-sdk/trace/migration/raw_client.go create mode 100644 seed/go-sdk/trace/migration_test.go create mode 100644 seed/go-sdk/trace/option/request_option.go create mode 100644 seed/go-sdk/trace/playlist.go create mode 100644 seed/go-sdk/trace/playlist/client.go create mode 100644 seed/go-sdk/trace/playlist/raw_client.go create mode 100644 seed/go-sdk/trace/playlist_test.go create mode 100644 seed/go-sdk/trace/pointer.go create mode 100644 seed/go-sdk/trace/pointer_test.go create mode 100644 seed/go-sdk/trace/problem.go create mode 100644 seed/go-sdk/trace/problem/client.go create mode 100644 seed/go-sdk/trace/problem/raw_client.go create mode 100644 seed/go-sdk/trace/problem_test.go create mode 100644 seed/go-sdk/trace/reference.md delete mode 100644 seed/go-sdk/trace/snippet-templates.json create mode 100644 seed/go-sdk/trace/submission.go create mode 100644 seed/go-sdk/trace/submission/client.go create mode 100644 seed/go-sdk/trace/submission/doc.go create mode 100644 seed/go-sdk/trace/submission/raw_client.go create mode 100644 seed/go-sdk/trace/submission_test.go create mode 100644 seed/go-sdk/trace/sysprop/client.go create mode 100644 seed/go-sdk/trace/sysprop/raw_client.go create mode 100644 seed/go-sdk/trace/v2/client/client.go create mode 100644 seed/go-sdk/trace/v2/client/raw_client.go create mode 100644 seed/go-sdk/trace/v2/error_codes.go create mode 100644 seed/go-sdk/trace/v2/problem.go create mode 100644 seed/go-sdk/trace/v2/problem/client.go create mode 100644 seed/go-sdk/trace/v2/problem/raw_client.go create mode 100644 seed/go-sdk/trace/v2/problem_test.go create mode 100644 seed/go-sdk/trace/v2/v3/client/client.go create mode 100644 seed/go-sdk/trace/v2/v3/error_codes.go create mode 100644 seed/go-sdk/trace/v2/v3/problem.go create mode 100644 seed/go-sdk/trace/v2/v3/problem/client.go create mode 100644 seed/go-sdk/trace/v2/v3/problem/raw_client.go create mode 100644 seed/go-sdk/trace/v2/v3/problem_test.go diff --git a/generators/go-v2/base/src/cli/AbstractGoGeneratorCli.ts b/generators/go-v2/base/src/cli/AbstractGoGeneratorCli.ts index 41d14965e656..f0486d2bdc8d 100644 --- a/generators/go-v2/base/src/cli/AbstractGoGeneratorCli.ts +++ b/generators/go-v2/base/src/cli/AbstractGoGeneratorCli.ts @@ -2,12 +2,21 @@ import { AbstractGeneratorCli, File, parseIR } from "@fern-api/base-generator"; import { AbsoluteFilePath } from "@fern-api/fs-utils"; import { BaseGoCustomConfigSchema } from "@fern-api/go-ast"; import { FernIr } from "@fern-fern/ir-sdk"; +import { readFile } from "fs/promises"; type IntermediateRepresentation = FernIr.IntermediateRepresentation; import { serialization as IrSerialization } from "@fern-fern/ir-sdk"; import { AbstractGoGeneratorContext } from "../context/AbstractGoGeneratorContext.js"; +/** + * Suffix appended to the IR filepath to locate the sidecar file the native + * (v1) Go generator writes with the type locations it relocated while breaking + * import cycles. Must match `typeRelocationsFileSuffix` in + * `generators/go/internal/generator/generator.go`. + */ +const TYPE_RELOCATIONS_FILE_SUFFIX = ".relocations.json"; + export abstract class AbstractGoGeneratorCli< CustomConfig extends BaseGoCustomConfigSchema, GoGeneratorContext extends AbstractGoGeneratorContext @@ -18,10 +27,59 @@ export abstract class AbstractGoGeneratorCli< * @returns */ protected async parseIntermediateRepresentation(irFilepath: string): Promise { - return await parseIR({ + const ir = await parseIR({ absolutePathToIR: AbsoluteFilePath.of(irFilepath), parse: IrSerialization.IntermediateRepresentation.parse }); + await this.applyTypeRelocations(ir, irFilepath); + return ir; + } + + /** + * The native (v1) Go generator breaks import cycles by relocating "leaf" + * types into a shared `common` package, but it does this in its own + * in-memory copy of the IR. Because this generator runs as a separate + * subprocess against the original IR file, it would otherwise reference + * those types from their pre-relocation packages and emit undefined + * symbols. v1 records the relocations in a sidecar file next to the IR; + * here we apply them so both generators agree on where each type lives. + */ + private async applyTypeRelocations(ir: IntermediateRepresentation, irFilepath: string): Promise { + let contents: string; + try { + contents = await readFile(irFilepath + TYPE_RELOCATIONS_FILE_SUFFIX, "utf-8"); + } catch { + // No sidecar file means no cycle-breaking relocations were applied. + return; + } + const relocations: unknown = JSON.parse(contents); + if (typeof relocations !== "object" || relocations == null) { + return; + } + const parseOptions = { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedEnumValues: true, + allowUnrecognizedUnionMembers: true, + skipValidation: true + } as const; + for (const [typeId, rawFernFilepath] of Object.entries(relocations)) { + const typeDeclaration = ir.types[typeId]; + if (typeDeclaration != null) { + typeDeclaration.name = { + ...typeDeclaration.name, + fernFilepath: await IrSerialization.FernFilepath.parseOrThrow(rawFernFilepath, parseOptions) + }; + } + // The dynamic IR powers snippet generation and carries its own copy + // of each type's location, so it must be relocated in lockstep. + const dynamicType = ir.dynamic?.types[typeId]; + if (dynamicType != null) { + dynamicType.declaration = { + ...dynamicType.declaration, + fernFilepath: await IrSerialization.dynamic.FernFilepath.parseOrThrow(rawFernFilepath, parseOptions) + }; + } + } } protected async generateMetadata(context: GoGeneratorContext): Promise { diff --git a/generators/go/internal/generator/cycle.go b/generators/go/internal/generator/cycle.go index 11493a33504e..69cc58e14ec9 100644 --- a/generators/go/internal/generator/cycle.go +++ b/generators/go/internal/generator/cycle.go @@ -486,6 +486,9 @@ func replaceFilepathForTypeInTypeReference( typeId common.TypeId, fernFilepath *common.FernFilepath, ) { + if typeReference == nil { + return + } if container := typeReference.Container; container != nil { replaceFilepathForTypeInContainer(container, typeId, fernFilepath) } diff --git a/generators/go/internal/generator/file_writer.go b/generators/go/internal/generator/file_writer.go index d66743ce84db..0ea16a0bf245 100644 --- a/generators/go/internal/generator/file_writer.go +++ b/generators/go/internal/generator/file_writer.go @@ -475,11 +475,32 @@ func (f *fileWriter) GenerateGetterSetterTestFile() (*File, error) { mainAliasToPath[alias] = importPath } + // Cycle-breaking can relocate types into a sibling subpackage whose alias + // matches the current package name (e.g. a package named "v2" importing the + // relocated "common/v2", also aliased "v2"). In that case a "v2." qualifier + // refers to the imported package, not the local one, so it must be kept and + // imported rather than stripped. + currentImportPath := path.Join(f.baseImportPath, path.Dir(f.filename)) + packageNameIsImportedAlias := false + if importPath, ok := mainAliasToPath[f.packageName]; ok && importPath != currentImportPath { + packageNameIsImportedAlias = true + } + validSubpackages := make(map[string]struct{}) + if packageNameIsImportedAlias { + // A property's qualifier is only the first package referenced in its + // type string (e.g. "common" in map[common.X]*v2.Y), so the colliding + // alias may not be discovered below. Register it up front. + validSubpackages[f.packageName] = struct{}{} + testWriter.scope.AddImport(mainAliasToPath[f.packageName]) + } for _, td := range f.testData { for _, propType := range td.propertyTypes { pkgQualifier := extractPackageQualifier(propType) - if pkgQualifier == "" || pkgQualifier == f.packageName || isStdLibPackage(pkgQualifier) { + if pkgQualifier == "" || isStdLibPackage(pkgQualifier) { + continue + } + if pkgQualifier == f.packageName && !packageNameIsImportedAlias { continue } if _, seen := validSubpackages[pkgQualifier]; seen { @@ -510,7 +531,7 @@ func (f *fileWriter) GenerateGetterSetterTestFile() (*File, error) { // 3. Package qualifier is in validSubpackages (known generated subpackage) // 4. Package qualifier is a standard library package shouldInclude := false - if pkgQualifier == "" || pkgQualifier == f.packageName { + if pkgQualifier == "" || (pkgQualifier == f.packageName && !packageNameIsImportedAlias) { shouldInclude = true } else if _, isValid := validSubpackages[pkgQualifier]; isValid { shouldInclude = true @@ -523,7 +544,16 @@ func (f *fileWriter) GenerateGetterSetterTestFile() (*File, error) { } localPropertyNames = append(localPropertyNames, testData.propertyNames[i]) - localPropertyTypes = append(localPropertyTypes, stripPackageQualifier(propType, f.packageName)) + // When the current package name is also an imported alias (a type was + // relocated into a sibling subpackage by cycle-breaking), the + // "packageName." qualifier refers to that import, not the local + // package, so it must be kept; stripping it references an undefined + // local type. + localPropertyType := propType + if !packageNameIsImportedAlias { + localPropertyType = stripPackageQualifier(propType, f.packageName) + } + localPropertyTypes = append(localPropertyTypes, localPropertyType) if i < len(testData.propertySafeNames) { localPropertySafeNames = append(localPropertySafeNames, testData.propertySafeNames[i]) } diff --git a/generators/go/internal/generator/generator.go b/generators/go/internal/generator/generator.go index 54a53e8d8ea7..59778721f072 100644 --- a/generators/go/internal/generator/generator.go +++ b/generators/go/internal/generator/generator.go @@ -36,6 +36,20 @@ const ( // defaultExportedClientName is the default name for the generated client. defaultExportedClientName = "Client" + + // typeRelocationsFileSuffix is appended to the IR filepath to produce the + // path of the sidecar file that records the type locations relocated by + // cycle-breaking. The go-v2 SDK generator reads this file so that it + // references the relocated types from the same package v1 declares them in. + typeRelocationsFileSuffix = ".relocations.json" + + // typeRelocationsOutputFilepathEnvVar names an environment variable that, + // when set, points to an additional host-readable path where the + // cycle-breaking relocations are written. The Fern CLI's local generation + // runner sets this so its host-side dynamic snippet test generator can + // apply the same relocations before emitting snippets. It is never set by + // remote (Fiddle) generation, so production output is unaffected. + typeRelocationsOutputFilepathEnvVar = "FERN_TYPE_RELOCATIONS_OUTPUT_FILEPATH" ) // Mode is an enum for different generator modes (i.e. types, client, etc). @@ -258,6 +272,7 @@ func (g *Generator) generate(ir *fernir.IntermediateRepresentation, mode Mode) ( return nil, err } if cycleInfo != nil { + relocations := make(map[common.TypeId]*common.FernFilepath, len(cycleInfo.LeafTypes)) for _, leafType := range cycleInfo.LeafTypes { // Update every leaf type's FernFilepath so that the rest of // the types reference it from the appropriate location. @@ -284,6 +299,15 @@ func (g *Generator) generate(ir *fernir.IntermediateRepresentation, mode Mode) ( newFernFilepath.AllParts = append(newFernFilepath.AllParts, commonPackageElement) replaceFilepathForTypeInIR(ir, typeDecl.Name.TypeId, newFernFilepath) + relocations[typeDecl.Name.TypeId] = newFernFilepath + } + // The go-v2 SDK generator runs as a subprocess against the same IR file + // but does not perform cycle-breaking itself. Persist the relocated type + // locations so that go-v2 references the moved types from the same + // package that v1 declares them in (otherwise its generated client code + // references undefined symbols). + if err := g.writeTypeRelocations(relocations); err != nil { + return nil, err } } // First determine what types will be generated so that we can determine whether or not there will @@ -776,9 +800,6 @@ func (g *Generator) generate(ir *fernir.IntermediateRepresentation, mode Mode) ( } } - for _, file := range files { - fmt.Printf("v1 output file %s\n", file.Path) - } return files, nil } @@ -1096,6 +1117,38 @@ func (g *Generator) generateReadme( ) } +// writeTypeRelocations persists the type locations relocated by cycle-breaking +// to a sidecar file next to the IR. The go-v2 SDK generator runs as a separate +// subprocess against the same IR but does not perform cycle-breaking itself, so +// without this it would reference the relocated types from their original +// (pre-relocation) packages and produce undefined symbols. +func (g *Generator) writeTypeRelocations(relocations map[common.TypeId]*common.FernFilepath) error { + if len(relocations) == 0 { + return nil + } + data, err := json.Marshal(relocations) + if err != nil { + return fmt.Errorf("failed to marshal type relocations: %w", err) + } + // Sidecar next to the IR, read by the go-v2 SDK generator running as a + // subprocess against the same IR file inside this container. + if g.config.IRFilepath != "" { + if err := os.WriteFile(g.config.IRFilepath+typeRelocationsFileSuffix, data, 0644); err != nil { + return fmt.Errorf("failed to write type relocations: %w", err) + } + } + // When the Fern CLI's local generation runner asks for it, also write the + // relocations to a host-readable path so the host-side dynamic snippet test + // generator can apply them before emitting snippets. The CLI deletes this + // file before copying generated output, so it never reaches the SDK. + if outputFilepath := os.Getenv(typeRelocationsOutputFilepathEnvVar); outputFilepath != "" { + if err := os.WriteFile(outputFilepath, data, 0644); err != nil { + return fmt.Errorf("failed to write type relocations to %s: %w", outputFilepath, err) + } + } + return nil +} + // readIR reads the *IntermediateRepresentation from the given filename. // It extracts the casingsConfig first so that Name.UnmarshalJSON can // produce the correct casing variants (e.g. with or without initialisms). diff --git a/generators/go/sdk/changes/unreleased/fix-trace-relocated-type-references.yml b/generators/go/sdk/changes/unreleased/fix-trace-relocated-type-references.yml new file mode 100644 index 000000000000..7aec9b0aac6f --- /dev/null +++ b/generators/go/sdk/changes/unreleased/fix-trace-relocated-type-references.yml @@ -0,0 +1,10 @@ +- summary: | + Fix compile errors in generated Go SDKs where the v2/ TypeScript client, + its generated tests, and the generated dynamic snippet tests referenced + types in their original package after the v1 generator had relocated those + leaf types into the shared common package to break an import cycle. The v1 + generator now records the relocations in a sidecar that the v2 generator + reads, and also writes them to a host-readable file (when the Fern CLI asks + for it) so the CLI's dynamic snippet test generator references the relocated + types from the same package too. + type: fix diff --git a/packages/cli/cli/changes/unreleased/fix-go-dynamic-snippet-relocated-types.yml b/packages/cli/cli/changes/unreleased/fix-go-dynamic-snippet-relocated-types.yml new file mode 100644 index 000000000000..5a10f6ab8414 --- /dev/null +++ b/packages/cli/cli/changes/unreleased/fix-go-dynamic-snippet-relocated-types.yml @@ -0,0 +1,8 @@ +- summary: | + When a generator breaks an import cycle by relocating types into a shared + package, the local generation runner now applies those relocations to the IR + that powers host-side dynamic snippet test generation. This keeps the + generated dynamic snippets referencing each relocated type from the same + package the generator declares it in, fixing undefined-symbol compile errors + in the Go SDK's dynamic snippet tests. + type: fix diff --git a/packages/cli/generation/local-generation/docker-utils/src/runDocker.ts b/packages/cli/generation/local-generation/docker-utils/src/runDocker.ts index bb302ccaa90f..b97c208dcf48 100644 --- a/packages/cli/generation/local-generation/docker-utils/src/runDocker.ts +++ b/packages/cli/generation/local-generation/docker-utils/src/runDocker.ts @@ -248,6 +248,7 @@ export async function execInContainer({ containerId, command, runner, + envVars = {}, writeLogsToFile = true, reject = true }: { @@ -255,14 +256,16 @@ export async function execInContainer({ containerId: string; command: string[]; runner?: ContainerRunner; + envVars?: Record; writeLogsToFile?: boolean; reject?: boolean; }): Promise<{ stdout: string; stderr: string; exitCode: number }> { const containerRunner = runner ?? "docker"; + const envArgs = Object.entries(envVars).flatMap(([key, value]) => ["-e", `${key}=${value}`]); const { stdout, stderr, exitCode } = await loggingExeca( logger, containerRunner, - ["exec", "--user", "root", containerId, ...command], + ["exec", "--user", "root", ...envArgs, containerId, ...command], { reject: false, all: true, diff --git a/packages/cli/generation/local-generation/local-workspace-runner/src/ContainerExecutionEnvironment.ts b/packages/cli/generation/local-generation/local-workspace-runner/src/ContainerExecutionEnvironment.ts index 51cf43431970..d5795ea6bbeb 100644 --- a/packages/cli/generation/local-generation/local-workspace-runner/src/ContainerExecutionEnvironment.ts +++ b/packages/cli/generation/local-generation/local-workspace-runner/src/ContainerExecutionEnvironment.ts @@ -7,7 +7,9 @@ import { CONTAINER_PATH_TO_IR, CONTAINER_PATH_TO_SNIPPET, CONTAINER_PATH_TO_SNIPPET_TEMPLATES, - DEFAULT_NODE_DEBUG_PORT + DEFAULT_NODE_DEBUG_PORT, + TYPE_RELOCATIONS_FILENAME, + TYPE_RELOCATIONS_OUTPUT_FILEPATH_ENV_VAR } from "./constants.js"; import { ExecutionEnvironment } from "./ExecutionEnvironment.js"; @@ -78,7 +80,13 @@ export class ContainerExecutionEnvironment implements ExecutionEnvironment { binds.push(`${sourceMount.hostPath}:${sourceMount.containerPath}:ro`); } - const envVars: Record = {}; + const envVars: Record = { + // Generators that relocate types to break import cycles write the + // relocations here (inside the bind-mounted output dir, so it is + // host-readable). The host applies them to its dynamic snippet IR + // and deletes the file before copying generated output. + [TYPE_RELOCATIONS_OUTPUT_FILEPATH_ENV_VAR]: `${CONTAINER_CODEGEN_OUTPUT_DIRECTORY}/${TYPE_RELOCATIONS_FILENAME}` + }; const ports: Record = {}; if (inspect) { envVars["NODE_OPTIONS"] = `--inspect-brk=0.0.0.0:${DEFAULT_NODE_DEBUG_PORT}`; diff --git a/packages/cli/generation/local-generation/local-workspace-runner/src/NativeExecutionEnvironment.ts b/packages/cli/generation/local-generation/local-workspace-runner/src/NativeExecutionEnvironment.ts index 271066276b90..21e3b77e9e8d 100644 --- a/packages/cli/generation/local-generation/local-workspace-runner/src/NativeExecutionEnvironment.ts +++ b/packages/cli/generation/local-generation/local-workspace-runner/src/NativeExecutionEnvironment.ts @@ -1,7 +1,12 @@ import { loggingExeca } from "@fern-api/logging-execa"; import { CliError } from "@fern-api/task-context"; import { copyFile, rm } from "fs/promises"; -import { CONTAINER_SPECS_DIRECTORY } from "./constants.js"; +import { join } from "path"; +import { + CONTAINER_SPECS_DIRECTORY, + TYPE_RELOCATIONS_FILENAME, + TYPE_RELOCATIONS_OUTPUT_FILEPATH_ENV_VAR +} from "./constants.js"; import { ExecutionEnvironment, SourceMount } from "./ExecutionEnvironment.js"; const LICENSE_MOUNT_PATH = "/tmp/LICENSE"; @@ -64,6 +69,14 @@ export class NativeExecutionEnvironment implements ExecutionEnvironment { const specsMount = sourceMounts?.find((m: SourceMount) => m.containerPath === CONTAINER_SPECS_DIRECTORY); const specsEnv = specsMount != null ? { FERN_SPECS_DIR: specsMount.hostPath } : {}; + // Generators that relocate types to break import cycles write the + // relocations here (directly in the host output dir). The host applies + // them to its dynamic snippet IR and deletes the file before copying + // generated output. + const relocationsEnv = { + [TYPE_RELOCATIONS_OUTPUT_FILEPATH_ENV_VAR]: join(outputPath, TYPE_RELOCATIONS_FILENAME) + }; + try { for (const command of this.commands) { const processedCommand = command @@ -88,6 +101,7 @@ export class NativeExecutionEnvironment implements ExecutionEnvironment { ...process.env, ...this.env, ...specsEnv, + ...relocationsEnv, IR_PATH: irPath, CONFIG_PATH: configPath, OUTPUT_PATH: outputPath, diff --git a/packages/cli/generation/local-generation/local-workspace-runner/src/ReusableContainerExecutionEnvironment.ts b/packages/cli/generation/local-generation/local-workspace-runner/src/ReusableContainerExecutionEnvironment.ts index 1887e3511f95..c51524db2b57 100644 --- a/packages/cli/generation/local-generation/local-workspace-runner/src/ReusableContainerExecutionEnvironment.ts +++ b/packages/cli/generation/local-generation/local-workspace-runner/src/ReusableContainerExecutionEnvironment.ts @@ -16,7 +16,9 @@ import { CONTAINER_PATH_TO_IR, CONTAINER_PATH_TO_SNIPPET, CONTAINER_PATH_TO_SNIPPET_TEMPLATES, - CONTAINER_SOURCES_DIRECTORY + CONTAINER_SOURCES_DIRECTORY, + TYPE_RELOCATIONS_FILENAME, + TYPE_RELOCATIONS_OUTPUT_FILEPATH_ENV_VAR } from "./constants.js"; import { ExecutionEnvironment } from "./ExecutionEnvironment.js"; @@ -263,6 +265,13 @@ export class ReusableContainerExecutionEnvironment implements ExecutionEnvironme logger, containerId, command: [...entrypoint, CONTAINER_GENERATOR_CONFIG_PATH], + // Generators that relocate types to break import cycles write the + // relocations here. It is copied back to the host output dir below, + // where the host applies them to its dynamic snippet IR and deletes + // the file before copying generated output. + envVars: { + [TYPE_RELOCATIONS_OUTPUT_FILEPATH_ENV_VAR]: `${CONTAINER_CODEGEN_OUTPUT_DIRECTORY}/${TYPE_RELOCATIONS_FILENAME}` + }, runner: this.runner, writeLogsToFile: true }); diff --git a/packages/cli/generation/local-generation/local-workspace-runner/src/applyTypeRelocations.ts b/packages/cli/generation/local-generation/local-workspace-runner/src/applyTypeRelocations.ts new file mode 100644 index 000000000000..6661179bd524 --- /dev/null +++ b/packages/cli/generation/local-generation/local-workspace-runner/src/applyTypeRelocations.ts @@ -0,0 +1,80 @@ +import { AbsoluteFilePath, join, RelativeFilePath } from "@fern-api/fs-utils"; +import { IntermediateRepresentation, serialization as IrSerialization } from "@fern-api/ir-sdk"; +import { TaskContext } from "@fern-api/task-context"; +import { readFile, rm } from "fs/promises"; +import { TYPE_RELOCATIONS_FILENAME } from "./constants.js"; + +/** + * Some generators (e.g. Go) break import cycles by relocating "leaf" types into + * a shared package. They do this in their own in-memory copy of the IR, so the + * relocations are invisible to the host-side dynamic snippet test generator, + * which would otherwise emit snippets referencing the types from their + * pre-relocation packages and fail to compile. + * + * When relocations occur, the generator writes them to a file in its output + * directory (see `TYPE_RELOCATIONS_OUTPUT_FILEPATH_ENV_VAR`). This applies those + * relocations to the host's IR (mirroring what the generator did internally) and + * then deletes the file so it never ships in the generated SDK. + * + * No-op when the file is absent (i.e. no cycle-breaking happened, or the + * generator does not emit relocations). + */ +export async function applyTypeRelocations({ + ir, + tmpOutputDirectory, + context +}: { + ir: IntermediateRepresentation; + tmpOutputDirectory: AbsoluteFilePath; + context: TaskContext; +}): Promise { + const relocationsFilepath = join(tmpOutputDirectory, RelativeFilePath.of(TYPE_RELOCATIONS_FILENAME)); + + let contents: string; + try { + contents = await readFile(relocationsFilepath, "utf-8"); + } catch { + // No file means the generator did not relocate any types. + return; + } + + try { + const relocations: unknown = JSON.parse(contents); + if (typeof relocations !== "object" || relocations == null) { + return; + } + const parseOptions = { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedEnumValues: true, + allowUnrecognizedUnionMembers: true, + skipValidation: true + } as const; + for (const [typeId, rawFernFilepath] of Object.entries(relocations)) { + const typeDeclaration = ir.types[typeId]; + if (typeDeclaration != null) { + typeDeclaration.name = { + ...typeDeclaration.name, + fernFilepath: await IrSerialization.FernFilepath.parseOrThrow(rawFernFilepath, parseOptions) + }; + } + // The dynamic IR powers snippet generation and carries its own copy + // of each type's location, so it must be relocated in lockstep. + const dynamicType = ir.dynamic?.types[typeId]; + if (dynamicType != null) { + dynamicType.declaration = { + ...dynamicType.declaration, + fernFilepath: await IrSerialization.dynamic.FernFilepath.parseOrThrow(rawFernFilepath, parseOptions) + }; + } + } + } catch (error) { + context.logger.warn( + `Failed to apply type relocations from ${relocationsFilepath}: ${ + error instanceof Error ? error.message : String(error) + }` + ); + } finally { + // Never let the relocations file leak into the generated SDK output. + await rm(relocationsFilepath, { force: true }); + } +} diff --git a/packages/cli/generation/local-generation/local-workspace-runner/src/constants.ts b/packages/cli/generation/local-generation/local-workspace-runner/src/constants.ts index db199336028b..688ef5ef23c8 100644 --- a/packages/cli/generation/local-generation/local-workspace-runner/src/constants.ts +++ b/packages/cli/generation/local-generation/local-workspace-runner/src/constants.ts @@ -33,6 +33,24 @@ export const CONTAINER_SPECS_DIRECTORY = DOCKER_SPECS_DIRECTORY; export const DEFAULT_NODE_DEBUG_PORT = "9229"; +/** + * Filename, relative to the generator's output directory, that the Go (v1) + * generator writes its cycle-breaking type relocations to when + * {@link TYPE_RELOCATIONS_OUTPUT_FILEPATH_ENV_VAR} is set. The output directory + * is host-readable in every execution environment (bind mount, `docker cp`, or + * native), so the host-side dynamic snippet test generator can apply the same + * relocations the generator did. The file is deleted before generated output is + * copied to its final location, so it never ships in an SDK. + */ +export const TYPE_RELOCATIONS_FILENAME = ".fern-type-relocations.json"; + +/** + * Environment variable telling the generator where to additionally write its + * cycle-breaking type relocations. Must match `typeRelocationsOutputFilepathEnvVar` + * in `generators/go/internal/generator/generator.go`. + */ +export const TYPE_RELOCATIONS_OUTPUT_FILEPATH_ENV_VAR = "FERN_TYPE_RELOCATIONS_OUTPUT_FILEPATH"; + /** * Generators that receive pre-processed raw API spec files mounted into their * Docker container. Add new generator names here as they opt in. diff --git a/packages/cli/generation/local-generation/local-workspace-runner/src/runGenerator.ts b/packages/cli/generation/local-generation/local-workspace-runner/src/runGenerator.ts index 8f9d9abdc2f9..ef8819848884 100644 --- a/packages/cli/generation/local-generation/local-workspace-runner/src/runGenerator.ts +++ b/packages/cli/generation/local-generation/local-workspace-runner/src/runGenerator.ts @@ -16,6 +16,7 @@ import { mkdir, writeFile } from "fs/promises"; import * as path from "path"; import { join } from "path"; import tmp, { DirectoryResult } from "tmp-promise"; +import { applyTypeRelocations } from "./applyTypeRelocations.js"; import { ContainerExecutionEnvironment } from "./ContainerExecutionEnvironment.js"; import { CODEGEN_OUTPUT_DIRECTORY_NAME, @@ -292,6 +293,16 @@ export async function writeFilesToDiskAndRunGenerator({ runner }); + // If the generator relocated any types to break import cycles, apply those + // relocations to the IR powering host-side dynamic snippet generation so it + // references the moved types from the same package the generator declares + // them in. Deletes the relocations file so it never reaches the SDK output. + await applyTypeRelocations({ + ir: latest, + tmpOutputDirectory: absolutePathToTmpOutputDirectory, + context + }); + const taskHandler = new LocalTaskHandler({ context, absolutePathToLocalOutput, diff --git a/seed/go-sdk/seed.yml b/seed/go-sdk/seed.yml index 594e73dd4599..fab9956557bd 100644 --- a/seed/go-sdk/seed.yml +++ b/seed/go-sdk/seed.yml @@ -359,5 +359,4 @@ allowedFailures: # "not supported yet" or a nil-pointer panic). These need feature work. # Generated Go code does not compile. Each needs a generator fix. - - trace # generated v2/ subpackage references undefined test types - request-parameters # int64 default 9223372036854775807 loses precision in the IR pipeline diff --git a/seed/go-sdk/trace/.fern/metadata.json b/seed/go-sdk/trace/.fern/metadata.json new file mode 100644 index 000000000000..b100b18d03b2 --- /dev/null +++ b/seed/go-sdk/trace/.fern/metadata.json @@ -0,0 +1,12 @@ +{ + "cliVersion": "DUMMY", + "generatorName": "fernapi/fern-go-sdk", + "generatorVersion": "latest", + "generatorConfig": { + "enableWireTests": false + }, + "originGitCommit": "DUMMY", + "invokedBy": "manual", + "requestedVersion": "0.0.1", + "sdkVersion": "v0.0.1" +} \ No newline at end of file diff --git a/seed/go-sdk/trace/.github/workflows/ci.yml b/seed/go-sdk/trace/.github/workflows/ci.yml new file mode 100644 index 000000000000..1097e6a18acc --- /dev/null +++ b/seed/go-sdk/trace/.github/workflows/ci.yml @@ -0,0 +1,62 @@ +name: ci + +on: [push] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: false + +jobs: + compile: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Set up go + uses: actions/setup-go@v4 + + - name: Compile + run: go build ./... + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Set up go + uses: actions/setup-go@v4 + + - name: Lint + uses: golangci/golangci-lint-action@v9 + with: + version: v2.10.1 + test: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Set up go + uses: actions/setup-go@v4 + + - name: Setup wiremock server + run: | + PROJECT_NAME="wiremock-$(basename $(dirname $(pwd)) | tr -d '.')" + echo "PROJECT_NAME=$PROJECT_NAME" >> $GITHUB_ENV + if [ -f wiremock/docker-compose.test.yml ]; then + docker compose -p "$PROJECT_NAME" -f wiremock/docker-compose.test.yml down + docker compose -p "$PROJECT_NAME" -f wiremock/docker-compose.test.yml up -d + WIREMOCK_PORT=$(docker compose -p "$PROJECT_NAME" -f wiremock/docker-compose.test.yml port wiremock 8080 | cut -d: -f2) + echo "WIREMOCK_URL=http://localhost:$WIREMOCK_PORT" >> $GITHUB_ENV + fi + + - name: Test + run: go test ./... + + - name: Teardown wiremock server + if: always() + run: | + if [ -f wiremock/docker-compose.test.yml ]; then + docker compose -p "$PROJECT_NAME" -f wiremock/docker-compose.test.yml down + fi diff --git a/seed/go-sdk/trace/CONTRIBUTING.md b/seed/go-sdk/trace/CONTRIBUTING.md new file mode 100644 index 000000000000..cd327427f36b --- /dev/null +++ b/seed/go-sdk/trace/CONTRIBUTING.md @@ -0,0 +1,143 @@ +# Contributing + +Thanks for your interest in contributing to this SDK! This document provides guidelines for contributing to the project. + +## Getting Started + +### Prerequisites + +- Go 1.21+ +- Docker (only required to run wire tests; see [Wire Tests](#wire-tests)) + +### Installation + +Install the project dependencies: + +```bash +go mod tidy +``` + +### Building + +Build the project: + +```bash +go build ./... +``` + +### Testing + +Run the test suite: + +```bash +go test ./... +``` + +#### Wire Tests + +If this SDK includes a `wiremock/` directory, the test suite contains wire tests that exercise the client against a [WireMock](https://wiremock.org/) server. The `go test` command above expects `WIREMOCK_URL` to point at a running WireMock instance. + +Start WireMock, run the tests, then tear it down: + +```bash +docker compose -f wiremock/docker-compose.test.yml up -d +export WIREMOCK_URL=http://localhost:$(docker compose -f wiremock/docker-compose.test.yml port wiremock 8080 | cut -d: -f2) +go test ./... +docker compose -f wiremock/docker-compose.test.yml down +``` + +The compose file maps WireMock's container port `8080` to a random host port, which is why `WIREMOCK_URL` is derived from `docker compose ... port` rather than hardcoded. + +### Formatting + +Format code: + +```bash +gofmt -w . +``` + +Or equivalently: + +```bash +go fmt ./... +``` + +### Vetting + +Run the Go vet tool to catch common mistakes: + +```bash +go vet ./... +``` + +## About Generated Code + +**Important**: Most files in this SDK are automatically generated by [Fern](https://buildwithfern.com) from the API definition. Direct modifications to generated files will be overwritten the next time the SDK is generated. + +### Generated Files + +The following directories contain generated code: +- Most Go files in the project + +### How to Customize + +If you need to customize the SDK, you have two options: + +#### Option 1: Use `.fernignore` + +For custom code that should persist across SDK regenerations: + +1. Create a `.fernignore` file in the project root +2. Add file patterns for files you want to preserve (similar to `.gitignore` syntax) +3. Add your custom code to those files + +Files listed in `.fernignore` will not be overwritten when the SDK is regenerated. + +For more information, see the [Fern documentation on custom code](https://buildwithfern.com/learn/sdks/overview/custom-code). + +#### Option 2: Contribute to the Generator + +If you want to change how code is generated for all users of this SDK: + +1. The Go SDK generator lives in the [Fern repository](https://github.com/fern-api/fern) +2. Generator code is located at `generators/go-v2/` +3. Follow the [Fern contributing guidelines](https://github.com/fern-api/fern/blob/main/CONTRIBUTING.md) +4. Submit a pull request with your changes to the generator + +This approach is best for: +- Bug fixes in generated code +- New features that would benefit all users +- Improvements to code generation patterns + +## Making Changes + +### Workflow + +1. Create a new branch for your changes +2. Make your modifications +3. Run tests to ensure nothing breaks: `go test ./...` +4. Format your code: `gofmt -w .` +5. Vet your code: `go vet ./...` +6. Build the project: `go build ./...` +7. Commit your changes with a clear commit message +8. Push your branch and create a pull request + +### Commit Messages + +Write clear, descriptive commit messages that explain what changed and why. + +### Code Style + +This project uses `gofmt` for code formatting. Run `gofmt -w .` before committing to ensure your code meets the project's style guidelines. + +## Questions or Issues? + +If you have questions or run into issues: + +1. Check the [Fern documentation](https://buildwithfern.com) +2. Search existing [GitHub issues](https://github.com/fern-api/fern/issues) +3. Open a new issue if your question hasn't been addressed + +## License + +By contributing to this project, you agree that your contributions will be licensed under the same license as the project. diff --git a/seed/go-sdk/trace/README.md b/seed/go-sdk/trace/README.md new file mode 100644 index 000000000000..7e5cd825c22c --- /dev/null +++ b/seed/go-sdk/trace/README.md @@ -0,0 +1,211 @@ +# Seed Go Library + +[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=Seed%2FGo) + +The Seed Go library provides convenient access to the Seed APIs from Go. + +## Table of Contents + +- [Reference](#reference) +- [Usage](#usage) +- [Environments](#environments) +- [Errors](#errors) +- [Request Options](#request-options) +- [Advanced](#advanced) + - [Response Headers](#response-headers) + - [Retries](#retries) + - [Timeouts](#timeouts) + - [Explicit Null](#explicit-null) +- [Contributing](#contributing) + +## Reference + +A full reference for this library is available [here](./reference.md). + +## Usage + +Instantiate and use the client with the following: + +```go +package example + +import ( + context "context" + + uuid "github.com/google/uuid" + fern "github.com/trace/fern" + client "github.com/trace/fern/client" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithToken( + "", + ), + ) + request := &fern.TestSubmissionStatus{ + Stopped: "stopped", + } + client.Admin.UpdateTestSubmissionStatus( + context.TODO(), + uuid.MustParse( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + request, + ) +} +``` + +## Environments + +You can choose between different environments by using the `option.WithBaseURL` option. You can configure any arbitrary base +URL, which is particularly useful in test environments. + +```go +client := client.NewClient( + option.WithBaseURL(trace.Environments.Prod), +) +``` + +## Errors + +Structured error types are returned from API calls that return non-success status codes. These errors are compatible +with the `errors.Is` and `errors.As` APIs, so you can access the error like so: + +```go +response, err := client.Admin.UpdateTestSubmissionStatus(...) +if err != nil { + var apiError *core.APIError + if errors.As(err, apiError) { + // Do something with the API error ... + } + return err +} +``` + +## Request Options + +A variety of request options are included to adapt the behavior of the library, which includes configuring +authorization tokens, or providing your own instrumented `*http.Client`. + +These request options can either be +specified on the client so that they're applied on every request, or for an individual request, like so: + +> Providing your own `*http.Client` is recommended. Otherwise, the `http.DefaultClient` will be used, +> and your client will wait indefinitely for a response (unless the per-request, context-based timeout +> is used). + +```go +// Specify default options applied on every request. +client := client.NewClient( + option.WithToken(""), + option.WithHTTPClient( + &http.Client{ + Timeout: 5 * time.Second, + }, + ), +) + +// Specify options for an individual request. +response, err := client.Admin.UpdateTestSubmissionStatus( + ..., + option.WithToken(""), +) +``` + +## Advanced + +### Response Headers + +You can access the raw HTTP response data by using the `WithRawResponse` field on the client. This is useful +when you need to examine the response headers received from the API call. (When the endpoint is paginated, +the raw HTTP response data will be included automatically in the Page response object.) + +```go +response, err := client.Admin.WithRawResponse.UpdateTestSubmissionStatus(...) +if err != nil { + return err +} +fmt.Printf("Got response headers: %v", response.Header) +fmt.Printf("Got status code: %d", response.StatusCode) +``` + +### Retries + +The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long +as the request is deemed retryable and the number of retry attempts has not grown larger than the configured +retry limit (default: 2). + +Which status codes are retried depends on the `retryStatusCodes` generator configuration: + +**`legacy`** (current default): retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) + +If the `Retry-After` header is present in the response, the SDK will prioritize respecting its value exactly +over the default exponential backoff. + +Use the `option.WithMaxAttempts` option to configure this behavior for the entire client or an individual request: + +```go +client := client.NewClient( + option.WithMaxAttempts(1), +) + +response, err := client.Admin.UpdateTestSubmissionStatus( + ..., + option.WithMaxAttempts(1), +) +``` + +### Timeouts + +Setting a timeout for each individual request is as simple as using the standard context library. Setting a one second timeout for an individual API call looks like the following: + +```go +ctx, cancel := context.WithTimeout(ctx, time.Second) +defer cancel() + +response, err := client.Admin.UpdateTestSubmissionStatus(ctx, ...) +``` + +### Explicit Null + +If you want to send the explicit `null` JSON value through an optional parameter, you can use the setters\ +that come with every object. Calling a setter method for a property will flip a bit in the `explicitFields` +bitfield for that setter's object; during serialization, any property with a flipped bit will have its +omittable status stripped, so zero or `nil` values will be sent explicitly rather than omitted altogether: + +```go +type ExampleRequest struct { + // An optional string parameter. + Name *string `json:"name,omitempty" url:"-"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` +} + +request := &ExampleRequest{} +request.SetName(nil) + +response, err := client.Admin.UpdateTestSubmissionStatus(ctx, request, ...) +``` + +## Contributing + +While we value open-source contributions to this SDK, this library is generated programmatically. +Additions made directly to this library would have to be moved over to our generation code, +otherwise they would be overwritten upon the next generated release. Feel free to open a PR as +a proof of concept, but know that we will not be able to merge it as-is. We suggest opening +an issue first to discuss with us! + +On the other hand, contributions to the README are always very welcome! diff --git a/seed/go-sdk/trace/admin.go b/seed/go-sdk/trace/admin.go new file mode 100644 index 000000000000..dc4cf936bff2 --- /dev/null +++ b/seed/go-sdk/trace/admin.go @@ -0,0 +1,264 @@ +// Code generated by Fern. DO NOT EDIT. + +package trace + +import ( + json "encoding/json" + fmt "fmt" + internal "github.com/trace/fern/internal" + big "math/big" +) + +var ( + storeTracedTestCaseRequestFieldResult = big.NewInt(1 << 0) + storeTracedTestCaseRequestFieldTraceResponses = big.NewInt(1 << 1) +) + +type StoreTracedTestCaseRequest struct { + Result *TestCaseResultWithStdout `json:"result" url:"-"` + TraceResponses []*TraceResponse `json:"traceResponses" url:"-"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` +} + +func (s *StoreTracedTestCaseRequest) require(field *big.Int) { + if s.explicitFields == nil { + s.explicitFields = big.NewInt(0) + } + s.explicitFields.Or(s.explicitFields, field) +} + +// SetResult sets the Result field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *StoreTracedTestCaseRequest) SetResult(result *TestCaseResultWithStdout) { + s.Result = result + s.require(storeTracedTestCaseRequestFieldResult) +} + +// SetTraceResponses sets the TraceResponses field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *StoreTracedTestCaseRequest) SetTraceResponses(traceResponses []*TraceResponse) { + s.TraceResponses = traceResponses + s.require(storeTracedTestCaseRequestFieldTraceResponses) +} + +func (s *StoreTracedTestCaseRequest) UnmarshalJSON(data []byte) error { + type unmarshaler StoreTracedTestCaseRequest + var body unmarshaler + if err := json.Unmarshal(data, &body); err != nil { + return err + } + *s = StoreTracedTestCaseRequest(body) + return nil +} + +func (s *StoreTracedTestCaseRequest) MarshalJSON() ([]byte, error) { + type embed StoreTracedTestCaseRequest + var marshaler = struct { + embed + }{ + embed: embed(*s), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, s.explicitFields) + return json.Marshal(explicitMarshaler) +} + +var ( + storeTracedWorkspaceRequestFieldWorkspaceRunDetails = big.NewInt(1 << 0) + storeTracedWorkspaceRequestFieldTraceResponses = big.NewInt(1 << 1) +) + +type StoreTracedWorkspaceRequest struct { + WorkspaceRunDetails *WorkspaceRunDetails `json:"workspaceRunDetails" url:"-"` + TraceResponses []*TraceResponse `json:"traceResponses" url:"-"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` +} + +func (s *StoreTracedWorkspaceRequest) require(field *big.Int) { + if s.explicitFields == nil { + s.explicitFields = big.NewInt(0) + } + s.explicitFields.Or(s.explicitFields, field) +} + +// SetWorkspaceRunDetails sets the WorkspaceRunDetails field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *StoreTracedWorkspaceRequest) SetWorkspaceRunDetails(workspaceRunDetails *WorkspaceRunDetails) { + s.WorkspaceRunDetails = workspaceRunDetails + s.require(storeTracedWorkspaceRequestFieldWorkspaceRunDetails) +} + +// SetTraceResponses sets the TraceResponses field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *StoreTracedWorkspaceRequest) SetTraceResponses(traceResponses []*TraceResponse) { + s.TraceResponses = traceResponses + s.require(storeTracedWorkspaceRequestFieldTraceResponses) +} + +func (s *StoreTracedWorkspaceRequest) UnmarshalJSON(data []byte) error { + type unmarshaler StoreTracedWorkspaceRequest + var body unmarshaler + if err := json.Unmarshal(data, &body); err != nil { + return err + } + *s = StoreTracedWorkspaceRequest(body) + return nil +} + +func (s *StoreTracedWorkspaceRequest) MarshalJSON() ([]byte, error) { + type embed StoreTracedWorkspaceRequest + var marshaler = struct { + embed + }{ + embed: embed(*s), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, s.explicitFields) + return json.Marshal(explicitMarshaler) +} + +type Test struct { + Type string + And bool + Or bool + + rawJSON json.RawMessage +} + +func (t *Test) GetType() string { + if t == nil { + return "" + } + return t.Type +} + +func (t *Test) GetAnd() bool { + if t == nil { + return false + } + return t.And +} + +func (t *Test) GetOr() bool { + if t == nil { + return false + } + return t.Or +} + +func (t *Test) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + t.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", t) + } + switch unmarshaler.Type { + case "and": + var valueUnmarshaler struct { + And bool `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + t.And = valueUnmarshaler.And + case "or": + var valueUnmarshaler struct { + Or bool `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + t.Or = valueUnmarshaler.Or + } + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t Test) MarshalJSON() ([]byte, error) { + if err := t.validate(); err != nil { + return nil, err + } + if t.And != false { + var marshaler = struct { + Type string `json:"type"` + And bool `json:"value"` + }{ + Type: "and", + And: t.And, + } + return json.Marshal(marshaler) + } + if t.Or != false { + var marshaler = struct { + Type string `json:"type"` + Or bool `json:"value"` + }{ + Type: "or", + Or: t.Or, + } + return json.Marshal(marshaler) + } + if len(t.rawJSON) > 0 { + return t.rawJSON, nil + } + return nil, fmt.Errorf("type %T does not define a non-empty union type", t) +} + +type TestVisitor interface { + VisitAnd(bool) error + VisitOr(bool) error +} + +func (t *Test) Accept(visitor TestVisitor) error { + if t.And != false { + return visitor.VisitAnd(t.And) + } + if t.Or != false { + return visitor.VisitOr(t.Or) + } + return fmt.Errorf("type %T does not define a non-empty union type", t) +} + +func (t *Test) validate() error { + if t == nil { + return fmt.Errorf("type %T is nil", t) + } + var fields []string + if t.And != false { + fields = append(fields, "and") + } + if t.Or != false { + fields = append(fields, "or") + } + if len(fields) == 0 { + if t.Type != "" { + if len(t.rawJSON) > 0 { + return nil + } + return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", t, t.Type) + } + return fmt.Errorf("type %T is empty", t) + } + if len(fields) > 1 { + return fmt.Errorf("type %T defines values for %s, but only one value is allowed", t, fields) + } + if t.Type != "" { + field := fields[0] + if t.Type != field { + return fmt.Errorf( + "type %T defines a discriminant set to %q, but it does not match the %T field; either remove or update the discriminant to match", + t, + t.Type, + t, + ) + } + } + return nil +} diff --git a/seed/go-sdk/trace/admin/client.go b/seed/go-sdk/trace/admin/client.go new file mode 100644 index 000000000000..dfe57806f195 --- /dev/null +++ b/seed/go-sdk/trace/admin/client.go @@ -0,0 +1,184 @@ +// Code generated by Fern. DO NOT EDIT. + +package admin + +import ( + context "context" + + fern "github.com/trace/fern" + v2 "github.com/trace/fern/common/v2" + core "github.com/trace/fern/core" + internal "github.com/trace/fern/internal" + option "github.com/trace/fern/option" +) + +type Client struct { + WithRawResponse *RawClient + + options *core.RequestOptions + baseURL string + caller *internal.Caller +} + +func NewClient(options *core.RequestOptions) *Client { + return &Client{ + WithRawResponse: NewRawClient(options), + options: options, + baseURL: options.BaseURL, + caller: internal.NewCaller( + &internal.CallerParams{ + Client: options.HTTPClient, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + }, + ), + } +} + +func (c *Client) UpdateTestSubmissionStatus( + ctx context.Context, + submissionID fern.SubmissionID, + request *fern.TestSubmissionStatus, + opts ...option.RequestOption, +) error { + _, err := c.WithRawResponse.UpdateTestSubmissionStatus( + ctx, + submissionID, + request, + opts..., + ) + if err != nil { + return err + } + return nil +} + +func (c *Client) SendTestSubmissionUpdate( + ctx context.Context, + submissionID fern.SubmissionID, + request *fern.TestSubmissionUpdate, + opts ...option.RequestOption, +) error { + _, err := c.WithRawResponse.SendTestSubmissionUpdate( + ctx, + submissionID, + request, + opts..., + ) + if err != nil { + return err + } + return nil +} + +func (c *Client) UpdateWorkspaceSubmissionStatus( + ctx context.Context, + submissionID fern.SubmissionID, + request *fern.WorkspaceSubmissionStatus, + opts ...option.RequestOption, +) error { + _, err := c.WithRawResponse.UpdateWorkspaceSubmissionStatus( + ctx, + submissionID, + request, + opts..., + ) + if err != nil { + return err + } + return nil +} + +func (c *Client) SendWorkspaceSubmissionUpdate( + ctx context.Context, + submissionID fern.SubmissionID, + request *fern.WorkspaceSubmissionUpdate, + opts ...option.RequestOption, +) error { + _, err := c.WithRawResponse.SendWorkspaceSubmissionUpdate( + ctx, + submissionID, + request, + opts..., + ) + if err != nil { + return err + } + return nil +} + +func (c *Client) StoreTracedTestCase( + ctx context.Context, + submissionID fern.SubmissionID, + testCaseID string, + request *fern.StoreTracedTestCaseRequest, + opts ...option.RequestOption, +) error { + _, err := c.WithRawResponse.StoreTracedTestCase( + ctx, + submissionID, + testCaseID, + request, + opts..., + ) + if err != nil { + return err + } + return nil +} + +func (c *Client) StoreTracedTestCaseV2( + ctx context.Context, + submissionID fern.SubmissionID, + testCaseID v2.TestCaseID, + request []*fern.TraceResponseV2, + opts ...option.RequestOption, +) error { + _, err := c.WithRawResponse.StoreTracedTestCaseV2( + ctx, + submissionID, + testCaseID, + request, + opts..., + ) + if err != nil { + return err + } + return nil +} + +func (c *Client) StoreTracedWorkspace( + ctx context.Context, + submissionID fern.SubmissionID, + request *fern.StoreTracedWorkspaceRequest, + opts ...option.RequestOption, +) error { + _, err := c.WithRawResponse.StoreTracedWorkspace( + ctx, + submissionID, + request, + opts..., + ) + if err != nil { + return err + } + return nil +} + +func (c *Client) StoreTracedWorkspaceV2( + ctx context.Context, + submissionID fern.SubmissionID, + request []*fern.TraceResponseV2, + opts ...option.RequestOption, +) error { + _, err := c.WithRawResponse.StoreTracedWorkspaceV2( + ctx, + submissionID, + request, + opts..., + ) + if err != nil { + return err + } + return nil +} diff --git a/seed/go-sdk/trace/admin/raw_client.go b/seed/go-sdk/trace/admin/raw_client.go new file mode 100644 index 000000000000..e5c9ee8ebac6 --- /dev/null +++ b/seed/go-sdk/trace/admin/raw_client.go @@ -0,0 +1,390 @@ +// Code generated by Fern. DO NOT EDIT. + +package admin + +import ( + context "context" + http "net/http" + + fern "github.com/trace/fern" + v2 "github.com/trace/fern/common/v2" + core "github.com/trace/fern/core" + internal "github.com/trace/fern/internal" + option "github.com/trace/fern/option" +) + +type RawClient struct { + baseURL string + caller *internal.Caller + options *core.RequestOptions +} + +func NewRawClient(options *core.RequestOptions) *RawClient { + return &RawClient{ + options: options, + baseURL: options.BaseURL, + caller: internal.NewCaller( + &internal.CallerParams{ + Client: options.HTTPClient, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + }, + ), + } +} + +func (r *RawClient) UpdateTestSubmissionStatus( + ctx context.Context, + submissionID fern.SubmissionID, + request *fern.TestSubmissionStatus, + opts ...option.RequestOption, +) (*core.Response[any], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.trace.come", + ) + endpointURL := internal.EncodeURL( + baseURL+"/admin/store-test-submission-status/%v", + submissionID, + ) + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: headers, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + Request: request, + }, + ) + if err != nil { + return nil, err + } + return &core.Response[any]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: nil, + }, nil +} + +func (r *RawClient) SendTestSubmissionUpdate( + ctx context.Context, + submissionID fern.SubmissionID, + request *fern.TestSubmissionUpdate, + opts ...option.RequestOption, +) (*core.Response[any], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.trace.come", + ) + endpointURL := internal.EncodeURL( + baseURL+"/admin/store-test-submission-status-v2/%v", + submissionID, + ) + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: headers, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + Request: request, + }, + ) + if err != nil { + return nil, err + } + return &core.Response[any]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: nil, + }, nil +} + +func (r *RawClient) UpdateWorkspaceSubmissionStatus( + ctx context.Context, + submissionID fern.SubmissionID, + request *fern.WorkspaceSubmissionStatus, + opts ...option.RequestOption, +) (*core.Response[any], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.trace.come", + ) + endpointURL := internal.EncodeURL( + baseURL+"/admin/store-workspace-submission-status/%v", + submissionID, + ) + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: headers, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + Request: request, + }, + ) + if err != nil { + return nil, err + } + return &core.Response[any]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: nil, + }, nil +} + +func (r *RawClient) SendWorkspaceSubmissionUpdate( + ctx context.Context, + submissionID fern.SubmissionID, + request *fern.WorkspaceSubmissionUpdate, + opts ...option.RequestOption, +) (*core.Response[any], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.trace.come", + ) + endpointURL := internal.EncodeURL( + baseURL+"/admin/store-workspace-submission-status-v2/%v", + submissionID, + ) + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: headers, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + Request: request, + }, + ) + if err != nil { + return nil, err + } + return &core.Response[any]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: nil, + }, nil +} + +func (r *RawClient) StoreTracedTestCase( + ctx context.Context, + submissionID fern.SubmissionID, + testCaseID string, + request *fern.StoreTracedTestCaseRequest, + opts ...option.RequestOption, +) (*core.Response[any], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.trace.come", + ) + endpointURL := internal.EncodeURL( + baseURL+"/admin/store-test-trace/submission/%v/testCase/%v", + submissionID, + testCaseID, + ) + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: headers, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + Request: request, + }, + ) + if err != nil { + return nil, err + } + return &core.Response[any]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: nil, + }, nil +} + +func (r *RawClient) StoreTracedTestCaseV2( + ctx context.Context, + submissionID fern.SubmissionID, + testCaseID v2.TestCaseID, + request []*fern.TraceResponseV2, + opts ...option.RequestOption, +) (*core.Response[any], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.trace.come", + ) + endpointURL := internal.EncodeURL( + baseURL+"/admin/store-test-trace-v2/submission/%v/testCase/%v", + submissionID, + testCaseID, + ) + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: headers, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + Request: request, + }, + ) + if err != nil { + return nil, err + } + return &core.Response[any]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: nil, + }, nil +} + +func (r *RawClient) StoreTracedWorkspace( + ctx context.Context, + submissionID fern.SubmissionID, + request *fern.StoreTracedWorkspaceRequest, + opts ...option.RequestOption, +) (*core.Response[any], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.trace.come", + ) + endpointURL := internal.EncodeURL( + baseURL+"/admin/store-workspace-trace/submission/%v", + submissionID, + ) + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: headers, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + Request: request, + }, + ) + if err != nil { + return nil, err + } + return &core.Response[any]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: nil, + }, nil +} + +func (r *RawClient) StoreTracedWorkspaceV2( + ctx context.Context, + submissionID fern.SubmissionID, + request []*fern.TraceResponseV2, + opts ...option.RequestOption, +) (*core.Response[any], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.trace.come", + ) + endpointURL := internal.EncodeURL( + baseURL+"/admin/store-workspace-trace-v2/submission/%v", + submissionID, + ) + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: headers, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + Request: request, + }, + ) + if err != nil { + return nil, err + } + return &core.Response[any]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: nil, + }, nil +} diff --git a/seed/go-sdk/trace/admin_test.go b/seed/go-sdk/trace/admin_test.go new file mode 100644 index 000000000000..aac233d44b8f --- /dev/null +++ b/seed/go-sdk/trace/admin_test.go @@ -0,0 +1,250 @@ +// Code generated by Fern. DO NOT EDIT. + +package trace + +import ( + json "encoding/json" + assert "github.com/stretchr/testify/assert" + require "github.com/stretchr/testify/require" + testing "testing" +) + +func TestSettersStoreTracedTestCaseRequest(t *testing.T) { + t.Run("SetResult", func(t *testing.T) { + obj := &StoreTracedTestCaseRequest{} + var fernTestValueResult *TestCaseResultWithStdout + obj.SetResult(fernTestValueResult) + assert.Equal(t, fernTestValueResult, obj.Result) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetTraceResponses", func(t *testing.T) { + obj := &StoreTracedTestCaseRequest{} + var fernTestValueTraceResponses []*TraceResponse + obj.SetTraceResponses(fernTestValueTraceResponses) + assert.Equal(t, fernTestValueTraceResponses, obj.TraceResponses) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestSettersMarkExplicitStoreTracedTestCaseRequest(t *testing.T) { + t.Run("SetResult_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StoreTracedTestCaseRequest{} + var fernTestValueResult *TestCaseResultWithStdout + + // Act + obj.SetResult(fernTestValueResult) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetTraceResponses_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StoreTracedTestCaseRequest{} + var fernTestValueTraceResponses []*TraceResponse + + // Act + obj.SetTraceResponses(fernTestValueTraceResponses) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersStoreTracedWorkspaceRequest(t *testing.T) { + t.Run("SetWorkspaceRunDetails", func(t *testing.T) { + obj := &StoreTracedWorkspaceRequest{} + var fernTestValueWorkspaceRunDetails *WorkspaceRunDetails + obj.SetWorkspaceRunDetails(fernTestValueWorkspaceRunDetails) + assert.Equal(t, fernTestValueWorkspaceRunDetails, obj.WorkspaceRunDetails) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetTraceResponses", func(t *testing.T) { + obj := &StoreTracedWorkspaceRequest{} + var fernTestValueTraceResponses []*TraceResponse + obj.SetTraceResponses(fernTestValueTraceResponses) + assert.Equal(t, fernTestValueTraceResponses, obj.TraceResponses) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestSettersMarkExplicitStoreTracedWorkspaceRequest(t *testing.T) { + t.Run("SetWorkspaceRunDetails_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StoreTracedWorkspaceRequest{} + var fernTestValueWorkspaceRunDetails *WorkspaceRunDetails + + // Act + obj.SetWorkspaceRunDetails(fernTestValueWorkspaceRunDetails) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetTraceResponses_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StoreTracedWorkspaceRequest{} + var fernTestValueTraceResponses []*TraceResponse + + // Act + obj.SetTraceResponses(fernTestValueTraceResponses) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestGettersTest(t *testing.T) { + t.Run("GetType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Test{} + var expected string + obj.Type = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetType(), "getter should return the property value") + }) + + t.Run("GetType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *Test + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetType() // Should return zero value + }) + + t.Run("GetAnd", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Test{} + var expected bool + obj.And = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetAnd(), "getter should return the property value") + }) + + t.Run("GetAnd_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *Test + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetAnd() // Should return zero value + }) + + t.Run("GetOr", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Test{} + var expected bool + obj.Or = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetOr(), "getter should return the property value") + }) + + t.Run("GetOr_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *Test + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetOr() // Should return zero value + }) + +} diff --git a/seed/go-sdk/trace/client/client.go b/seed/go-sdk/trace/client/client.go new file mode 100644 index 000000000000..d591a4c98f22 --- /dev/null +++ b/seed/go-sdk/trace/client/client.go @@ -0,0 +1,55 @@ +// Code generated by Fern. DO NOT EDIT. + +package client + +import ( + admin "github.com/trace/fern/admin" + core "github.com/trace/fern/core" + homepage "github.com/trace/fern/homepage" + internal "github.com/trace/fern/internal" + migration "github.com/trace/fern/migration" + option "github.com/trace/fern/option" + playlist "github.com/trace/fern/playlist" + problem "github.com/trace/fern/problem" + submission "github.com/trace/fern/submission" + sysprop "github.com/trace/fern/sysprop" + client "github.com/trace/fern/v2/client" +) + +type Client struct { + V2 *client.Client + Admin *admin.Client + Homepage *homepage.Client + Migration *migration.Client + Playlist *playlist.Client + Problem *problem.Client + Submission *submission.Client + Sysprop *sysprop.Client + + options *core.RequestOptions + baseURL string + caller *internal.Caller +} + +func NewClient(opts ...option.RequestOption) *Client { + options := core.NewRequestOptions(opts...) + return &Client{ + V2: client.NewClient(options), + Admin: admin.NewClient(options), + Homepage: homepage.NewClient(options), + Migration: migration.NewClient(options), + Playlist: playlist.NewClient(options), + Problem: problem.NewClient(options), + Submission: submission.NewClient(options), + Sysprop: sysprop.NewClient(options), + options: options, + baseURL: options.BaseURL, + caller: internal.NewCaller( + &internal.CallerParams{ + Client: options.HTTPClient, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + }, + ), + } +} diff --git a/seed/go-sdk/trace/client/client_test.go b/seed/go-sdk/trace/client/client_test.go new file mode 100644 index 000000000000..4c5eda52787e --- /dev/null +++ b/seed/go-sdk/trace/client/client_test.go @@ -0,0 +1,45 @@ +// Code generated by Fern. DO NOT EDIT. + +package client + +import ( + assert "github.com/stretchr/testify/assert" + option "github.com/trace/fern/option" + http "net/http" + testing "testing" + time "time" +) + +func TestNewClient(t *testing.T) { + t.Run("default", func(t *testing.T) { + c := NewClient() + assert.Empty(t, c.baseURL) + }) + + t.Run("base url", func(t *testing.T) { + c := NewClient( + option.WithBaseURL("test.co"), + ) + assert.Equal(t, "test.co", c.baseURL) + }) + + t.Run("http client", func(t *testing.T) { + httpClient := &http.Client{ + Timeout: 5 * time.Second, + } + c := NewClient( + option.WithHTTPClient(httpClient), + ) + assert.Empty(t, c.baseURL) + }) + + t.Run("http header", func(t *testing.T) { + header := make(http.Header) + header.Set("X-API-Tenancy", "test") + c := NewClient( + option.WithHTTPHeader(header), + ) + assert.Empty(t, c.baseURL) + assert.Equal(t, "test", c.options.HTTPHeader.Get("X-API-Tenancy")) + }) +} diff --git a/seed/go-sdk/trace/common/common.go b/seed/go-sdk/trace/common/common.go new file mode 100644 index 000000000000..31d1a532fc00 --- /dev/null +++ b/seed/go-sdk/trace/common/common.go @@ -0,0 +1,2142 @@ +// Code generated by Fern. DO NOT EDIT. + +package common + +import ( + json "encoding/json" + fmt "fmt" + internal "github.com/trace/fern/internal" + big "math/big" +) + +var ( + binaryTreeNodeValueFieldNodeID = big.NewInt(1 << 0) + binaryTreeNodeValueFieldVal = big.NewInt(1 << 1) + binaryTreeNodeValueFieldRight = big.NewInt(1 << 2) + binaryTreeNodeValueFieldLeft = big.NewInt(1 << 3) +) + +type BinaryTreeNodeValue struct { + NodeID NodeID `json:"nodeId" url:"nodeId"` + Val float64 `json:"val" url:"val"` + Right *NodeID `json:"right,omitempty" url:"right,omitempty"` + Left *NodeID `json:"left,omitempty" url:"left,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (b *BinaryTreeNodeValue) GetNodeID() NodeID { + if b == nil { + return "" + } + return b.NodeID +} + +func (b *BinaryTreeNodeValue) GetVal() float64 { + if b == nil { + return 0 + } + return b.Val +} + +func (b *BinaryTreeNodeValue) GetRight() *NodeID { + if b == nil { + return nil + } + return b.Right +} + +func (b *BinaryTreeNodeValue) GetLeft() *NodeID { + if b == nil { + return nil + } + return b.Left +} + +func (b *BinaryTreeNodeValue) GetExtraProperties() map[string]interface{} { + if b == nil { + return nil + } + return b.extraProperties +} + +func (b *BinaryTreeNodeValue) require(field *big.Int) { + if b.explicitFields == nil { + b.explicitFields = big.NewInt(0) + } + b.explicitFields.Or(b.explicitFields, field) +} + +// SetNodeID sets the NodeID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BinaryTreeNodeValue) SetNodeID(nodeID NodeID) { + b.NodeID = nodeID + b.require(binaryTreeNodeValueFieldNodeID) +} + +// SetVal sets the Val field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BinaryTreeNodeValue) SetVal(val float64) { + b.Val = val + b.require(binaryTreeNodeValueFieldVal) +} + +// SetRight sets the Right field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BinaryTreeNodeValue) SetRight(right *NodeID) { + b.Right = right + b.require(binaryTreeNodeValueFieldRight) +} + +// SetLeft sets the Left field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BinaryTreeNodeValue) SetLeft(left *NodeID) { + b.Left = left + b.require(binaryTreeNodeValueFieldLeft) +} + +func (b *BinaryTreeNodeValue) UnmarshalJSON(data []byte) error { + type unmarshaler BinaryTreeNodeValue + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *b = BinaryTreeNodeValue(value) + extraProperties, err := internal.ExtractExtraProperties(data, *b) + if err != nil { + return err + } + b.extraProperties = extraProperties + b.rawJSON = json.RawMessage(data) + return nil +} + +func (b *BinaryTreeNodeValue) MarshalJSON() ([]byte, error) { + type embed BinaryTreeNodeValue + var marshaler = struct { + embed + }{ + embed: embed(*b), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, b.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (b *BinaryTreeNodeValue) String() string { + if b == nil { + return "" + } + if len(b.rawJSON) > 0 { + if value, err := internal.StringifyJSON(b.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(b); err == nil { + return value + } + return fmt.Sprintf("%#v", b) +} + +var ( + binaryTreeValueFieldRoot = big.NewInt(1 << 0) + binaryTreeValueFieldNodes = big.NewInt(1 << 1) +) + +type BinaryTreeValue struct { + Root *NodeID `json:"root,omitempty" url:"root,omitempty"` + Nodes map[NodeID]*BinaryTreeNodeValue `json:"nodes" url:"nodes"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (b *BinaryTreeValue) GetRoot() *NodeID { + if b == nil { + return nil + } + return b.Root +} + +func (b *BinaryTreeValue) GetNodes() map[NodeID]*BinaryTreeNodeValue { + if b == nil { + return nil + } + return b.Nodes +} + +func (b *BinaryTreeValue) GetExtraProperties() map[string]interface{} { + if b == nil { + return nil + } + return b.extraProperties +} + +func (b *BinaryTreeValue) require(field *big.Int) { + if b.explicitFields == nil { + b.explicitFields = big.NewInt(0) + } + b.explicitFields.Or(b.explicitFields, field) +} + +// SetRoot sets the Root field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BinaryTreeValue) SetRoot(root *NodeID) { + b.Root = root + b.require(binaryTreeValueFieldRoot) +} + +// SetNodes sets the Nodes field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BinaryTreeValue) SetNodes(nodes map[NodeID]*BinaryTreeNodeValue) { + b.Nodes = nodes + b.require(binaryTreeValueFieldNodes) +} + +func (b *BinaryTreeValue) UnmarshalJSON(data []byte) error { + type unmarshaler BinaryTreeValue + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *b = BinaryTreeValue(value) + extraProperties, err := internal.ExtractExtraProperties(data, *b) + if err != nil { + return err + } + b.extraProperties = extraProperties + b.rawJSON = json.RawMessage(data) + return nil +} + +func (b *BinaryTreeValue) MarshalJSON() ([]byte, error) { + type embed BinaryTreeValue + var marshaler = struct { + embed + }{ + embed: embed(*b), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, b.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (b *BinaryTreeValue) String() string { + if b == nil { + return "" + } + if len(b.rawJSON) > 0 { + if value, err := internal.StringifyJSON(b.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(b); err == nil { + return value + } + return fmt.Sprintf("%#v", b) +} + +var ( + doublyLinkedListNodeValueFieldNodeID = big.NewInt(1 << 0) + doublyLinkedListNodeValueFieldVal = big.NewInt(1 << 1) + doublyLinkedListNodeValueFieldNext = big.NewInt(1 << 2) + doublyLinkedListNodeValueFieldPrev = big.NewInt(1 << 3) +) + +type DoublyLinkedListNodeValue struct { + NodeID NodeID `json:"nodeId" url:"nodeId"` + Val float64 `json:"val" url:"val"` + Next *NodeID `json:"next,omitempty" url:"next,omitempty"` + Prev *NodeID `json:"prev,omitempty" url:"prev,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (d *DoublyLinkedListNodeValue) GetNodeID() NodeID { + if d == nil { + return "" + } + return d.NodeID +} + +func (d *DoublyLinkedListNodeValue) GetVal() float64 { + if d == nil { + return 0 + } + return d.Val +} + +func (d *DoublyLinkedListNodeValue) GetNext() *NodeID { + if d == nil { + return nil + } + return d.Next +} + +func (d *DoublyLinkedListNodeValue) GetPrev() *NodeID { + if d == nil { + return nil + } + return d.Prev +} + +func (d *DoublyLinkedListNodeValue) GetExtraProperties() map[string]interface{} { + if d == nil { + return nil + } + return d.extraProperties +} + +func (d *DoublyLinkedListNodeValue) require(field *big.Int) { + if d.explicitFields == nil { + d.explicitFields = big.NewInt(0) + } + d.explicitFields.Or(d.explicitFields, field) +} + +// SetNodeID sets the NodeID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (d *DoublyLinkedListNodeValue) SetNodeID(nodeID NodeID) { + d.NodeID = nodeID + d.require(doublyLinkedListNodeValueFieldNodeID) +} + +// SetVal sets the Val field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (d *DoublyLinkedListNodeValue) SetVal(val float64) { + d.Val = val + d.require(doublyLinkedListNodeValueFieldVal) +} + +// SetNext sets the Next field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (d *DoublyLinkedListNodeValue) SetNext(next *NodeID) { + d.Next = next + d.require(doublyLinkedListNodeValueFieldNext) +} + +// SetPrev sets the Prev field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (d *DoublyLinkedListNodeValue) SetPrev(prev *NodeID) { + d.Prev = prev + d.require(doublyLinkedListNodeValueFieldPrev) +} + +func (d *DoublyLinkedListNodeValue) UnmarshalJSON(data []byte) error { + type unmarshaler DoublyLinkedListNodeValue + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DoublyLinkedListNodeValue(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) + return nil +} + +func (d *DoublyLinkedListNodeValue) MarshalJSON() ([]byte, error) { + type embed DoublyLinkedListNodeValue + var marshaler = struct { + embed + }{ + embed: embed(*d), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, d.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (d *DoublyLinkedListNodeValue) String() string { + if d == nil { + return "" + } + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +var ( + doublyLinkedListValueFieldHead = big.NewInt(1 << 0) + doublyLinkedListValueFieldNodes = big.NewInt(1 << 1) +) + +type DoublyLinkedListValue struct { + Head *NodeID `json:"head,omitempty" url:"head,omitempty"` + Nodes map[NodeID]*DoublyLinkedListNodeValue `json:"nodes" url:"nodes"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (d *DoublyLinkedListValue) GetHead() *NodeID { + if d == nil { + return nil + } + return d.Head +} + +func (d *DoublyLinkedListValue) GetNodes() map[NodeID]*DoublyLinkedListNodeValue { + if d == nil { + return nil + } + return d.Nodes +} + +func (d *DoublyLinkedListValue) GetExtraProperties() map[string]interface{} { + if d == nil { + return nil + } + return d.extraProperties +} + +func (d *DoublyLinkedListValue) require(field *big.Int) { + if d.explicitFields == nil { + d.explicitFields = big.NewInt(0) + } + d.explicitFields.Or(d.explicitFields, field) +} + +// SetHead sets the Head field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (d *DoublyLinkedListValue) SetHead(head *NodeID) { + d.Head = head + d.require(doublyLinkedListValueFieldHead) +} + +// SetNodes sets the Nodes field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (d *DoublyLinkedListValue) SetNodes(nodes map[NodeID]*DoublyLinkedListNodeValue) { + d.Nodes = nodes + d.require(doublyLinkedListValueFieldNodes) +} + +func (d *DoublyLinkedListValue) UnmarshalJSON(data []byte) error { + type unmarshaler DoublyLinkedListValue + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DoublyLinkedListValue(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) + return nil +} + +func (d *DoublyLinkedListValue) MarshalJSON() ([]byte, error) { + type embed DoublyLinkedListValue + var marshaler = struct { + embed + }{ + embed: embed(*d), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, d.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (d *DoublyLinkedListValue) String() string { + if d == nil { + return "" + } + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +var ( + keyValuePairFieldKey = big.NewInt(1 << 0) + keyValuePairFieldValue = big.NewInt(1 << 1) +) + +type KeyValuePair struct { + Key *VariableValue `json:"key" url:"key"` + Value *VariableValue `json:"value" url:"value"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (k *KeyValuePair) GetKey() *VariableValue { + if k == nil { + return nil + } + return k.Key +} + +func (k *KeyValuePair) GetValue() *VariableValue { + if k == nil { + return nil + } + return k.Value +} + +func (k *KeyValuePair) GetExtraProperties() map[string]interface{} { + if k == nil { + return nil + } + return k.extraProperties +} + +func (k *KeyValuePair) require(field *big.Int) { + if k.explicitFields == nil { + k.explicitFields = big.NewInt(0) + } + k.explicitFields.Or(k.explicitFields, field) +} + +// SetKey sets the Key field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (k *KeyValuePair) SetKey(key *VariableValue) { + k.Key = key + k.require(keyValuePairFieldKey) +} + +// SetValue sets the Value field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (k *KeyValuePair) SetValue(value *VariableValue) { + k.Value = value + k.require(keyValuePairFieldValue) +} + +func (k *KeyValuePair) UnmarshalJSON(data []byte) error { + type unmarshaler KeyValuePair + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *k = KeyValuePair(value) + extraProperties, err := internal.ExtractExtraProperties(data, *k) + if err != nil { + return err + } + k.extraProperties = extraProperties + k.rawJSON = json.RawMessage(data) + return nil +} + +func (k *KeyValuePair) MarshalJSON() ([]byte, error) { + type embed KeyValuePair + var marshaler = struct { + embed + }{ + embed: embed(*k), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, k.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (k *KeyValuePair) String() string { + if k == nil { + return "" + } + if len(k.rawJSON) > 0 { + if value, err := internal.StringifyJSON(k.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(k); err == nil { + return value + } + return fmt.Sprintf("%#v", k) +} + +type Language string + +const ( + LanguageJava Language = "JAVA" + LanguageJavascript Language = "JAVASCRIPT" + LanguagePython Language = "PYTHON" +) + +func NewLanguageFromString(s string) (Language, error) { + switch s { + case "JAVA": + return LanguageJava, nil + case "JAVASCRIPT": + return LanguageJavascript, nil + case "PYTHON": + return LanguagePython, nil + } + var t Language + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (l Language) Ptr() *Language { + return &l +} + +var ( + listTypeFieldValueType = big.NewInt(1 << 0) + listTypeFieldIsFixedLength = big.NewInt(1 << 1) +) + +type ListType struct { + ValueType *VariableType `json:"valueType" url:"valueType"` + // Whether this list is fixed-size (for languages that supports fixed-size lists). Defaults to false. + IsFixedLength *bool `json:"isFixedLength,omitempty" url:"isFixedLength,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (l *ListType) GetValueType() *VariableType { + if l == nil { + return nil + } + return l.ValueType +} + +func (l *ListType) GetIsFixedLength() *bool { + if l == nil { + return nil + } + return l.IsFixedLength +} + +func (l *ListType) GetExtraProperties() map[string]interface{} { + if l == nil { + return nil + } + return l.extraProperties +} + +func (l *ListType) require(field *big.Int) { + if l.explicitFields == nil { + l.explicitFields = big.NewInt(0) + } + l.explicitFields.Or(l.explicitFields, field) +} + +// SetValueType sets the ValueType field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *ListType) SetValueType(valueType *VariableType) { + l.ValueType = valueType + l.require(listTypeFieldValueType) +} + +// SetIsFixedLength sets the IsFixedLength field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *ListType) SetIsFixedLength(isFixedLength *bool) { + l.IsFixedLength = isFixedLength + l.require(listTypeFieldIsFixedLength) +} + +func (l *ListType) UnmarshalJSON(data []byte) error { + type unmarshaler ListType + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *l = ListType(value) + extraProperties, err := internal.ExtractExtraProperties(data, *l) + if err != nil { + return err + } + l.extraProperties = extraProperties + l.rawJSON = json.RawMessage(data) + return nil +} + +func (l *ListType) MarshalJSON() ([]byte, error) { + type embed ListType + var marshaler = struct { + embed + }{ + embed: embed(*l), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, l.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (l *ListType) String() string { + if l == nil { + return "" + } + if len(l.rawJSON) > 0 { + if value, err := internal.StringifyJSON(l.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(l); err == nil { + return value + } + return fmt.Sprintf("%#v", l) +} + +var ( + mapTypeFieldKeyType = big.NewInt(1 << 0) + mapTypeFieldValueType = big.NewInt(1 << 1) +) + +type MapType struct { + KeyType *VariableType `json:"keyType" url:"keyType"` + ValueType *VariableType `json:"valueType" url:"valueType"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (m *MapType) GetKeyType() *VariableType { + if m == nil { + return nil + } + return m.KeyType +} + +func (m *MapType) GetValueType() *VariableType { + if m == nil { + return nil + } + return m.ValueType +} + +func (m *MapType) GetExtraProperties() map[string]interface{} { + if m == nil { + return nil + } + return m.extraProperties +} + +func (m *MapType) require(field *big.Int) { + if m.explicitFields == nil { + m.explicitFields = big.NewInt(0) + } + m.explicitFields.Or(m.explicitFields, field) +} + +// SetKeyType sets the KeyType field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (m *MapType) SetKeyType(keyType *VariableType) { + m.KeyType = keyType + m.require(mapTypeFieldKeyType) +} + +// SetValueType sets the ValueType field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (m *MapType) SetValueType(valueType *VariableType) { + m.ValueType = valueType + m.require(mapTypeFieldValueType) +} + +func (m *MapType) UnmarshalJSON(data []byte) error { + type unmarshaler MapType + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *m = MapType(value) + extraProperties, err := internal.ExtractExtraProperties(data, *m) + if err != nil { + return err + } + m.extraProperties = extraProperties + m.rawJSON = json.RawMessage(data) + return nil +} + +func (m *MapType) MarshalJSON() ([]byte, error) { + type embed MapType + var marshaler = struct { + embed + }{ + embed: embed(*m), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, m.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (m *MapType) String() string { + if m == nil { + return "" + } + if len(m.rawJSON) > 0 { + if value, err := internal.StringifyJSON(m.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(m); err == nil { + return value + } + return fmt.Sprintf("%#v", m) +} + +var ( + mapValueFieldKeyValuePairs = big.NewInt(1 << 0) +) + +type MapValue struct { + KeyValuePairs []*KeyValuePair `json:"keyValuePairs" url:"keyValuePairs"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (m *MapValue) GetKeyValuePairs() []*KeyValuePair { + if m == nil { + return nil + } + return m.KeyValuePairs +} + +func (m *MapValue) GetExtraProperties() map[string]interface{} { + if m == nil { + return nil + } + return m.extraProperties +} + +func (m *MapValue) require(field *big.Int) { + if m.explicitFields == nil { + m.explicitFields = big.NewInt(0) + } + m.explicitFields.Or(m.explicitFields, field) +} + +// SetKeyValuePairs sets the KeyValuePairs field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (m *MapValue) SetKeyValuePairs(keyValuePairs []*KeyValuePair) { + m.KeyValuePairs = keyValuePairs + m.require(mapValueFieldKeyValuePairs) +} + +func (m *MapValue) UnmarshalJSON(data []byte) error { + type unmarshaler MapValue + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *m = MapValue(value) + extraProperties, err := internal.ExtractExtraProperties(data, *m) + if err != nil { + return err + } + m.extraProperties = extraProperties + m.rawJSON = json.RawMessage(data) + return nil +} + +func (m *MapValue) MarshalJSON() ([]byte, error) { + type embed MapValue + var marshaler = struct { + embed + }{ + embed: embed(*m), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, m.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (m *MapValue) String() string { + if m == nil { + return "" + } + if len(m.rawJSON) > 0 { + if value, err := internal.StringifyJSON(m.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(m); err == nil { + return value + } + return fmt.Sprintf("%#v", m) +} + +type NodeID = string + +type ProblemID = string + +var ( + singlyLinkedListNodeValueFieldNodeID = big.NewInt(1 << 0) + singlyLinkedListNodeValueFieldVal = big.NewInt(1 << 1) + singlyLinkedListNodeValueFieldNext = big.NewInt(1 << 2) +) + +type SinglyLinkedListNodeValue struct { + NodeID NodeID `json:"nodeId" url:"nodeId"` + Val float64 `json:"val" url:"val"` + Next *NodeID `json:"next,omitempty" url:"next,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SinglyLinkedListNodeValue) GetNodeID() NodeID { + if s == nil { + return "" + } + return s.NodeID +} + +func (s *SinglyLinkedListNodeValue) GetVal() float64 { + if s == nil { + return 0 + } + return s.Val +} + +func (s *SinglyLinkedListNodeValue) GetNext() *NodeID { + if s == nil { + return nil + } + return s.Next +} + +func (s *SinglyLinkedListNodeValue) GetExtraProperties() map[string]interface{} { + if s == nil { + return nil + } + return s.extraProperties +} + +func (s *SinglyLinkedListNodeValue) require(field *big.Int) { + if s.explicitFields == nil { + s.explicitFields = big.NewInt(0) + } + s.explicitFields.Or(s.explicitFields, field) +} + +// SetNodeID sets the NodeID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SinglyLinkedListNodeValue) SetNodeID(nodeID NodeID) { + s.NodeID = nodeID + s.require(singlyLinkedListNodeValueFieldNodeID) +} + +// SetVal sets the Val field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SinglyLinkedListNodeValue) SetVal(val float64) { + s.Val = val + s.require(singlyLinkedListNodeValueFieldVal) +} + +// SetNext sets the Next field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SinglyLinkedListNodeValue) SetNext(next *NodeID) { + s.Next = next + s.require(singlyLinkedListNodeValueFieldNext) +} + +func (s *SinglyLinkedListNodeValue) UnmarshalJSON(data []byte) error { + type unmarshaler SinglyLinkedListNodeValue + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SinglyLinkedListNodeValue(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SinglyLinkedListNodeValue) MarshalJSON() ([]byte, error) { + type embed SinglyLinkedListNodeValue + var marshaler = struct { + embed + }{ + embed: embed(*s), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, s.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (s *SinglyLinkedListNodeValue) String() string { + if s == nil { + return "" + } + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +var ( + singlyLinkedListValueFieldHead = big.NewInt(1 << 0) + singlyLinkedListValueFieldNodes = big.NewInt(1 << 1) +) + +type SinglyLinkedListValue struct { + Head *NodeID `json:"head,omitempty" url:"head,omitempty"` + Nodes map[NodeID]*SinglyLinkedListNodeValue `json:"nodes" url:"nodes"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SinglyLinkedListValue) GetHead() *NodeID { + if s == nil { + return nil + } + return s.Head +} + +func (s *SinglyLinkedListValue) GetNodes() map[NodeID]*SinglyLinkedListNodeValue { + if s == nil { + return nil + } + return s.Nodes +} + +func (s *SinglyLinkedListValue) GetExtraProperties() map[string]interface{} { + if s == nil { + return nil + } + return s.extraProperties +} + +func (s *SinglyLinkedListValue) require(field *big.Int) { + if s.explicitFields == nil { + s.explicitFields = big.NewInt(0) + } + s.explicitFields.Or(s.explicitFields, field) +} + +// SetHead sets the Head field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SinglyLinkedListValue) SetHead(head *NodeID) { + s.Head = head + s.require(singlyLinkedListValueFieldHead) +} + +// SetNodes sets the Nodes field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SinglyLinkedListValue) SetNodes(nodes map[NodeID]*SinglyLinkedListNodeValue) { + s.Nodes = nodes + s.require(singlyLinkedListValueFieldNodes) +} + +func (s *SinglyLinkedListValue) UnmarshalJSON(data []byte) error { + type unmarshaler SinglyLinkedListValue + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SinglyLinkedListValue(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SinglyLinkedListValue) MarshalJSON() ([]byte, error) { + type embed SinglyLinkedListValue + var marshaler = struct { + embed + }{ + embed: embed(*s), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, s.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (s *SinglyLinkedListValue) String() string { + if s == nil { + return "" + } + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type VariableType struct { + Type string + IntegerType interface{} + DoubleType interface{} + BooleanType interface{} + StringType interface{} + CharType interface{} + ListType *ListType + MapType *MapType + BinaryTreeType interface{} + SinglyLinkedListType interface{} + DoublyLinkedListType interface{} + + rawJSON json.RawMessage +} + +func (v *VariableType) GetType() string { + if v == nil { + return "" + } + return v.Type +} + +func (v *VariableType) GetIntegerType() interface{} { + if v == nil { + return nil + } + return v.IntegerType +} + +func (v *VariableType) GetDoubleType() interface{} { + if v == nil { + return nil + } + return v.DoubleType +} + +func (v *VariableType) GetBooleanType() interface{} { + if v == nil { + return nil + } + return v.BooleanType +} + +func (v *VariableType) GetStringType() interface{} { + if v == nil { + return nil + } + return v.StringType +} + +func (v *VariableType) GetCharType() interface{} { + if v == nil { + return nil + } + return v.CharType +} + +func (v *VariableType) GetListType() *ListType { + if v == nil { + return nil + } + return v.ListType +} + +func (v *VariableType) GetMapType() *MapType { + if v == nil { + return nil + } + return v.MapType +} + +func (v *VariableType) GetBinaryTreeType() interface{} { + if v == nil { + return nil + } + return v.BinaryTreeType +} + +func (v *VariableType) GetSinglyLinkedListType() interface{} { + if v == nil { + return nil + } + return v.SinglyLinkedListType +} + +func (v *VariableType) GetDoublyLinkedListType() interface{} { + if v == nil { + return nil + } + return v.DoublyLinkedListType +} + +func (v *VariableType) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + v.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", v) + } + switch unmarshaler.Type { + case "integerType": + value := make(map[string]interface{}) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.IntegerType = value + case "doubleType": + value := make(map[string]interface{}) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.DoubleType = value + case "booleanType": + value := make(map[string]interface{}) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.BooleanType = value + case "stringType": + value := make(map[string]interface{}) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.StringType = value + case "charType": + value := make(map[string]interface{}) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.CharType = value + case "listType": + value := new(ListType) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.ListType = value + case "mapType": + value := new(MapType) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.MapType = value + case "binaryTreeType": + value := make(map[string]interface{}) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.BinaryTreeType = value + case "singlyLinkedListType": + value := make(map[string]interface{}) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.SinglyLinkedListType = value + case "doublyLinkedListType": + value := make(map[string]interface{}) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.DoublyLinkedListType = value + } + v.rawJSON = json.RawMessage(data) + return nil +} + +func (v VariableType) MarshalJSON() ([]byte, error) { + if err := v.validate(); err != nil { + return nil, err + } + if v.IntegerType != nil { + var marshaler = struct { + Type string `json:"type"` + IntegerType interface{} `json:"integerType,omitempty"` + }{ + Type: "integerType", + IntegerType: v.IntegerType, + } + return json.Marshal(marshaler) + } + if v.DoubleType != nil { + var marshaler = struct { + Type string `json:"type"` + DoubleType interface{} `json:"doubleType,omitempty"` + }{ + Type: "doubleType", + DoubleType: v.DoubleType, + } + return json.Marshal(marshaler) + } + if v.BooleanType != nil { + var marshaler = struct { + Type string `json:"type"` + BooleanType interface{} `json:"booleanType,omitempty"` + }{ + Type: "booleanType", + BooleanType: v.BooleanType, + } + return json.Marshal(marshaler) + } + if v.StringType != nil { + var marshaler = struct { + Type string `json:"type"` + StringType interface{} `json:"stringType,omitempty"` + }{ + Type: "stringType", + StringType: v.StringType, + } + return json.Marshal(marshaler) + } + if v.CharType != nil { + var marshaler = struct { + Type string `json:"type"` + CharType interface{} `json:"charType,omitempty"` + }{ + Type: "charType", + CharType: v.CharType, + } + return json.Marshal(marshaler) + } + if v.ListType != nil { + return internal.MarshalJSONWithExtraProperty(v.ListType, "type", "listType") + } + if v.MapType != nil { + return internal.MarshalJSONWithExtraProperty(v.MapType, "type", "mapType") + } + if v.BinaryTreeType != nil { + var marshaler = struct { + Type string `json:"type"` + BinaryTreeType interface{} `json:"binaryTreeType,omitempty"` + }{ + Type: "binaryTreeType", + BinaryTreeType: v.BinaryTreeType, + } + return json.Marshal(marshaler) + } + if v.SinglyLinkedListType != nil { + var marshaler = struct { + Type string `json:"type"` + SinglyLinkedListType interface{} `json:"singlyLinkedListType,omitempty"` + }{ + Type: "singlyLinkedListType", + SinglyLinkedListType: v.SinglyLinkedListType, + } + return json.Marshal(marshaler) + } + if v.DoublyLinkedListType != nil { + var marshaler = struct { + Type string `json:"type"` + DoublyLinkedListType interface{} `json:"doublyLinkedListType,omitempty"` + }{ + Type: "doublyLinkedListType", + DoublyLinkedListType: v.DoublyLinkedListType, + } + return json.Marshal(marshaler) + } + if len(v.rawJSON) > 0 { + return v.rawJSON, nil + } + return nil, fmt.Errorf("type %T does not define a non-empty union type", v) +} + +type VariableTypeVisitor interface { + VisitIntegerType(interface{}) error + VisitDoubleType(interface{}) error + VisitBooleanType(interface{}) error + VisitStringType(interface{}) error + VisitCharType(interface{}) error + VisitListType(*ListType) error + VisitMapType(*MapType) error + VisitBinaryTreeType(interface{}) error + VisitSinglyLinkedListType(interface{}) error + VisitDoublyLinkedListType(interface{}) error +} + +func (v *VariableType) Accept(visitor VariableTypeVisitor) error { + if v.IntegerType != nil { + return visitor.VisitIntegerType(v.IntegerType) + } + if v.DoubleType != nil { + return visitor.VisitDoubleType(v.DoubleType) + } + if v.BooleanType != nil { + return visitor.VisitBooleanType(v.BooleanType) + } + if v.StringType != nil { + return visitor.VisitStringType(v.StringType) + } + if v.CharType != nil { + return visitor.VisitCharType(v.CharType) + } + if v.ListType != nil { + return visitor.VisitListType(v.ListType) + } + if v.MapType != nil { + return visitor.VisitMapType(v.MapType) + } + if v.BinaryTreeType != nil { + return visitor.VisitBinaryTreeType(v.BinaryTreeType) + } + if v.SinglyLinkedListType != nil { + return visitor.VisitSinglyLinkedListType(v.SinglyLinkedListType) + } + if v.DoublyLinkedListType != nil { + return visitor.VisitDoublyLinkedListType(v.DoublyLinkedListType) + } + return fmt.Errorf("type %T does not define a non-empty union type", v) +} + +func (v *VariableType) validate() error { + if v == nil { + return fmt.Errorf("type %T is nil", v) + } + var fields []string + if v.IntegerType != nil { + fields = append(fields, "integerType") + } + if v.DoubleType != nil { + fields = append(fields, "doubleType") + } + if v.BooleanType != nil { + fields = append(fields, "booleanType") + } + if v.StringType != nil { + fields = append(fields, "stringType") + } + if v.CharType != nil { + fields = append(fields, "charType") + } + if v.ListType != nil { + fields = append(fields, "listType") + } + if v.MapType != nil { + fields = append(fields, "mapType") + } + if v.BinaryTreeType != nil { + fields = append(fields, "binaryTreeType") + } + if v.SinglyLinkedListType != nil { + fields = append(fields, "singlyLinkedListType") + } + if v.DoublyLinkedListType != nil { + fields = append(fields, "doublyLinkedListType") + } + if len(fields) == 0 { + if v.Type != "" { + if len(v.rawJSON) > 0 { + return nil + } + return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", v, v.Type) + } + return fmt.Errorf("type %T is empty", v) + } + if len(fields) > 1 { + return fmt.Errorf("type %T defines values for %s, but only one value is allowed", v, fields) + } + if v.Type != "" { + field := fields[0] + if v.Type != field { + return fmt.Errorf( + "type %T defines a discriminant set to %q, but it does not match the %T field; either remove or update the discriminant to match", + v, + v.Type, + v, + ) + } + } + return nil +} + +type VariableValue struct { + Type string + IntegerValue int + BooleanValue bool + DoubleValue float64 + StringValue string + CharValue string + MapValue *MapValue + ListValue []*VariableValue + BinaryTreeValue *BinaryTreeValue + SinglyLinkedListValue *SinglyLinkedListValue + DoublyLinkedListValue *DoublyLinkedListValue + NullValue interface{} + + rawJSON json.RawMessage +} + +func (v *VariableValue) GetType() string { + if v == nil { + return "" + } + return v.Type +} + +func (v *VariableValue) GetIntegerValue() int { + if v == nil { + return 0 + } + return v.IntegerValue +} + +func (v *VariableValue) GetBooleanValue() bool { + if v == nil { + return false + } + return v.BooleanValue +} + +func (v *VariableValue) GetDoubleValue() float64 { + if v == nil { + return 0 + } + return v.DoubleValue +} + +func (v *VariableValue) GetStringValue() string { + if v == nil { + return "" + } + return v.StringValue +} + +func (v *VariableValue) GetCharValue() string { + if v == nil { + return "" + } + return v.CharValue +} + +func (v *VariableValue) GetMapValue() *MapValue { + if v == nil { + return nil + } + return v.MapValue +} + +func (v *VariableValue) GetListValue() []*VariableValue { + if v == nil { + return nil + } + return v.ListValue +} + +func (v *VariableValue) GetBinaryTreeValue() *BinaryTreeValue { + if v == nil { + return nil + } + return v.BinaryTreeValue +} + +func (v *VariableValue) GetSinglyLinkedListValue() *SinglyLinkedListValue { + if v == nil { + return nil + } + return v.SinglyLinkedListValue +} + +func (v *VariableValue) GetDoublyLinkedListValue() *DoublyLinkedListValue { + if v == nil { + return nil + } + return v.DoublyLinkedListValue +} + +func (v *VariableValue) GetNullValue() interface{} { + if v == nil { + return nil + } + return v.NullValue +} + +func (v *VariableValue) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + v.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", v) + } + switch unmarshaler.Type { + case "integerValue": + var valueUnmarshaler struct { + IntegerValue int `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + v.IntegerValue = valueUnmarshaler.IntegerValue + case "booleanValue": + var valueUnmarshaler struct { + BooleanValue bool `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + v.BooleanValue = valueUnmarshaler.BooleanValue + case "doubleValue": + var valueUnmarshaler struct { + DoubleValue float64 `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + v.DoubleValue = valueUnmarshaler.DoubleValue + case "stringValue": + var valueUnmarshaler struct { + StringValue string `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + v.StringValue = valueUnmarshaler.StringValue + case "charValue": + var valueUnmarshaler struct { + CharValue string `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + v.CharValue = valueUnmarshaler.CharValue + case "mapValue": + value := new(MapValue) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.MapValue = value + case "listValue": + var valueUnmarshaler struct { + ListValue []*VariableValue `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + v.ListValue = valueUnmarshaler.ListValue + case "binaryTreeValue": + value := new(BinaryTreeValue) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.BinaryTreeValue = value + case "singlyLinkedListValue": + value := new(SinglyLinkedListValue) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.SinglyLinkedListValue = value + case "doublyLinkedListValue": + value := new(DoublyLinkedListValue) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.DoublyLinkedListValue = value + case "nullValue": + value := make(map[string]interface{}) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + v.NullValue = value + } + v.rawJSON = json.RawMessage(data) + return nil +} + +func (v VariableValue) MarshalJSON() ([]byte, error) { + if err := v.validate(); err != nil { + return nil, err + } + if v.IntegerValue != 0 { + var marshaler = struct { + Type string `json:"type"` + IntegerValue int `json:"value"` + }{ + Type: "integerValue", + IntegerValue: v.IntegerValue, + } + return json.Marshal(marshaler) + } + if v.BooleanValue != false { + var marshaler = struct { + Type string `json:"type"` + BooleanValue bool `json:"value"` + }{ + Type: "booleanValue", + BooleanValue: v.BooleanValue, + } + return json.Marshal(marshaler) + } + if v.DoubleValue != 0 { + var marshaler = struct { + Type string `json:"type"` + DoubleValue float64 `json:"value"` + }{ + Type: "doubleValue", + DoubleValue: v.DoubleValue, + } + return json.Marshal(marshaler) + } + if v.StringValue != "" { + var marshaler = struct { + Type string `json:"type"` + StringValue string `json:"value"` + }{ + Type: "stringValue", + StringValue: v.StringValue, + } + return json.Marshal(marshaler) + } + if v.CharValue != "" { + var marshaler = struct { + Type string `json:"type"` + CharValue string `json:"value"` + }{ + Type: "charValue", + CharValue: v.CharValue, + } + return json.Marshal(marshaler) + } + if v.MapValue != nil { + return internal.MarshalJSONWithExtraProperty(v.MapValue, "type", "mapValue") + } + if v.ListValue != nil { + var marshaler = struct { + Type string `json:"type"` + ListValue []*VariableValue `json:"value"` + }{ + Type: "listValue", + ListValue: v.ListValue, + } + return json.Marshal(marshaler) + } + if v.BinaryTreeValue != nil { + return internal.MarshalJSONWithExtraProperty(v.BinaryTreeValue, "type", "binaryTreeValue") + } + if v.SinglyLinkedListValue != nil { + return internal.MarshalJSONWithExtraProperty(v.SinglyLinkedListValue, "type", "singlyLinkedListValue") + } + if v.DoublyLinkedListValue != nil { + return internal.MarshalJSONWithExtraProperty(v.DoublyLinkedListValue, "type", "doublyLinkedListValue") + } + if v.NullValue != nil { + var marshaler = struct { + Type string `json:"type"` + NullValue interface{} `json:"nullValue,omitempty"` + }{ + Type: "nullValue", + NullValue: v.NullValue, + } + return json.Marshal(marshaler) + } + if len(v.rawJSON) > 0 { + return v.rawJSON, nil + } + return nil, fmt.Errorf("type %T does not define a non-empty union type", v) +} + +type VariableValueVisitor interface { + VisitIntegerValue(int) error + VisitBooleanValue(bool) error + VisitDoubleValue(float64) error + VisitStringValue(string) error + VisitCharValue(string) error + VisitMapValue(*MapValue) error + VisitListValue([]*VariableValue) error + VisitBinaryTreeValue(*BinaryTreeValue) error + VisitSinglyLinkedListValue(*SinglyLinkedListValue) error + VisitDoublyLinkedListValue(*DoublyLinkedListValue) error + VisitNullValue(interface{}) error +} + +func (v *VariableValue) Accept(visitor VariableValueVisitor) error { + if v.IntegerValue != 0 { + return visitor.VisitIntegerValue(v.IntegerValue) + } + if v.BooleanValue != false { + return visitor.VisitBooleanValue(v.BooleanValue) + } + if v.DoubleValue != 0 { + return visitor.VisitDoubleValue(v.DoubleValue) + } + if v.StringValue != "" { + return visitor.VisitStringValue(v.StringValue) + } + if v.CharValue != "" { + return visitor.VisitCharValue(v.CharValue) + } + if v.MapValue != nil { + return visitor.VisitMapValue(v.MapValue) + } + if v.ListValue != nil { + return visitor.VisitListValue(v.ListValue) + } + if v.BinaryTreeValue != nil { + return visitor.VisitBinaryTreeValue(v.BinaryTreeValue) + } + if v.SinglyLinkedListValue != nil { + return visitor.VisitSinglyLinkedListValue(v.SinglyLinkedListValue) + } + if v.DoublyLinkedListValue != nil { + return visitor.VisitDoublyLinkedListValue(v.DoublyLinkedListValue) + } + if v.NullValue != nil { + return visitor.VisitNullValue(v.NullValue) + } + return fmt.Errorf("type %T does not define a non-empty union type", v) +} + +func (v *VariableValue) validate() error { + if v == nil { + return fmt.Errorf("type %T is nil", v) + } + var fields []string + if v.IntegerValue != 0 { + fields = append(fields, "integerValue") + } + if v.BooleanValue != false { + fields = append(fields, "booleanValue") + } + if v.DoubleValue != 0 { + fields = append(fields, "doubleValue") + } + if v.StringValue != "" { + fields = append(fields, "stringValue") + } + if v.CharValue != "" { + fields = append(fields, "charValue") + } + if v.MapValue != nil { + fields = append(fields, "mapValue") + } + if v.ListValue != nil { + fields = append(fields, "listValue") + } + if v.BinaryTreeValue != nil { + fields = append(fields, "binaryTreeValue") + } + if v.SinglyLinkedListValue != nil { + fields = append(fields, "singlyLinkedListValue") + } + if v.DoublyLinkedListValue != nil { + fields = append(fields, "doublyLinkedListValue") + } + if v.NullValue != nil { + fields = append(fields, "nullValue") + } + if len(fields) == 0 { + if v.Type != "" { + if len(v.rawJSON) > 0 { + return nil + } + return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", v, v.Type) + } + return fmt.Errorf("type %T is empty", v) + } + if len(fields) > 1 { + return fmt.Errorf("type %T defines values for %s, but only one value is allowed", v, fields) + } + if v.Type != "" { + field := fields[0] + if v.Type != field { + return fmt.Errorf( + "type %T defines a discriminant set to %q, but it does not match the %T field; either remove or update the discriminant to match", + v, + v.Type, + v, + ) + } + } + return nil +} + +var ( + problemDescriptionFieldBoards = big.NewInt(1 << 0) +) + +type ProblemDescription struct { + Boards []*ProblemDescriptionBoard `json:"boards" url:"boards"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (p *ProblemDescription) GetBoards() []*ProblemDescriptionBoard { + if p == nil { + return nil + } + return p.Boards +} + +func (p *ProblemDescription) GetExtraProperties() map[string]interface{} { + if p == nil { + return nil + } + return p.extraProperties +} + +func (p *ProblemDescription) require(field *big.Int) { + if p.explicitFields == nil { + p.explicitFields = big.NewInt(0) + } + p.explicitFields.Or(p.explicitFields, field) +} + +// SetBoards sets the Boards field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ProblemDescription) SetBoards(boards []*ProblemDescriptionBoard) { + p.Boards = boards + p.require(problemDescriptionFieldBoards) +} + +func (p *ProblemDescription) UnmarshalJSON(data []byte) error { + type unmarshaler ProblemDescription + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *p = ProblemDescription(value) + extraProperties, err := internal.ExtractExtraProperties(data, *p) + if err != nil { + return err + } + p.extraProperties = extraProperties + p.rawJSON = json.RawMessage(data) + return nil +} + +func (p *ProblemDescription) MarshalJSON() ([]byte, error) { + type embed ProblemDescription + var marshaler = struct { + embed + }{ + embed: embed(*p), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, p.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (p *ProblemDescription) String() string { + if p == nil { + return "" + } + if len(p.rawJSON) > 0 { + if value, err := internal.StringifyJSON(p.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(p); err == nil { + return value + } + return fmt.Sprintf("%#v", p) +} + +type ProblemDescriptionBoard struct { + Type string + HTML string + Variable *VariableValue + TestCaseID string + + rawJSON json.RawMessage +} + +func (p *ProblemDescriptionBoard) GetType() string { + if p == nil { + return "" + } + return p.Type +} + +func (p *ProblemDescriptionBoard) GetHTML() string { + if p == nil { + return "" + } + return p.HTML +} + +func (p *ProblemDescriptionBoard) GetVariable() *VariableValue { + if p == nil { + return nil + } + return p.Variable +} + +func (p *ProblemDescriptionBoard) GetTestCaseID() string { + if p == nil { + return "" + } + return p.TestCaseID +} + +func (p *ProblemDescriptionBoard) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + p.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", p) + } + switch unmarshaler.Type { + case "html": + var valueUnmarshaler struct { + HTML string `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + p.HTML = valueUnmarshaler.HTML + case "variable": + var valueUnmarshaler struct { + Variable *VariableValue `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + p.Variable = valueUnmarshaler.Variable + case "testCaseId": + var valueUnmarshaler struct { + TestCaseID string `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + p.TestCaseID = valueUnmarshaler.TestCaseID + } + p.rawJSON = json.RawMessage(data) + return nil +} + +func (p ProblemDescriptionBoard) MarshalJSON() ([]byte, error) { + if err := p.validate(); err != nil { + return nil, err + } + if p.HTML != "" { + var marshaler = struct { + Type string `json:"type"` + HTML string `json:"value"` + }{ + Type: "html", + HTML: p.HTML, + } + return json.Marshal(marshaler) + } + if p.Variable != nil { + var marshaler = struct { + Type string `json:"type"` + Variable *VariableValue `json:"value"` + }{ + Type: "variable", + Variable: p.Variable, + } + return json.Marshal(marshaler) + } + if p.TestCaseID != "" { + var marshaler = struct { + Type string `json:"type"` + TestCaseID string `json:"value"` + }{ + Type: "testCaseId", + TestCaseID: p.TestCaseID, + } + return json.Marshal(marshaler) + } + if len(p.rawJSON) > 0 { + return p.rawJSON, nil + } + return nil, fmt.Errorf("type %T does not define a non-empty union type", p) +} + +type ProblemDescriptionBoardVisitor interface { + VisitHTML(string) error + VisitVariable(*VariableValue) error + VisitTestCaseID(string) error +} + +func (p *ProblemDescriptionBoard) Accept(visitor ProblemDescriptionBoardVisitor) error { + if p.HTML != "" { + return visitor.VisitHTML(p.HTML) + } + if p.Variable != nil { + return visitor.VisitVariable(p.Variable) + } + if p.TestCaseID != "" { + return visitor.VisitTestCaseID(p.TestCaseID) + } + return fmt.Errorf("type %T does not define a non-empty union type", p) +} + +func (p *ProblemDescriptionBoard) validate() error { + if p == nil { + return fmt.Errorf("type %T is nil", p) + } + var fields []string + if p.HTML != "" { + fields = append(fields, "html") + } + if p.Variable != nil { + fields = append(fields, "variable") + } + if p.TestCaseID != "" { + fields = append(fields, "testCaseId") + } + if len(fields) == 0 { + if p.Type != "" { + if len(p.rawJSON) > 0 { + return nil + } + return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", p, p.Type) + } + return fmt.Errorf("type %T is empty", p) + } + if len(fields) > 1 { + return fmt.Errorf("type %T defines values for %s, but only one value is allowed", p, fields) + } + if p.Type != "" { + field := fields[0] + if p.Type != field { + return fmt.Errorf( + "type %T defines a discriminant set to %q, but it does not match the %T field; either remove or update the discriminant to match", + p, + p.Type, + p, + ) + } + } + return nil +} diff --git a/seed/go-sdk/trace/common/common_test.go b/seed/go-sdk/trace/common/common_test.go new file mode 100644 index 000000000000..4e94ebec98f7 --- /dev/null +++ b/seed/go-sdk/trace/common/common_test.go @@ -0,0 +1,3387 @@ +// Code generated by Fern. DO NOT EDIT. + +package common + +import ( + json "encoding/json" + assert "github.com/stretchr/testify/assert" + require "github.com/stretchr/testify/require" + testing "testing" +) + +func TestSettersBinaryTreeNodeValue(t *testing.T) { + t.Run("SetNodeID", func(t *testing.T) { + obj := &BinaryTreeNodeValue{} + var fernTestValueNodeID NodeID + obj.SetNodeID(fernTestValueNodeID) + assert.Equal(t, fernTestValueNodeID, obj.NodeID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetVal", func(t *testing.T) { + obj := &BinaryTreeNodeValue{} + var fernTestValueVal float64 + obj.SetVal(fernTestValueVal) + assert.Equal(t, fernTestValueVal, obj.Val) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetRight", func(t *testing.T) { + obj := &BinaryTreeNodeValue{} + var fernTestValueRight *NodeID + obj.SetRight(fernTestValueRight) + assert.Equal(t, fernTestValueRight, obj.Right) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetLeft", func(t *testing.T) { + obj := &BinaryTreeNodeValue{} + var fernTestValueLeft *NodeID + obj.SetLeft(fernTestValueLeft) + assert.Equal(t, fernTestValueLeft, obj.Left) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersBinaryTreeNodeValue(t *testing.T) { + t.Run("GetNodeID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BinaryTreeNodeValue{} + var expected NodeID + obj.NodeID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetNodeID(), "getter should return the property value") + }) + + t.Run("GetNodeID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BinaryTreeNodeValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetNodeID() // Should return zero value + }) + + t.Run("GetVal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BinaryTreeNodeValue{} + var expected float64 + obj.Val = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetVal(), "getter should return the property value") + }) + + t.Run("GetVal_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BinaryTreeNodeValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetVal() // Should return zero value + }) + + t.Run("GetRight", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BinaryTreeNodeValue{} + var expected *NodeID + obj.Right = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetRight(), "getter should return the property value") + }) + + t.Run("GetRight_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BinaryTreeNodeValue{} + obj.Right = nil + + // Act & Assert + assert.Nil(t, obj.GetRight(), "getter should return nil when property is nil") + }) + + t.Run("GetRight_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BinaryTreeNodeValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetRight() // Should return zero value + }) + + t.Run("GetLeft", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BinaryTreeNodeValue{} + var expected *NodeID + obj.Left = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetLeft(), "getter should return the property value") + }) + + t.Run("GetLeft_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BinaryTreeNodeValue{} + obj.Left = nil + + // Act & Assert + assert.Nil(t, obj.GetLeft(), "getter should return nil when property is nil") + }) + + t.Run("GetLeft_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BinaryTreeNodeValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetLeft() // Should return zero value + }) + +} + +func TestSettersMarkExplicitBinaryTreeNodeValue(t *testing.T) { + t.Run("SetNodeID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BinaryTreeNodeValue{} + var fernTestValueNodeID NodeID + + // Act + obj.SetNodeID(fernTestValueNodeID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetVal_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BinaryTreeNodeValue{} + var fernTestValueVal float64 + + // Act + obj.SetVal(fernTestValueVal) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetRight_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BinaryTreeNodeValue{} + var fernTestValueRight *NodeID + + // Act + obj.SetRight(fernTestValueRight) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetLeft_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BinaryTreeNodeValue{} + var fernTestValueLeft *NodeID + + // Act + obj.SetLeft(fernTestValueLeft) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersBinaryTreeValue(t *testing.T) { + t.Run("SetRoot", func(t *testing.T) { + obj := &BinaryTreeValue{} + var fernTestValueRoot *NodeID + obj.SetRoot(fernTestValueRoot) + assert.Equal(t, fernTestValueRoot, obj.Root) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetNodes", func(t *testing.T) { + obj := &BinaryTreeValue{} + var fernTestValueNodes map[NodeID]*BinaryTreeNodeValue + obj.SetNodes(fernTestValueNodes) + assert.Equal(t, fernTestValueNodes, obj.Nodes) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersBinaryTreeValue(t *testing.T) { + t.Run("GetRoot", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BinaryTreeValue{} + var expected *NodeID + obj.Root = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetRoot(), "getter should return the property value") + }) + + t.Run("GetRoot_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BinaryTreeValue{} + obj.Root = nil + + // Act & Assert + assert.Nil(t, obj.GetRoot(), "getter should return nil when property is nil") + }) + + t.Run("GetRoot_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BinaryTreeValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetRoot() // Should return zero value + }) + + t.Run("GetNodes", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BinaryTreeValue{} + var expected map[NodeID]*BinaryTreeNodeValue + obj.Nodes = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetNodes(), "getter should return the property value") + }) + + t.Run("GetNodes_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BinaryTreeValue{} + obj.Nodes = nil + + // Act & Assert + assert.Nil(t, obj.GetNodes(), "getter should return nil when property is nil") + }) + + t.Run("GetNodes_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BinaryTreeValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetNodes() // Should return zero value + }) + +} + +func TestSettersMarkExplicitBinaryTreeValue(t *testing.T) { + t.Run("SetRoot_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BinaryTreeValue{} + var fernTestValueRoot *NodeID + + // Act + obj.SetRoot(fernTestValueRoot) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetNodes_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BinaryTreeValue{} + var fernTestValueNodes map[NodeID]*BinaryTreeNodeValue + + // Act + obj.SetNodes(fernTestValueNodes) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersDoublyLinkedListNodeValue(t *testing.T) { + t.Run("SetNodeID", func(t *testing.T) { + obj := &DoublyLinkedListNodeValue{} + var fernTestValueNodeID NodeID + obj.SetNodeID(fernTestValueNodeID) + assert.Equal(t, fernTestValueNodeID, obj.NodeID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetVal", func(t *testing.T) { + obj := &DoublyLinkedListNodeValue{} + var fernTestValueVal float64 + obj.SetVal(fernTestValueVal) + assert.Equal(t, fernTestValueVal, obj.Val) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetNext", func(t *testing.T) { + obj := &DoublyLinkedListNodeValue{} + var fernTestValueNext *NodeID + obj.SetNext(fernTestValueNext) + assert.Equal(t, fernTestValueNext, obj.Next) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetPrev", func(t *testing.T) { + obj := &DoublyLinkedListNodeValue{} + var fernTestValuePrev *NodeID + obj.SetPrev(fernTestValuePrev) + assert.Equal(t, fernTestValuePrev, obj.Prev) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersDoublyLinkedListNodeValue(t *testing.T) { + t.Run("GetNodeID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DoublyLinkedListNodeValue{} + var expected NodeID + obj.NodeID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetNodeID(), "getter should return the property value") + }) + + t.Run("GetNodeID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DoublyLinkedListNodeValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetNodeID() // Should return zero value + }) + + t.Run("GetVal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DoublyLinkedListNodeValue{} + var expected float64 + obj.Val = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetVal(), "getter should return the property value") + }) + + t.Run("GetVal_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DoublyLinkedListNodeValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetVal() // Should return zero value + }) + + t.Run("GetNext", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DoublyLinkedListNodeValue{} + var expected *NodeID + obj.Next = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetNext(), "getter should return the property value") + }) + + t.Run("GetNext_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DoublyLinkedListNodeValue{} + obj.Next = nil + + // Act & Assert + assert.Nil(t, obj.GetNext(), "getter should return nil when property is nil") + }) + + t.Run("GetNext_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DoublyLinkedListNodeValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetNext() // Should return zero value + }) + + t.Run("GetPrev", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DoublyLinkedListNodeValue{} + var expected *NodeID + obj.Prev = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetPrev(), "getter should return the property value") + }) + + t.Run("GetPrev_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DoublyLinkedListNodeValue{} + obj.Prev = nil + + // Act & Assert + assert.Nil(t, obj.GetPrev(), "getter should return nil when property is nil") + }) + + t.Run("GetPrev_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DoublyLinkedListNodeValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetPrev() // Should return zero value + }) + +} + +func TestSettersMarkExplicitDoublyLinkedListNodeValue(t *testing.T) { + t.Run("SetNodeID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DoublyLinkedListNodeValue{} + var fernTestValueNodeID NodeID + + // Act + obj.SetNodeID(fernTestValueNodeID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetVal_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DoublyLinkedListNodeValue{} + var fernTestValueVal float64 + + // Act + obj.SetVal(fernTestValueVal) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetNext_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DoublyLinkedListNodeValue{} + var fernTestValueNext *NodeID + + // Act + obj.SetNext(fernTestValueNext) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetPrev_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DoublyLinkedListNodeValue{} + var fernTestValuePrev *NodeID + + // Act + obj.SetPrev(fernTestValuePrev) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersDoublyLinkedListValue(t *testing.T) { + t.Run("SetHead", func(t *testing.T) { + obj := &DoublyLinkedListValue{} + var fernTestValueHead *NodeID + obj.SetHead(fernTestValueHead) + assert.Equal(t, fernTestValueHead, obj.Head) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetNodes", func(t *testing.T) { + obj := &DoublyLinkedListValue{} + var fernTestValueNodes map[NodeID]*DoublyLinkedListNodeValue + obj.SetNodes(fernTestValueNodes) + assert.Equal(t, fernTestValueNodes, obj.Nodes) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersDoublyLinkedListValue(t *testing.T) { + t.Run("GetHead", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DoublyLinkedListValue{} + var expected *NodeID + obj.Head = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetHead(), "getter should return the property value") + }) + + t.Run("GetHead_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DoublyLinkedListValue{} + obj.Head = nil + + // Act & Assert + assert.Nil(t, obj.GetHead(), "getter should return nil when property is nil") + }) + + t.Run("GetHead_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DoublyLinkedListValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetHead() // Should return zero value + }) + + t.Run("GetNodes", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DoublyLinkedListValue{} + var expected map[NodeID]*DoublyLinkedListNodeValue + obj.Nodes = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetNodes(), "getter should return the property value") + }) + + t.Run("GetNodes_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DoublyLinkedListValue{} + obj.Nodes = nil + + // Act & Assert + assert.Nil(t, obj.GetNodes(), "getter should return nil when property is nil") + }) + + t.Run("GetNodes_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DoublyLinkedListValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetNodes() // Should return zero value + }) + +} + +func TestSettersMarkExplicitDoublyLinkedListValue(t *testing.T) { + t.Run("SetHead_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DoublyLinkedListValue{} + var fernTestValueHead *NodeID + + // Act + obj.SetHead(fernTestValueHead) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetNodes_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DoublyLinkedListValue{} + var fernTestValueNodes map[NodeID]*DoublyLinkedListNodeValue + + // Act + obj.SetNodes(fernTestValueNodes) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersKeyValuePair(t *testing.T) { + t.Run("SetKey", func(t *testing.T) { + obj := &KeyValuePair{} + var fernTestValueKey *VariableValue + obj.SetKey(fernTestValueKey) + assert.Equal(t, fernTestValueKey, obj.Key) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetValue", func(t *testing.T) { + obj := &KeyValuePair{} + var fernTestValueValue *VariableValue + obj.SetValue(fernTestValueValue) + assert.Equal(t, fernTestValueValue, obj.Value) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersKeyValuePair(t *testing.T) { + t.Run("GetKey", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &KeyValuePair{} + var expected *VariableValue + obj.Key = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetKey(), "getter should return the property value") + }) + + t.Run("GetKey_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &KeyValuePair{} + obj.Key = nil + + // Act & Assert + assert.Nil(t, obj.GetKey(), "getter should return nil when property is nil") + }) + + t.Run("GetKey_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *KeyValuePair + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetKey() // Should return zero value + }) + + t.Run("GetValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &KeyValuePair{} + var expected *VariableValue + obj.Value = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetValue(), "getter should return the property value") + }) + + t.Run("GetValue_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &KeyValuePair{} + obj.Value = nil + + // Act & Assert + assert.Nil(t, obj.GetValue(), "getter should return nil when property is nil") + }) + + t.Run("GetValue_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *KeyValuePair + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetValue() // Should return zero value + }) + +} + +func TestSettersMarkExplicitKeyValuePair(t *testing.T) { + t.Run("SetKey_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &KeyValuePair{} + var fernTestValueKey *VariableValue + + // Act + obj.SetKey(fernTestValueKey) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetValue_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &KeyValuePair{} + var fernTestValueValue *VariableValue + + // Act + obj.SetValue(fernTestValueValue) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersListType(t *testing.T) { + t.Run("SetValueType", func(t *testing.T) { + obj := &ListType{} + var fernTestValueValueType *VariableType + obj.SetValueType(fernTestValueValueType) + assert.Equal(t, fernTestValueValueType, obj.ValueType) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetIsFixedLength", func(t *testing.T) { + obj := &ListType{} + var fernTestValueIsFixedLength *bool + obj.SetIsFixedLength(fernTestValueIsFixedLength) + assert.Equal(t, fernTestValueIsFixedLength, obj.IsFixedLength) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersListType(t *testing.T) { + t.Run("GetValueType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ListType{} + var expected *VariableType + obj.ValueType = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetValueType(), "getter should return the property value") + }) + + t.Run("GetValueType_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ListType{} + obj.ValueType = nil + + // Act & Assert + assert.Nil(t, obj.GetValueType(), "getter should return nil when property is nil") + }) + + t.Run("GetValueType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ListType + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetValueType() // Should return zero value + }) + + t.Run("GetIsFixedLength", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ListType{} + var expected *bool + obj.IsFixedLength = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetIsFixedLength(), "getter should return the property value") + }) + + t.Run("GetIsFixedLength_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ListType{} + obj.IsFixedLength = nil + + // Act & Assert + assert.Nil(t, obj.GetIsFixedLength(), "getter should return nil when property is nil") + }) + + t.Run("GetIsFixedLength_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ListType + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetIsFixedLength() // Should return zero value + }) + +} + +func TestSettersMarkExplicitListType(t *testing.T) { + t.Run("SetValueType_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ListType{} + var fernTestValueValueType *VariableType + + // Act + obj.SetValueType(fernTestValueValueType) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetIsFixedLength_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ListType{} + var fernTestValueIsFixedLength *bool + + // Act + obj.SetIsFixedLength(fernTestValueIsFixedLength) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersMapType(t *testing.T) { + t.Run("SetKeyType", func(t *testing.T) { + obj := &MapType{} + var fernTestValueKeyType *VariableType + obj.SetKeyType(fernTestValueKeyType) + assert.Equal(t, fernTestValueKeyType, obj.KeyType) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetValueType", func(t *testing.T) { + obj := &MapType{} + var fernTestValueValueType *VariableType + obj.SetValueType(fernTestValueValueType) + assert.Equal(t, fernTestValueValueType, obj.ValueType) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersMapType(t *testing.T) { + t.Run("GetKeyType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &MapType{} + var expected *VariableType + obj.KeyType = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetKeyType(), "getter should return the property value") + }) + + t.Run("GetKeyType_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &MapType{} + obj.KeyType = nil + + // Act & Assert + assert.Nil(t, obj.GetKeyType(), "getter should return nil when property is nil") + }) + + t.Run("GetKeyType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *MapType + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetKeyType() // Should return zero value + }) + + t.Run("GetValueType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &MapType{} + var expected *VariableType + obj.ValueType = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetValueType(), "getter should return the property value") + }) + + t.Run("GetValueType_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &MapType{} + obj.ValueType = nil + + // Act & Assert + assert.Nil(t, obj.GetValueType(), "getter should return nil when property is nil") + }) + + t.Run("GetValueType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *MapType + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetValueType() // Should return zero value + }) + +} + +func TestSettersMarkExplicitMapType(t *testing.T) { + t.Run("SetKeyType_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &MapType{} + var fernTestValueKeyType *VariableType + + // Act + obj.SetKeyType(fernTestValueKeyType) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetValueType_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &MapType{} + var fernTestValueValueType *VariableType + + // Act + obj.SetValueType(fernTestValueValueType) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersMapValue(t *testing.T) { + t.Run("SetKeyValuePairs", func(t *testing.T) { + obj := &MapValue{} + var fernTestValueKeyValuePairs []*KeyValuePair + obj.SetKeyValuePairs(fernTestValueKeyValuePairs) + assert.Equal(t, fernTestValueKeyValuePairs, obj.KeyValuePairs) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersMapValue(t *testing.T) { + t.Run("GetKeyValuePairs", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &MapValue{} + var expected []*KeyValuePair + obj.KeyValuePairs = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetKeyValuePairs(), "getter should return the property value") + }) + + t.Run("GetKeyValuePairs_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &MapValue{} + obj.KeyValuePairs = nil + + // Act & Assert + assert.Nil(t, obj.GetKeyValuePairs(), "getter should return nil when property is nil") + }) + + t.Run("GetKeyValuePairs_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *MapValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetKeyValuePairs() // Should return zero value + }) + +} + +func TestSettersMarkExplicitMapValue(t *testing.T) { + t.Run("SetKeyValuePairs_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &MapValue{} + var fernTestValueKeyValuePairs []*KeyValuePair + + // Act + obj.SetKeyValuePairs(fernTestValueKeyValuePairs) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersSinglyLinkedListNodeValue(t *testing.T) { + t.Run("SetNodeID", func(t *testing.T) { + obj := &SinglyLinkedListNodeValue{} + var fernTestValueNodeID NodeID + obj.SetNodeID(fernTestValueNodeID) + assert.Equal(t, fernTestValueNodeID, obj.NodeID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetVal", func(t *testing.T) { + obj := &SinglyLinkedListNodeValue{} + var fernTestValueVal float64 + obj.SetVal(fernTestValueVal) + assert.Equal(t, fernTestValueVal, obj.Val) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetNext", func(t *testing.T) { + obj := &SinglyLinkedListNodeValue{} + var fernTestValueNext *NodeID + obj.SetNext(fernTestValueNext) + assert.Equal(t, fernTestValueNext, obj.Next) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersSinglyLinkedListNodeValue(t *testing.T) { + t.Run("GetNodeID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SinglyLinkedListNodeValue{} + var expected NodeID + obj.NodeID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetNodeID(), "getter should return the property value") + }) + + t.Run("GetNodeID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SinglyLinkedListNodeValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetNodeID() // Should return zero value + }) + + t.Run("GetVal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SinglyLinkedListNodeValue{} + var expected float64 + obj.Val = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetVal(), "getter should return the property value") + }) + + t.Run("GetVal_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SinglyLinkedListNodeValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetVal() // Should return zero value + }) + + t.Run("GetNext", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SinglyLinkedListNodeValue{} + var expected *NodeID + obj.Next = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetNext(), "getter should return the property value") + }) + + t.Run("GetNext_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SinglyLinkedListNodeValue{} + obj.Next = nil + + // Act & Assert + assert.Nil(t, obj.GetNext(), "getter should return nil when property is nil") + }) + + t.Run("GetNext_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SinglyLinkedListNodeValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetNext() // Should return zero value + }) + +} + +func TestSettersMarkExplicitSinglyLinkedListNodeValue(t *testing.T) { + t.Run("SetNodeID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SinglyLinkedListNodeValue{} + var fernTestValueNodeID NodeID + + // Act + obj.SetNodeID(fernTestValueNodeID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetVal_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SinglyLinkedListNodeValue{} + var fernTestValueVal float64 + + // Act + obj.SetVal(fernTestValueVal) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetNext_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SinglyLinkedListNodeValue{} + var fernTestValueNext *NodeID + + // Act + obj.SetNext(fernTestValueNext) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersSinglyLinkedListValue(t *testing.T) { + t.Run("SetHead", func(t *testing.T) { + obj := &SinglyLinkedListValue{} + var fernTestValueHead *NodeID + obj.SetHead(fernTestValueHead) + assert.Equal(t, fernTestValueHead, obj.Head) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetNodes", func(t *testing.T) { + obj := &SinglyLinkedListValue{} + var fernTestValueNodes map[NodeID]*SinglyLinkedListNodeValue + obj.SetNodes(fernTestValueNodes) + assert.Equal(t, fernTestValueNodes, obj.Nodes) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersSinglyLinkedListValue(t *testing.T) { + t.Run("GetHead", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SinglyLinkedListValue{} + var expected *NodeID + obj.Head = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetHead(), "getter should return the property value") + }) + + t.Run("GetHead_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SinglyLinkedListValue{} + obj.Head = nil + + // Act & Assert + assert.Nil(t, obj.GetHead(), "getter should return nil when property is nil") + }) + + t.Run("GetHead_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SinglyLinkedListValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetHead() // Should return zero value + }) + + t.Run("GetNodes", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SinglyLinkedListValue{} + var expected map[NodeID]*SinglyLinkedListNodeValue + obj.Nodes = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetNodes(), "getter should return the property value") + }) + + t.Run("GetNodes_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SinglyLinkedListValue{} + obj.Nodes = nil + + // Act & Assert + assert.Nil(t, obj.GetNodes(), "getter should return nil when property is nil") + }) + + t.Run("GetNodes_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SinglyLinkedListValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetNodes() // Should return zero value + }) + +} + +func TestSettersMarkExplicitSinglyLinkedListValue(t *testing.T) { + t.Run("SetHead_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SinglyLinkedListValue{} + var fernTestValueHead *NodeID + + // Act + obj.SetHead(fernTestValueHead) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetNodes_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SinglyLinkedListValue{} + var fernTestValueNodes map[NodeID]*SinglyLinkedListNodeValue + + // Act + obj.SetNodes(fernTestValueNodes) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestGettersVariableType(t *testing.T) { + t.Run("GetType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VariableType{} + var expected string + obj.Type = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetType(), "getter should return the property value") + }) + + t.Run("GetType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VariableType + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetType() // Should return zero value + }) + + t.Run("GetIntegerType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VariableType{} + var expected interface{} + obj.IntegerType = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetIntegerType(), "getter should return the property value") + }) + + t.Run("GetIntegerType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VariableType + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetIntegerType() // Should return zero value + }) + + t.Run("GetDoubleType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VariableType{} + var expected interface{} + obj.DoubleType = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetDoubleType(), "getter should return the property value") + }) + + t.Run("GetDoubleType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VariableType + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetDoubleType() // Should return zero value + }) + + t.Run("GetBooleanType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VariableType{} + var expected interface{} + obj.BooleanType = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetBooleanType(), "getter should return the property value") + }) + + t.Run("GetBooleanType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VariableType + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetBooleanType() // Should return zero value + }) + + t.Run("GetStringType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VariableType{} + var expected interface{} + obj.StringType = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetStringType(), "getter should return the property value") + }) + + t.Run("GetStringType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VariableType + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetStringType() // Should return zero value + }) + + t.Run("GetCharType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VariableType{} + var expected interface{} + obj.CharType = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetCharType(), "getter should return the property value") + }) + + t.Run("GetCharType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VariableType + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetCharType() // Should return zero value + }) + + t.Run("GetListType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VariableType{} + var expected *ListType + obj.ListType = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetListType(), "getter should return the property value") + }) + + t.Run("GetListType_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VariableType{} + obj.ListType = nil + + // Act & Assert + assert.Nil(t, obj.GetListType(), "getter should return nil when property is nil") + }) + + t.Run("GetListType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VariableType + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetListType() // Should return zero value + }) + + t.Run("GetMapType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VariableType{} + var expected *MapType + obj.MapType = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetMapType(), "getter should return the property value") + }) + + t.Run("GetMapType_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VariableType{} + obj.MapType = nil + + // Act & Assert + assert.Nil(t, obj.GetMapType(), "getter should return nil when property is nil") + }) + + t.Run("GetMapType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VariableType + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetMapType() // Should return zero value + }) + + t.Run("GetBinaryTreeType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VariableType{} + var expected interface{} + obj.BinaryTreeType = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetBinaryTreeType(), "getter should return the property value") + }) + + t.Run("GetBinaryTreeType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VariableType + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetBinaryTreeType() // Should return zero value + }) + + t.Run("GetSinglyLinkedListType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VariableType{} + var expected interface{} + obj.SinglyLinkedListType = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSinglyLinkedListType(), "getter should return the property value") + }) + + t.Run("GetSinglyLinkedListType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VariableType + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSinglyLinkedListType() // Should return zero value + }) + + t.Run("GetDoublyLinkedListType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VariableType{} + var expected interface{} + obj.DoublyLinkedListType = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetDoublyLinkedListType(), "getter should return the property value") + }) + + t.Run("GetDoublyLinkedListType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VariableType + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetDoublyLinkedListType() // Should return zero value + }) + +} + +func TestGettersVariableValue(t *testing.T) { + t.Run("GetType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VariableValue{} + var expected string + obj.Type = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetType(), "getter should return the property value") + }) + + t.Run("GetType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VariableValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetType() // Should return zero value + }) + + t.Run("GetIntegerValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VariableValue{} + var expected int + obj.IntegerValue = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetIntegerValue(), "getter should return the property value") + }) + + t.Run("GetIntegerValue_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VariableValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetIntegerValue() // Should return zero value + }) + + t.Run("GetBooleanValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VariableValue{} + var expected bool + obj.BooleanValue = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetBooleanValue(), "getter should return the property value") + }) + + t.Run("GetBooleanValue_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VariableValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetBooleanValue() // Should return zero value + }) + + t.Run("GetDoubleValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VariableValue{} + var expected float64 + obj.DoubleValue = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetDoubleValue(), "getter should return the property value") + }) + + t.Run("GetDoubleValue_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VariableValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetDoubleValue() // Should return zero value + }) + + t.Run("GetStringValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VariableValue{} + var expected string + obj.StringValue = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetStringValue(), "getter should return the property value") + }) + + t.Run("GetStringValue_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VariableValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetStringValue() // Should return zero value + }) + + t.Run("GetCharValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VariableValue{} + var expected string + obj.CharValue = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetCharValue(), "getter should return the property value") + }) + + t.Run("GetCharValue_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VariableValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetCharValue() // Should return zero value + }) + + t.Run("GetMapValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VariableValue{} + var expected *MapValue + obj.MapValue = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetMapValue(), "getter should return the property value") + }) + + t.Run("GetMapValue_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VariableValue{} + obj.MapValue = nil + + // Act & Assert + assert.Nil(t, obj.GetMapValue(), "getter should return nil when property is nil") + }) + + t.Run("GetMapValue_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VariableValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetMapValue() // Should return zero value + }) + + t.Run("GetListValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VariableValue{} + var expected []*VariableValue + obj.ListValue = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetListValue(), "getter should return the property value") + }) + + t.Run("GetListValue_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VariableValue{} + obj.ListValue = nil + + // Act & Assert + assert.Nil(t, obj.GetListValue(), "getter should return nil when property is nil") + }) + + t.Run("GetListValue_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VariableValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetListValue() // Should return zero value + }) + + t.Run("GetBinaryTreeValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VariableValue{} + var expected *BinaryTreeValue + obj.BinaryTreeValue = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetBinaryTreeValue(), "getter should return the property value") + }) + + t.Run("GetBinaryTreeValue_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VariableValue{} + obj.BinaryTreeValue = nil + + // Act & Assert + assert.Nil(t, obj.GetBinaryTreeValue(), "getter should return nil when property is nil") + }) + + t.Run("GetBinaryTreeValue_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VariableValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetBinaryTreeValue() // Should return zero value + }) + + t.Run("GetSinglyLinkedListValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VariableValue{} + var expected *SinglyLinkedListValue + obj.SinglyLinkedListValue = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSinglyLinkedListValue(), "getter should return the property value") + }) + + t.Run("GetSinglyLinkedListValue_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VariableValue{} + obj.SinglyLinkedListValue = nil + + // Act & Assert + assert.Nil(t, obj.GetSinglyLinkedListValue(), "getter should return nil when property is nil") + }) + + t.Run("GetSinglyLinkedListValue_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VariableValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSinglyLinkedListValue() // Should return zero value + }) + + t.Run("GetDoublyLinkedListValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VariableValue{} + var expected *DoublyLinkedListValue + obj.DoublyLinkedListValue = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetDoublyLinkedListValue(), "getter should return the property value") + }) + + t.Run("GetDoublyLinkedListValue_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VariableValue{} + obj.DoublyLinkedListValue = nil + + // Act & Assert + assert.Nil(t, obj.GetDoublyLinkedListValue(), "getter should return nil when property is nil") + }) + + t.Run("GetDoublyLinkedListValue_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VariableValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetDoublyLinkedListValue() // Should return zero value + }) + + t.Run("GetNullValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VariableValue{} + var expected interface{} + obj.NullValue = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetNullValue(), "getter should return the property value") + }) + + t.Run("GetNullValue_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VariableValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetNullValue() // Should return zero value + }) + +} + +func TestSettersProblemDescription(t *testing.T) { + t.Run("SetBoards", func(t *testing.T) { + obj := &ProblemDescription{} + var fernTestValueBoards []*ProblemDescriptionBoard + obj.SetBoards(fernTestValueBoards) + assert.Equal(t, fernTestValueBoards, obj.Boards) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersProblemDescription(t *testing.T) { + t.Run("GetBoards", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemDescription{} + var expected []*ProblemDescriptionBoard + obj.Boards = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetBoards(), "getter should return the property value") + }) + + t.Run("GetBoards_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemDescription{} + obj.Boards = nil + + // Act & Assert + assert.Nil(t, obj.GetBoards(), "getter should return nil when property is nil") + }) + + t.Run("GetBoards_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemDescription + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetBoards() // Should return zero value + }) + +} + +func TestSettersMarkExplicitProblemDescription(t *testing.T) { + t.Run("SetBoards_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemDescription{} + var fernTestValueBoards []*ProblemDescriptionBoard + + // Act + obj.SetBoards(fernTestValueBoards) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestGettersProblemDescriptionBoard(t *testing.T) { + t.Run("GetType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemDescriptionBoard{} + var expected string + obj.Type = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetType(), "getter should return the property value") + }) + + t.Run("GetType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemDescriptionBoard + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetType() // Should return zero value + }) + + t.Run("GetHTML", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemDescriptionBoard{} + var expected string + obj.HTML = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetHTML(), "getter should return the property value") + }) + + t.Run("GetHTML_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemDescriptionBoard + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetHTML() // Should return zero value + }) + + t.Run("GetVariable", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemDescriptionBoard{} + var expected *VariableValue + obj.Variable = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetVariable(), "getter should return the property value") + }) + + t.Run("GetVariable_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemDescriptionBoard{} + obj.Variable = nil + + // Act & Assert + assert.Nil(t, obj.GetVariable(), "getter should return nil when property is nil") + }) + + t.Run("GetVariable_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemDescriptionBoard + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetVariable() // Should return zero value + }) + + t.Run("GetTestCaseID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemDescriptionBoard{} + var expected string + obj.TestCaseID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTestCaseID(), "getter should return the property value") + }) + + t.Run("GetTestCaseID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemDescriptionBoard + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTestCaseID() // Should return zero value + }) + +} + +func TestJSONMarshalingBinaryTreeNodeValue(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BinaryTreeNodeValue{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled BinaryTreeNodeValue + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj BinaryTreeNodeValue + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj BinaryTreeNodeValue + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingBinaryTreeValue(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BinaryTreeValue{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled BinaryTreeValue + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj BinaryTreeValue + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj BinaryTreeValue + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingDoublyLinkedListNodeValue(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DoublyLinkedListNodeValue{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled DoublyLinkedListNodeValue + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj DoublyLinkedListNodeValue + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj DoublyLinkedListNodeValue + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingDoublyLinkedListValue(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DoublyLinkedListValue{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled DoublyLinkedListValue + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj DoublyLinkedListValue + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj DoublyLinkedListValue + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingKeyValuePair(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &KeyValuePair{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled KeyValuePair + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj KeyValuePair + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj KeyValuePair + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingListType(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ListType{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled ListType + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj ListType + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj ListType + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingMapType(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &MapType{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled MapType + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj MapType + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj MapType + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingMapValue(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &MapValue{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled MapValue + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj MapValue + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj MapValue + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingProblemDescription(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemDescription{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled ProblemDescription + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj ProblemDescription + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj ProblemDescription + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingSinglyLinkedListNodeValue(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SinglyLinkedListNodeValue{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled SinglyLinkedListNodeValue + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj SinglyLinkedListNodeValue + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj SinglyLinkedListNodeValue + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingSinglyLinkedListValue(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SinglyLinkedListValue{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled SinglyLinkedListValue + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj SinglyLinkedListValue + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj SinglyLinkedListValue + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestStringBinaryTreeNodeValue(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &BinaryTreeNodeValue{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BinaryTreeNodeValue + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringBinaryTreeValue(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &BinaryTreeValue{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BinaryTreeValue + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringDoublyLinkedListNodeValue(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &DoublyLinkedListNodeValue{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DoublyLinkedListNodeValue + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringDoublyLinkedListValue(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &DoublyLinkedListValue{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DoublyLinkedListValue + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringKeyValuePair(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &KeyValuePair{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *KeyValuePair + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringListType(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &ListType{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ListType + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringMapType(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &MapType{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *MapType + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringMapValue(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &MapValue{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *MapValue + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringProblemDescription(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &ProblemDescription{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemDescription + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringSinglyLinkedListNodeValue(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &SinglyLinkedListNodeValue{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SinglyLinkedListNodeValue + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringSinglyLinkedListValue(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &SinglyLinkedListValue{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SinglyLinkedListValue + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestEnumLanguage(t *testing.T) { + t.Run("NewFromString_JAVA", func(t *testing.T) { + t.Parallel() + val, err := NewLanguageFromString("JAVA") + assert.NoError(t, err, "valid enum value should not return error") + assert.Equal(t, Language("JAVA"), val, "enum value should match expected wire value") + }) + + t.Run("NewFromString_JAVASCRIPT", func(t *testing.T) { + t.Parallel() + val, err := NewLanguageFromString("JAVASCRIPT") + assert.NoError(t, err, "valid enum value should not return error") + assert.Equal(t, Language("JAVASCRIPT"), val, "enum value should match expected wire value") + }) + + t.Run("NewFromString_PYTHON", func(t *testing.T) { + t.Parallel() + val, err := NewLanguageFromString("PYTHON") + assert.NoError(t, err, "valid enum value should not return error") + assert.Equal(t, Language("PYTHON"), val, "enum value should match expected wire value") + }) + + t.Run("NewFromString_Invalid", func(t *testing.T) { + _, err := NewLanguageFromString("invalid_value_that_does_not_exist") + assert.Error(t, err) + }) + + t.Run("Ptr", func(t *testing.T) { + val, err := NewLanguageFromString("JAVA") + assert.NoError(t, err) + ptr := val.Ptr() + assert.NotNil(t, ptr) + assert.Equal(t, val, *ptr) + }) +} + +func TestExtraPropertiesBinaryTreeNodeValue(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &BinaryTreeNodeValue{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BinaryTreeNodeValue + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesBinaryTreeValue(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &BinaryTreeValue{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BinaryTreeValue + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesDoublyLinkedListNodeValue(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &DoublyLinkedListNodeValue{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DoublyLinkedListNodeValue + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesDoublyLinkedListValue(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &DoublyLinkedListValue{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DoublyLinkedListValue + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesKeyValuePair(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &KeyValuePair{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *KeyValuePair + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesListType(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &ListType{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ListType + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesMapType(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &MapType{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *MapType + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesMapValue(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &MapValue{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *MapValue + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesProblemDescription(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &ProblemDescription{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemDescription + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesSinglyLinkedListNodeValue(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &SinglyLinkedListNodeValue{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SinglyLinkedListNodeValue + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesSinglyLinkedListValue(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &SinglyLinkedListValue{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SinglyLinkedListValue + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} diff --git a/seed/go-sdk/trace/common/v2/common.go b/seed/go-sdk/trace/common/v2/common.go new file mode 100644 index 000000000000..b943d7484d85 --- /dev/null +++ b/seed/go-sdk/trace/common/v2/common.go @@ -0,0 +1,3024 @@ +// Code generated by Fern. DO NOT EDIT. + +package v2 + +import ( + json "encoding/json" + fmt "fmt" + common "github.com/trace/fern/common" + internal "github.com/trace/fern/internal" + big "math/big" +) + +type AssertCorrectnessCheck struct { + Type string + DeepEquality *DeepEqualityCorrectnessCheck + Custom *VoidFunctionDefinitionThatTakesActualResult + + rawJSON json.RawMessage +} + +func (a *AssertCorrectnessCheck) GetType() string { + if a == nil { + return "" + } + return a.Type +} + +func (a *AssertCorrectnessCheck) GetDeepEquality() *DeepEqualityCorrectnessCheck { + if a == nil { + return nil + } + return a.DeepEquality +} + +func (a *AssertCorrectnessCheck) GetCustom() *VoidFunctionDefinitionThatTakesActualResult { + if a == nil { + return nil + } + return a.Custom +} + +func (a *AssertCorrectnessCheck) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + a.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", a) + } + switch unmarshaler.Type { + case "deepEquality": + value := new(DeepEqualityCorrectnessCheck) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + a.DeepEquality = value + case "custom": + value := new(VoidFunctionDefinitionThatTakesActualResult) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + a.Custom = value + } + a.rawJSON = json.RawMessage(data) + return nil +} + +func (a AssertCorrectnessCheck) MarshalJSON() ([]byte, error) { + if err := a.validate(); err != nil { + return nil, err + } + if a.DeepEquality != nil { + return internal.MarshalJSONWithExtraProperty(a.DeepEquality, "type", "deepEquality") + } + if a.Custom != nil { + return internal.MarshalJSONWithExtraProperty(a.Custom, "type", "custom") + } + if len(a.rawJSON) > 0 { + return a.rawJSON, nil + } + return nil, fmt.Errorf("type %T does not define a non-empty union type", a) +} + +type AssertCorrectnessCheckVisitor interface { + VisitDeepEquality(*DeepEqualityCorrectnessCheck) error + VisitCustom(*VoidFunctionDefinitionThatTakesActualResult) error +} + +func (a *AssertCorrectnessCheck) Accept(visitor AssertCorrectnessCheckVisitor) error { + if a.DeepEquality != nil { + return visitor.VisitDeepEquality(a.DeepEquality) + } + if a.Custom != nil { + return visitor.VisitCustom(a.Custom) + } + return fmt.Errorf("type %T does not define a non-empty union type", a) +} + +func (a *AssertCorrectnessCheck) validate() error { + if a == nil { + return fmt.Errorf("type %T is nil", a) + } + var fields []string + if a.DeepEquality != nil { + fields = append(fields, "deepEquality") + } + if a.Custom != nil { + fields = append(fields, "custom") + } + if len(fields) == 0 { + if a.Type != "" { + if len(a.rawJSON) > 0 { + return nil + } + return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", a, a.Type) + } + return fmt.Errorf("type %T is empty", a) + } + if len(fields) > 1 { + return fmt.Errorf("type %T defines values for %s, but only one value is allowed", a, fields) + } + if a.Type != "" { + field := fields[0] + if a.Type != field { + return fmt.Errorf( + "type %T defines a discriminant set to %q, but it does not match the %T field; either remove or update the discriminant to match", + a, + a.Type, + a, + ) + } + } + return nil +} + +var ( + basicCustomFilesFieldMethodName = big.NewInt(1 << 0) + basicCustomFilesFieldSignature = big.NewInt(1 << 1) + basicCustomFilesFieldAdditionalFiles = big.NewInt(1 << 2) + basicCustomFilesFieldBasicTestCaseTemplate = big.NewInt(1 << 3) +) + +type BasicCustomFiles struct { + MethodName string `json:"methodName" url:"methodName"` + Signature *NonVoidFunctionSignature `json:"signature" url:"signature"` + AdditionalFiles map[common.Language]*Files `json:"additionalFiles" url:"additionalFiles"` + BasicTestCaseTemplate *BasicTestCaseTemplate `json:"basicTestCaseTemplate" url:"basicTestCaseTemplate"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (b *BasicCustomFiles) GetMethodName() string { + if b == nil { + return "" + } + return b.MethodName +} + +func (b *BasicCustomFiles) GetSignature() *NonVoidFunctionSignature { + if b == nil { + return nil + } + return b.Signature +} + +func (b *BasicCustomFiles) GetAdditionalFiles() map[common.Language]*Files { + if b == nil { + return nil + } + return b.AdditionalFiles +} + +func (b *BasicCustomFiles) GetBasicTestCaseTemplate() *BasicTestCaseTemplate { + if b == nil { + return nil + } + return b.BasicTestCaseTemplate +} + +func (b *BasicCustomFiles) GetExtraProperties() map[string]interface{} { + if b == nil { + return nil + } + return b.extraProperties +} + +func (b *BasicCustomFiles) require(field *big.Int) { + if b.explicitFields == nil { + b.explicitFields = big.NewInt(0) + } + b.explicitFields.Or(b.explicitFields, field) +} + +// SetMethodName sets the MethodName field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BasicCustomFiles) SetMethodName(methodName string) { + b.MethodName = methodName + b.require(basicCustomFilesFieldMethodName) +} + +// SetSignature sets the Signature field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BasicCustomFiles) SetSignature(signature *NonVoidFunctionSignature) { + b.Signature = signature + b.require(basicCustomFilesFieldSignature) +} + +// SetAdditionalFiles sets the AdditionalFiles field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BasicCustomFiles) SetAdditionalFiles(additionalFiles map[common.Language]*Files) { + b.AdditionalFiles = additionalFiles + b.require(basicCustomFilesFieldAdditionalFiles) +} + +// SetBasicTestCaseTemplate sets the BasicTestCaseTemplate field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BasicCustomFiles) SetBasicTestCaseTemplate(basicTestCaseTemplate *BasicTestCaseTemplate) { + b.BasicTestCaseTemplate = basicTestCaseTemplate + b.require(basicCustomFilesFieldBasicTestCaseTemplate) +} + +func (b *BasicCustomFiles) UnmarshalJSON(data []byte) error { + type unmarshaler BasicCustomFiles + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *b = BasicCustomFiles(value) + extraProperties, err := internal.ExtractExtraProperties(data, *b) + if err != nil { + return err + } + b.extraProperties = extraProperties + b.rawJSON = json.RawMessage(data) + return nil +} + +func (b *BasicCustomFiles) MarshalJSON() ([]byte, error) { + type embed BasicCustomFiles + var marshaler = struct { + embed + }{ + embed: embed(*b), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, b.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (b *BasicCustomFiles) String() string { + if b == nil { + return "" + } + if len(b.rawJSON) > 0 { + if value, err := internal.StringifyJSON(b.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(b); err == nil { + return value + } + return fmt.Sprintf("%#v", b) +} + +var ( + basicTestCaseTemplateFieldTemplateID = big.NewInt(1 << 0) + basicTestCaseTemplateFieldName = big.NewInt(1 << 1) + basicTestCaseTemplateFieldDescription = big.NewInt(1 << 2) + basicTestCaseTemplateFieldExpectedValueParameterID = big.NewInt(1 << 3) +) + +type BasicTestCaseTemplate struct { + TemplateID TestCaseTemplateID `json:"templateId" url:"templateId"` + Name string `json:"name" url:"name"` + Description *TestCaseImplementationDescription `json:"description" url:"description"` + ExpectedValueParameterID ParameterID `json:"expectedValueParameterId" url:"expectedValueParameterId"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (b *BasicTestCaseTemplate) GetTemplateID() TestCaseTemplateID { + if b == nil { + return "" + } + return b.TemplateID +} + +func (b *BasicTestCaseTemplate) GetName() string { + if b == nil { + return "" + } + return b.Name +} + +func (b *BasicTestCaseTemplate) GetDescription() *TestCaseImplementationDescription { + if b == nil { + return nil + } + return b.Description +} + +func (b *BasicTestCaseTemplate) GetExpectedValueParameterID() ParameterID { + if b == nil { + return "" + } + return b.ExpectedValueParameterID +} + +func (b *BasicTestCaseTemplate) GetExtraProperties() map[string]interface{} { + if b == nil { + return nil + } + return b.extraProperties +} + +func (b *BasicTestCaseTemplate) require(field *big.Int) { + if b.explicitFields == nil { + b.explicitFields = big.NewInt(0) + } + b.explicitFields.Or(b.explicitFields, field) +} + +// SetTemplateID sets the TemplateID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BasicTestCaseTemplate) SetTemplateID(templateID TestCaseTemplateID) { + b.TemplateID = templateID + b.require(basicTestCaseTemplateFieldTemplateID) +} + +// SetName sets the Name field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BasicTestCaseTemplate) SetName(name string) { + b.Name = name + b.require(basicTestCaseTemplateFieldName) +} + +// SetDescription sets the Description field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BasicTestCaseTemplate) SetDescription(description *TestCaseImplementationDescription) { + b.Description = description + b.require(basicTestCaseTemplateFieldDescription) +} + +// SetExpectedValueParameterID sets the ExpectedValueParameterID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BasicTestCaseTemplate) SetExpectedValueParameterID(expectedValueParameterID ParameterID) { + b.ExpectedValueParameterID = expectedValueParameterID + b.require(basicTestCaseTemplateFieldExpectedValueParameterID) +} + +func (b *BasicTestCaseTemplate) UnmarshalJSON(data []byte) error { + type unmarshaler BasicTestCaseTemplate + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *b = BasicTestCaseTemplate(value) + extraProperties, err := internal.ExtractExtraProperties(data, *b) + if err != nil { + return err + } + b.extraProperties = extraProperties + b.rawJSON = json.RawMessage(data) + return nil +} + +func (b *BasicTestCaseTemplate) MarshalJSON() ([]byte, error) { + type embed BasicTestCaseTemplate + var marshaler = struct { + embed + }{ + embed: embed(*b), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, b.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (b *BasicTestCaseTemplate) String() string { + if b == nil { + return "" + } + if len(b.rawJSON) > 0 { + if value, err := internal.StringifyJSON(b.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(b); err == nil { + return value + } + return fmt.Sprintf("%#v", b) +} + +type CustomFiles struct { + Type string + Basic *BasicCustomFiles + Custom map[common.Language]*Files + + rawJSON json.RawMessage +} + +func (c *CustomFiles) GetType() string { + if c == nil { + return "" + } + return c.Type +} + +func (c *CustomFiles) GetBasic() *BasicCustomFiles { + if c == nil { + return nil + } + return c.Basic +} + +func (c *CustomFiles) GetCustom() map[common.Language]*Files { + if c == nil { + return nil + } + return c.Custom +} + +func (c *CustomFiles) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + c.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", c) + } + switch unmarshaler.Type { + case "basic": + value := new(BasicCustomFiles) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.Basic = value + case "custom": + var valueUnmarshaler struct { + Custom map[common.Language]*Files `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + c.Custom = valueUnmarshaler.Custom + } + c.rawJSON = json.RawMessage(data) + return nil +} + +func (c CustomFiles) MarshalJSON() ([]byte, error) { + if err := c.validate(); err != nil { + return nil, err + } + if c.Basic != nil { + return internal.MarshalJSONWithExtraProperty(c.Basic, "type", "basic") + } + if c.Custom != nil { + var marshaler = struct { + Type string `json:"type"` + Custom map[common.Language]*Files `json:"value"` + }{ + Type: "custom", + Custom: c.Custom, + } + return json.Marshal(marshaler) + } + if len(c.rawJSON) > 0 { + return c.rawJSON, nil + } + return nil, fmt.Errorf("type %T does not define a non-empty union type", c) +} + +type CustomFilesVisitor interface { + VisitBasic(*BasicCustomFiles) error + VisitCustom(map[common.Language]*Files) error +} + +func (c *CustomFiles) Accept(visitor CustomFilesVisitor) error { + if c.Basic != nil { + return visitor.VisitBasic(c.Basic) + } + if c.Custom != nil { + return visitor.VisitCustom(c.Custom) + } + return fmt.Errorf("type %T does not define a non-empty union type", c) +} + +func (c *CustomFiles) validate() error { + if c == nil { + return fmt.Errorf("type %T is nil", c) + } + var fields []string + if c.Basic != nil { + fields = append(fields, "basic") + } + if c.Custom != nil { + fields = append(fields, "custom") + } + if len(fields) == 0 { + if c.Type != "" { + if len(c.rawJSON) > 0 { + return nil + } + return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", c, c.Type) + } + return fmt.Errorf("type %T is empty", c) + } + if len(fields) > 1 { + return fmt.Errorf("type %T defines values for %s, but only one value is allowed", c, fields) + } + if c.Type != "" { + field := fields[0] + if c.Type != field { + return fmt.Errorf( + "type %T defines a discriminant set to %q, but it does not match the %T field; either remove or update the discriminant to match", + c, + c.Type, + c, + ) + } + } + return nil +} + +var ( + deepEqualityCorrectnessCheckFieldExpectedValueParameterID = big.NewInt(1 << 0) +) + +type DeepEqualityCorrectnessCheck struct { + ExpectedValueParameterID ParameterID `json:"expectedValueParameterId" url:"expectedValueParameterId"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (d *DeepEqualityCorrectnessCheck) GetExpectedValueParameterID() ParameterID { + if d == nil { + return "" + } + return d.ExpectedValueParameterID +} + +func (d *DeepEqualityCorrectnessCheck) GetExtraProperties() map[string]interface{} { + if d == nil { + return nil + } + return d.extraProperties +} + +func (d *DeepEqualityCorrectnessCheck) require(field *big.Int) { + if d.explicitFields == nil { + d.explicitFields = big.NewInt(0) + } + d.explicitFields.Or(d.explicitFields, field) +} + +// SetExpectedValueParameterID sets the ExpectedValueParameterID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (d *DeepEqualityCorrectnessCheck) SetExpectedValueParameterID(expectedValueParameterID ParameterID) { + d.ExpectedValueParameterID = expectedValueParameterID + d.require(deepEqualityCorrectnessCheckFieldExpectedValueParameterID) +} + +func (d *DeepEqualityCorrectnessCheck) UnmarshalJSON(data []byte) error { + type unmarshaler DeepEqualityCorrectnessCheck + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeepEqualityCorrectnessCheck(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeepEqualityCorrectnessCheck) MarshalJSON() ([]byte, error) { + type embed DeepEqualityCorrectnessCheck + var marshaler = struct { + embed + }{ + embed: embed(*d), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, d.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (d *DeepEqualityCorrectnessCheck) String() string { + if d == nil { + return "" + } + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +var ( + fileInfoV2FieldFilename = big.NewInt(1 << 0) + fileInfoV2FieldDirectory = big.NewInt(1 << 1) + fileInfoV2FieldContents = big.NewInt(1 << 2) + fileInfoV2FieldEditable = big.NewInt(1 << 3) +) + +type FileInfoV2 struct { + Filename string `json:"filename" url:"filename"` + Directory string `json:"directory" url:"directory"` + Contents string `json:"contents" url:"contents"` + Editable bool `json:"editable" url:"editable"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (f *FileInfoV2) GetFilename() string { + if f == nil { + return "" + } + return f.Filename +} + +func (f *FileInfoV2) GetDirectory() string { + if f == nil { + return "" + } + return f.Directory +} + +func (f *FileInfoV2) GetContents() string { + if f == nil { + return "" + } + return f.Contents +} + +func (f *FileInfoV2) GetEditable() bool { + if f == nil { + return false + } + return f.Editable +} + +func (f *FileInfoV2) GetExtraProperties() map[string]interface{} { + if f == nil { + return nil + } + return f.extraProperties +} + +func (f *FileInfoV2) require(field *big.Int) { + if f.explicitFields == nil { + f.explicitFields = big.NewInt(0) + } + f.explicitFields.Or(f.explicitFields, field) +} + +// SetFilename sets the Filename field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (f *FileInfoV2) SetFilename(filename string) { + f.Filename = filename + f.require(fileInfoV2FieldFilename) +} + +// SetDirectory sets the Directory field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (f *FileInfoV2) SetDirectory(directory string) { + f.Directory = directory + f.require(fileInfoV2FieldDirectory) +} + +// SetContents sets the Contents field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (f *FileInfoV2) SetContents(contents string) { + f.Contents = contents + f.require(fileInfoV2FieldContents) +} + +// SetEditable sets the Editable field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (f *FileInfoV2) SetEditable(editable bool) { + f.Editable = editable + f.require(fileInfoV2FieldEditable) +} + +func (f *FileInfoV2) UnmarshalJSON(data []byte) error { + type unmarshaler FileInfoV2 + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *f = FileInfoV2(value) + extraProperties, err := internal.ExtractExtraProperties(data, *f) + if err != nil { + return err + } + f.extraProperties = extraProperties + f.rawJSON = json.RawMessage(data) + return nil +} + +func (f *FileInfoV2) MarshalJSON() ([]byte, error) { + type embed FileInfoV2 + var marshaler = struct { + embed + }{ + embed: embed(*f), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, f.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (f *FileInfoV2) String() string { + if f == nil { + return "" + } + if len(f.rawJSON) > 0 { + if value, err := internal.StringifyJSON(f.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(f); err == nil { + return value + } + return fmt.Sprintf("%#v", f) +} + +var ( + filesFieldFiles = big.NewInt(1 << 0) +) + +type Files struct { + Files []*FileInfoV2 `json:"files" url:"files"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (f *Files) GetFiles() []*FileInfoV2 { + if f == nil { + return nil + } + return f.Files +} + +func (f *Files) GetExtraProperties() map[string]interface{} { + if f == nil { + return nil + } + return f.extraProperties +} + +func (f *Files) require(field *big.Int) { + if f.explicitFields == nil { + f.explicitFields = big.NewInt(0) + } + f.explicitFields.Or(f.explicitFields, field) +} + +// SetFiles sets the Files field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (f *Files) SetFiles(files []*FileInfoV2) { + f.Files = files + f.require(filesFieldFiles) +} + +func (f *Files) UnmarshalJSON(data []byte) error { + type unmarshaler Files + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *f = Files(value) + extraProperties, err := internal.ExtractExtraProperties(data, *f) + if err != nil { + return err + } + f.extraProperties = extraProperties + f.rawJSON = json.RawMessage(data) + return nil +} + +func (f *Files) MarshalJSON() ([]byte, error) { + type embed Files + var marshaler = struct { + embed + }{ + embed: embed(*f), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, f.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (f *Files) String() string { + if f == nil { + return "" + } + if len(f.rawJSON) > 0 { + if value, err := internal.StringifyJSON(f.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(f); err == nil { + return value + } + return fmt.Sprintf("%#v", f) +} + +var ( + functionImplementationFieldImpl = big.NewInt(1 << 0) + functionImplementationFieldImports = big.NewInt(1 << 1) +) + +type FunctionImplementation struct { + Impl string `json:"impl" url:"impl"` + Imports *string `json:"imports,omitempty" url:"imports,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (f *FunctionImplementation) GetImpl() string { + if f == nil { + return "" + } + return f.Impl +} + +func (f *FunctionImplementation) GetImports() *string { + if f == nil { + return nil + } + return f.Imports +} + +func (f *FunctionImplementation) GetExtraProperties() map[string]interface{} { + if f == nil { + return nil + } + return f.extraProperties +} + +func (f *FunctionImplementation) require(field *big.Int) { + if f.explicitFields == nil { + f.explicitFields = big.NewInt(0) + } + f.explicitFields.Or(f.explicitFields, field) +} + +// SetImpl sets the Impl field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (f *FunctionImplementation) SetImpl(impl string) { + f.Impl = impl + f.require(functionImplementationFieldImpl) +} + +// SetImports sets the Imports field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (f *FunctionImplementation) SetImports(imports *string) { + f.Imports = imports + f.require(functionImplementationFieldImports) +} + +func (f *FunctionImplementation) UnmarshalJSON(data []byte) error { + type unmarshaler FunctionImplementation + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *f = FunctionImplementation(value) + extraProperties, err := internal.ExtractExtraProperties(data, *f) + if err != nil { + return err + } + f.extraProperties = extraProperties + f.rawJSON = json.RawMessage(data) + return nil +} + +func (f *FunctionImplementation) MarshalJSON() ([]byte, error) { + type embed FunctionImplementation + var marshaler = struct { + embed + }{ + embed: embed(*f), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, f.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (f *FunctionImplementation) String() string { + if f == nil { + return "" + } + if len(f.rawJSON) > 0 { + if value, err := internal.StringifyJSON(f.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(f); err == nil { + return value + } + return fmt.Sprintf("%#v", f) +} + +var ( + functionImplementationForMultipleLanguagesFieldCodeByLanguage = big.NewInt(1 << 0) +) + +type FunctionImplementationForMultipleLanguages struct { + CodeByLanguage map[common.Language]*FunctionImplementation `json:"codeByLanguage" url:"codeByLanguage"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (f *FunctionImplementationForMultipleLanguages) GetCodeByLanguage() map[common.Language]*FunctionImplementation { + if f == nil { + return nil + } + return f.CodeByLanguage +} + +func (f *FunctionImplementationForMultipleLanguages) GetExtraProperties() map[string]interface{} { + if f == nil { + return nil + } + return f.extraProperties +} + +func (f *FunctionImplementationForMultipleLanguages) require(field *big.Int) { + if f.explicitFields == nil { + f.explicitFields = big.NewInt(0) + } + f.explicitFields.Or(f.explicitFields, field) +} + +// SetCodeByLanguage sets the CodeByLanguage field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (f *FunctionImplementationForMultipleLanguages) SetCodeByLanguage(codeByLanguage map[common.Language]*FunctionImplementation) { + f.CodeByLanguage = codeByLanguage + f.require(functionImplementationForMultipleLanguagesFieldCodeByLanguage) +} + +func (f *FunctionImplementationForMultipleLanguages) UnmarshalJSON(data []byte) error { + type unmarshaler FunctionImplementationForMultipleLanguages + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *f = FunctionImplementationForMultipleLanguages(value) + extraProperties, err := internal.ExtractExtraProperties(data, *f) + if err != nil { + return err + } + f.extraProperties = extraProperties + f.rawJSON = json.RawMessage(data) + return nil +} + +func (f *FunctionImplementationForMultipleLanguages) MarshalJSON() ([]byte, error) { + type embed FunctionImplementationForMultipleLanguages + var marshaler = struct { + embed + }{ + embed: embed(*f), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, f.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (f *FunctionImplementationForMultipleLanguages) String() string { + if f == nil { + return "" + } + if len(f.rawJSON) > 0 { + if value, err := internal.StringifyJSON(f.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(f); err == nil { + return value + } + return fmt.Sprintf("%#v", f) +} + +var ( + generatedFilesFieldGeneratedTestCaseFiles = big.NewInt(1 << 0) + generatedFilesFieldGeneratedTemplateFiles = big.NewInt(1 << 1) + generatedFilesFieldOther = big.NewInt(1 << 2) +) + +type GeneratedFiles struct { + GeneratedTestCaseFiles map[common.Language]*Files `json:"generatedTestCaseFiles" url:"generatedTestCaseFiles"` + GeneratedTemplateFiles map[common.Language]*Files `json:"generatedTemplateFiles" url:"generatedTemplateFiles"` + Other map[common.Language]*Files `json:"other" url:"other"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (g *GeneratedFiles) GetGeneratedTestCaseFiles() map[common.Language]*Files { + if g == nil { + return nil + } + return g.GeneratedTestCaseFiles +} + +func (g *GeneratedFiles) GetGeneratedTemplateFiles() map[common.Language]*Files { + if g == nil { + return nil + } + return g.GeneratedTemplateFiles +} + +func (g *GeneratedFiles) GetOther() map[common.Language]*Files { + if g == nil { + return nil + } + return g.Other +} + +func (g *GeneratedFiles) GetExtraProperties() map[string]interface{} { + if g == nil { + return nil + } + return g.extraProperties +} + +func (g *GeneratedFiles) require(field *big.Int) { + if g.explicitFields == nil { + g.explicitFields = big.NewInt(0) + } + g.explicitFields.Or(g.explicitFields, field) +} + +// SetGeneratedTestCaseFiles sets the GeneratedTestCaseFiles field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GeneratedFiles) SetGeneratedTestCaseFiles(generatedTestCaseFiles map[common.Language]*Files) { + g.GeneratedTestCaseFiles = generatedTestCaseFiles + g.require(generatedFilesFieldGeneratedTestCaseFiles) +} + +// SetGeneratedTemplateFiles sets the GeneratedTemplateFiles field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GeneratedFiles) SetGeneratedTemplateFiles(generatedTemplateFiles map[common.Language]*Files) { + g.GeneratedTemplateFiles = generatedTemplateFiles + g.require(generatedFilesFieldGeneratedTemplateFiles) +} + +// SetOther sets the Other field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GeneratedFiles) SetOther(other map[common.Language]*Files) { + g.Other = other + g.require(generatedFilesFieldOther) +} + +func (g *GeneratedFiles) UnmarshalJSON(data []byte) error { + type unmarshaler GeneratedFiles + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GeneratedFiles(value) + extraProperties, err := internal.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + g.rawJSON = json.RawMessage(data) + return nil +} + +func (g *GeneratedFiles) MarshalJSON() ([]byte, error) { + type embed GeneratedFiles + var marshaler = struct { + embed + }{ + embed: embed(*g), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, g.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (g *GeneratedFiles) String() string { + if g == nil { + return "" + } + if len(g.rawJSON) > 0 { + if value, err := internal.StringifyJSON(g.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +var ( + nonVoidFunctionDefinitionFieldSignature = big.NewInt(1 << 0) + nonVoidFunctionDefinitionFieldCode = big.NewInt(1 << 1) +) + +type NonVoidFunctionDefinition struct { + Signature *NonVoidFunctionSignature `json:"signature" url:"signature"` + Code *FunctionImplementationForMultipleLanguages `json:"code" url:"code"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (n *NonVoidFunctionDefinition) GetSignature() *NonVoidFunctionSignature { + if n == nil { + return nil + } + return n.Signature +} + +func (n *NonVoidFunctionDefinition) GetCode() *FunctionImplementationForMultipleLanguages { + if n == nil { + return nil + } + return n.Code +} + +func (n *NonVoidFunctionDefinition) GetExtraProperties() map[string]interface{} { + if n == nil { + return nil + } + return n.extraProperties +} + +func (n *NonVoidFunctionDefinition) require(field *big.Int) { + if n.explicitFields == nil { + n.explicitFields = big.NewInt(0) + } + n.explicitFields.Or(n.explicitFields, field) +} + +// SetSignature sets the Signature field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (n *NonVoidFunctionDefinition) SetSignature(signature *NonVoidFunctionSignature) { + n.Signature = signature + n.require(nonVoidFunctionDefinitionFieldSignature) +} + +// SetCode sets the Code field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (n *NonVoidFunctionDefinition) SetCode(code *FunctionImplementationForMultipleLanguages) { + n.Code = code + n.require(nonVoidFunctionDefinitionFieldCode) +} + +func (n *NonVoidFunctionDefinition) UnmarshalJSON(data []byte) error { + type unmarshaler NonVoidFunctionDefinition + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *n = NonVoidFunctionDefinition(value) + extraProperties, err := internal.ExtractExtraProperties(data, *n) + if err != nil { + return err + } + n.extraProperties = extraProperties + n.rawJSON = json.RawMessage(data) + return nil +} + +func (n *NonVoidFunctionDefinition) MarshalJSON() ([]byte, error) { + type embed NonVoidFunctionDefinition + var marshaler = struct { + embed + }{ + embed: embed(*n), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, n.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (n *NonVoidFunctionDefinition) String() string { + if n == nil { + return "" + } + if len(n.rawJSON) > 0 { + if value, err := internal.StringifyJSON(n.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(n); err == nil { + return value + } + return fmt.Sprintf("%#v", n) +} + +var ( + nonVoidFunctionSignatureFieldParameters = big.NewInt(1 << 0) + nonVoidFunctionSignatureFieldReturnType = big.NewInt(1 << 1) +) + +type NonVoidFunctionSignature struct { + Parameters []*Parameter `json:"parameters" url:"parameters"` + ReturnType *common.VariableType `json:"returnType" url:"returnType"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (n *NonVoidFunctionSignature) GetParameters() []*Parameter { + if n == nil { + return nil + } + return n.Parameters +} + +func (n *NonVoidFunctionSignature) GetReturnType() *common.VariableType { + if n == nil { + return nil + } + return n.ReturnType +} + +func (n *NonVoidFunctionSignature) GetExtraProperties() map[string]interface{} { + if n == nil { + return nil + } + return n.extraProperties +} + +func (n *NonVoidFunctionSignature) require(field *big.Int) { + if n.explicitFields == nil { + n.explicitFields = big.NewInt(0) + } + n.explicitFields.Or(n.explicitFields, field) +} + +// SetParameters sets the Parameters field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (n *NonVoidFunctionSignature) SetParameters(parameters []*Parameter) { + n.Parameters = parameters + n.require(nonVoidFunctionSignatureFieldParameters) +} + +// SetReturnType sets the ReturnType field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (n *NonVoidFunctionSignature) SetReturnType(returnType *common.VariableType) { + n.ReturnType = returnType + n.require(nonVoidFunctionSignatureFieldReturnType) +} + +func (n *NonVoidFunctionSignature) UnmarshalJSON(data []byte) error { + type unmarshaler NonVoidFunctionSignature + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *n = NonVoidFunctionSignature(value) + extraProperties, err := internal.ExtractExtraProperties(data, *n) + if err != nil { + return err + } + n.extraProperties = extraProperties + n.rawJSON = json.RawMessage(data) + return nil +} + +func (n *NonVoidFunctionSignature) MarshalJSON() ([]byte, error) { + type embed NonVoidFunctionSignature + var marshaler = struct { + embed + }{ + embed: embed(*n), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, n.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (n *NonVoidFunctionSignature) String() string { + if n == nil { + return "" + } + if len(n.rawJSON) > 0 { + if value, err := internal.StringifyJSON(n.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(n); err == nil { + return value + } + return fmt.Sprintf("%#v", n) +} + +var ( + parameterFieldParameterID = big.NewInt(1 << 0) + parameterFieldName = big.NewInt(1 << 1) + parameterFieldVariableType = big.NewInt(1 << 2) +) + +type Parameter struct { + ParameterID ParameterID `json:"parameterId" url:"parameterId"` + Name string `json:"name" url:"name"` + VariableType *common.VariableType `json:"variableType" url:"variableType"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (p *Parameter) GetParameterID() ParameterID { + if p == nil { + return "" + } + return p.ParameterID +} + +func (p *Parameter) GetName() string { + if p == nil { + return "" + } + return p.Name +} + +func (p *Parameter) GetVariableType() *common.VariableType { + if p == nil { + return nil + } + return p.VariableType +} + +func (p *Parameter) GetExtraProperties() map[string]interface{} { + if p == nil { + return nil + } + return p.extraProperties +} + +func (p *Parameter) require(field *big.Int) { + if p.explicitFields == nil { + p.explicitFields = big.NewInt(0) + } + p.explicitFields.Or(p.explicitFields, field) +} + +// SetParameterID sets the ParameterID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *Parameter) SetParameterID(parameterID ParameterID) { + p.ParameterID = parameterID + p.require(parameterFieldParameterID) +} + +// SetName sets the Name field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *Parameter) SetName(name string) { + p.Name = name + p.require(parameterFieldName) +} + +// SetVariableType sets the VariableType field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *Parameter) SetVariableType(variableType *common.VariableType) { + p.VariableType = variableType + p.require(parameterFieldVariableType) +} + +func (p *Parameter) UnmarshalJSON(data []byte) error { + type unmarshaler Parameter + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *p = Parameter(value) + extraProperties, err := internal.ExtractExtraProperties(data, *p) + if err != nil { + return err + } + p.extraProperties = extraProperties + p.rawJSON = json.RawMessage(data) + return nil +} + +func (p *Parameter) MarshalJSON() ([]byte, error) { + type embed Parameter + var marshaler = struct { + embed + }{ + embed: embed(*p), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, p.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (p *Parameter) String() string { + if p == nil { + return "" + } + if len(p.rawJSON) > 0 { + if value, err := internal.StringifyJSON(p.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(p); err == nil { + return value + } + return fmt.Sprintf("%#v", p) +} + +type ParameterID = string + +var ( + problemInfoV2FieldProblemID = big.NewInt(1 << 0) + problemInfoV2FieldProblemDescription = big.NewInt(1 << 1) + problemInfoV2FieldProblemName = big.NewInt(1 << 2) + problemInfoV2FieldProblemVersion = big.NewInt(1 << 3) + problemInfoV2FieldSupportedLanguages = big.NewInt(1 << 4) + problemInfoV2FieldCustomFiles = big.NewInt(1 << 5) + problemInfoV2FieldGeneratedFiles = big.NewInt(1 << 6) + problemInfoV2FieldCustomTestCaseTemplates = big.NewInt(1 << 7) + problemInfoV2FieldTestcases = big.NewInt(1 << 8) + problemInfoV2FieldIsPublic = big.NewInt(1 << 9) +) + +type ProblemInfoV2 struct { + ProblemID common.ProblemID `json:"problemId" url:"problemId"` + ProblemDescription *common.ProblemDescription `json:"problemDescription" url:"problemDescription"` + ProblemName string `json:"problemName" url:"problemName"` + ProblemVersion int `json:"problemVersion" url:"problemVersion"` + SupportedLanguages []common.Language `json:"supportedLanguages" url:"supportedLanguages"` + CustomFiles *CustomFiles `json:"customFiles" url:"customFiles"` + GeneratedFiles *GeneratedFiles `json:"generatedFiles" url:"generatedFiles"` + CustomTestCaseTemplates []*TestCaseTemplate `json:"customTestCaseTemplates" url:"customTestCaseTemplates"` + Testcases []*TestCaseV2 `json:"testcases" url:"testcases"` + IsPublic bool `json:"isPublic" url:"isPublic"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (p *ProblemInfoV2) GetProblemID() common.ProblemID { + if p == nil { + return "" + } + return p.ProblemID +} + +func (p *ProblemInfoV2) GetProblemDescription() *common.ProblemDescription { + if p == nil { + return nil + } + return p.ProblemDescription +} + +func (p *ProblemInfoV2) GetProblemName() string { + if p == nil { + return "" + } + return p.ProblemName +} + +func (p *ProblemInfoV2) GetProblemVersion() int { + if p == nil { + return 0 + } + return p.ProblemVersion +} + +func (p *ProblemInfoV2) GetSupportedLanguages() []common.Language { + if p == nil { + return nil + } + return p.SupportedLanguages +} + +func (p *ProblemInfoV2) GetCustomFiles() *CustomFiles { + if p == nil { + return nil + } + return p.CustomFiles +} + +func (p *ProblemInfoV2) GetGeneratedFiles() *GeneratedFiles { + if p == nil { + return nil + } + return p.GeneratedFiles +} + +func (p *ProblemInfoV2) GetCustomTestCaseTemplates() []*TestCaseTemplate { + if p == nil { + return nil + } + return p.CustomTestCaseTemplates +} + +func (p *ProblemInfoV2) GetTestcases() []*TestCaseV2 { + if p == nil { + return nil + } + return p.Testcases +} + +func (p *ProblemInfoV2) GetIsPublic() bool { + if p == nil { + return false + } + return p.IsPublic +} + +func (p *ProblemInfoV2) GetExtraProperties() map[string]interface{} { + if p == nil { + return nil + } + return p.extraProperties +} + +func (p *ProblemInfoV2) require(field *big.Int) { + if p.explicitFields == nil { + p.explicitFields = big.NewInt(0) + } + p.explicitFields.Or(p.explicitFields, field) +} + +// SetProblemID sets the ProblemID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ProblemInfoV2) SetProblemID(problemID common.ProblemID) { + p.ProblemID = problemID + p.require(problemInfoV2FieldProblemID) +} + +// SetProblemDescription sets the ProblemDescription field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ProblemInfoV2) SetProblemDescription(problemDescription *common.ProblemDescription) { + p.ProblemDescription = problemDescription + p.require(problemInfoV2FieldProblemDescription) +} + +// SetProblemName sets the ProblemName field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ProblemInfoV2) SetProblemName(problemName string) { + p.ProblemName = problemName + p.require(problemInfoV2FieldProblemName) +} + +// SetProblemVersion sets the ProblemVersion field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ProblemInfoV2) SetProblemVersion(problemVersion int) { + p.ProblemVersion = problemVersion + p.require(problemInfoV2FieldProblemVersion) +} + +// SetSupportedLanguages sets the SupportedLanguages field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ProblemInfoV2) SetSupportedLanguages(supportedLanguages []common.Language) { + p.SupportedLanguages = supportedLanguages + p.require(problemInfoV2FieldSupportedLanguages) +} + +// SetCustomFiles sets the CustomFiles field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ProblemInfoV2) SetCustomFiles(customFiles *CustomFiles) { + p.CustomFiles = customFiles + p.require(problemInfoV2FieldCustomFiles) +} + +// SetGeneratedFiles sets the GeneratedFiles field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ProblemInfoV2) SetGeneratedFiles(generatedFiles *GeneratedFiles) { + p.GeneratedFiles = generatedFiles + p.require(problemInfoV2FieldGeneratedFiles) +} + +// SetCustomTestCaseTemplates sets the CustomTestCaseTemplates field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ProblemInfoV2) SetCustomTestCaseTemplates(customTestCaseTemplates []*TestCaseTemplate) { + p.CustomTestCaseTemplates = customTestCaseTemplates + p.require(problemInfoV2FieldCustomTestCaseTemplates) +} + +// SetTestcases sets the Testcases field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ProblemInfoV2) SetTestcases(testcases []*TestCaseV2) { + p.Testcases = testcases + p.require(problemInfoV2FieldTestcases) +} + +// SetIsPublic sets the IsPublic field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ProblemInfoV2) SetIsPublic(isPublic bool) { + p.IsPublic = isPublic + p.require(problemInfoV2FieldIsPublic) +} + +func (p *ProblemInfoV2) UnmarshalJSON(data []byte) error { + type unmarshaler ProblemInfoV2 + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *p = ProblemInfoV2(value) + extraProperties, err := internal.ExtractExtraProperties(data, *p) + if err != nil { + return err + } + p.extraProperties = extraProperties + p.rawJSON = json.RawMessage(data) + return nil +} + +func (p *ProblemInfoV2) MarshalJSON() ([]byte, error) { + type embed ProblemInfoV2 + var marshaler = struct { + embed + }{ + embed: embed(*p), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, p.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (p *ProblemInfoV2) String() string { + if p == nil { + return "" + } + if len(p.rawJSON) > 0 { + if value, err := internal.StringifyJSON(p.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(p); err == nil { + return value + } + return fmt.Sprintf("%#v", p) +} + +var ( + testCaseExpectsFieldExpectedStdout = big.NewInt(1 << 0) +) + +type TestCaseExpects struct { + ExpectedStdout *string `json:"expectedStdout,omitempty" url:"expectedStdout,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TestCaseExpects) GetExpectedStdout() *string { + if t == nil { + return nil + } + return t.ExpectedStdout +} + +func (t *TestCaseExpects) GetExtraProperties() map[string]interface{} { + if t == nil { + return nil + } + return t.extraProperties +} + +func (t *TestCaseExpects) require(field *big.Int) { + if t.explicitFields == nil { + t.explicitFields = big.NewInt(0) + } + t.explicitFields.Or(t.explicitFields, field) +} + +// SetExpectedStdout sets the ExpectedStdout field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseExpects) SetExpectedStdout(expectedStdout *string) { + t.ExpectedStdout = expectedStdout + t.require(testCaseExpectsFieldExpectedStdout) +} + +func (t *TestCaseExpects) UnmarshalJSON(data []byte) error { + type unmarshaler TestCaseExpects + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TestCaseExpects(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TestCaseExpects) MarshalJSON() ([]byte, error) { + type embed TestCaseExpects + var marshaler = struct { + embed + }{ + embed: embed(*t), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, t.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (t *TestCaseExpects) String() string { + if t == nil { + return "" + } + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +type TestCaseFunction struct { + Type string + WithActualResult *TestCaseWithActualResultImplementation + Custom *VoidFunctionDefinition + + rawJSON json.RawMessage +} + +func (t *TestCaseFunction) GetType() string { + if t == nil { + return "" + } + return t.Type +} + +func (t *TestCaseFunction) GetWithActualResult() *TestCaseWithActualResultImplementation { + if t == nil { + return nil + } + return t.WithActualResult +} + +func (t *TestCaseFunction) GetCustom() *VoidFunctionDefinition { + if t == nil { + return nil + } + return t.Custom +} + +func (t *TestCaseFunction) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + t.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", t) + } + switch unmarshaler.Type { + case "withActualResult": + value := new(TestCaseWithActualResultImplementation) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + t.WithActualResult = value + case "custom": + value := new(VoidFunctionDefinition) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + t.Custom = value + } + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t TestCaseFunction) MarshalJSON() ([]byte, error) { + if err := t.validate(); err != nil { + return nil, err + } + if t.WithActualResult != nil { + return internal.MarshalJSONWithExtraProperty(t.WithActualResult, "type", "withActualResult") + } + if t.Custom != nil { + return internal.MarshalJSONWithExtraProperty(t.Custom, "type", "custom") + } + if len(t.rawJSON) > 0 { + return t.rawJSON, nil + } + return nil, fmt.Errorf("type %T does not define a non-empty union type", t) +} + +type TestCaseFunctionVisitor interface { + VisitWithActualResult(*TestCaseWithActualResultImplementation) error + VisitCustom(*VoidFunctionDefinition) error +} + +func (t *TestCaseFunction) Accept(visitor TestCaseFunctionVisitor) error { + if t.WithActualResult != nil { + return visitor.VisitWithActualResult(t.WithActualResult) + } + if t.Custom != nil { + return visitor.VisitCustom(t.Custom) + } + return fmt.Errorf("type %T does not define a non-empty union type", t) +} + +func (t *TestCaseFunction) validate() error { + if t == nil { + return fmt.Errorf("type %T is nil", t) + } + var fields []string + if t.WithActualResult != nil { + fields = append(fields, "withActualResult") + } + if t.Custom != nil { + fields = append(fields, "custom") + } + if len(fields) == 0 { + if t.Type != "" { + if len(t.rawJSON) > 0 { + return nil + } + return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", t, t.Type) + } + return fmt.Errorf("type %T is empty", t) + } + if len(fields) > 1 { + return fmt.Errorf("type %T defines values for %s, but only one value is allowed", t, fields) + } + if t.Type != "" { + field := fields[0] + if t.Type != field { + return fmt.Errorf( + "type %T defines a discriminant set to %q, but it does not match the %T field; either remove or update the discriminant to match", + t, + t.Type, + t, + ) + } + } + return nil +} + +type TestCaseID = string + +var ( + testCaseImplementationFieldDescription = big.NewInt(1 << 0) + testCaseImplementationFieldFunction = big.NewInt(1 << 1) +) + +type TestCaseImplementation struct { + Description *TestCaseImplementationDescription `json:"description" url:"description"` + Function *TestCaseFunction `json:"function" url:"function"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TestCaseImplementation) GetDescription() *TestCaseImplementationDescription { + if t == nil { + return nil + } + return t.Description +} + +func (t *TestCaseImplementation) GetFunction() *TestCaseFunction { + if t == nil { + return nil + } + return t.Function +} + +func (t *TestCaseImplementation) GetExtraProperties() map[string]interface{} { + if t == nil { + return nil + } + return t.extraProperties +} + +func (t *TestCaseImplementation) require(field *big.Int) { + if t.explicitFields == nil { + t.explicitFields = big.NewInt(0) + } + t.explicitFields.Or(t.explicitFields, field) +} + +// SetDescription sets the Description field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseImplementation) SetDescription(description *TestCaseImplementationDescription) { + t.Description = description + t.require(testCaseImplementationFieldDescription) +} + +// SetFunction sets the Function field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseImplementation) SetFunction(function *TestCaseFunction) { + t.Function = function + t.require(testCaseImplementationFieldFunction) +} + +func (t *TestCaseImplementation) UnmarshalJSON(data []byte) error { + type unmarshaler TestCaseImplementation + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TestCaseImplementation(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TestCaseImplementation) MarshalJSON() ([]byte, error) { + type embed TestCaseImplementation + var marshaler = struct { + embed + }{ + embed: embed(*t), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, t.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (t *TestCaseImplementation) String() string { + if t == nil { + return "" + } + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +var ( + testCaseImplementationDescriptionFieldBoards = big.NewInt(1 << 0) +) + +type TestCaseImplementationDescription struct { + Boards []*TestCaseImplementationDescriptionBoard `json:"boards" url:"boards"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TestCaseImplementationDescription) GetBoards() []*TestCaseImplementationDescriptionBoard { + if t == nil { + return nil + } + return t.Boards +} + +func (t *TestCaseImplementationDescription) GetExtraProperties() map[string]interface{} { + if t == nil { + return nil + } + return t.extraProperties +} + +func (t *TestCaseImplementationDescription) require(field *big.Int) { + if t.explicitFields == nil { + t.explicitFields = big.NewInt(0) + } + t.explicitFields.Or(t.explicitFields, field) +} + +// SetBoards sets the Boards field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseImplementationDescription) SetBoards(boards []*TestCaseImplementationDescriptionBoard) { + t.Boards = boards + t.require(testCaseImplementationDescriptionFieldBoards) +} + +func (t *TestCaseImplementationDescription) UnmarshalJSON(data []byte) error { + type unmarshaler TestCaseImplementationDescription + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TestCaseImplementationDescription(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TestCaseImplementationDescription) MarshalJSON() ([]byte, error) { + type embed TestCaseImplementationDescription + var marshaler = struct { + embed + }{ + embed: embed(*t), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, t.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (t *TestCaseImplementationDescription) String() string { + if t == nil { + return "" + } + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +type TestCaseImplementationDescriptionBoard struct { + Type string + HTML string + ParamID ParameterID + + rawJSON json.RawMessage +} + +func (t *TestCaseImplementationDescriptionBoard) GetType() string { + if t == nil { + return "" + } + return t.Type +} + +func (t *TestCaseImplementationDescriptionBoard) GetHTML() string { + if t == nil { + return "" + } + return t.HTML +} + +func (t *TestCaseImplementationDescriptionBoard) GetParamID() ParameterID { + if t == nil { + return "" + } + return t.ParamID +} + +func (t *TestCaseImplementationDescriptionBoard) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + t.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", t) + } + switch unmarshaler.Type { + case "html": + var valueUnmarshaler struct { + HTML string `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + t.HTML = valueUnmarshaler.HTML + case "paramId": + var valueUnmarshaler struct { + ParamID ParameterID `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + t.ParamID = valueUnmarshaler.ParamID + } + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t TestCaseImplementationDescriptionBoard) MarshalJSON() ([]byte, error) { + if err := t.validate(); err != nil { + return nil, err + } + if t.HTML != "" { + var marshaler = struct { + Type string `json:"type"` + HTML string `json:"value"` + }{ + Type: "html", + HTML: t.HTML, + } + return json.Marshal(marshaler) + } + if t.ParamID != "" { + var marshaler = struct { + Type string `json:"type"` + ParamID ParameterID `json:"value"` + }{ + Type: "paramId", + ParamID: t.ParamID, + } + return json.Marshal(marshaler) + } + if len(t.rawJSON) > 0 { + return t.rawJSON, nil + } + return nil, fmt.Errorf("type %T does not define a non-empty union type", t) +} + +type TestCaseImplementationDescriptionBoardVisitor interface { + VisitHTML(string) error + VisitParamID(ParameterID) error +} + +func (t *TestCaseImplementationDescriptionBoard) Accept(visitor TestCaseImplementationDescriptionBoardVisitor) error { + if t.HTML != "" { + return visitor.VisitHTML(t.HTML) + } + if t.ParamID != "" { + return visitor.VisitParamID(t.ParamID) + } + return fmt.Errorf("type %T does not define a non-empty union type", t) +} + +func (t *TestCaseImplementationDescriptionBoard) validate() error { + if t == nil { + return fmt.Errorf("type %T is nil", t) + } + var fields []string + if t.HTML != "" { + fields = append(fields, "html") + } + if t.ParamID != "" { + fields = append(fields, "paramId") + } + if len(fields) == 0 { + if t.Type != "" { + if len(t.rawJSON) > 0 { + return nil + } + return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", t, t.Type) + } + return fmt.Errorf("type %T is empty", t) + } + if len(fields) > 1 { + return fmt.Errorf("type %T defines values for %s, but only one value is allowed", t, fields) + } + if t.Type != "" { + field := fields[0] + if t.Type != field { + return fmt.Errorf( + "type %T defines a discriminant set to %q, but it does not match the %T field; either remove or update the discriminant to match", + t, + t.Type, + t, + ) + } + } + return nil +} + +type TestCaseImplementationReference struct { + Type string + TemplateID TestCaseTemplateID + Implementation *TestCaseImplementation + + rawJSON json.RawMessage +} + +func (t *TestCaseImplementationReference) GetType() string { + if t == nil { + return "" + } + return t.Type +} + +func (t *TestCaseImplementationReference) GetTemplateID() TestCaseTemplateID { + if t == nil { + return "" + } + return t.TemplateID +} + +func (t *TestCaseImplementationReference) GetImplementation() *TestCaseImplementation { + if t == nil { + return nil + } + return t.Implementation +} + +func (t *TestCaseImplementationReference) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + t.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", t) + } + switch unmarshaler.Type { + case "templateId": + var valueUnmarshaler struct { + TemplateID TestCaseTemplateID `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + t.TemplateID = valueUnmarshaler.TemplateID + case "implementation": + value := new(TestCaseImplementation) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + t.Implementation = value + } + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t TestCaseImplementationReference) MarshalJSON() ([]byte, error) { + if err := t.validate(); err != nil { + return nil, err + } + if t.TemplateID != "" { + var marshaler = struct { + Type string `json:"type"` + TemplateID TestCaseTemplateID `json:"value"` + }{ + Type: "templateId", + TemplateID: t.TemplateID, + } + return json.Marshal(marshaler) + } + if t.Implementation != nil { + return internal.MarshalJSONWithExtraProperty(t.Implementation, "type", "implementation") + } + if len(t.rawJSON) > 0 { + return t.rawJSON, nil + } + return nil, fmt.Errorf("type %T does not define a non-empty union type", t) +} + +type TestCaseImplementationReferenceVisitor interface { + VisitTemplateID(TestCaseTemplateID) error + VisitImplementation(*TestCaseImplementation) error +} + +func (t *TestCaseImplementationReference) Accept(visitor TestCaseImplementationReferenceVisitor) error { + if t.TemplateID != "" { + return visitor.VisitTemplateID(t.TemplateID) + } + if t.Implementation != nil { + return visitor.VisitImplementation(t.Implementation) + } + return fmt.Errorf("type %T does not define a non-empty union type", t) +} + +func (t *TestCaseImplementationReference) validate() error { + if t == nil { + return fmt.Errorf("type %T is nil", t) + } + var fields []string + if t.TemplateID != "" { + fields = append(fields, "templateId") + } + if t.Implementation != nil { + fields = append(fields, "implementation") + } + if len(fields) == 0 { + if t.Type != "" { + if len(t.rawJSON) > 0 { + return nil + } + return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", t, t.Type) + } + return fmt.Errorf("type %T is empty", t) + } + if len(fields) > 1 { + return fmt.Errorf("type %T defines values for %s, but only one value is allowed", t, fields) + } + if t.Type != "" { + field := fields[0] + if t.Type != field { + return fmt.Errorf( + "type %T defines a discriminant set to %q, but it does not match the %T field; either remove or update the discriminant to match", + t, + t.Type, + t, + ) + } + } + return nil +} + +var ( + testCaseMetadataFieldID = big.NewInt(1 << 0) + testCaseMetadataFieldName = big.NewInt(1 << 1) + testCaseMetadataFieldHidden = big.NewInt(1 << 2) +) + +type TestCaseMetadata struct { + ID TestCaseID `json:"id" url:"id"` + Name string `json:"name" url:"name"` + Hidden bool `json:"hidden" url:"hidden"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TestCaseMetadata) GetID() TestCaseID { + if t == nil { + return "" + } + return t.ID +} + +func (t *TestCaseMetadata) GetName() string { + if t == nil { + return "" + } + return t.Name +} + +func (t *TestCaseMetadata) GetHidden() bool { + if t == nil { + return false + } + return t.Hidden +} + +func (t *TestCaseMetadata) GetExtraProperties() map[string]interface{} { + if t == nil { + return nil + } + return t.extraProperties +} + +func (t *TestCaseMetadata) require(field *big.Int) { + if t.explicitFields == nil { + t.explicitFields = big.NewInt(0) + } + t.explicitFields.Or(t.explicitFields, field) +} + +// SetID sets the ID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseMetadata) SetID(id TestCaseID) { + t.ID = id + t.require(testCaseMetadataFieldID) +} + +// SetName sets the Name field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseMetadata) SetName(name string) { + t.Name = name + t.require(testCaseMetadataFieldName) +} + +// SetHidden sets the Hidden field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseMetadata) SetHidden(hidden bool) { + t.Hidden = hidden + t.require(testCaseMetadataFieldHidden) +} + +func (t *TestCaseMetadata) UnmarshalJSON(data []byte) error { + type unmarshaler TestCaseMetadata + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TestCaseMetadata(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TestCaseMetadata) MarshalJSON() ([]byte, error) { + type embed TestCaseMetadata + var marshaler = struct { + embed + }{ + embed: embed(*t), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, t.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (t *TestCaseMetadata) String() string { + if t == nil { + return "" + } + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +var ( + testCaseTemplateFieldTemplateID = big.NewInt(1 << 0) + testCaseTemplateFieldName = big.NewInt(1 << 1) + testCaseTemplateFieldImplementation = big.NewInt(1 << 2) +) + +type TestCaseTemplate struct { + TemplateID TestCaseTemplateID `json:"templateId" url:"templateId"` + Name string `json:"name" url:"name"` + Implementation *TestCaseImplementation `json:"implementation" url:"implementation"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TestCaseTemplate) GetTemplateID() TestCaseTemplateID { + if t == nil { + return "" + } + return t.TemplateID +} + +func (t *TestCaseTemplate) GetName() string { + if t == nil { + return "" + } + return t.Name +} + +func (t *TestCaseTemplate) GetImplementation() *TestCaseImplementation { + if t == nil { + return nil + } + return t.Implementation +} + +func (t *TestCaseTemplate) GetExtraProperties() map[string]interface{} { + if t == nil { + return nil + } + return t.extraProperties +} + +func (t *TestCaseTemplate) require(field *big.Int) { + if t.explicitFields == nil { + t.explicitFields = big.NewInt(0) + } + t.explicitFields.Or(t.explicitFields, field) +} + +// SetTemplateID sets the TemplateID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseTemplate) SetTemplateID(templateID TestCaseTemplateID) { + t.TemplateID = templateID + t.require(testCaseTemplateFieldTemplateID) +} + +// SetName sets the Name field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseTemplate) SetName(name string) { + t.Name = name + t.require(testCaseTemplateFieldName) +} + +// SetImplementation sets the Implementation field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseTemplate) SetImplementation(implementation *TestCaseImplementation) { + t.Implementation = implementation + t.require(testCaseTemplateFieldImplementation) +} + +func (t *TestCaseTemplate) UnmarshalJSON(data []byte) error { + type unmarshaler TestCaseTemplate + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TestCaseTemplate(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TestCaseTemplate) MarshalJSON() ([]byte, error) { + type embed TestCaseTemplate + var marshaler = struct { + embed + }{ + embed: embed(*t), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, t.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (t *TestCaseTemplate) String() string { + if t == nil { + return "" + } + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +type TestCaseTemplateID = string + +var ( + testCaseV2FieldMetadata = big.NewInt(1 << 0) + testCaseV2FieldImplementation = big.NewInt(1 << 1) + testCaseV2FieldArguments = big.NewInt(1 << 2) + testCaseV2FieldExpects = big.NewInt(1 << 3) +) + +type TestCaseV2 struct { + Metadata *TestCaseMetadata `json:"metadata" url:"metadata"` + Implementation *TestCaseImplementationReference `json:"implementation" url:"implementation"` + Arguments map[ParameterID]*common.VariableValue `json:"arguments" url:"arguments"` + Expects *TestCaseExpects `json:"expects,omitempty" url:"expects,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TestCaseV2) GetMetadata() *TestCaseMetadata { + if t == nil { + return nil + } + return t.Metadata +} + +func (t *TestCaseV2) GetImplementation() *TestCaseImplementationReference { + if t == nil { + return nil + } + return t.Implementation +} + +func (t *TestCaseV2) GetArguments() map[ParameterID]*common.VariableValue { + if t == nil { + return nil + } + return t.Arguments +} + +func (t *TestCaseV2) GetExpects() *TestCaseExpects { + if t == nil { + return nil + } + return t.Expects +} + +func (t *TestCaseV2) GetExtraProperties() map[string]interface{} { + if t == nil { + return nil + } + return t.extraProperties +} + +func (t *TestCaseV2) require(field *big.Int) { + if t.explicitFields == nil { + t.explicitFields = big.NewInt(0) + } + t.explicitFields.Or(t.explicitFields, field) +} + +// SetMetadata sets the Metadata field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseV2) SetMetadata(metadata *TestCaseMetadata) { + t.Metadata = metadata + t.require(testCaseV2FieldMetadata) +} + +// SetImplementation sets the Implementation field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseV2) SetImplementation(implementation *TestCaseImplementationReference) { + t.Implementation = implementation + t.require(testCaseV2FieldImplementation) +} + +// SetArguments sets the Arguments field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseV2) SetArguments(arguments map[ParameterID]*common.VariableValue) { + t.Arguments = arguments + t.require(testCaseV2FieldArguments) +} + +// SetExpects sets the Expects field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseV2) SetExpects(expects *TestCaseExpects) { + t.Expects = expects + t.require(testCaseV2FieldExpects) +} + +func (t *TestCaseV2) UnmarshalJSON(data []byte) error { + type unmarshaler TestCaseV2 + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TestCaseV2(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TestCaseV2) MarshalJSON() ([]byte, error) { + type embed TestCaseV2 + var marshaler = struct { + embed + }{ + embed: embed(*t), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, t.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (t *TestCaseV2) String() string { + if t == nil { + return "" + } + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +var ( + testCaseWithActualResultImplementationFieldGetActualResult = big.NewInt(1 << 0) + testCaseWithActualResultImplementationFieldAssertCorrectnessCheck = big.NewInt(1 << 1) +) + +type TestCaseWithActualResultImplementation struct { + GetActualResult *NonVoidFunctionDefinition `json:"getActualResult" url:"getActualResult"` + AssertCorrectnessCheck *AssertCorrectnessCheck `json:"assertCorrectnessCheck" url:"assertCorrectnessCheck"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TestCaseWithActualResultImplementation) GetGetActualResult() *NonVoidFunctionDefinition { + if t == nil { + return nil + } + return t.GetActualResult +} + +func (t *TestCaseWithActualResultImplementation) GetAssertCorrectnessCheck() *AssertCorrectnessCheck { + if t == nil { + return nil + } + return t.AssertCorrectnessCheck +} + +func (t *TestCaseWithActualResultImplementation) GetExtraProperties() map[string]interface{} { + if t == nil { + return nil + } + return t.extraProperties +} + +func (t *TestCaseWithActualResultImplementation) require(field *big.Int) { + if t.explicitFields == nil { + t.explicitFields = big.NewInt(0) + } + t.explicitFields.Or(t.explicitFields, field) +} + +// SetGetActualResult sets the GetActualResult field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseWithActualResultImplementation) SetGetActualResult(getActualResult *NonVoidFunctionDefinition) { + t.GetActualResult = getActualResult + t.require(testCaseWithActualResultImplementationFieldGetActualResult) +} + +// SetAssertCorrectnessCheck sets the AssertCorrectnessCheck field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseWithActualResultImplementation) SetAssertCorrectnessCheck(assertCorrectnessCheck *AssertCorrectnessCheck) { + t.AssertCorrectnessCheck = assertCorrectnessCheck + t.require(testCaseWithActualResultImplementationFieldAssertCorrectnessCheck) +} + +func (t *TestCaseWithActualResultImplementation) UnmarshalJSON(data []byte) error { + type unmarshaler TestCaseWithActualResultImplementation + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TestCaseWithActualResultImplementation(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TestCaseWithActualResultImplementation) MarshalJSON() ([]byte, error) { + type embed TestCaseWithActualResultImplementation + var marshaler = struct { + embed + }{ + embed: embed(*t), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, t.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (t *TestCaseWithActualResultImplementation) String() string { + if t == nil { + return "" + } + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +var ( + voidFunctionDefinitionFieldParameters = big.NewInt(1 << 0) + voidFunctionDefinitionFieldCode = big.NewInt(1 << 1) +) + +type VoidFunctionDefinition struct { + Parameters []*Parameter `json:"parameters" url:"parameters"` + Code *FunctionImplementationForMultipleLanguages `json:"code" url:"code"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (v *VoidFunctionDefinition) GetParameters() []*Parameter { + if v == nil { + return nil + } + return v.Parameters +} + +func (v *VoidFunctionDefinition) GetCode() *FunctionImplementationForMultipleLanguages { + if v == nil { + return nil + } + return v.Code +} + +func (v *VoidFunctionDefinition) GetExtraProperties() map[string]interface{} { + if v == nil { + return nil + } + return v.extraProperties +} + +func (v *VoidFunctionDefinition) require(field *big.Int) { + if v.explicitFields == nil { + v.explicitFields = big.NewInt(0) + } + v.explicitFields.Or(v.explicitFields, field) +} + +// SetParameters sets the Parameters field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (v *VoidFunctionDefinition) SetParameters(parameters []*Parameter) { + v.Parameters = parameters + v.require(voidFunctionDefinitionFieldParameters) +} + +// SetCode sets the Code field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (v *VoidFunctionDefinition) SetCode(code *FunctionImplementationForMultipleLanguages) { + v.Code = code + v.require(voidFunctionDefinitionFieldCode) +} + +func (v *VoidFunctionDefinition) UnmarshalJSON(data []byte) error { + type unmarshaler VoidFunctionDefinition + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *v = VoidFunctionDefinition(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err + } + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil +} + +func (v *VoidFunctionDefinition) MarshalJSON() ([]byte, error) { + type embed VoidFunctionDefinition + var marshaler = struct { + embed + }{ + embed: embed(*v), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, v.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (v *VoidFunctionDefinition) String() string { + if v == nil { + return "" + } + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(v); err == nil { + return value + } + return fmt.Sprintf("%#v", v) +} + +// The generated signature will include an additional param, actualResult +var ( + voidFunctionDefinitionThatTakesActualResultFieldAdditionalParameters = big.NewInt(1 << 0) + voidFunctionDefinitionThatTakesActualResultFieldCode = big.NewInt(1 << 1) +) + +type VoidFunctionDefinitionThatTakesActualResult struct { + AdditionalParameters []*Parameter `json:"additionalParameters" url:"additionalParameters"` + Code *FunctionImplementationForMultipleLanguages `json:"code" url:"code"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (v *VoidFunctionDefinitionThatTakesActualResult) GetAdditionalParameters() []*Parameter { + if v == nil { + return nil + } + return v.AdditionalParameters +} + +func (v *VoidFunctionDefinitionThatTakesActualResult) GetCode() *FunctionImplementationForMultipleLanguages { + if v == nil { + return nil + } + return v.Code +} + +func (v *VoidFunctionDefinitionThatTakesActualResult) GetExtraProperties() map[string]interface{} { + if v == nil { + return nil + } + return v.extraProperties +} + +func (v *VoidFunctionDefinitionThatTakesActualResult) require(field *big.Int) { + if v.explicitFields == nil { + v.explicitFields = big.NewInt(0) + } + v.explicitFields.Or(v.explicitFields, field) +} + +// SetAdditionalParameters sets the AdditionalParameters field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (v *VoidFunctionDefinitionThatTakesActualResult) SetAdditionalParameters(additionalParameters []*Parameter) { + v.AdditionalParameters = additionalParameters + v.require(voidFunctionDefinitionThatTakesActualResultFieldAdditionalParameters) +} + +// SetCode sets the Code field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (v *VoidFunctionDefinitionThatTakesActualResult) SetCode(code *FunctionImplementationForMultipleLanguages) { + v.Code = code + v.require(voidFunctionDefinitionThatTakesActualResultFieldCode) +} + +func (v *VoidFunctionDefinitionThatTakesActualResult) UnmarshalJSON(data []byte) error { + type unmarshaler VoidFunctionDefinitionThatTakesActualResult + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *v = VoidFunctionDefinitionThatTakesActualResult(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err + } + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil +} + +func (v *VoidFunctionDefinitionThatTakesActualResult) MarshalJSON() ([]byte, error) { + type embed VoidFunctionDefinitionThatTakesActualResult + var marshaler = struct { + embed + }{ + embed: embed(*v), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, v.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (v *VoidFunctionDefinitionThatTakesActualResult) String() string { + if v == nil { + return "" + } + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(v); err == nil { + return value + } + return fmt.Sprintf("%#v", v) +} diff --git a/seed/go-sdk/trace/common/v2/common_test.go b/seed/go-sdk/trace/common/v2/common_test.go new file mode 100644 index 000000000000..ac652d4cd673 --- /dev/null +++ b/seed/go-sdk/trace/common/v2/common_test.go @@ -0,0 +1,6036 @@ +// Code generated by Fern. DO NOT EDIT. + +package v2 + +import ( + json "encoding/json" + assert "github.com/stretchr/testify/assert" + require "github.com/stretchr/testify/require" + common "github.com/trace/fern/common" + testing "testing" +) + +func TestGettersAssertCorrectnessCheck(t *testing.T) { + t.Run("GetType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &AssertCorrectnessCheck{} + var expected string + obj.Type = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetType(), "getter should return the property value") + }) + + t.Run("GetType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *AssertCorrectnessCheck + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetType() // Should return zero value + }) + + t.Run("GetDeepEquality", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &AssertCorrectnessCheck{} + var expected *DeepEqualityCorrectnessCheck + obj.DeepEquality = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetDeepEquality(), "getter should return the property value") + }) + + t.Run("GetDeepEquality_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &AssertCorrectnessCheck{} + obj.DeepEquality = nil + + // Act & Assert + assert.Nil(t, obj.GetDeepEquality(), "getter should return nil when property is nil") + }) + + t.Run("GetDeepEquality_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *AssertCorrectnessCheck + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetDeepEquality() // Should return zero value + }) + + t.Run("GetCustom", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &AssertCorrectnessCheck{} + var expected *VoidFunctionDefinitionThatTakesActualResult + obj.Custom = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetCustom(), "getter should return the property value") + }) + + t.Run("GetCustom_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &AssertCorrectnessCheck{} + obj.Custom = nil + + // Act & Assert + assert.Nil(t, obj.GetCustom(), "getter should return nil when property is nil") + }) + + t.Run("GetCustom_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *AssertCorrectnessCheck + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetCustom() // Should return zero value + }) + +} + +func TestSettersBasicCustomFiles(t *testing.T) { + t.Run("SetMethodName", func(t *testing.T) { + obj := &BasicCustomFiles{} + var fernTestValueMethodName string + obj.SetMethodName(fernTestValueMethodName) + assert.Equal(t, fernTestValueMethodName, obj.MethodName) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetSignature", func(t *testing.T) { + obj := &BasicCustomFiles{} + var fernTestValueSignature *NonVoidFunctionSignature + obj.SetSignature(fernTestValueSignature) + assert.Equal(t, fernTestValueSignature, obj.Signature) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetAdditionalFiles", func(t *testing.T) { + obj := &BasicCustomFiles{} + var fernTestValueAdditionalFiles map[common.Language]*Files + obj.SetAdditionalFiles(fernTestValueAdditionalFiles) + assert.Equal(t, fernTestValueAdditionalFiles, obj.AdditionalFiles) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetBasicTestCaseTemplate", func(t *testing.T) { + obj := &BasicCustomFiles{} + var fernTestValueBasicTestCaseTemplate *BasicTestCaseTemplate + obj.SetBasicTestCaseTemplate(fernTestValueBasicTestCaseTemplate) + assert.Equal(t, fernTestValueBasicTestCaseTemplate, obj.BasicTestCaseTemplate) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersBasicCustomFiles(t *testing.T) { + t.Run("GetMethodName", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicCustomFiles{} + var expected string + obj.MethodName = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetMethodName(), "getter should return the property value") + }) + + t.Run("GetMethodName_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BasicCustomFiles + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetMethodName() // Should return zero value + }) + + t.Run("GetSignature", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicCustomFiles{} + var expected *NonVoidFunctionSignature + obj.Signature = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSignature(), "getter should return the property value") + }) + + t.Run("GetSignature_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicCustomFiles{} + obj.Signature = nil + + // Act & Assert + assert.Nil(t, obj.GetSignature(), "getter should return nil when property is nil") + }) + + t.Run("GetSignature_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BasicCustomFiles + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSignature() // Should return zero value + }) + + t.Run("GetAdditionalFiles", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicCustomFiles{} + var expected map[common.Language]*Files + obj.AdditionalFiles = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetAdditionalFiles(), "getter should return the property value") + }) + + t.Run("GetAdditionalFiles_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicCustomFiles{} + obj.AdditionalFiles = nil + + // Act & Assert + assert.Nil(t, obj.GetAdditionalFiles(), "getter should return nil when property is nil") + }) + + t.Run("GetAdditionalFiles_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BasicCustomFiles + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetAdditionalFiles() // Should return zero value + }) + + t.Run("GetBasicTestCaseTemplate", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicCustomFiles{} + var expected *BasicTestCaseTemplate + obj.BasicTestCaseTemplate = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetBasicTestCaseTemplate(), "getter should return the property value") + }) + + t.Run("GetBasicTestCaseTemplate_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicCustomFiles{} + obj.BasicTestCaseTemplate = nil + + // Act & Assert + assert.Nil(t, obj.GetBasicTestCaseTemplate(), "getter should return nil when property is nil") + }) + + t.Run("GetBasicTestCaseTemplate_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BasicCustomFiles + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetBasicTestCaseTemplate() // Should return zero value + }) + +} + +func TestSettersMarkExplicitBasicCustomFiles(t *testing.T) { + t.Run("SetMethodName_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicCustomFiles{} + var fernTestValueMethodName string + + // Act + obj.SetMethodName(fernTestValueMethodName) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetSignature_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicCustomFiles{} + var fernTestValueSignature *NonVoidFunctionSignature + + // Act + obj.SetSignature(fernTestValueSignature) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetAdditionalFiles_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicCustomFiles{} + var fernTestValueAdditionalFiles map[common.Language]*Files + + // Act + obj.SetAdditionalFiles(fernTestValueAdditionalFiles) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetBasicTestCaseTemplate_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicCustomFiles{} + var fernTestValueBasicTestCaseTemplate *BasicTestCaseTemplate + + // Act + obj.SetBasicTestCaseTemplate(fernTestValueBasicTestCaseTemplate) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersBasicTestCaseTemplate(t *testing.T) { + t.Run("SetTemplateID", func(t *testing.T) { + obj := &BasicTestCaseTemplate{} + var fernTestValueTemplateID TestCaseTemplateID + obj.SetTemplateID(fernTestValueTemplateID) + assert.Equal(t, fernTestValueTemplateID, obj.TemplateID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetName", func(t *testing.T) { + obj := &BasicTestCaseTemplate{} + var fernTestValueName string + obj.SetName(fernTestValueName) + assert.Equal(t, fernTestValueName, obj.Name) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetDescription", func(t *testing.T) { + obj := &BasicTestCaseTemplate{} + var fernTestValueDescription *TestCaseImplementationDescription + obj.SetDescription(fernTestValueDescription) + assert.Equal(t, fernTestValueDescription, obj.Description) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetExpectedValueParameterID", func(t *testing.T) { + obj := &BasicTestCaseTemplate{} + var fernTestValueExpectedValueParameterID ParameterID + obj.SetExpectedValueParameterID(fernTestValueExpectedValueParameterID) + assert.Equal(t, fernTestValueExpectedValueParameterID, obj.ExpectedValueParameterID) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersBasicTestCaseTemplate(t *testing.T) { + t.Run("GetTemplateID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicTestCaseTemplate{} + var expected TestCaseTemplateID + obj.TemplateID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTemplateID(), "getter should return the property value") + }) + + t.Run("GetTemplateID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BasicTestCaseTemplate + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTemplateID() // Should return zero value + }) + + t.Run("GetName", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicTestCaseTemplate{} + var expected string + obj.Name = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetName(), "getter should return the property value") + }) + + t.Run("GetName_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BasicTestCaseTemplate + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetName() // Should return zero value + }) + + t.Run("GetDescription", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicTestCaseTemplate{} + var expected *TestCaseImplementationDescription + obj.Description = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetDescription(), "getter should return the property value") + }) + + t.Run("GetDescription_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicTestCaseTemplate{} + obj.Description = nil + + // Act & Assert + assert.Nil(t, obj.GetDescription(), "getter should return nil when property is nil") + }) + + t.Run("GetDescription_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BasicTestCaseTemplate + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetDescription() // Should return zero value + }) + + t.Run("GetExpectedValueParameterID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicTestCaseTemplate{} + var expected ParameterID + obj.ExpectedValueParameterID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetExpectedValueParameterID(), "getter should return the property value") + }) + + t.Run("GetExpectedValueParameterID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BasicTestCaseTemplate + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetExpectedValueParameterID() // Should return zero value + }) + +} + +func TestSettersMarkExplicitBasicTestCaseTemplate(t *testing.T) { + t.Run("SetTemplateID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicTestCaseTemplate{} + var fernTestValueTemplateID TestCaseTemplateID + + // Act + obj.SetTemplateID(fernTestValueTemplateID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetName_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicTestCaseTemplate{} + var fernTestValueName string + + // Act + obj.SetName(fernTestValueName) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetDescription_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicTestCaseTemplate{} + var fernTestValueDescription *TestCaseImplementationDescription + + // Act + obj.SetDescription(fernTestValueDescription) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetExpectedValueParameterID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicTestCaseTemplate{} + var fernTestValueExpectedValueParameterID ParameterID + + // Act + obj.SetExpectedValueParameterID(fernTestValueExpectedValueParameterID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestGettersCustomFiles(t *testing.T) { + t.Run("GetType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CustomFiles{} + var expected string + obj.Type = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetType(), "getter should return the property value") + }) + + t.Run("GetType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CustomFiles + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetType() // Should return zero value + }) + + t.Run("GetBasic", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CustomFiles{} + var expected *BasicCustomFiles + obj.Basic = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetBasic(), "getter should return the property value") + }) + + t.Run("GetBasic_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CustomFiles{} + obj.Basic = nil + + // Act & Assert + assert.Nil(t, obj.GetBasic(), "getter should return nil when property is nil") + }) + + t.Run("GetBasic_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CustomFiles + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetBasic() // Should return zero value + }) + + t.Run("GetCustom", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CustomFiles{} + var expected map[common.Language]*Files + obj.Custom = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetCustom(), "getter should return the property value") + }) + + t.Run("GetCustom_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CustomFiles{} + obj.Custom = nil + + // Act & Assert + assert.Nil(t, obj.GetCustom(), "getter should return nil when property is nil") + }) + + t.Run("GetCustom_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CustomFiles + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetCustom() // Should return zero value + }) + +} + +func TestSettersDeepEqualityCorrectnessCheck(t *testing.T) { + t.Run("SetExpectedValueParameterID", func(t *testing.T) { + obj := &DeepEqualityCorrectnessCheck{} + var fernTestValueExpectedValueParameterID ParameterID + obj.SetExpectedValueParameterID(fernTestValueExpectedValueParameterID) + assert.Equal(t, fernTestValueExpectedValueParameterID, obj.ExpectedValueParameterID) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersDeepEqualityCorrectnessCheck(t *testing.T) { + t.Run("GetExpectedValueParameterID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DeepEqualityCorrectnessCheck{} + var expected ParameterID + obj.ExpectedValueParameterID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetExpectedValueParameterID(), "getter should return the property value") + }) + + t.Run("GetExpectedValueParameterID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DeepEqualityCorrectnessCheck + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetExpectedValueParameterID() // Should return zero value + }) + +} + +func TestSettersMarkExplicitDeepEqualityCorrectnessCheck(t *testing.T) { + t.Run("SetExpectedValueParameterID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DeepEqualityCorrectnessCheck{} + var fernTestValueExpectedValueParameterID ParameterID + + // Act + obj.SetExpectedValueParameterID(fernTestValueExpectedValueParameterID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersFileInfoV2(t *testing.T) { + t.Run("SetFilename", func(t *testing.T) { + obj := &FileInfoV2{} + var fernTestValueFilename string + obj.SetFilename(fernTestValueFilename) + assert.Equal(t, fernTestValueFilename, obj.Filename) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetDirectory", func(t *testing.T) { + obj := &FileInfoV2{} + var fernTestValueDirectory string + obj.SetDirectory(fernTestValueDirectory) + assert.Equal(t, fernTestValueDirectory, obj.Directory) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetContents", func(t *testing.T) { + obj := &FileInfoV2{} + var fernTestValueContents string + obj.SetContents(fernTestValueContents) + assert.Equal(t, fernTestValueContents, obj.Contents) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetEditable", func(t *testing.T) { + obj := &FileInfoV2{} + var fernTestValueEditable bool + obj.SetEditable(fernTestValueEditable) + assert.Equal(t, fernTestValueEditable, obj.Editable) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersFileInfoV2(t *testing.T) { + t.Run("GetFilename", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FileInfoV2{} + var expected string + obj.Filename = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetFilename(), "getter should return the property value") + }) + + t.Run("GetFilename_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FileInfoV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetFilename() // Should return zero value + }) + + t.Run("GetDirectory", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FileInfoV2{} + var expected string + obj.Directory = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetDirectory(), "getter should return the property value") + }) + + t.Run("GetDirectory_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FileInfoV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetDirectory() // Should return zero value + }) + + t.Run("GetContents", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FileInfoV2{} + var expected string + obj.Contents = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetContents(), "getter should return the property value") + }) + + t.Run("GetContents_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FileInfoV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetContents() // Should return zero value + }) + + t.Run("GetEditable", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FileInfoV2{} + var expected bool + obj.Editable = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetEditable(), "getter should return the property value") + }) + + t.Run("GetEditable_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FileInfoV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetEditable() // Should return zero value + }) + +} + +func TestSettersMarkExplicitFileInfoV2(t *testing.T) { + t.Run("SetFilename_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FileInfoV2{} + var fernTestValueFilename string + + // Act + obj.SetFilename(fernTestValueFilename) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetDirectory_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FileInfoV2{} + var fernTestValueDirectory string + + // Act + obj.SetDirectory(fernTestValueDirectory) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetContents_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FileInfoV2{} + var fernTestValueContents string + + // Act + obj.SetContents(fernTestValueContents) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetEditable_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FileInfoV2{} + var fernTestValueEditable bool + + // Act + obj.SetEditable(fernTestValueEditable) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersFiles(t *testing.T) { + t.Run("SetFiles", func(t *testing.T) { + obj := &Files{} + var fernTestValueFiles []*FileInfoV2 + obj.SetFiles(fernTestValueFiles) + assert.Equal(t, fernTestValueFiles, obj.Files) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersFiles(t *testing.T) { + t.Run("GetFiles", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Files{} + var expected []*FileInfoV2 + obj.Files = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetFiles(), "getter should return the property value") + }) + + t.Run("GetFiles_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Files{} + obj.Files = nil + + // Act & Assert + assert.Nil(t, obj.GetFiles(), "getter should return nil when property is nil") + }) + + t.Run("GetFiles_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *Files + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetFiles() // Should return zero value + }) + +} + +func TestSettersMarkExplicitFiles(t *testing.T) { + t.Run("SetFiles_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Files{} + var fernTestValueFiles []*FileInfoV2 + + // Act + obj.SetFiles(fernTestValueFiles) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersFunctionImplementation(t *testing.T) { + t.Run("SetImpl", func(t *testing.T) { + obj := &FunctionImplementation{} + var fernTestValueImpl string + obj.SetImpl(fernTestValueImpl) + assert.Equal(t, fernTestValueImpl, obj.Impl) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetImports", func(t *testing.T) { + obj := &FunctionImplementation{} + var fernTestValueImports *string + obj.SetImports(fernTestValueImports) + assert.Equal(t, fernTestValueImports, obj.Imports) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersFunctionImplementation(t *testing.T) { + t.Run("GetImpl", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FunctionImplementation{} + var expected string + obj.Impl = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetImpl(), "getter should return the property value") + }) + + t.Run("GetImpl_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FunctionImplementation + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetImpl() // Should return zero value + }) + + t.Run("GetImports", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FunctionImplementation{} + var expected *string + obj.Imports = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetImports(), "getter should return the property value") + }) + + t.Run("GetImports_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FunctionImplementation{} + obj.Imports = nil + + // Act & Assert + assert.Nil(t, obj.GetImports(), "getter should return nil when property is nil") + }) + + t.Run("GetImports_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FunctionImplementation + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetImports() // Should return zero value + }) + +} + +func TestSettersMarkExplicitFunctionImplementation(t *testing.T) { + t.Run("SetImpl_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FunctionImplementation{} + var fernTestValueImpl string + + // Act + obj.SetImpl(fernTestValueImpl) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetImports_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FunctionImplementation{} + var fernTestValueImports *string + + // Act + obj.SetImports(fernTestValueImports) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersFunctionImplementationForMultipleLanguages(t *testing.T) { + t.Run("SetCodeByLanguage", func(t *testing.T) { + obj := &FunctionImplementationForMultipleLanguages{} + var fernTestValueCodeByLanguage map[common.Language]*FunctionImplementation + obj.SetCodeByLanguage(fernTestValueCodeByLanguage) + assert.Equal(t, fernTestValueCodeByLanguage, obj.CodeByLanguage) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersFunctionImplementationForMultipleLanguages(t *testing.T) { + t.Run("GetCodeByLanguage", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FunctionImplementationForMultipleLanguages{} + var expected map[common.Language]*FunctionImplementation + obj.CodeByLanguage = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetCodeByLanguage(), "getter should return the property value") + }) + + t.Run("GetCodeByLanguage_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FunctionImplementationForMultipleLanguages{} + obj.CodeByLanguage = nil + + // Act & Assert + assert.Nil(t, obj.GetCodeByLanguage(), "getter should return nil when property is nil") + }) + + t.Run("GetCodeByLanguage_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FunctionImplementationForMultipleLanguages + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetCodeByLanguage() // Should return zero value + }) + +} + +func TestSettersMarkExplicitFunctionImplementationForMultipleLanguages(t *testing.T) { + t.Run("SetCodeByLanguage_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FunctionImplementationForMultipleLanguages{} + var fernTestValueCodeByLanguage map[common.Language]*FunctionImplementation + + // Act + obj.SetCodeByLanguage(fernTestValueCodeByLanguage) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersGeneratedFiles(t *testing.T) { + t.Run("SetGeneratedTestCaseFiles", func(t *testing.T) { + obj := &GeneratedFiles{} + var fernTestValueGeneratedTestCaseFiles map[common.Language]*Files + obj.SetGeneratedTestCaseFiles(fernTestValueGeneratedTestCaseFiles) + assert.Equal(t, fernTestValueGeneratedTestCaseFiles, obj.GeneratedTestCaseFiles) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetGeneratedTemplateFiles", func(t *testing.T) { + obj := &GeneratedFiles{} + var fernTestValueGeneratedTemplateFiles map[common.Language]*Files + obj.SetGeneratedTemplateFiles(fernTestValueGeneratedTemplateFiles) + assert.Equal(t, fernTestValueGeneratedTemplateFiles, obj.GeneratedTemplateFiles) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetOther", func(t *testing.T) { + obj := &GeneratedFiles{} + var fernTestValueOther map[common.Language]*Files + obj.SetOther(fernTestValueOther) + assert.Equal(t, fernTestValueOther, obj.Other) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersGeneratedFiles(t *testing.T) { + t.Run("GetGeneratedTestCaseFiles", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GeneratedFiles{} + var expected map[common.Language]*Files + obj.GeneratedTestCaseFiles = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetGeneratedTestCaseFiles(), "getter should return the property value") + }) + + t.Run("GetGeneratedTestCaseFiles_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GeneratedFiles{} + obj.GeneratedTestCaseFiles = nil + + // Act & Assert + assert.Nil(t, obj.GetGeneratedTestCaseFiles(), "getter should return nil when property is nil") + }) + + t.Run("GetGeneratedTestCaseFiles_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GeneratedFiles + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetGeneratedTestCaseFiles() // Should return zero value + }) + + t.Run("GetGeneratedTemplateFiles", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GeneratedFiles{} + var expected map[common.Language]*Files + obj.GeneratedTemplateFiles = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetGeneratedTemplateFiles(), "getter should return the property value") + }) + + t.Run("GetGeneratedTemplateFiles_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GeneratedFiles{} + obj.GeneratedTemplateFiles = nil + + // Act & Assert + assert.Nil(t, obj.GetGeneratedTemplateFiles(), "getter should return nil when property is nil") + }) + + t.Run("GetGeneratedTemplateFiles_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GeneratedFiles + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetGeneratedTemplateFiles() // Should return zero value + }) + + t.Run("GetOther", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GeneratedFiles{} + var expected map[common.Language]*Files + obj.Other = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetOther(), "getter should return the property value") + }) + + t.Run("GetOther_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GeneratedFiles{} + obj.Other = nil + + // Act & Assert + assert.Nil(t, obj.GetOther(), "getter should return nil when property is nil") + }) + + t.Run("GetOther_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GeneratedFiles + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetOther() // Should return zero value + }) + +} + +func TestSettersMarkExplicitGeneratedFiles(t *testing.T) { + t.Run("SetGeneratedTestCaseFiles_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GeneratedFiles{} + var fernTestValueGeneratedTestCaseFiles map[common.Language]*Files + + // Act + obj.SetGeneratedTestCaseFiles(fernTestValueGeneratedTestCaseFiles) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetGeneratedTemplateFiles_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GeneratedFiles{} + var fernTestValueGeneratedTemplateFiles map[common.Language]*Files + + // Act + obj.SetGeneratedTemplateFiles(fernTestValueGeneratedTemplateFiles) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetOther_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GeneratedFiles{} + var fernTestValueOther map[common.Language]*Files + + // Act + obj.SetOther(fernTestValueOther) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersNonVoidFunctionDefinition(t *testing.T) { + t.Run("SetSignature", func(t *testing.T) { + obj := &NonVoidFunctionDefinition{} + var fernTestValueSignature *NonVoidFunctionSignature + obj.SetSignature(fernTestValueSignature) + assert.Equal(t, fernTestValueSignature, obj.Signature) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetCode", func(t *testing.T) { + obj := &NonVoidFunctionDefinition{} + var fernTestValueCode *FunctionImplementationForMultipleLanguages + obj.SetCode(fernTestValueCode) + assert.Equal(t, fernTestValueCode, obj.Code) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersNonVoidFunctionDefinition(t *testing.T) { + t.Run("GetSignature", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &NonVoidFunctionDefinition{} + var expected *NonVoidFunctionSignature + obj.Signature = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSignature(), "getter should return the property value") + }) + + t.Run("GetSignature_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &NonVoidFunctionDefinition{} + obj.Signature = nil + + // Act & Assert + assert.Nil(t, obj.GetSignature(), "getter should return nil when property is nil") + }) + + t.Run("GetSignature_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *NonVoidFunctionDefinition + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSignature() // Should return zero value + }) + + t.Run("GetCode", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &NonVoidFunctionDefinition{} + var expected *FunctionImplementationForMultipleLanguages + obj.Code = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetCode(), "getter should return the property value") + }) + + t.Run("GetCode_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &NonVoidFunctionDefinition{} + obj.Code = nil + + // Act & Assert + assert.Nil(t, obj.GetCode(), "getter should return nil when property is nil") + }) + + t.Run("GetCode_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *NonVoidFunctionDefinition + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetCode() // Should return zero value + }) + +} + +func TestSettersMarkExplicitNonVoidFunctionDefinition(t *testing.T) { + t.Run("SetSignature_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &NonVoidFunctionDefinition{} + var fernTestValueSignature *NonVoidFunctionSignature + + // Act + obj.SetSignature(fernTestValueSignature) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetCode_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &NonVoidFunctionDefinition{} + var fernTestValueCode *FunctionImplementationForMultipleLanguages + + // Act + obj.SetCode(fernTestValueCode) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersNonVoidFunctionSignature(t *testing.T) { + t.Run("SetParameters", func(t *testing.T) { + obj := &NonVoidFunctionSignature{} + var fernTestValueParameters []*Parameter + obj.SetParameters(fernTestValueParameters) + assert.Equal(t, fernTestValueParameters, obj.Parameters) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetReturnType", func(t *testing.T) { + obj := &NonVoidFunctionSignature{} + var fernTestValueReturnType *common.VariableType + obj.SetReturnType(fernTestValueReturnType) + assert.Equal(t, fernTestValueReturnType, obj.ReturnType) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersNonVoidFunctionSignature(t *testing.T) { + t.Run("GetParameters", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &NonVoidFunctionSignature{} + var expected []*Parameter + obj.Parameters = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetParameters(), "getter should return the property value") + }) + + t.Run("GetParameters_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &NonVoidFunctionSignature{} + obj.Parameters = nil + + // Act & Assert + assert.Nil(t, obj.GetParameters(), "getter should return nil when property is nil") + }) + + t.Run("GetParameters_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *NonVoidFunctionSignature + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetParameters() // Should return zero value + }) + + t.Run("GetReturnType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &NonVoidFunctionSignature{} + var expected *common.VariableType + obj.ReturnType = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetReturnType(), "getter should return the property value") + }) + + t.Run("GetReturnType_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &NonVoidFunctionSignature{} + obj.ReturnType = nil + + // Act & Assert + assert.Nil(t, obj.GetReturnType(), "getter should return nil when property is nil") + }) + + t.Run("GetReturnType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *NonVoidFunctionSignature + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetReturnType() // Should return zero value + }) + +} + +func TestSettersMarkExplicitNonVoidFunctionSignature(t *testing.T) { + t.Run("SetParameters_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &NonVoidFunctionSignature{} + var fernTestValueParameters []*Parameter + + // Act + obj.SetParameters(fernTestValueParameters) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetReturnType_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &NonVoidFunctionSignature{} + var fernTestValueReturnType *common.VariableType + + // Act + obj.SetReturnType(fernTestValueReturnType) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersParameter(t *testing.T) { + t.Run("SetParameterID", func(t *testing.T) { + obj := &Parameter{} + var fernTestValueParameterID ParameterID + obj.SetParameterID(fernTestValueParameterID) + assert.Equal(t, fernTestValueParameterID, obj.ParameterID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetName", func(t *testing.T) { + obj := &Parameter{} + var fernTestValueName string + obj.SetName(fernTestValueName) + assert.Equal(t, fernTestValueName, obj.Name) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetVariableType", func(t *testing.T) { + obj := &Parameter{} + var fernTestValueVariableType *common.VariableType + obj.SetVariableType(fernTestValueVariableType) + assert.Equal(t, fernTestValueVariableType, obj.VariableType) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersParameter(t *testing.T) { + t.Run("GetParameterID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Parameter{} + var expected ParameterID + obj.ParameterID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetParameterID(), "getter should return the property value") + }) + + t.Run("GetParameterID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *Parameter + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetParameterID() // Should return zero value + }) + + t.Run("GetName", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Parameter{} + var expected string + obj.Name = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetName(), "getter should return the property value") + }) + + t.Run("GetName_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *Parameter + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetName() // Should return zero value + }) + + t.Run("GetVariableType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Parameter{} + var expected *common.VariableType + obj.VariableType = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetVariableType(), "getter should return the property value") + }) + + t.Run("GetVariableType_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Parameter{} + obj.VariableType = nil + + // Act & Assert + assert.Nil(t, obj.GetVariableType(), "getter should return nil when property is nil") + }) + + t.Run("GetVariableType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *Parameter + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetVariableType() // Should return zero value + }) + +} + +func TestSettersMarkExplicitParameter(t *testing.T) { + t.Run("SetParameterID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Parameter{} + var fernTestValueParameterID ParameterID + + // Act + obj.SetParameterID(fernTestValueParameterID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetName_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Parameter{} + var fernTestValueName string + + // Act + obj.SetName(fernTestValueName) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetVariableType_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Parameter{} + var fernTestValueVariableType *common.VariableType + + // Act + obj.SetVariableType(fernTestValueVariableType) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersProblemInfoV2(t *testing.T) { + t.Run("SetProblemID", func(t *testing.T) { + obj := &ProblemInfoV2{} + var fernTestValueProblemID common.ProblemID + obj.SetProblemID(fernTestValueProblemID) + assert.Equal(t, fernTestValueProblemID, obj.ProblemID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetProblemDescription", func(t *testing.T) { + obj := &ProblemInfoV2{} + var fernTestValueProblemDescription *common.ProblemDescription + obj.SetProblemDescription(fernTestValueProblemDescription) + assert.Equal(t, fernTestValueProblemDescription, obj.ProblemDescription) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetProblemName", func(t *testing.T) { + obj := &ProblemInfoV2{} + var fernTestValueProblemName string + obj.SetProblemName(fernTestValueProblemName) + assert.Equal(t, fernTestValueProblemName, obj.ProblemName) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetProblemVersion", func(t *testing.T) { + obj := &ProblemInfoV2{} + var fernTestValueProblemVersion int + obj.SetProblemVersion(fernTestValueProblemVersion) + assert.Equal(t, fernTestValueProblemVersion, obj.ProblemVersion) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetSupportedLanguages", func(t *testing.T) { + obj := &ProblemInfoV2{} + var fernTestValueSupportedLanguages []common.Language + obj.SetSupportedLanguages(fernTestValueSupportedLanguages) + assert.Equal(t, fernTestValueSupportedLanguages, obj.SupportedLanguages) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetCustomFiles", func(t *testing.T) { + obj := &ProblemInfoV2{} + var fernTestValueCustomFiles *CustomFiles + obj.SetCustomFiles(fernTestValueCustomFiles) + assert.Equal(t, fernTestValueCustomFiles, obj.CustomFiles) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetGeneratedFiles", func(t *testing.T) { + obj := &ProblemInfoV2{} + var fernTestValueGeneratedFiles *GeneratedFiles + obj.SetGeneratedFiles(fernTestValueGeneratedFiles) + assert.Equal(t, fernTestValueGeneratedFiles, obj.GeneratedFiles) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetCustomTestCaseTemplates", func(t *testing.T) { + obj := &ProblemInfoV2{} + var fernTestValueCustomTestCaseTemplates []*TestCaseTemplate + obj.SetCustomTestCaseTemplates(fernTestValueCustomTestCaseTemplates) + assert.Equal(t, fernTestValueCustomTestCaseTemplates, obj.CustomTestCaseTemplates) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetTestcases", func(t *testing.T) { + obj := &ProblemInfoV2{} + var fernTestValueTestcases []*TestCaseV2 + obj.SetTestcases(fernTestValueTestcases) + assert.Equal(t, fernTestValueTestcases, obj.Testcases) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetIsPublic", func(t *testing.T) { + obj := &ProblemInfoV2{} + var fernTestValueIsPublic bool + obj.SetIsPublic(fernTestValueIsPublic) + assert.Equal(t, fernTestValueIsPublic, obj.IsPublic) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersProblemInfoV2(t *testing.T) { + t.Run("GetProblemID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var expected common.ProblemID + obj.ProblemID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetProblemID(), "getter should return the property value") + }) + + t.Run("GetProblemID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemInfoV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetProblemID() // Should return zero value + }) + + t.Run("GetProblemDescription", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var expected *common.ProblemDescription + obj.ProblemDescription = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetProblemDescription(), "getter should return the property value") + }) + + t.Run("GetProblemDescription_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + obj.ProblemDescription = nil + + // Act & Assert + assert.Nil(t, obj.GetProblemDescription(), "getter should return nil when property is nil") + }) + + t.Run("GetProblemDescription_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemInfoV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetProblemDescription() // Should return zero value + }) + + t.Run("GetProblemName", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var expected string + obj.ProblemName = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetProblemName(), "getter should return the property value") + }) + + t.Run("GetProblemName_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemInfoV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetProblemName() // Should return zero value + }) + + t.Run("GetProblemVersion", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var expected int + obj.ProblemVersion = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetProblemVersion(), "getter should return the property value") + }) + + t.Run("GetProblemVersion_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemInfoV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetProblemVersion() // Should return zero value + }) + + t.Run("GetSupportedLanguages", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var expected []common.Language + obj.SupportedLanguages = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSupportedLanguages(), "getter should return the property value") + }) + + t.Run("GetSupportedLanguages_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + obj.SupportedLanguages = nil + + // Act & Assert + assert.Nil(t, obj.GetSupportedLanguages(), "getter should return nil when property is nil") + }) + + t.Run("GetSupportedLanguages_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemInfoV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSupportedLanguages() // Should return zero value + }) + + t.Run("GetCustomFiles", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var expected *CustomFiles + obj.CustomFiles = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetCustomFiles(), "getter should return the property value") + }) + + t.Run("GetCustomFiles_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + obj.CustomFiles = nil + + // Act & Assert + assert.Nil(t, obj.GetCustomFiles(), "getter should return nil when property is nil") + }) + + t.Run("GetCustomFiles_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemInfoV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetCustomFiles() // Should return zero value + }) + + t.Run("GetGeneratedFiles", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var expected *GeneratedFiles + obj.GeneratedFiles = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetGeneratedFiles(), "getter should return the property value") + }) + + t.Run("GetGeneratedFiles_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + obj.GeneratedFiles = nil + + // Act & Assert + assert.Nil(t, obj.GetGeneratedFiles(), "getter should return nil when property is nil") + }) + + t.Run("GetGeneratedFiles_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemInfoV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetGeneratedFiles() // Should return zero value + }) + + t.Run("GetCustomTestCaseTemplates", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var expected []*TestCaseTemplate + obj.CustomTestCaseTemplates = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetCustomTestCaseTemplates(), "getter should return the property value") + }) + + t.Run("GetCustomTestCaseTemplates_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + obj.CustomTestCaseTemplates = nil + + // Act & Assert + assert.Nil(t, obj.GetCustomTestCaseTemplates(), "getter should return nil when property is nil") + }) + + t.Run("GetCustomTestCaseTemplates_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemInfoV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetCustomTestCaseTemplates() // Should return zero value + }) + + t.Run("GetTestcases", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var expected []*TestCaseV2 + obj.Testcases = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTestcases(), "getter should return the property value") + }) + + t.Run("GetTestcases_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + obj.Testcases = nil + + // Act & Assert + assert.Nil(t, obj.GetTestcases(), "getter should return nil when property is nil") + }) + + t.Run("GetTestcases_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemInfoV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTestcases() // Should return zero value + }) + + t.Run("GetIsPublic", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var expected bool + obj.IsPublic = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetIsPublic(), "getter should return the property value") + }) + + t.Run("GetIsPublic_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemInfoV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetIsPublic() // Should return zero value + }) + +} + +func TestSettersMarkExplicitProblemInfoV2(t *testing.T) { + t.Run("SetProblemID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var fernTestValueProblemID common.ProblemID + + // Act + obj.SetProblemID(fernTestValueProblemID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetProblemDescription_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var fernTestValueProblemDescription *common.ProblemDescription + + // Act + obj.SetProblemDescription(fernTestValueProblemDescription) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetProblemName_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var fernTestValueProblemName string + + // Act + obj.SetProblemName(fernTestValueProblemName) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetProblemVersion_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var fernTestValueProblemVersion int + + // Act + obj.SetProblemVersion(fernTestValueProblemVersion) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetSupportedLanguages_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var fernTestValueSupportedLanguages []common.Language + + // Act + obj.SetSupportedLanguages(fernTestValueSupportedLanguages) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetCustomFiles_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var fernTestValueCustomFiles *CustomFiles + + // Act + obj.SetCustomFiles(fernTestValueCustomFiles) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetGeneratedFiles_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var fernTestValueGeneratedFiles *GeneratedFiles + + // Act + obj.SetGeneratedFiles(fernTestValueGeneratedFiles) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetCustomTestCaseTemplates_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var fernTestValueCustomTestCaseTemplates []*TestCaseTemplate + + // Act + obj.SetCustomTestCaseTemplates(fernTestValueCustomTestCaseTemplates) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetTestcases_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var fernTestValueTestcases []*TestCaseV2 + + // Act + obj.SetTestcases(fernTestValueTestcases) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetIsPublic_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var fernTestValueIsPublic bool + + // Act + obj.SetIsPublic(fernTestValueIsPublic) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersTestCaseExpects(t *testing.T) { + t.Run("SetExpectedStdout", func(t *testing.T) { + obj := &TestCaseExpects{} + var fernTestValueExpectedStdout *string + obj.SetExpectedStdout(fernTestValueExpectedStdout) + assert.Equal(t, fernTestValueExpectedStdout, obj.ExpectedStdout) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersTestCaseExpects(t *testing.T) { + t.Run("GetExpectedStdout", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseExpects{} + var expected *string + obj.ExpectedStdout = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetExpectedStdout(), "getter should return the property value") + }) + + t.Run("GetExpectedStdout_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseExpects{} + obj.ExpectedStdout = nil + + // Act & Assert + assert.Nil(t, obj.GetExpectedStdout(), "getter should return nil when property is nil") + }) + + t.Run("GetExpectedStdout_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseExpects + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetExpectedStdout() // Should return zero value + }) + +} + +func TestSettersMarkExplicitTestCaseExpects(t *testing.T) { + t.Run("SetExpectedStdout_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseExpects{} + var fernTestValueExpectedStdout *string + + // Act + obj.SetExpectedStdout(fernTestValueExpectedStdout) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestGettersTestCaseFunction(t *testing.T) { + t.Run("GetType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseFunction{} + var expected string + obj.Type = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetType(), "getter should return the property value") + }) + + t.Run("GetType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseFunction + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetType() // Should return zero value + }) + + t.Run("GetWithActualResult", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseFunction{} + var expected *TestCaseWithActualResultImplementation + obj.WithActualResult = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetWithActualResult(), "getter should return the property value") + }) + + t.Run("GetWithActualResult_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseFunction{} + obj.WithActualResult = nil + + // Act & Assert + assert.Nil(t, obj.GetWithActualResult(), "getter should return nil when property is nil") + }) + + t.Run("GetWithActualResult_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseFunction + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetWithActualResult() // Should return zero value + }) + + t.Run("GetCustom", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseFunction{} + var expected *VoidFunctionDefinition + obj.Custom = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetCustom(), "getter should return the property value") + }) + + t.Run("GetCustom_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseFunction{} + obj.Custom = nil + + // Act & Assert + assert.Nil(t, obj.GetCustom(), "getter should return nil when property is nil") + }) + + t.Run("GetCustom_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseFunction + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetCustom() // Should return zero value + }) + +} + +func TestSettersTestCaseImplementation(t *testing.T) { + t.Run("SetDescription", func(t *testing.T) { + obj := &TestCaseImplementation{} + var fernTestValueDescription *TestCaseImplementationDescription + obj.SetDescription(fernTestValueDescription) + assert.Equal(t, fernTestValueDescription, obj.Description) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetFunction", func(t *testing.T) { + obj := &TestCaseImplementation{} + var fernTestValueFunction *TestCaseFunction + obj.SetFunction(fernTestValueFunction) + assert.Equal(t, fernTestValueFunction, obj.Function) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersTestCaseImplementation(t *testing.T) { + t.Run("GetDescription", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseImplementation{} + var expected *TestCaseImplementationDescription + obj.Description = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetDescription(), "getter should return the property value") + }) + + t.Run("GetDescription_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseImplementation{} + obj.Description = nil + + // Act & Assert + assert.Nil(t, obj.GetDescription(), "getter should return nil when property is nil") + }) + + t.Run("GetDescription_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseImplementation + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetDescription() // Should return zero value + }) + + t.Run("GetFunction", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseImplementation{} + var expected *TestCaseFunction + obj.Function = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetFunction(), "getter should return the property value") + }) + + t.Run("GetFunction_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseImplementation{} + obj.Function = nil + + // Act & Assert + assert.Nil(t, obj.GetFunction(), "getter should return nil when property is nil") + }) + + t.Run("GetFunction_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseImplementation + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetFunction() // Should return zero value + }) + +} + +func TestSettersMarkExplicitTestCaseImplementation(t *testing.T) { + t.Run("SetDescription_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseImplementation{} + var fernTestValueDescription *TestCaseImplementationDescription + + // Act + obj.SetDescription(fernTestValueDescription) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetFunction_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseImplementation{} + var fernTestValueFunction *TestCaseFunction + + // Act + obj.SetFunction(fernTestValueFunction) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersTestCaseImplementationDescription(t *testing.T) { + t.Run("SetBoards", func(t *testing.T) { + obj := &TestCaseImplementationDescription{} + var fernTestValueBoards []*TestCaseImplementationDescriptionBoard + obj.SetBoards(fernTestValueBoards) + assert.Equal(t, fernTestValueBoards, obj.Boards) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersTestCaseImplementationDescription(t *testing.T) { + t.Run("GetBoards", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseImplementationDescription{} + var expected []*TestCaseImplementationDescriptionBoard + obj.Boards = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetBoards(), "getter should return the property value") + }) + + t.Run("GetBoards_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseImplementationDescription{} + obj.Boards = nil + + // Act & Assert + assert.Nil(t, obj.GetBoards(), "getter should return nil when property is nil") + }) + + t.Run("GetBoards_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseImplementationDescription + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetBoards() // Should return zero value + }) + +} + +func TestSettersMarkExplicitTestCaseImplementationDescription(t *testing.T) { + t.Run("SetBoards_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseImplementationDescription{} + var fernTestValueBoards []*TestCaseImplementationDescriptionBoard + + // Act + obj.SetBoards(fernTestValueBoards) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestGettersTestCaseImplementationDescriptionBoard(t *testing.T) { + t.Run("GetType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseImplementationDescriptionBoard{} + var expected string + obj.Type = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetType(), "getter should return the property value") + }) + + t.Run("GetType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseImplementationDescriptionBoard + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetType() // Should return zero value + }) + + t.Run("GetHTML", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseImplementationDescriptionBoard{} + var expected string + obj.HTML = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetHTML(), "getter should return the property value") + }) + + t.Run("GetHTML_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseImplementationDescriptionBoard + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetHTML() // Should return zero value + }) + + t.Run("GetParamID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseImplementationDescriptionBoard{} + var expected ParameterID + obj.ParamID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetParamID(), "getter should return the property value") + }) + + t.Run("GetParamID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseImplementationDescriptionBoard + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetParamID() // Should return zero value + }) + +} + +func TestGettersTestCaseImplementationReference(t *testing.T) { + t.Run("GetType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseImplementationReference{} + var expected string + obj.Type = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetType(), "getter should return the property value") + }) + + t.Run("GetType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseImplementationReference + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetType() // Should return zero value + }) + + t.Run("GetTemplateID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseImplementationReference{} + var expected TestCaseTemplateID + obj.TemplateID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTemplateID(), "getter should return the property value") + }) + + t.Run("GetTemplateID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseImplementationReference + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTemplateID() // Should return zero value + }) + + t.Run("GetImplementation", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseImplementationReference{} + var expected *TestCaseImplementation + obj.Implementation = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetImplementation(), "getter should return the property value") + }) + + t.Run("GetImplementation_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseImplementationReference{} + obj.Implementation = nil + + // Act & Assert + assert.Nil(t, obj.GetImplementation(), "getter should return nil when property is nil") + }) + + t.Run("GetImplementation_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseImplementationReference + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetImplementation() // Should return zero value + }) + +} + +func TestSettersTestCaseMetadata(t *testing.T) { + t.Run("SetID", func(t *testing.T) { + obj := &TestCaseMetadata{} + var fernTestValueID TestCaseID + obj.SetID(fernTestValueID) + assert.Equal(t, fernTestValueID, obj.ID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetName", func(t *testing.T) { + obj := &TestCaseMetadata{} + var fernTestValueName string + obj.SetName(fernTestValueName) + assert.Equal(t, fernTestValueName, obj.Name) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetHidden", func(t *testing.T) { + obj := &TestCaseMetadata{} + var fernTestValueHidden bool + obj.SetHidden(fernTestValueHidden) + assert.Equal(t, fernTestValueHidden, obj.Hidden) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersTestCaseMetadata(t *testing.T) { + t.Run("GetID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseMetadata{} + var expected TestCaseID + obj.ID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetID(), "getter should return the property value") + }) + + t.Run("GetID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseMetadata + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetID() // Should return zero value + }) + + t.Run("GetName", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseMetadata{} + var expected string + obj.Name = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetName(), "getter should return the property value") + }) + + t.Run("GetName_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseMetadata + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetName() // Should return zero value + }) + + t.Run("GetHidden", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseMetadata{} + var expected bool + obj.Hidden = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetHidden(), "getter should return the property value") + }) + + t.Run("GetHidden_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseMetadata + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetHidden() // Should return zero value + }) + +} + +func TestSettersMarkExplicitTestCaseMetadata(t *testing.T) { + t.Run("SetID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseMetadata{} + var fernTestValueID TestCaseID + + // Act + obj.SetID(fernTestValueID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetName_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseMetadata{} + var fernTestValueName string + + // Act + obj.SetName(fernTestValueName) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetHidden_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseMetadata{} + var fernTestValueHidden bool + + // Act + obj.SetHidden(fernTestValueHidden) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersTestCaseTemplate(t *testing.T) { + t.Run("SetTemplateID", func(t *testing.T) { + obj := &TestCaseTemplate{} + var fernTestValueTemplateID TestCaseTemplateID + obj.SetTemplateID(fernTestValueTemplateID) + assert.Equal(t, fernTestValueTemplateID, obj.TemplateID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetName", func(t *testing.T) { + obj := &TestCaseTemplate{} + var fernTestValueName string + obj.SetName(fernTestValueName) + assert.Equal(t, fernTestValueName, obj.Name) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetImplementation", func(t *testing.T) { + obj := &TestCaseTemplate{} + var fernTestValueImplementation *TestCaseImplementation + obj.SetImplementation(fernTestValueImplementation) + assert.Equal(t, fernTestValueImplementation, obj.Implementation) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersTestCaseTemplate(t *testing.T) { + t.Run("GetTemplateID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseTemplate{} + var expected TestCaseTemplateID + obj.TemplateID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTemplateID(), "getter should return the property value") + }) + + t.Run("GetTemplateID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseTemplate + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTemplateID() // Should return zero value + }) + + t.Run("GetName", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseTemplate{} + var expected string + obj.Name = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetName(), "getter should return the property value") + }) + + t.Run("GetName_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseTemplate + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetName() // Should return zero value + }) + + t.Run("GetImplementation", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseTemplate{} + var expected *TestCaseImplementation + obj.Implementation = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetImplementation(), "getter should return the property value") + }) + + t.Run("GetImplementation_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseTemplate{} + obj.Implementation = nil + + // Act & Assert + assert.Nil(t, obj.GetImplementation(), "getter should return nil when property is nil") + }) + + t.Run("GetImplementation_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseTemplate + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetImplementation() // Should return zero value + }) + +} + +func TestSettersMarkExplicitTestCaseTemplate(t *testing.T) { + t.Run("SetTemplateID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseTemplate{} + var fernTestValueTemplateID TestCaseTemplateID + + // Act + obj.SetTemplateID(fernTestValueTemplateID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetName_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseTemplate{} + var fernTestValueName string + + // Act + obj.SetName(fernTestValueName) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetImplementation_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseTemplate{} + var fernTestValueImplementation *TestCaseImplementation + + // Act + obj.SetImplementation(fernTestValueImplementation) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersTestCaseV2(t *testing.T) { + t.Run("SetMetadata", func(t *testing.T) { + obj := &TestCaseV2{} + var fernTestValueMetadata *TestCaseMetadata + obj.SetMetadata(fernTestValueMetadata) + assert.Equal(t, fernTestValueMetadata, obj.Metadata) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetImplementation", func(t *testing.T) { + obj := &TestCaseV2{} + var fernTestValueImplementation *TestCaseImplementationReference + obj.SetImplementation(fernTestValueImplementation) + assert.Equal(t, fernTestValueImplementation, obj.Implementation) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetArguments", func(t *testing.T) { + obj := &TestCaseV2{} + var fernTestValueArguments map[ParameterID]*common.VariableValue + obj.SetArguments(fernTestValueArguments) + assert.Equal(t, fernTestValueArguments, obj.Arguments) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetExpects", func(t *testing.T) { + obj := &TestCaseV2{} + var fernTestValueExpects *TestCaseExpects + obj.SetExpects(fernTestValueExpects) + assert.Equal(t, fernTestValueExpects, obj.Expects) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersTestCaseV2(t *testing.T) { + t.Run("GetMetadata", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseV2{} + var expected *TestCaseMetadata + obj.Metadata = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetMetadata(), "getter should return the property value") + }) + + t.Run("GetMetadata_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseV2{} + obj.Metadata = nil + + // Act & Assert + assert.Nil(t, obj.GetMetadata(), "getter should return nil when property is nil") + }) + + t.Run("GetMetadata_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetMetadata() // Should return zero value + }) + + t.Run("GetImplementation", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseV2{} + var expected *TestCaseImplementationReference + obj.Implementation = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetImplementation(), "getter should return the property value") + }) + + t.Run("GetImplementation_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseV2{} + obj.Implementation = nil + + // Act & Assert + assert.Nil(t, obj.GetImplementation(), "getter should return nil when property is nil") + }) + + t.Run("GetImplementation_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetImplementation() // Should return zero value + }) + + t.Run("GetArguments", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseV2{} + var expected map[ParameterID]*common.VariableValue + obj.Arguments = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetArguments(), "getter should return the property value") + }) + + t.Run("GetArguments_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseV2{} + obj.Arguments = nil + + // Act & Assert + assert.Nil(t, obj.GetArguments(), "getter should return nil when property is nil") + }) + + t.Run("GetArguments_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetArguments() // Should return zero value + }) + + t.Run("GetExpects", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseV2{} + var expected *TestCaseExpects + obj.Expects = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetExpects(), "getter should return the property value") + }) + + t.Run("GetExpects_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseV2{} + obj.Expects = nil + + // Act & Assert + assert.Nil(t, obj.GetExpects(), "getter should return nil when property is nil") + }) + + t.Run("GetExpects_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetExpects() // Should return zero value + }) + +} + +func TestSettersMarkExplicitTestCaseV2(t *testing.T) { + t.Run("SetMetadata_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseV2{} + var fernTestValueMetadata *TestCaseMetadata + + // Act + obj.SetMetadata(fernTestValueMetadata) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetImplementation_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseV2{} + var fernTestValueImplementation *TestCaseImplementationReference + + // Act + obj.SetImplementation(fernTestValueImplementation) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetArguments_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseV2{} + var fernTestValueArguments map[ParameterID]*common.VariableValue + + // Act + obj.SetArguments(fernTestValueArguments) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetExpects_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseV2{} + var fernTestValueExpects *TestCaseExpects + + // Act + obj.SetExpects(fernTestValueExpects) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersTestCaseWithActualResultImplementation(t *testing.T) { + t.Run("SetGetActualResult", func(t *testing.T) { + obj := &TestCaseWithActualResultImplementation{} + var fernTestValueGetActualResult *NonVoidFunctionDefinition + obj.SetGetActualResult(fernTestValueGetActualResult) + assert.Equal(t, fernTestValueGetActualResult, obj.GetActualResult) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetAssertCorrectnessCheck", func(t *testing.T) { + obj := &TestCaseWithActualResultImplementation{} + var fernTestValueAssertCorrectnessCheck *AssertCorrectnessCheck + obj.SetAssertCorrectnessCheck(fernTestValueAssertCorrectnessCheck) + assert.Equal(t, fernTestValueAssertCorrectnessCheck, obj.AssertCorrectnessCheck) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersTestCaseWithActualResultImplementation(t *testing.T) { + t.Run("GetGetActualResult", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseWithActualResultImplementation{} + var expected *NonVoidFunctionDefinition + obj.GetActualResult = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetGetActualResult(), "getter should return the property value") + }) + + t.Run("GetGetActualResult_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseWithActualResultImplementation{} + obj.GetActualResult = nil + + // Act & Assert + assert.Nil(t, obj.GetGetActualResult(), "getter should return nil when property is nil") + }) + + t.Run("GetGetActualResult_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseWithActualResultImplementation + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetGetActualResult() // Should return zero value + }) + + t.Run("GetAssertCorrectnessCheck", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseWithActualResultImplementation{} + var expected *AssertCorrectnessCheck + obj.AssertCorrectnessCheck = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetAssertCorrectnessCheck(), "getter should return the property value") + }) + + t.Run("GetAssertCorrectnessCheck_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseWithActualResultImplementation{} + obj.AssertCorrectnessCheck = nil + + // Act & Assert + assert.Nil(t, obj.GetAssertCorrectnessCheck(), "getter should return nil when property is nil") + }) + + t.Run("GetAssertCorrectnessCheck_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseWithActualResultImplementation + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetAssertCorrectnessCheck() // Should return zero value + }) + +} + +func TestSettersMarkExplicitTestCaseWithActualResultImplementation(t *testing.T) { + t.Run("SetGetActualResult_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseWithActualResultImplementation{} + var fernTestValueGetActualResult *NonVoidFunctionDefinition + + // Act + obj.SetGetActualResult(fernTestValueGetActualResult) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetAssertCorrectnessCheck_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseWithActualResultImplementation{} + var fernTestValueAssertCorrectnessCheck *AssertCorrectnessCheck + + // Act + obj.SetAssertCorrectnessCheck(fernTestValueAssertCorrectnessCheck) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersVoidFunctionDefinition(t *testing.T) { + t.Run("SetParameters", func(t *testing.T) { + obj := &VoidFunctionDefinition{} + var fernTestValueParameters []*Parameter + obj.SetParameters(fernTestValueParameters) + assert.Equal(t, fernTestValueParameters, obj.Parameters) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetCode", func(t *testing.T) { + obj := &VoidFunctionDefinition{} + var fernTestValueCode *FunctionImplementationForMultipleLanguages + obj.SetCode(fernTestValueCode) + assert.Equal(t, fernTestValueCode, obj.Code) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersVoidFunctionDefinition(t *testing.T) { + t.Run("GetParameters", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionDefinition{} + var expected []*Parameter + obj.Parameters = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetParameters(), "getter should return the property value") + }) + + t.Run("GetParameters_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionDefinition{} + obj.Parameters = nil + + // Act & Assert + assert.Nil(t, obj.GetParameters(), "getter should return nil when property is nil") + }) + + t.Run("GetParameters_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VoidFunctionDefinition + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetParameters() // Should return zero value + }) + + t.Run("GetCode", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionDefinition{} + var expected *FunctionImplementationForMultipleLanguages + obj.Code = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetCode(), "getter should return the property value") + }) + + t.Run("GetCode_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionDefinition{} + obj.Code = nil + + // Act & Assert + assert.Nil(t, obj.GetCode(), "getter should return nil when property is nil") + }) + + t.Run("GetCode_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VoidFunctionDefinition + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetCode() // Should return zero value + }) + +} + +func TestSettersMarkExplicitVoidFunctionDefinition(t *testing.T) { + t.Run("SetParameters_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionDefinition{} + var fernTestValueParameters []*Parameter + + // Act + obj.SetParameters(fernTestValueParameters) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetCode_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionDefinition{} + var fernTestValueCode *FunctionImplementationForMultipleLanguages + + // Act + obj.SetCode(fernTestValueCode) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersVoidFunctionDefinitionThatTakesActualResult(t *testing.T) { + t.Run("SetAdditionalParameters", func(t *testing.T) { + obj := &VoidFunctionDefinitionThatTakesActualResult{} + var fernTestValueAdditionalParameters []*Parameter + obj.SetAdditionalParameters(fernTestValueAdditionalParameters) + assert.Equal(t, fernTestValueAdditionalParameters, obj.AdditionalParameters) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetCode", func(t *testing.T) { + obj := &VoidFunctionDefinitionThatTakesActualResult{} + var fernTestValueCode *FunctionImplementationForMultipleLanguages + obj.SetCode(fernTestValueCode) + assert.Equal(t, fernTestValueCode, obj.Code) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersVoidFunctionDefinitionThatTakesActualResult(t *testing.T) { + t.Run("GetAdditionalParameters", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionDefinitionThatTakesActualResult{} + var expected []*Parameter + obj.AdditionalParameters = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetAdditionalParameters(), "getter should return the property value") + }) + + t.Run("GetAdditionalParameters_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionDefinitionThatTakesActualResult{} + obj.AdditionalParameters = nil + + // Act & Assert + assert.Nil(t, obj.GetAdditionalParameters(), "getter should return nil when property is nil") + }) + + t.Run("GetAdditionalParameters_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VoidFunctionDefinitionThatTakesActualResult + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetAdditionalParameters() // Should return zero value + }) + + t.Run("GetCode", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionDefinitionThatTakesActualResult{} + var expected *FunctionImplementationForMultipleLanguages + obj.Code = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetCode(), "getter should return the property value") + }) + + t.Run("GetCode_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionDefinitionThatTakesActualResult{} + obj.Code = nil + + // Act & Assert + assert.Nil(t, obj.GetCode(), "getter should return nil when property is nil") + }) + + t.Run("GetCode_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VoidFunctionDefinitionThatTakesActualResult + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetCode() // Should return zero value + }) + +} + +func TestSettersMarkExplicitVoidFunctionDefinitionThatTakesActualResult(t *testing.T) { + t.Run("SetAdditionalParameters_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionDefinitionThatTakesActualResult{} + var fernTestValueAdditionalParameters []*Parameter + + // Act + obj.SetAdditionalParameters(fernTestValueAdditionalParameters) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetCode_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionDefinitionThatTakesActualResult{} + var fernTestValueCode *FunctionImplementationForMultipleLanguages + + // Act + obj.SetCode(fernTestValueCode) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestJSONMarshalingBasicCustomFiles(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicCustomFiles{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled BasicCustomFiles + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj BasicCustomFiles + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj BasicCustomFiles + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingBasicTestCaseTemplate(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicTestCaseTemplate{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled BasicTestCaseTemplate + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj BasicTestCaseTemplate + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj BasicTestCaseTemplate + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingDeepEqualityCorrectnessCheck(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DeepEqualityCorrectnessCheck{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled DeepEqualityCorrectnessCheck + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj DeepEqualityCorrectnessCheck + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj DeepEqualityCorrectnessCheck + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingFileInfoV2(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FileInfoV2{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled FileInfoV2 + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj FileInfoV2 + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj FileInfoV2 + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingFiles(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Files{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled Files + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj Files + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj Files + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingFunctionImplementation(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FunctionImplementation{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled FunctionImplementation + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj FunctionImplementation + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj FunctionImplementation + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingFunctionImplementationForMultipleLanguages(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FunctionImplementationForMultipleLanguages{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled FunctionImplementationForMultipleLanguages + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj FunctionImplementationForMultipleLanguages + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj FunctionImplementationForMultipleLanguages + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingGeneratedFiles(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GeneratedFiles{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled GeneratedFiles + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj GeneratedFiles + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj GeneratedFiles + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingNonVoidFunctionDefinition(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &NonVoidFunctionDefinition{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled NonVoidFunctionDefinition + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj NonVoidFunctionDefinition + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj NonVoidFunctionDefinition + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingNonVoidFunctionSignature(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &NonVoidFunctionSignature{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled NonVoidFunctionSignature + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj NonVoidFunctionSignature + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj NonVoidFunctionSignature + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingParameter(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Parameter{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled Parameter + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj Parameter + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj Parameter + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingProblemInfoV2(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled ProblemInfoV2 + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj ProblemInfoV2 + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj ProblemInfoV2 + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingTestCaseExpects(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseExpects{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled TestCaseExpects + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj TestCaseExpects + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj TestCaseExpects + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingTestCaseImplementation(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseImplementation{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled TestCaseImplementation + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj TestCaseImplementation + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj TestCaseImplementation + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingTestCaseImplementationDescription(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseImplementationDescription{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled TestCaseImplementationDescription + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj TestCaseImplementationDescription + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj TestCaseImplementationDescription + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingTestCaseMetadata(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseMetadata{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled TestCaseMetadata + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj TestCaseMetadata + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj TestCaseMetadata + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingTestCaseTemplate(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseTemplate{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled TestCaseTemplate + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj TestCaseTemplate + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj TestCaseTemplate + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingTestCaseV2(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseV2{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled TestCaseV2 + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj TestCaseV2 + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj TestCaseV2 + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingTestCaseWithActualResultImplementation(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseWithActualResultImplementation{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled TestCaseWithActualResultImplementation + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj TestCaseWithActualResultImplementation + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj TestCaseWithActualResultImplementation + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingVoidFunctionDefinition(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionDefinition{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled VoidFunctionDefinition + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj VoidFunctionDefinition + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj VoidFunctionDefinition + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingVoidFunctionDefinitionThatTakesActualResult(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionDefinitionThatTakesActualResult{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled VoidFunctionDefinitionThatTakesActualResult + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj VoidFunctionDefinitionThatTakesActualResult + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj VoidFunctionDefinitionThatTakesActualResult + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestStringBasicCustomFiles(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &BasicCustomFiles{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BasicCustomFiles + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringBasicTestCaseTemplate(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &BasicTestCaseTemplate{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BasicTestCaseTemplate + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringDeepEqualityCorrectnessCheck(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &DeepEqualityCorrectnessCheck{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DeepEqualityCorrectnessCheck + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringFileInfoV2(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &FileInfoV2{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FileInfoV2 + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringFiles(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &Files{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *Files + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringFunctionImplementation(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &FunctionImplementation{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FunctionImplementation + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringFunctionImplementationForMultipleLanguages(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &FunctionImplementationForMultipleLanguages{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FunctionImplementationForMultipleLanguages + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringGeneratedFiles(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &GeneratedFiles{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GeneratedFiles + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringNonVoidFunctionDefinition(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &NonVoidFunctionDefinition{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *NonVoidFunctionDefinition + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringNonVoidFunctionSignature(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &NonVoidFunctionSignature{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *NonVoidFunctionSignature + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringParameter(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &Parameter{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *Parameter + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringProblemInfoV2(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &ProblemInfoV2{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemInfoV2 + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringTestCaseExpects(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &TestCaseExpects{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseExpects + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringTestCaseImplementation(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &TestCaseImplementation{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseImplementation + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringTestCaseImplementationDescription(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &TestCaseImplementationDescription{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseImplementationDescription + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringTestCaseMetadata(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &TestCaseMetadata{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseMetadata + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringTestCaseTemplate(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &TestCaseTemplate{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseTemplate + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringTestCaseV2(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &TestCaseV2{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseV2 + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringTestCaseWithActualResultImplementation(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &TestCaseWithActualResultImplementation{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseWithActualResultImplementation + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringVoidFunctionDefinition(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &VoidFunctionDefinition{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VoidFunctionDefinition + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringVoidFunctionDefinitionThatTakesActualResult(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &VoidFunctionDefinitionThatTakesActualResult{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VoidFunctionDefinitionThatTakesActualResult + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestExtraPropertiesBasicCustomFiles(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &BasicCustomFiles{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BasicCustomFiles + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesBasicTestCaseTemplate(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &BasicTestCaseTemplate{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BasicTestCaseTemplate + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesDeepEqualityCorrectnessCheck(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &DeepEqualityCorrectnessCheck{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DeepEqualityCorrectnessCheck + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesFileInfoV2(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &FileInfoV2{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FileInfoV2 + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesFiles(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &Files{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *Files + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesFunctionImplementation(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &FunctionImplementation{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FunctionImplementation + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesFunctionImplementationForMultipleLanguages(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &FunctionImplementationForMultipleLanguages{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FunctionImplementationForMultipleLanguages + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesGeneratedFiles(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &GeneratedFiles{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GeneratedFiles + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesNonVoidFunctionDefinition(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &NonVoidFunctionDefinition{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *NonVoidFunctionDefinition + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesNonVoidFunctionSignature(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &NonVoidFunctionSignature{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *NonVoidFunctionSignature + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesParameter(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &Parameter{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *Parameter + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesProblemInfoV2(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &ProblemInfoV2{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemInfoV2 + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesTestCaseExpects(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &TestCaseExpects{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseExpects + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesTestCaseImplementation(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &TestCaseImplementation{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseImplementation + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesTestCaseImplementationDescription(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &TestCaseImplementationDescription{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseImplementationDescription + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesTestCaseMetadata(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &TestCaseMetadata{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseMetadata + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesTestCaseTemplate(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &TestCaseTemplate{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseTemplate + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesTestCaseV2(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &TestCaseV2{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseV2 + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesTestCaseWithActualResultImplementation(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &TestCaseWithActualResultImplementation{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseWithActualResultImplementation + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesVoidFunctionDefinition(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &VoidFunctionDefinition{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VoidFunctionDefinition + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesVoidFunctionDefinitionThatTakesActualResult(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &VoidFunctionDefinitionThatTakesActualResult{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VoidFunctionDefinitionThatTakesActualResult + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} diff --git a/seed/go-sdk/trace/commons.go b/seed/go-sdk/trace/commons.go new file mode 100644 index 000000000000..d8c5d82e6fd4 --- /dev/null +++ b/seed/go-sdk/trace/commons.go @@ -0,0 +1,1355 @@ +// Code generated by Fern. DO NOT EDIT. + +package trace + +import ( + json "encoding/json" + fmt "fmt" + common "github.com/trace/fern/common" + internal "github.com/trace/fern/internal" + big "math/big" +) + +var ( + binaryTreeNodeAndTreeValueFieldNodeID = big.NewInt(1 << 0) + binaryTreeNodeAndTreeValueFieldFullTree = big.NewInt(1 << 1) +) + +type BinaryTreeNodeAndTreeValue struct { + NodeID common.NodeID `json:"nodeId" url:"nodeId"` + FullTree *common.BinaryTreeValue `json:"fullTree" url:"fullTree"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (b *BinaryTreeNodeAndTreeValue) GetNodeID() common.NodeID { + if b == nil { + return "" + } + return b.NodeID +} + +func (b *BinaryTreeNodeAndTreeValue) GetFullTree() *common.BinaryTreeValue { + if b == nil { + return nil + } + return b.FullTree +} + +func (b *BinaryTreeNodeAndTreeValue) GetExtraProperties() map[string]interface{} { + if b == nil { + return nil + } + return b.extraProperties +} + +func (b *BinaryTreeNodeAndTreeValue) require(field *big.Int) { + if b.explicitFields == nil { + b.explicitFields = big.NewInt(0) + } + b.explicitFields.Or(b.explicitFields, field) +} + +// SetNodeID sets the NodeID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BinaryTreeNodeAndTreeValue) SetNodeID(nodeID common.NodeID) { + b.NodeID = nodeID + b.require(binaryTreeNodeAndTreeValueFieldNodeID) +} + +// SetFullTree sets the FullTree field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BinaryTreeNodeAndTreeValue) SetFullTree(fullTree *common.BinaryTreeValue) { + b.FullTree = fullTree + b.require(binaryTreeNodeAndTreeValueFieldFullTree) +} + +func (b *BinaryTreeNodeAndTreeValue) UnmarshalJSON(data []byte) error { + type unmarshaler BinaryTreeNodeAndTreeValue + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *b = BinaryTreeNodeAndTreeValue(value) + extraProperties, err := internal.ExtractExtraProperties(data, *b) + if err != nil { + return err + } + b.extraProperties = extraProperties + b.rawJSON = json.RawMessage(data) + return nil +} + +func (b *BinaryTreeNodeAndTreeValue) MarshalJSON() ([]byte, error) { + type embed BinaryTreeNodeAndTreeValue + var marshaler = struct { + embed + }{ + embed: embed(*b), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, b.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (b *BinaryTreeNodeAndTreeValue) String() string { + if b == nil { + return "" + } + if len(b.rawJSON) > 0 { + if value, err := internal.StringifyJSON(b.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(b); err == nil { + return value + } + return fmt.Sprintf("%#v", b) +} + +var ( + debugKeyValuePairsFieldKey = big.NewInt(1 << 0) + debugKeyValuePairsFieldValue = big.NewInt(1 << 1) +) + +type DebugKeyValuePairs struct { + Key *DebugVariableValue `json:"key" url:"key"` + Value *DebugVariableValue `json:"value" url:"value"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (d *DebugKeyValuePairs) GetKey() *DebugVariableValue { + if d == nil { + return nil + } + return d.Key +} + +func (d *DebugKeyValuePairs) GetValue() *DebugVariableValue { + if d == nil { + return nil + } + return d.Value +} + +func (d *DebugKeyValuePairs) GetExtraProperties() map[string]interface{} { + if d == nil { + return nil + } + return d.extraProperties +} + +func (d *DebugKeyValuePairs) require(field *big.Int) { + if d.explicitFields == nil { + d.explicitFields = big.NewInt(0) + } + d.explicitFields.Or(d.explicitFields, field) +} + +// SetKey sets the Key field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (d *DebugKeyValuePairs) SetKey(key *DebugVariableValue) { + d.Key = key + d.require(debugKeyValuePairsFieldKey) +} + +// SetValue sets the Value field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (d *DebugKeyValuePairs) SetValue(value *DebugVariableValue) { + d.Value = value + d.require(debugKeyValuePairsFieldValue) +} + +func (d *DebugKeyValuePairs) UnmarshalJSON(data []byte) error { + type unmarshaler DebugKeyValuePairs + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DebugKeyValuePairs(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) + return nil +} + +func (d *DebugKeyValuePairs) MarshalJSON() ([]byte, error) { + type embed DebugKeyValuePairs + var marshaler = struct { + embed + }{ + embed: embed(*d), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, d.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (d *DebugKeyValuePairs) String() string { + if d == nil { + return "" + } + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +var ( + debugMapValueFieldKeyValuePairs = big.NewInt(1 << 0) +) + +type DebugMapValue struct { + KeyValuePairs []*DebugKeyValuePairs `json:"keyValuePairs" url:"keyValuePairs"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (d *DebugMapValue) GetKeyValuePairs() []*DebugKeyValuePairs { + if d == nil { + return nil + } + return d.KeyValuePairs +} + +func (d *DebugMapValue) GetExtraProperties() map[string]interface{} { + if d == nil { + return nil + } + return d.extraProperties +} + +func (d *DebugMapValue) require(field *big.Int) { + if d.explicitFields == nil { + d.explicitFields = big.NewInt(0) + } + d.explicitFields.Or(d.explicitFields, field) +} + +// SetKeyValuePairs sets the KeyValuePairs field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (d *DebugMapValue) SetKeyValuePairs(keyValuePairs []*DebugKeyValuePairs) { + d.KeyValuePairs = keyValuePairs + d.require(debugMapValueFieldKeyValuePairs) +} + +func (d *DebugMapValue) UnmarshalJSON(data []byte) error { + type unmarshaler DebugMapValue + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DebugMapValue(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) + return nil +} + +func (d *DebugMapValue) MarshalJSON() ([]byte, error) { + type embed DebugMapValue + var marshaler = struct { + embed + }{ + embed: embed(*d), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, d.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (d *DebugMapValue) String() string { + if d == nil { + return "" + } + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type DebugVariableValue struct { + Type string + IntegerValue int + BooleanValue bool + DoubleValue float64 + StringValue string + CharValue string + MapValue *DebugMapValue + ListValue []*DebugVariableValue + BinaryTreeNodeValue *BinaryTreeNodeAndTreeValue + SinglyLinkedListNodeValue *SinglyLinkedListNodeAndListValue + DoublyLinkedListNodeValue *DoublyLinkedListNodeAndListValue + UndefinedValue interface{} + NullValue interface{} + GenericValue *GenericValue + + rawJSON json.RawMessage +} + +func (d *DebugVariableValue) GetType() string { + if d == nil { + return "" + } + return d.Type +} + +func (d *DebugVariableValue) GetIntegerValue() int { + if d == nil { + return 0 + } + return d.IntegerValue +} + +func (d *DebugVariableValue) GetBooleanValue() bool { + if d == nil { + return false + } + return d.BooleanValue +} + +func (d *DebugVariableValue) GetDoubleValue() float64 { + if d == nil { + return 0 + } + return d.DoubleValue +} + +func (d *DebugVariableValue) GetStringValue() string { + if d == nil { + return "" + } + return d.StringValue +} + +func (d *DebugVariableValue) GetCharValue() string { + if d == nil { + return "" + } + return d.CharValue +} + +func (d *DebugVariableValue) GetMapValue() *DebugMapValue { + if d == nil { + return nil + } + return d.MapValue +} + +func (d *DebugVariableValue) GetListValue() []*DebugVariableValue { + if d == nil { + return nil + } + return d.ListValue +} + +func (d *DebugVariableValue) GetBinaryTreeNodeValue() *BinaryTreeNodeAndTreeValue { + if d == nil { + return nil + } + return d.BinaryTreeNodeValue +} + +func (d *DebugVariableValue) GetSinglyLinkedListNodeValue() *SinglyLinkedListNodeAndListValue { + if d == nil { + return nil + } + return d.SinglyLinkedListNodeValue +} + +func (d *DebugVariableValue) GetDoublyLinkedListNodeValue() *DoublyLinkedListNodeAndListValue { + if d == nil { + return nil + } + return d.DoublyLinkedListNodeValue +} + +func (d *DebugVariableValue) GetUndefinedValue() interface{} { + if d == nil { + return nil + } + return d.UndefinedValue +} + +func (d *DebugVariableValue) GetNullValue() interface{} { + if d == nil { + return nil + } + return d.NullValue +} + +func (d *DebugVariableValue) GetGenericValue() *GenericValue { + if d == nil { + return nil + } + return d.GenericValue +} + +func (d *DebugVariableValue) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + d.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", d) + } + switch unmarshaler.Type { + case "integerValue": + var valueUnmarshaler struct { + IntegerValue int `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + d.IntegerValue = valueUnmarshaler.IntegerValue + case "booleanValue": + var valueUnmarshaler struct { + BooleanValue bool `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + d.BooleanValue = valueUnmarshaler.BooleanValue + case "doubleValue": + var valueUnmarshaler struct { + DoubleValue float64 `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + d.DoubleValue = valueUnmarshaler.DoubleValue + case "stringValue": + var valueUnmarshaler struct { + StringValue string `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + d.StringValue = valueUnmarshaler.StringValue + case "charValue": + var valueUnmarshaler struct { + CharValue string `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + d.CharValue = valueUnmarshaler.CharValue + case "mapValue": + value := new(DebugMapValue) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + d.MapValue = value + case "listValue": + var valueUnmarshaler struct { + ListValue []*DebugVariableValue `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + d.ListValue = valueUnmarshaler.ListValue + case "binaryTreeNodeValue": + value := new(BinaryTreeNodeAndTreeValue) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + d.BinaryTreeNodeValue = value + case "singlyLinkedListNodeValue": + value := new(SinglyLinkedListNodeAndListValue) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + d.SinglyLinkedListNodeValue = value + case "doublyLinkedListNodeValue": + value := new(DoublyLinkedListNodeAndListValue) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + d.DoublyLinkedListNodeValue = value + case "undefinedValue": + value := make(map[string]interface{}) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + d.UndefinedValue = value + case "nullValue": + value := make(map[string]interface{}) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + d.NullValue = value + case "genericValue": + value := new(GenericValue) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + d.GenericValue = value + } + d.rawJSON = json.RawMessage(data) + return nil +} + +func (d DebugVariableValue) MarshalJSON() ([]byte, error) { + if err := d.validate(); err != nil { + return nil, err + } + if d.IntegerValue != 0 { + var marshaler = struct { + Type string `json:"type"` + IntegerValue int `json:"value"` + }{ + Type: "integerValue", + IntegerValue: d.IntegerValue, + } + return json.Marshal(marshaler) + } + if d.BooleanValue != false { + var marshaler = struct { + Type string `json:"type"` + BooleanValue bool `json:"value"` + }{ + Type: "booleanValue", + BooleanValue: d.BooleanValue, + } + return json.Marshal(marshaler) + } + if d.DoubleValue != 0 { + var marshaler = struct { + Type string `json:"type"` + DoubleValue float64 `json:"value"` + }{ + Type: "doubleValue", + DoubleValue: d.DoubleValue, + } + return json.Marshal(marshaler) + } + if d.StringValue != "" { + var marshaler = struct { + Type string `json:"type"` + StringValue string `json:"value"` + }{ + Type: "stringValue", + StringValue: d.StringValue, + } + return json.Marshal(marshaler) + } + if d.CharValue != "" { + var marshaler = struct { + Type string `json:"type"` + CharValue string `json:"value"` + }{ + Type: "charValue", + CharValue: d.CharValue, + } + return json.Marshal(marshaler) + } + if d.MapValue != nil { + return internal.MarshalJSONWithExtraProperty(d.MapValue, "type", "mapValue") + } + if d.ListValue != nil { + var marshaler = struct { + Type string `json:"type"` + ListValue []*DebugVariableValue `json:"value"` + }{ + Type: "listValue", + ListValue: d.ListValue, + } + return json.Marshal(marshaler) + } + if d.BinaryTreeNodeValue != nil { + return internal.MarshalJSONWithExtraProperty(d.BinaryTreeNodeValue, "type", "binaryTreeNodeValue") + } + if d.SinglyLinkedListNodeValue != nil { + return internal.MarshalJSONWithExtraProperty(d.SinglyLinkedListNodeValue, "type", "singlyLinkedListNodeValue") + } + if d.DoublyLinkedListNodeValue != nil { + return internal.MarshalJSONWithExtraProperty(d.DoublyLinkedListNodeValue, "type", "doublyLinkedListNodeValue") + } + if d.UndefinedValue != nil { + var marshaler = struct { + Type string `json:"type"` + UndefinedValue interface{} `json:"undefinedValue,omitempty"` + }{ + Type: "undefinedValue", + UndefinedValue: d.UndefinedValue, + } + return json.Marshal(marshaler) + } + if d.NullValue != nil { + var marshaler = struct { + Type string `json:"type"` + NullValue interface{} `json:"nullValue,omitempty"` + }{ + Type: "nullValue", + NullValue: d.NullValue, + } + return json.Marshal(marshaler) + } + if d.GenericValue != nil { + return internal.MarshalJSONWithExtraProperty(d.GenericValue, "type", "genericValue") + } + if len(d.rawJSON) > 0 { + return d.rawJSON, nil + } + return nil, fmt.Errorf("type %T does not define a non-empty union type", d) +} + +type DebugVariableValueVisitor interface { + VisitIntegerValue(int) error + VisitBooleanValue(bool) error + VisitDoubleValue(float64) error + VisitStringValue(string) error + VisitCharValue(string) error + VisitMapValue(*DebugMapValue) error + VisitListValue([]*DebugVariableValue) error + VisitBinaryTreeNodeValue(*BinaryTreeNodeAndTreeValue) error + VisitSinglyLinkedListNodeValue(*SinglyLinkedListNodeAndListValue) error + VisitDoublyLinkedListNodeValue(*DoublyLinkedListNodeAndListValue) error + VisitUndefinedValue(interface{}) error + VisitNullValue(interface{}) error + VisitGenericValue(*GenericValue) error +} + +func (d *DebugVariableValue) Accept(visitor DebugVariableValueVisitor) error { + if d.IntegerValue != 0 { + return visitor.VisitIntegerValue(d.IntegerValue) + } + if d.BooleanValue != false { + return visitor.VisitBooleanValue(d.BooleanValue) + } + if d.DoubleValue != 0 { + return visitor.VisitDoubleValue(d.DoubleValue) + } + if d.StringValue != "" { + return visitor.VisitStringValue(d.StringValue) + } + if d.CharValue != "" { + return visitor.VisitCharValue(d.CharValue) + } + if d.MapValue != nil { + return visitor.VisitMapValue(d.MapValue) + } + if d.ListValue != nil { + return visitor.VisitListValue(d.ListValue) + } + if d.BinaryTreeNodeValue != nil { + return visitor.VisitBinaryTreeNodeValue(d.BinaryTreeNodeValue) + } + if d.SinglyLinkedListNodeValue != nil { + return visitor.VisitSinglyLinkedListNodeValue(d.SinglyLinkedListNodeValue) + } + if d.DoublyLinkedListNodeValue != nil { + return visitor.VisitDoublyLinkedListNodeValue(d.DoublyLinkedListNodeValue) + } + if d.UndefinedValue != nil { + return visitor.VisitUndefinedValue(d.UndefinedValue) + } + if d.NullValue != nil { + return visitor.VisitNullValue(d.NullValue) + } + if d.GenericValue != nil { + return visitor.VisitGenericValue(d.GenericValue) + } + return fmt.Errorf("type %T does not define a non-empty union type", d) +} + +func (d *DebugVariableValue) validate() error { + if d == nil { + return fmt.Errorf("type %T is nil", d) + } + var fields []string + if d.IntegerValue != 0 { + fields = append(fields, "integerValue") + } + if d.BooleanValue != false { + fields = append(fields, "booleanValue") + } + if d.DoubleValue != 0 { + fields = append(fields, "doubleValue") + } + if d.StringValue != "" { + fields = append(fields, "stringValue") + } + if d.CharValue != "" { + fields = append(fields, "charValue") + } + if d.MapValue != nil { + fields = append(fields, "mapValue") + } + if d.ListValue != nil { + fields = append(fields, "listValue") + } + if d.BinaryTreeNodeValue != nil { + fields = append(fields, "binaryTreeNodeValue") + } + if d.SinglyLinkedListNodeValue != nil { + fields = append(fields, "singlyLinkedListNodeValue") + } + if d.DoublyLinkedListNodeValue != nil { + fields = append(fields, "doublyLinkedListNodeValue") + } + if d.UndefinedValue != nil { + fields = append(fields, "undefinedValue") + } + if d.NullValue != nil { + fields = append(fields, "nullValue") + } + if d.GenericValue != nil { + fields = append(fields, "genericValue") + } + if len(fields) == 0 { + if d.Type != "" { + if len(d.rawJSON) > 0 { + return nil + } + return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", d, d.Type) + } + return fmt.Errorf("type %T is empty", d) + } + if len(fields) > 1 { + return fmt.Errorf("type %T defines values for %s, but only one value is allowed", d, fields) + } + if d.Type != "" { + field := fields[0] + if d.Type != field { + return fmt.Errorf( + "type %T defines a discriminant set to %q, but it does not match the %T field; either remove or update the discriminant to match", + d, + d.Type, + d, + ) + } + } + return nil +} + +var ( + doublyLinkedListNodeAndListValueFieldNodeID = big.NewInt(1 << 0) + doublyLinkedListNodeAndListValueFieldFullList = big.NewInt(1 << 1) +) + +type DoublyLinkedListNodeAndListValue struct { + NodeID common.NodeID `json:"nodeId" url:"nodeId"` + FullList *common.DoublyLinkedListValue `json:"fullList" url:"fullList"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (d *DoublyLinkedListNodeAndListValue) GetNodeID() common.NodeID { + if d == nil { + return "" + } + return d.NodeID +} + +func (d *DoublyLinkedListNodeAndListValue) GetFullList() *common.DoublyLinkedListValue { + if d == nil { + return nil + } + return d.FullList +} + +func (d *DoublyLinkedListNodeAndListValue) GetExtraProperties() map[string]interface{} { + if d == nil { + return nil + } + return d.extraProperties +} + +func (d *DoublyLinkedListNodeAndListValue) require(field *big.Int) { + if d.explicitFields == nil { + d.explicitFields = big.NewInt(0) + } + d.explicitFields.Or(d.explicitFields, field) +} + +// SetNodeID sets the NodeID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (d *DoublyLinkedListNodeAndListValue) SetNodeID(nodeID common.NodeID) { + d.NodeID = nodeID + d.require(doublyLinkedListNodeAndListValueFieldNodeID) +} + +// SetFullList sets the FullList field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (d *DoublyLinkedListNodeAndListValue) SetFullList(fullList *common.DoublyLinkedListValue) { + d.FullList = fullList + d.require(doublyLinkedListNodeAndListValueFieldFullList) +} + +func (d *DoublyLinkedListNodeAndListValue) UnmarshalJSON(data []byte) error { + type unmarshaler DoublyLinkedListNodeAndListValue + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DoublyLinkedListNodeAndListValue(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) + return nil +} + +func (d *DoublyLinkedListNodeAndListValue) MarshalJSON() ([]byte, error) { + type embed DoublyLinkedListNodeAndListValue + var marshaler = struct { + embed + }{ + embed: embed(*d), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, d.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (d *DoublyLinkedListNodeAndListValue) String() string { + if d == nil { + return "" + } + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +var ( + fileInfoFieldFilename = big.NewInt(1 << 0) + fileInfoFieldContents = big.NewInt(1 << 1) +) + +type FileInfo struct { + Filename string `json:"filename" url:"filename"` + Contents string `json:"contents" url:"contents"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (f *FileInfo) GetFilename() string { + if f == nil { + return "" + } + return f.Filename +} + +func (f *FileInfo) GetContents() string { + if f == nil { + return "" + } + return f.Contents +} + +func (f *FileInfo) GetExtraProperties() map[string]interface{} { + if f == nil { + return nil + } + return f.extraProperties +} + +func (f *FileInfo) require(field *big.Int) { + if f.explicitFields == nil { + f.explicitFields = big.NewInt(0) + } + f.explicitFields.Or(f.explicitFields, field) +} + +// SetFilename sets the Filename field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (f *FileInfo) SetFilename(filename string) { + f.Filename = filename + f.require(fileInfoFieldFilename) +} + +// SetContents sets the Contents field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (f *FileInfo) SetContents(contents string) { + f.Contents = contents + f.require(fileInfoFieldContents) +} + +func (f *FileInfo) UnmarshalJSON(data []byte) error { + type unmarshaler FileInfo + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *f = FileInfo(value) + extraProperties, err := internal.ExtractExtraProperties(data, *f) + if err != nil { + return err + } + f.extraProperties = extraProperties + f.rawJSON = json.RawMessage(data) + return nil +} + +func (f *FileInfo) MarshalJSON() ([]byte, error) { + type embed FileInfo + var marshaler = struct { + embed + }{ + embed: embed(*f), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, f.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (f *FileInfo) String() string { + if f == nil { + return "" + } + if len(f.rawJSON) > 0 { + if value, err := internal.StringifyJSON(f.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(f); err == nil { + return value + } + return fmt.Sprintf("%#v", f) +} + +var ( + genericValueFieldStringifiedType = big.NewInt(1 << 0) + genericValueFieldStringifiedValue = big.NewInt(1 << 1) +) + +type GenericValue struct { + StringifiedType *string `json:"stringifiedType,omitempty" url:"stringifiedType,omitempty"` + StringifiedValue string `json:"stringifiedValue" url:"stringifiedValue"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (g *GenericValue) GetStringifiedType() *string { + if g == nil { + return nil + } + return g.StringifiedType +} + +func (g *GenericValue) GetStringifiedValue() string { + if g == nil { + return "" + } + return g.StringifiedValue +} + +func (g *GenericValue) GetExtraProperties() map[string]interface{} { + if g == nil { + return nil + } + return g.extraProperties +} + +func (g *GenericValue) require(field *big.Int) { + if g.explicitFields == nil { + g.explicitFields = big.NewInt(0) + } + g.explicitFields.Or(g.explicitFields, field) +} + +// SetStringifiedType sets the StringifiedType field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GenericValue) SetStringifiedType(stringifiedType *string) { + g.StringifiedType = stringifiedType + g.require(genericValueFieldStringifiedType) +} + +// SetStringifiedValue sets the StringifiedValue field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GenericValue) SetStringifiedValue(stringifiedValue string) { + g.StringifiedValue = stringifiedValue + g.require(genericValueFieldStringifiedValue) +} + +func (g *GenericValue) UnmarshalJSON(data []byte) error { + type unmarshaler GenericValue + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GenericValue(value) + extraProperties, err := internal.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + g.rawJSON = json.RawMessage(data) + return nil +} + +func (g *GenericValue) MarshalJSON() ([]byte, error) { + type embed GenericValue + var marshaler = struct { + embed + }{ + embed: embed(*g), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, g.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (g *GenericValue) String() string { + if g == nil { + return "" + } + if len(g.rawJSON) > 0 { + if value, err := internal.StringifyJSON(g.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +var ( + singlyLinkedListNodeAndListValueFieldNodeID = big.NewInt(1 << 0) + singlyLinkedListNodeAndListValueFieldFullList = big.NewInt(1 << 1) +) + +type SinglyLinkedListNodeAndListValue struct { + NodeID common.NodeID `json:"nodeId" url:"nodeId"` + FullList *common.SinglyLinkedListValue `json:"fullList" url:"fullList"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SinglyLinkedListNodeAndListValue) GetNodeID() common.NodeID { + if s == nil { + return "" + } + return s.NodeID +} + +func (s *SinglyLinkedListNodeAndListValue) GetFullList() *common.SinglyLinkedListValue { + if s == nil { + return nil + } + return s.FullList +} + +func (s *SinglyLinkedListNodeAndListValue) GetExtraProperties() map[string]interface{} { + if s == nil { + return nil + } + return s.extraProperties +} + +func (s *SinglyLinkedListNodeAndListValue) require(field *big.Int) { + if s.explicitFields == nil { + s.explicitFields = big.NewInt(0) + } + s.explicitFields.Or(s.explicitFields, field) +} + +// SetNodeID sets the NodeID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SinglyLinkedListNodeAndListValue) SetNodeID(nodeID common.NodeID) { + s.NodeID = nodeID + s.require(singlyLinkedListNodeAndListValueFieldNodeID) +} + +// SetFullList sets the FullList field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SinglyLinkedListNodeAndListValue) SetFullList(fullList *common.SinglyLinkedListValue) { + s.FullList = fullList + s.require(singlyLinkedListNodeAndListValueFieldFullList) +} + +func (s *SinglyLinkedListNodeAndListValue) UnmarshalJSON(data []byte) error { + type unmarshaler SinglyLinkedListNodeAndListValue + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SinglyLinkedListNodeAndListValue(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SinglyLinkedListNodeAndListValue) MarshalJSON() ([]byte, error) { + type embed SinglyLinkedListNodeAndListValue + var marshaler = struct { + embed + }{ + embed: embed(*s), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, s.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (s *SinglyLinkedListNodeAndListValue) String() string { + if s == nil { + return "" + } + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +var ( + testCaseFieldID = big.NewInt(1 << 0) + testCaseFieldParams = big.NewInt(1 << 1) +) + +type TestCase struct { + ID string `json:"id" url:"id"` + Params []*common.VariableValue `json:"params" url:"params"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TestCase) GetID() string { + if t == nil { + return "" + } + return t.ID +} + +func (t *TestCase) GetParams() []*common.VariableValue { + if t == nil { + return nil + } + return t.Params +} + +func (t *TestCase) GetExtraProperties() map[string]interface{} { + if t == nil { + return nil + } + return t.extraProperties +} + +func (t *TestCase) require(field *big.Int) { + if t.explicitFields == nil { + t.explicitFields = big.NewInt(0) + } + t.explicitFields.Or(t.explicitFields, field) +} + +// SetID sets the ID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCase) SetID(id string) { + t.ID = id + t.require(testCaseFieldID) +} + +// SetParams sets the Params field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCase) SetParams(params []*common.VariableValue) { + t.Params = params + t.require(testCaseFieldParams) +} + +func (t *TestCase) UnmarshalJSON(data []byte) error { + type unmarshaler TestCase + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TestCase(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TestCase) MarshalJSON() ([]byte, error) { + type embed TestCase + var marshaler = struct { + embed + }{ + embed: embed(*t), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, t.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (t *TestCase) String() string { + if t == nil { + return "" + } + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +var ( + testCaseWithExpectedResultFieldTestCase = big.NewInt(1 << 0) + testCaseWithExpectedResultFieldExpectedResult = big.NewInt(1 << 1) +) + +type TestCaseWithExpectedResult struct { + TestCase *TestCase `json:"testCase" url:"testCase"` + ExpectedResult *common.VariableValue `json:"expectedResult" url:"expectedResult"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TestCaseWithExpectedResult) GetTestCase() *TestCase { + if t == nil { + return nil + } + return t.TestCase +} + +func (t *TestCaseWithExpectedResult) GetExpectedResult() *common.VariableValue { + if t == nil { + return nil + } + return t.ExpectedResult +} + +func (t *TestCaseWithExpectedResult) GetExtraProperties() map[string]interface{} { + if t == nil { + return nil + } + return t.extraProperties +} + +func (t *TestCaseWithExpectedResult) require(field *big.Int) { + if t.explicitFields == nil { + t.explicitFields = big.NewInt(0) + } + t.explicitFields.Or(t.explicitFields, field) +} + +// SetTestCase sets the TestCase field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseWithExpectedResult) SetTestCase(testCase *TestCase) { + t.TestCase = testCase + t.require(testCaseWithExpectedResultFieldTestCase) +} + +// SetExpectedResult sets the ExpectedResult field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseWithExpectedResult) SetExpectedResult(expectedResult *common.VariableValue) { + t.ExpectedResult = expectedResult + t.require(testCaseWithExpectedResultFieldExpectedResult) +} + +func (t *TestCaseWithExpectedResult) UnmarshalJSON(data []byte) error { + type unmarshaler TestCaseWithExpectedResult + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TestCaseWithExpectedResult(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TestCaseWithExpectedResult) MarshalJSON() ([]byte, error) { + type embed TestCaseWithExpectedResult + var marshaler = struct { + embed + }{ + embed: embed(*t), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, t.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (t *TestCaseWithExpectedResult) String() string { + if t == nil { + return "" + } + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +type UserID = string diff --git a/seed/go-sdk/trace/commons_test.go b/seed/go-sdk/trace/commons_test.go new file mode 100644 index 000000000000..4ebd073c9f72 --- /dev/null +++ b/seed/go-sdk/trace/commons_test.go @@ -0,0 +1,2279 @@ +// Code generated by Fern. DO NOT EDIT. + +package trace + +import ( + json "encoding/json" + assert "github.com/stretchr/testify/assert" + require "github.com/stretchr/testify/require" + common "github.com/trace/fern/common" + testing "testing" +) + +func TestSettersBinaryTreeNodeAndTreeValue(t *testing.T) { + t.Run("SetNodeID", func(t *testing.T) { + obj := &BinaryTreeNodeAndTreeValue{} + var fernTestValueNodeID common.NodeID + obj.SetNodeID(fernTestValueNodeID) + assert.Equal(t, fernTestValueNodeID, obj.NodeID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetFullTree", func(t *testing.T) { + obj := &BinaryTreeNodeAndTreeValue{} + var fernTestValueFullTree *common.BinaryTreeValue + obj.SetFullTree(fernTestValueFullTree) + assert.Equal(t, fernTestValueFullTree, obj.FullTree) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersBinaryTreeNodeAndTreeValue(t *testing.T) { + t.Run("GetNodeID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BinaryTreeNodeAndTreeValue{} + var expected common.NodeID + obj.NodeID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetNodeID(), "getter should return the property value") + }) + + t.Run("GetNodeID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BinaryTreeNodeAndTreeValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetNodeID() // Should return zero value + }) + + t.Run("GetFullTree", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BinaryTreeNodeAndTreeValue{} + var expected *common.BinaryTreeValue + obj.FullTree = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetFullTree(), "getter should return the property value") + }) + + t.Run("GetFullTree_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BinaryTreeNodeAndTreeValue{} + obj.FullTree = nil + + // Act & Assert + assert.Nil(t, obj.GetFullTree(), "getter should return nil when property is nil") + }) + + t.Run("GetFullTree_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BinaryTreeNodeAndTreeValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetFullTree() // Should return zero value + }) + +} + +func TestSettersMarkExplicitBinaryTreeNodeAndTreeValue(t *testing.T) { + t.Run("SetNodeID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BinaryTreeNodeAndTreeValue{} + var fernTestValueNodeID common.NodeID + + // Act + obj.SetNodeID(fernTestValueNodeID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetFullTree_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BinaryTreeNodeAndTreeValue{} + var fernTestValueFullTree *common.BinaryTreeValue + + // Act + obj.SetFullTree(fernTestValueFullTree) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersDebugKeyValuePairs(t *testing.T) { + t.Run("SetKey", func(t *testing.T) { + obj := &DebugKeyValuePairs{} + var fernTestValueKey *DebugVariableValue + obj.SetKey(fernTestValueKey) + assert.Equal(t, fernTestValueKey, obj.Key) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetValue", func(t *testing.T) { + obj := &DebugKeyValuePairs{} + var fernTestValueValue *DebugVariableValue + obj.SetValue(fernTestValueValue) + assert.Equal(t, fernTestValueValue, obj.Value) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersDebugKeyValuePairs(t *testing.T) { + t.Run("GetKey", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DebugKeyValuePairs{} + var expected *DebugVariableValue + obj.Key = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetKey(), "getter should return the property value") + }) + + t.Run("GetKey_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DebugKeyValuePairs{} + obj.Key = nil + + // Act & Assert + assert.Nil(t, obj.GetKey(), "getter should return nil when property is nil") + }) + + t.Run("GetKey_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DebugKeyValuePairs + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetKey() // Should return zero value + }) + + t.Run("GetValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DebugKeyValuePairs{} + var expected *DebugVariableValue + obj.Value = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetValue(), "getter should return the property value") + }) + + t.Run("GetValue_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DebugKeyValuePairs{} + obj.Value = nil + + // Act & Assert + assert.Nil(t, obj.GetValue(), "getter should return nil when property is nil") + }) + + t.Run("GetValue_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DebugKeyValuePairs + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetValue() // Should return zero value + }) + +} + +func TestSettersMarkExplicitDebugKeyValuePairs(t *testing.T) { + t.Run("SetKey_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DebugKeyValuePairs{} + var fernTestValueKey *DebugVariableValue + + // Act + obj.SetKey(fernTestValueKey) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetValue_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DebugKeyValuePairs{} + var fernTestValueValue *DebugVariableValue + + // Act + obj.SetValue(fernTestValueValue) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersDebugMapValue(t *testing.T) { + t.Run("SetKeyValuePairs", func(t *testing.T) { + obj := &DebugMapValue{} + var fernTestValueKeyValuePairs []*DebugKeyValuePairs + obj.SetKeyValuePairs(fernTestValueKeyValuePairs) + assert.Equal(t, fernTestValueKeyValuePairs, obj.KeyValuePairs) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersDebugMapValue(t *testing.T) { + t.Run("GetKeyValuePairs", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DebugMapValue{} + var expected []*DebugKeyValuePairs + obj.KeyValuePairs = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetKeyValuePairs(), "getter should return the property value") + }) + + t.Run("GetKeyValuePairs_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DebugMapValue{} + obj.KeyValuePairs = nil + + // Act & Assert + assert.Nil(t, obj.GetKeyValuePairs(), "getter should return nil when property is nil") + }) + + t.Run("GetKeyValuePairs_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DebugMapValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetKeyValuePairs() // Should return zero value + }) + +} + +func TestSettersMarkExplicitDebugMapValue(t *testing.T) { + t.Run("SetKeyValuePairs_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DebugMapValue{} + var fernTestValueKeyValuePairs []*DebugKeyValuePairs + + // Act + obj.SetKeyValuePairs(fernTestValueKeyValuePairs) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestGettersDebugVariableValue(t *testing.T) { + t.Run("GetType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DebugVariableValue{} + var expected string + obj.Type = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetType(), "getter should return the property value") + }) + + t.Run("GetType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DebugVariableValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetType() // Should return zero value + }) + + t.Run("GetIntegerValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DebugVariableValue{} + var expected int + obj.IntegerValue = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetIntegerValue(), "getter should return the property value") + }) + + t.Run("GetIntegerValue_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DebugVariableValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetIntegerValue() // Should return zero value + }) + + t.Run("GetBooleanValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DebugVariableValue{} + var expected bool + obj.BooleanValue = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetBooleanValue(), "getter should return the property value") + }) + + t.Run("GetBooleanValue_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DebugVariableValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetBooleanValue() // Should return zero value + }) + + t.Run("GetDoubleValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DebugVariableValue{} + var expected float64 + obj.DoubleValue = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetDoubleValue(), "getter should return the property value") + }) + + t.Run("GetDoubleValue_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DebugVariableValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetDoubleValue() // Should return zero value + }) + + t.Run("GetStringValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DebugVariableValue{} + var expected string + obj.StringValue = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetStringValue(), "getter should return the property value") + }) + + t.Run("GetStringValue_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DebugVariableValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetStringValue() // Should return zero value + }) + + t.Run("GetCharValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DebugVariableValue{} + var expected string + obj.CharValue = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetCharValue(), "getter should return the property value") + }) + + t.Run("GetCharValue_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DebugVariableValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetCharValue() // Should return zero value + }) + + t.Run("GetMapValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DebugVariableValue{} + var expected *DebugMapValue + obj.MapValue = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetMapValue(), "getter should return the property value") + }) + + t.Run("GetMapValue_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DebugVariableValue{} + obj.MapValue = nil + + // Act & Assert + assert.Nil(t, obj.GetMapValue(), "getter should return nil when property is nil") + }) + + t.Run("GetMapValue_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DebugVariableValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetMapValue() // Should return zero value + }) + + t.Run("GetListValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DebugVariableValue{} + var expected []*DebugVariableValue + obj.ListValue = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetListValue(), "getter should return the property value") + }) + + t.Run("GetListValue_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DebugVariableValue{} + obj.ListValue = nil + + // Act & Assert + assert.Nil(t, obj.GetListValue(), "getter should return nil when property is nil") + }) + + t.Run("GetListValue_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DebugVariableValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetListValue() // Should return zero value + }) + + t.Run("GetBinaryTreeNodeValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DebugVariableValue{} + var expected *BinaryTreeNodeAndTreeValue + obj.BinaryTreeNodeValue = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetBinaryTreeNodeValue(), "getter should return the property value") + }) + + t.Run("GetBinaryTreeNodeValue_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DebugVariableValue{} + obj.BinaryTreeNodeValue = nil + + // Act & Assert + assert.Nil(t, obj.GetBinaryTreeNodeValue(), "getter should return nil when property is nil") + }) + + t.Run("GetBinaryTreeNodeValue_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DebugVariableValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetBinaryTreeNodeValue() // Should return zero value + }) + + t.Run("GetSinglyLinkedListNodeValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DebugVariableValue{} + var expected *SinglyLinkedListNodeAndListValue + obj.SinglyLinkedListNodeValue = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSinglyLinkedListNodeValue(), "getter should return the property value") + }) + + t.Run("GetSinglyLinkedListNodeValue_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DebugVariableValue{} + obj.SinglyLinkedListNodeValue = nil + + // Act & Assert + assert.Nil(t, obj.GetSinglyLinkedListNodeValue(), "getter should return nil when property is nil") + }) + + t.Run("GetSinglyLinkedListNodeValue_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DebugVariableValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSinglyLinkedListNodeValue() // Should return zero value + }) + + t.Run("GetDoublyLinkedListNodeValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DebugVariableValue{} + var expected *DoublyLinkedListNodeAndListValue + obj.DoublyLinkedListNodeValue = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetDoublyLinkedListNodeValue(), "getter should return the property value") + }) + + t.Run("GetDoublyLinkedListNodeValue_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DebugVariableValue{} + obj.DoublyLinkedListNodeValue = nil + + // Act & Assert + assert.Nil(t, obj.GetDoublyLinkedListNodeValue(), "getter should return nil when property is nil") + }) + + t.Run("GetDoublyLinkedListNodeValue_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DebugVariableValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetDoublyLinkedListNodeValue() // Should return zero value + }) + + t.Run("GetUndefinedValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DebugVariableValue{} + var expected interface{} + obj.UndefinedValue = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetUndefinedValue(), "getter should return the property value") + }) + + t.Run("GetUndefinedValue_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DebugVariableValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetUndefinedValue() // Should return zero value + }) + + t.Run("GetNullValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DebugVariableValue{} + var expected interface{} + obj.NullValue = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetNullValue(), "getter should return the property value") + }) + + t.Run("GetNullValue_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DebugVariableValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetNullValue() // Should return zero value + }) + + t.Run("GetGenericValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DebugVariableValue{} + var expected *GenericValue + obj.GenericValue = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetGenericValue(), "getter should return the property value") + }) + + t.Run("GetGenericValue_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DebugVariableValue{} + obj.GenericValue = nil + + // Act & Assert + assert.Nil(t, obj.GetGenericValue(), "getter should return nil when property is nil") + }) + + t.Run("GetGenericValue_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DebugVariableValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetGenericValue() // Should return zero value + }) + +} + +func TestSettersDoublyLinkedListNodeAndListValue(t *testing.T) { + t.Run("SetNodeID", func(t *testing.T) { + obj := &DoublyLinkedListNodeAndListValue{} + var fernTestValueNodeID common.NodeID + obj.SetNodeID(fernTestValueNodeID) + assert.Equal(t, fernTestValueNodeID, obj.NodeID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetFullList", func(t *testing.T) { + obj := &DoublyLinkedListNodeAndListValue{} + var fernTestValueFullList *common.DoublyLinkedListValue + obj.SetFullList(fernTestValueFullList) + assert.Equal(t, fernTestValueFullList, obj.FullList) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersDoublyLinkedListNodeAndListValue(t *testing.T) { + t.Run("GetNodeID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DoublyLinkedListNodeAndListValue{} + var expected common.NodeID + obj.NodeID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetNodeID(), "getter should return the property value") + }) + + t.Run("GetNodeID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DoublyLinkedListNodeAndListValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetNodeID() // Should return zero value + }) + + t.Run("GetFullList", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DoublyLinkedListNodeAndListValue{} + var expected *common.DoublyLinkedListValue + obj.FullList = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetFullList(), "getter should return the property value") + }) + + t.Run("GetFullList_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DoublyLinkedListNodeAndListValue{} + obj.FullList = nil + + // Act & Assert + assert.Nil(t, obj.GetFullList(), "getter should return nil when property is nil") + }) + + t.Run("GetFullList_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DoublyLinkedListNodeAndListValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetFullList() // Should return zero value + }) + +} + +func TestSettersMarkExplicitDoublyLinkedListNodeAndListValue(t *testing.T) { + t.Run("SetNodeID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DoublyLinkedListNodeAndListValue{} + var fernTestValueNodeID common.NodeID + + // Act + obj.SetNodeID(fernTestValueNodeID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetFullList_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DoublyLinkedListNodeAndListValue{} + var fernTestValueFullList *common.DoublyLinkedListValue + + // Act + obj.SetFullList(fernTestValueFullList) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersFileInfo(t *testing.T) { + t.Run("SetFilename", func(t *testing.T) { + obj := &FileInfo{} + var fernTestValueFilename string + obj.SetFilename(fernTestValueFilename) + assert.Equal(t, fernTestValueFilename, obj.Filename) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetContents", func(t *testing.T) { + obj := &FileInfo{} + var fernTestValueContents string + obj.SetContents(fernTestValueContents) + assert.Equal(t, fernTestValueContents, obj.Contents) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersFileInfo(t *testing.T) { + t.Run("GetFilename", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FileInfo{} + var expected string + obj.Filename = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetFilename(), "getter should return the property value") + }) + + t.Run("GetFilename_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FileInfo + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetFilename() // Should return zero value + }) + + t.Run("GetContents", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FileInfo{} + var expected string + obj.Contents = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetContents(), "getter should return the property value") + }) + + t.Run("GetContents_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FileInfo + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetContents() // Should return zero value + }) + +} + +func TestSettersMarkExplicitFileInfo(t *testing.T) { + t.Run("SetFilename_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FileInfo{} + var fernTestValueFilename string + + // Act + obj.SetFilename(fernTestValueFilename) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetContents_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FileInfo{} + var fernTestValueContents string + + // Act + obj.SetContents(fernTestValueContents) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersGenericValue(t *testing.T) { + t.Run("SetStringifiedType", func(t *testing.T) { + obj := &GenericValue{} + var fernTestValueStringifiedType *string + obj.SetStringifiedType(fernTestValueStringifiedType) + assert.Equal(t, fernTestValueStringifiedType, obj.StringifiedType) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetStringifiedValue", func(t *testing.T) { + obj := &GenericValue{} + var fernTestValueStringifiedValue string + obj.SetStringifiedValue(fernTestValueStringifiedValue) + assert.Equal(t, fernTestValueStringifiedValue, obj.StringifiedValue) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersGenericValue(t *testing.T) { + t.Run("GetStringifiedType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GenericValue{} + var expected *string + obj.StringifiedType = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetStringifiedType(), "getter should return the property value") + }) + + t.Run("GetStringifiedType_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GenericValue{} + obj.StringifiedType = nil + + // Act & Assert + assert.Nil(t, obj.GetStringifiedType(), "getter should return nil when property is nil") + }) + + t.Run("GetStringifiedType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GenericValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetStringifiedType() // Should return zero value + }) + + t.Run("GetStringifiedValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GenericValue{} + var expected string + obj.StringifiedValue = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetStringifiedValue(), "getter should return the property value") + }) + + t.Run("GetStringifiedValue_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GenericValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetStringifiedValue() // Should return zero value + }) + +} + +func TestSettersMarkExplicitGenericValue(t *testing.T) { + t.Run("SetStringifiedType_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GenericValue{} + var fernTestValueStringifiedType *string + + // Act + obj.SetStringifiedType(fernTestValueStringifiedType) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetStringifiedValue_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GenericValue{} + var fernTestValueStringifiedValue string + + // Act + obj.SetStringifiedValue(fernTestValueStringifiedValue) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersSinglyLinkedListNodeAndListValue(t *testing.T) { + t.Run("SetNodeID", func(t *testing.T) { + obj := &SinglyLinkedListNodeAndListValue{} + var fernTestValueNodeID common.NodeID + obj.SetNodeID(fernTestValueNodeID) + assert.Equal(t, fernTestValueNodeID, obj.NodeID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetFullList", func(t *testing.T) { + obj := &SinglyLinkedListNodeAndListValue{} + var fernTestValueFullList *common.SinglyLinkedListValue + obj.SetFullList(fernTestValueFullList) + assert.Equal(t, fernTestValueFullList, obj.FullList) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersSinglyLinkedListNodeAndListValue(t *testing.T) { + t.Run("GetNodeID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SinglyLinkedListNodeAndListValue{} + var expected common.NodeID + obj.NodeID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetNodeID(), "getter should return the property value") + }) + + t.Run("GetNodeID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SinglyLinkedListNodeAndListValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetNodeID() // Should return zero value + }) + + t.Run("GetFullList", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SinglyLinkedListNodeAndListValue{} + var expected *common.SinglyLinkedListValue + obj.FullList = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetFullList(), "getter should return the property value") + }) + + t.Run("GetFullList_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SinglyLinkedListNodeAndListValue{} + obj.FullList = nil + + // Act & Assert + assert.Nil(t, obj.GetFullList(), "getter should return nil when property is nil") + }) + + t.Run("GetFullList_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SinglyLinkedListNodeAndListValue + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetFullList() // Should return zero value + }) + +} + +func TestSettersMarkExplicitSinglyLinkedListNodeAndListValue(t *testing.T) { + t.Run("SetNodeID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SinglyLinkedListNodeAndListValue{} + var fernTestValueNodeID common.NodeID + + // Act + obj.SetNodeID(fernTestValueNodeID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetFullList_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SinglyLinkedListNodeAndListValue{} + var fernTestValueFullList *common.SinglyLinkedListValue + + // Act + obj.SetFullList(fernTestValueFullList) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersTestCase(t *testing.T) { + t.Run("SetID", func(t *testing.T) { + obj := &TestCase{} + var fernTestValueID string + obj.SetID(fernTestValueID) + assert.Equal(t, fernTestValueID, obj.ID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetParams", func(t *testing.T) { + obj := &TestCase{} + var fernTestValueParams []*common.VariableValue + obj.SetParams(fernTestValueParams) + assert.Equal(t, fernTestValueParams, obj.Params) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersTestCase(t *testing.T) { + t.Run("GetID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCase{} + var expected string + obj.ID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetID(), "getter should return the property value") + }) + + t.Run("GetID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCase + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetID() // Should return zero value + }) + + t.Run("GetParams", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCase{} + var expected []*common.VariableValue + obj.Params = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetParams(), "getter should return the property value") + }) + + t.Run("GetParams_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCase{} + obj.Params = nil + + // Act & Assert + assert.Nil(t, obj.GetParams(), "getter should return nil when property is nil") + }) + + t.Run("GetParams_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCase + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetParams() // Should return zero value + }) + +} + +func TestSettersMarkExplicitTestCase(t *testing.T) { + t.Run("SetID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCase{} + var fernTestValueID string + + // Act + obj.SetID(fernTestValueID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetParams_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCase{} + var fernTestValueParams []*common.VariableValue + + // Act + obj.SetParams(fernTestValueParams) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersTestCaseWithExpectedResult(t *testing.T) { + t.Run("SetTestCase", func(t *testing.T) { + obj := &TestCaseWithExpectedResult{} + var fernTestValueTestCase *TestCase + obj.SetTestCase(fernTestValueTestCase) + assert.Equal(t, fernTestValueTestCase, obj.TestCase) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetExpectedResult", func(t *testing.T) { + obj := &TestCaseWithExpectedResult{} + var fernTestValueExpectedResult *common.VariableValue + obj.SetExpectedResult(fernTestValueExpectedResult) + assert.Equal(t, fernTestValueExpectedResult, obj.ExpectedResult) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersTestCaseWithExpectedResult(t *testing.T) { + t.Run("GetTestCase", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseWithExpectedResult{} + var expected *TestCase + obj.TestCase = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTestCase(), "getter should return the property value") + }) + + t.Run("GetTestCase_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseWithExpectedResult{} + obj.TestCase = nil + + // Act & Assert + assert.Nil(t, obj.GetTestCase(), "getter should return nil when property is nil") + }) + + t.Run("GetTestCase_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseWithExpectedResult + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTestCase() // Should return zero value + }) + + t.Run("GetExpectedResult", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseWithExpectedResult{} + var expected *common.VariableValue + obj.ExpectedResult = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetExpectedResult(), "getter should return the property value") + }) + + t.Run("GetExpectedResult_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseWithExpectedResult{} + obj.ExpectedResult = nil + + // Act & Assert + assert.Nil(t, obj.GetExpectedResult(), "getter should return nil when property is nil") + }) + + t.Run("GetExpectedResult_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseWithExpectedResult + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetExpectedResult() // Should return zero value + }) + +} + +func TestSettersMarkExplicitTestCaseWithExpectedResult(t *testing.T) { + t.Run("SetTestCase_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseWithExpectedResult{} + var fernTestValueTestCase *TestCase + + // Act + obj.SetTestCase(fernTestValueTestCase) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetExpectedResult_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseWithExpectedResult{} + var fernTestValueExpectedResult *common.VariableValue + + // Act + obj.SetExpectedResult(fernTestValueExpectedResult) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestJSONMarshalingBinaryTreeNodeAndTreeValue(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BinaryTreeNodeAndTreeValue{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled BinaryTreeNodeAndTreeValue + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj BinaryTreeNodeAndTreeValue + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj BinaryTreeNodeAndTreeValue + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingDebugKeyValuePairs(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DebugKeyValuePairs{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled DebugKeyValuePairs + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj DebugKeyValuePairs + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj DebugKeyValuePairs + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingDebugMapValue(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DebugMapValue{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled DebugMapValue + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj DebugMapValue + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj DebugMapValue + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingDoublyLinkedListNodeAndListValue(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DoublyLinkedListNodeAndListValue{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled DoublyLinkedListNodeAndListValue + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj DoublyLinkedListNodeAndListValue + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj DoublyLinkedListNodeAndListValue + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingFileInfo(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FileInfo{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled FileInfo + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj FileInfo + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj FileInfo + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingGenericValue(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GenericValue{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled GenericValue + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj GenericValue + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj GenericValue + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingSinglyLinkedListNodeAndListValue(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SinglyLinkedListNodeAndListValue{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled SinglyLinkedListNodeAndListValue + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj SinglyLinkedListNodeAndListValue + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj SinglyLinkedListNodeAndListValue + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingTestCase(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCase{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled TestCase + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj TestCase + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj TestCase + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingTestCaseWithExpectedResult(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseWithExpectedResult{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled TestCaseWithExpectedResult + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj TestCaseWithExpectedResult + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj TestCaseWithExpectedResult + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestStringBinaryTreeNodeAndTreeValue(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &BinaryTreeNodeAndTreeValue{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BinaryTreeNodeAndTreeValue + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringDebugKeyValuePairs(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &DebugKeyValuePairs{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DebugKeyValuePairs + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringDebugMapValue(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &DebugMapValue{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DebugMapValue + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringDoublyLinkedListNodeAndListValue(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &DoublyLinkedListNodeAndListValue{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DoublyLinkedListNodeAndListValue + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringFileInfo(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &FileInfo{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FileInfo + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringGenericValue(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &GenericValue{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GenericValue + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringSinglyLinkedListNodeAndListValue(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &SinglyLinkedListNodeAndListValue{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SinglyLinkedListNodeAndListValue + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringTestCase(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &TestCase{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCase + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringTestCaseWithExpectedResult(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &TestCaseWithExpectedResult{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseWithExpectedResult + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestExtraPropertiesBinaryTreeNodeAndTreeValue(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &BinaryTreeNodeAndTreeValue{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BinaryTreeNodeAndTreeValue + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesDebugKeyValuePairs(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &DebugKeyValuePairs{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DebugKeyValuePairs + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesDebugMapValue(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &DebugMapValue{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DebugMapValue + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesDoublyLinkedListNodeAndListValue(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &DoublyLinkedListNodeAndListValue{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DoublyLinkedListNodeAndListValue + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesFileInfo(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &FileInfo{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FileInfo + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesGenericValue(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &GenericValue{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GenericValue + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesSinglyLinkedListNodeAndListValue(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &SinglyLinkedListNodeAndListValue{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SinglyLinkedListNodeAndListValue + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesTestCase(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &TestCase{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCase + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesTestCaseWithExpectedResult(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &TestCaseWithExpectedResult{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseWithExpectedResult + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} diff --git a/seed/go-sdk/trace/core/api_error.go b/seed/go-sdk/trace/core/api_error.go new file mode 100644 index 000000000000..6168388541b4 --- /dev/null +++ b/seed/go-sdk/trace/core/api_error.go @@ -0,0 +1,47 @@ +package core + +import ( + "fmt" + "net/http" +) + +// APIError is a lightweight wrapper around the standard error +// interface that preserves the status code from the RPC, if any. +type APIError struct { + err error + + StatusCode int `json:"-"` + Header http.Header `json:"-"` +} + +// NewAPIError constructs a new API error. +func NewAPIError(statusCode int, header http.Header, err error) *APIError { + return &APIError{ + err: err, + Header: header, + StatusCode: statusCode, + } +} + +// Unwrap returns the underlying error. This also makes the error compatible +// with errors.As and errors.Is. +func (a *APIError) Unwrap() error { + if a == nil { + return nil + } + return a.err +} + +// Error returns the API error's message. +func (a *APIError) Error() string { + if a == nil || (a.err == nil && a.StatusCode == 0) { + return "" + } + if a.err == nil { + return fmt.Sprintf("%d", a.StatusCode) + } + if a.StatusCode == 0 { + return a.err.Error() + } + return fmt.Sprintf("%d: %s", a.StatusCode, a.err.Error()) +} diff --git a/seed/go-sdk/trace/core/http.go b/seed/go-sdk/trace/core/http.go new file mode 100644 index 000000000000..92c435692940 --- /dev/null +++ b/seed/go-sdk/trace/core/http.go @@ -0,0 +1,15 @@ +package core + +import "net/http" + +// HTTPClient is an interface for a subset of the *http.Client. +type HTTPClient interface { + Do(*http.Request) (*http.Response, error) +} + +// Response is an HTTP response from an HTTP client. +type Response[T any] struct { + StatusCode int + Header http.Header + Body T +} diff --git a/seed/go-sdk/trace/core/request_option.go b/seed/go-sdk/trace/core/request_option.go new file mode 100644 index 000000000000..79068e4ee725 --- /dev/null +++ b/seed/go-sdk/trace/core/request_option.go @@ -0,0 +1,189 @@ +// Code generated by Fern. DO NOT EDIT. + +package core + +import ( + fmt "fmt" + http "net/http" + url "net/url" +) + +// RequestOption adapts the behavior of the client or an individual request. +type RequestOption interface { + applyRequestOptions(*RequestOptions) +} + +// RequestOptions defines all of the possible request options. +// +// This type is primarily used by the generated code and is not meant +// to be used directly; use the option package instead. +type RequestOptions struct { + BaseURL string + HTTPClient HTTPClient + HTTPHeader http.Header + BodyProperties map[string]interface{} + QueryParameters url.Values + MaxAttempts uint + MaxBufSize int + MaxStreamReconnectAttempts uint + DisableStreamReconnection bool + DisableRetries bool + Token string + TokenFunc func() (string, error) + XRandomHeader *string +} + +// NewRequestOptions returns a new *RequestOptions value. +// +// This function is primarily used by the generated code and is not meant +// to be used directly; use RequestOption instead. +func NewRequestOptions(opts ...RequestOption) *RequestOptions { + options := &RequestOptions{ + HTTPHeader: make(http.Header), + BodyProperties: make(map[string]interface{}), + QueryParameters: make(url.Values), + } + for _, opt := range opts { + opt.applyRequestOptions(options) + } + return options +} + +// ToHeader maps the configured request options into a http.Header used +// for the request(s). +func (r *RequestOptions) ToHeader() http.Header { + header := r.cloneHeader() + if r.Token != "" { + header.Set("Authorization", "Bearer "+r.Token) + } else if r.TokenFunc != nil { + if token, err := r.TokenFunc(); err == nil && token != "" { + header.Set("Authorization", "Bearer "+token) + } + } + if r.XRandomHeader != nil { + header.Set("X-Random-Header", fmt.Sprintf("%v", *r.XRandomHeader)) + } + return header +} + +func (r *RequestOptions) cloneHeader() http.Header { + headers := r.HTTPHeader.Clone() + headers.Set("X-Fern-Language", "Go") + headers.Set("X-Fern-SDK-Name", "github.com/trace/fern") + headers.Set("X-Fern-SDK-Version", "v0.0.1") + headers.Set("User-Agent", "github.com/trace/fern/0.0.1") + return headers +} + +// BaseURLOption implements the RequestOption interface. +type BaseURLOption struct { + BaseURL string +} + +func (b *BaseURLOption) applyRequestOptions(opts *RequestOptions) { + opts.BaseURL = b.BaseURL +} + +// HTTPClientOption implements the RequestOption interface. +type HTTPClientOption struct { + HTTPClient HTTPClient +} + +func (h *HTTPClientOption) applyRequestOptions(opts *RequestOptions) { + opts.HTTPClient = h.HTTPClient +} + +// HTTPHeaderOption implements the RequestOption interface. +type HTTPHeaderOption struct { + HTTPHeader http.Header +} + +func (h *HTTPHeaderOption) applyRequestOptions(opts *RequestOptions) { + opts.HTTPHeader = h.HTTPHeader +} + +// BodyPropertiesOption implements the RequestOption interface. +type BodyPropertiesOption struct { + BodyProperties map[string]interface{} +} + +func (b *BodyPropertiesOption) applyRequestOptions(opts *RequestOptions) { + opts.BodyProperties = b.BodyProperties +} + +// QueryParametersOption implements the RequestOption interface. +type QueryParametersOption struct { + QueryParameters url.Values +} + +func (q *QueryParametersOption) applyRequestOptions(opts *RequestOptions) { + opts.QueryParameters = q.QueryParameters +} + +// MaxAttemptsOption implements the RequestOption interface. +type MaxAttemptsOption struct { + MaxAttempts uint +} + +func (m *MaxAttemptsOption) applyRequestOptions(opts *RequestOptions) { + opts.MaxAttempts = m.MaxAttempts +} + +// MaxBufSizeOption implements the RequestOption interface. +type MaxBufSizeOption struct { + MaxBufSize int +} + +func (m *MaxBufSizeOption) applyRequestOptions(opts *RequestOptions) { + opts.MaxBufSize = m.MaxBufSize +} + +// MaxStreamReconnectAttemptsOption implements the RequestOption interface. +type MaxStreamReconnectAttemptsOption struct { + MaxStreamReconnectAttempts uint +} + +func (m *MaxStreamReconnectAttemptsOption) applyRequestOptions(opts *RequestOptions) { + opts.MaxStreamReconnectAttempts = m.MaxStreamReconnectAttempts +} + +// WithoutStreamReconnectionOption implements the RequestOption interface. +type WithoutStreamReconnectionOption struct{} + +func (w *WithoutStreamReconnectionOption) applyRequestOptions(opts *RequestOptions) { + opts.DisableStreamReconnection = true +} + +// WithoutRetriesOption implements the RequestOption interface. +type WithoutRetriesOption struct{} + +func (w *WithoutRetriesOption) applyRequestOptions(opts *RequestOptions) { + opts.DisableRetries = true +} + +// TokenOption implements the RequestOption interface. +type TokenOption struct { + Token string +} + +func (t *TokenOption) applyRequestOptions(opts *RequestOptions) { + opts.Token = t.Token +} + +// TokenFuncOption implements the RequestOption interface. +type TokenFuncOption struct { + TokenFunc func() (string, error) +} + +func (t *TokenFuncOption) applyRequestOptions(opts *RequestOptions) { + opts.TokenFunc = t.TokenFunc +} + +// XRandomHeaderOption implements the RequestOption interface. +type XRandomHeaderOption struct { + XRandomHeader *string +} + +func (x *XRandomHeaderOption) applyRequestOptions(opts *RequestOptions) { + opts.XRandomHeader = x.XRandomHeader +} diff --git a/seed/go-sdk/trace/dynamic-snippets/example0/snippet.go b/seed/go-sdk/trace/dynamic-snippets/example0/snippet.go new file mode 100644 index 000000000000..4c56b339f46c --- /dev/null +++ b/seed/go-sdk/trace/dynamic-snippets/example0/snippet.go @@ -0,0 +1,22 @@ +package example + +import ( + context "context" + + client "github.com/trace/fern/client" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + option.WithToken( + "", + ), + ) + client.V2.Test( + context.TODO(), + ) +} diff --git a/seed/go-sdk/trace/dynamic-snippets/example1/snippet.go b/seed/go-sdk/trace/dynamic-snippets/example1/snippet.go new file mode 100644 index 000000000000..61ac5365bd1d --- /dev/null +++ b/seed/go-sdk/trace/dynamic-snippets/example1/snippet.go @@ -0,0 +1,31 @@ +package example + +import ( + context "context" + + uuid "github.com/google/uuid" + fern "github.com/trace/fern" + client "github.com/trace/fern/client" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + option.WithToken( + "", + ), + ) + request := &fern.TestSubmissionStatus{ + Stopped: "stopped", + } + client.Admin.UpdateTestSubmissionStatus( + context.TODO(), + uuid.MustParse( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + request, + ) +} diff --git a/seed/go-sdk/trace/dynamic-snippets/example10/snippet.go b/seed/go-sdk/trace/dynamic-snippets/example10/snippet.go new file mode 100644 index 000000000000..eb6437695607 --- /dev/null +++ b/seed/go-sdk/trace/dynamic-snippets/example10/snippet.go @@ -0,0 +1,28 @@ +package example + +import ( + context "context" + + client "github.com/trace/fern/client" + common "github.com/trace/fern/common" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + option.WithToken( + "", + ), + ) + request := []common.ProblemID{ + "string", + "string", + } + client.Homepage.SetHomepageProblems( + context.TODO(), + request, + ) +} diff --git a/seed/go-sdk/trace/dynamic-snippets/example11/snippet.go b/seed/go-sdk/trace/dynamic-snippets/example11/snippet.go new file mode 100644 index 000000000000..143063a9c30b --- /dev/null +++ b/seed/go-sdk/trace/dynamic-snippets/example11/snippet.go @@ -0,0 +1,27 @@ +package example + +import ( + context "context" + + fern "github.com/trace/fern" + client "github.com/trace/fern/client" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + option.WithToken( + "", + ), + ) + request := &fern.GetAttemptedMigrationsRequest{ + AdminKeyHeader: "admin-key-header", + } + client.Migration.GetAttemptedMigrations( + context.TODO(), + request, + ) +} diff --git a/seed/go-sdk/trace/dynamic-snippets/example12/snippet.go b/seed/go-sdk/trace/dynamic-snippets/example12/snippet.go new file mode 100644 index 000000000000..f164fa175db5 --- /dev/null +++ b/seed/go-sdk/trace/dynamic-snippets/example12/snippet.go @@ -0,0 +1,43 @@ +package example + +import ( + context "context" + + fern "github.com/trace/fern" + client "github.com/trace/fern/client" + common "github.com/trace/fern/common" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + option.WithToken( + "", + ), + ) + request := &fern.CreatePlaylistRequest{ + Datetime: fern.MustParseDateTime( + "2024-01-15T09:30:00Z", + ), + OptionalDatetime: fern.Time( + fern.MustParseDateTime( + "2024-01-15T09:30:00Z", + ), + ), + Body: &fern.PlaylistCreateRequest{ + Name: "name", + Problems: []common.ProblemID{ + "problems", + "problems", + }, + }, + } + client.Playlist.CreatePlaylist( + context.TODO(), + 1, + request, + ) +} diff --git a/seed/go-sdk/trace/dynamic-snippets/example13/snippet.go b/seed/go-sdk/trace/dynamic-snippets/example13/snippet.go new file mode 100644 index 000000000000..f70f66a688ea --- /dev/null +++ b/seed/go-sdk/trace/dynamic-snippets/example13/snippet.go @@ -0,0 +1,40 @@ +package example + +import ( + context "context" + + fern "github.com/trace/fern" + client "github.com/trace/fern/client" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + option.WithToken( + "", + ), + ) + request := &fern.GetPlaylistsRequest{ + Limit: fern.Int( + 1, + ), + OtherField: "otherField", + MultiLineDocs: "multiLineDocs", + OptionalMultipleField: []*string{ + fern.String( + "optionalMultipleField", + ), + }, + MultipleField: []string{ + "multipleField", + }, + } + client.Playlist.GetPlaylists( + context.TODO(), + 1, + request, + ) +} diff --git a/seed/go-sdk/trace/dynamic-snippets/example14/snippet.go b/seed/go-sdk/trace/dynamic-snippets/example14/snippet.go new file mode 100644 index 000000000000..63ebbbaf4b21 --- /dev/null +++ b/seed/go-sdk/trace/dynamic-snippets/example14/snippet.go @@ -0,0 +1,24 @@ +package example + +import ( + context "context" + + client "github.com/trace/fern/client" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + option.WithToken( + "", + ), + ) + client.Playlist.GetPlaylist( + context.TODO(), + 1, + "playlistId", + ) +} diff --git a/seed/go-sdk/trace/dynamic-snippets/example15/snippet.go b/seed/go-sdk/trace/dynamic-snippets/example15/snippet.go new file mode 100644 index 000000000000..63ebbbaf4b21 --- /dev/null +++ b/seed/go-sdk/trace/dynamic-snippets/example15/snippet.go @@ -0,0 +1,24 @@ +package example + +import ( + context "context" + + client "github.com/trace/fern/client" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + option.WithToken( + "", + ), + ) + client.Playlist.GetPlaylist( + context.TODO(), + 1, + "playlistId", + ) +} diff --git a/seed/go-sdk/trace/dynamic-snippets/example16/snippet.go b/seed/go-sdk/trace/dynamic-snippets/example16/snippet.go new file mode 100644 index 000000000000..63ebbbaf4b21 --- /dev/null +++ b/seed/go-sdk/trace/dynamic-snippets/example16/snippet.go @@ -0,0 +1,24 @@ +package example + +import ( + context "context" + + client "github.com/trace/fern/client" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + option.WithToken( + "", + ), + ) + client.Playlist.GetPlaylist( + context.TODO(), + 1, + "playlistId", + ) +} diff --git a/seed/go-sdk/trace/dynamic-snippets/example17/snippet.go b/seed/go-sdk/trace/dynamic-snippets/example17/snippet.go new file mode 100644 index 000000000000..e19e76f47266 --- /dev/null +++ b/seed/go-sdk/trace/dynamic-snippets/example17/snippet.go @@ -0,0 +1,34 @@ +package example + +import ( + context "context" + + fern "github.com/trace/fern" + client "github.com/trace/fern/client" + common "github.com/trace/fern/common" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + option.WithToken( + "", + ), + ) + request := &fern.UpdatePlaylistRequest{ + Name: "name", + Problems: []common.ProblemID{ + "problems", + "problems", + }, + } + client.Playlist.UpdatePlaylist( + context.TODO(), + 1, + "playlistId", + request, + ) +} diff --git a/seed/go-sdk/trace/dynamic-snippets/example18/snippet.go b/seed/go-sdk/trace/dynamic-snippets/example18/snippet.go new file mode 100644 index 000000000000..e19e76f47266 --- /dev/null +++ b/seed/go-sdk/trace/dynamic-snippets/example18/snippet.go @@ -0,0 +1,34 @@ +package example + +import ( + context "context" + + fern "github.com/trace/fern" + client "github.com/trace/fern/client" + common "github.com/trace/fern/common" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + option.WithToken( + "", + ), + ) + request := &fern.UpdatePlaylistRequest{ + Name: "name", + Problems: []common.ProblemID{ + "problems", + "problems", + }, + } + client.Playlist.UpdatePlaylist( + context.TODO(), + 1, + "playlistId", + request, + ) +} diff --git a/seed/go-sdk/trace/dynamic-snippets/example19/snippet.go b/seed/go-sdk/trace/dynamic-snippets/example19/snippet.go new file mode 100644 index 000000000000..258733a9f10d --- /dev/null +++ b/seed/go-sdk/trace/dynamic-snippets/example19/snippet.go @@ -0,0 +1,24 @@ +package example + +import ( + context "context" + + client "github.com/trace/fern/client" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + option.WithToken( + "", + ), + ) + client.Playlist.DeletePlaylist( + context.TODO(), + 1, + "playlist_id", + ) +} diff --git a/seed/go-sdk/trace/dynamic-snippets/example2/snippet.go b/seed/go-sdk/trace/dynamic-snippets/example2/snippet.go new file mode 100644 index 000000000000..e112c12aa40f --- /dev/null +++ b/seed/go-sdk/trace/dynamic-snippets/example2/snippet.go @@ -0,0 +1,34 @@ +package example + +import ( + context "context" + + uuid "github.com/google/uuid" + fern "github.com/trace/fern" + client "github.com/trace/fern/client" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + option.WithToken( + "", + ), + ) + request := &fern.TestSubmissionUpdate{ + UpdateTime: fern.MustParseDateTime( + "2024-01-15T09:30:00Z", + ), + UpdateInfo: &fern.TestSubmissionUpdateInfo{}, + } + client.Admin.SendTestSubmissionUpdate( + context.TODO(), + uuid.MustParse( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + request, + ) +} diff --git a/seed/go-sdk/trace/dynamic-snippets/example20/snippet.go b/seed/go-sdk/trace/dynamic-snippets/example20/snippet.go new file mode 100644 index 000000000000..41236abebae0 --- /dev/null +++ b/seed/go-sdk/trace/dynamic-snippets/example20/snippet.go @@ -0,0 +1,92 @@ +package example + +import ( + context "context" + + fern "github.com/trace/fern" + client "github.com/trace/fern/client" + common "github.com/trace/fern/common" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + option.WithToken( + "", + ), + ) + request := &fern.CreateProblemRequest{ + ProblemName: "problemName", + ProblemDescription: &common.ProblemDescription{ + Boards: []*common.ProblemDescriptionBoard{ + &common.ProblemDescriptionBoard{}, + &common.ProblemDescriptionBoard{}, + }, + }, + Files: map[common.Language]*fern.ProblemFiles{ + common.LanguageJava: &fern.ProblemFiles{ + SolutionFile: &fern.FileInfo{ + Filename: "filename", + Contents: "contents", + }, + ReadOnlyFiles: []*fern.FileInfo{ + &fern.FileInfo{ + Filename: "filename", + Contents: "contents", + }, + &fern.FileInfo{ + Filename: "filename", + Contents: "contents", + }, + }, + }, + }, + InputParams: []*fern.VariableTypeAndName{ + &fern.VariableTypeAndName{ + VariableType: &common.VariableType{ + IntegerType: "integerType", + }, + Name: "name", + }, + &fern.VariableTypeAndName{ + VariableType: &common.VariableType{ + IntegerType: "integerType", + }, + Name: "name", + }, + }, + OutputType: &common.VariableType{ + IntegerType: "integerType", + }, + Testcases: []*fern.TestCaseWithExpectedResult{ + &fern.TestCaseWithExpectedResult{ + TestCase: &fern.TestCase{ + ID: "id", + Params: []*common.VariableValue{ + &common.VariableValue{}, + &common.VariableValue{}, + }, + }, + ExpectedResult: &common.VariableValue{}, + }, + &fern.TestCaseWithExpectedResult{ + TestCase: &fern.TestCase{ + ID: "id", + Params: []*common.VariableValue{ + &common.VariableValue{}, + &common.VariableValue{}, + }, + }, + ExpectedResult: &common.VariableValue{}, + }, + }, + MethodName: "methodName", + } + client.Problem.CreateProblem( + context.TODO(), + request, + ) +} diff --git a/seed/go-sdk/trace/dynamic-snippets/example21/snippet.go b/seed/go-sdk/trace/dynamic-snippets/example21/snippet.go new file mode 100644 index 000000000000..64bd1ad706f3 --- /dev/null +++ b/seed/go-sdk/trace/dynamic-snippets/example21/snippet.go @@ -0,0 +1,93 @@ +package example + +import ( + context "context" + + fern "github.com/trace/fern" + client "github.com/trace/fern/client" + common "github.com/trace/fern/common" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + option.WithToken( + "", + ), + ) + request := &fern.CreateProblemRequest{ + ProblemName: "problemName", + ProblemDescription: &common.ProblemDescription{ + Boards: []*common.ProblemDescriptionBoard{ + &common.ProblemDescriptionBoard{}, + &common.ProblemDescriptionBoard{}, + }, + }, + Files: map[common.Language]*fern.ProblemFiles{ + common.LanguageJava: &fern.ProblemFiles{ + SolutionFile: &fern.FileInfo{ + Filename: "filename", + Contents: "contents", + }, + ReadOnlyFiles: []*fern.FileInfo{ + &fern.FileInfo{ + Filename: "filename", + Contents: "contents", + }, + &fern.FileInfo{ + Filename: "filename", + Contents: "contents", + }, + }, + }, + }, + InputParams: []*fern.VariableTypeAndName{ + &fern.VariableTypeAndName{ + VariableType: &common.VariableType{ + IntegerType: "integerType", + }, + Name: "name", + }, + &fern.VariableTypeAndName{ + VariableType: &common.VariableType{ + IntegerType: "integerType", + }, + Name: "name", + }, + }, + OutputType: &common.VariableType{ + IntegerType: "integerType", + }, + Testcases: []*fern.TestCaseWithExpectedResult{ + &fern.TestCaseWithExpectedResult{ + TestCase: &fern.TestCase{ + ID: "id", + Params: []*common.VariableValue{ + &common.VariableValue{}, + &common.VariableValue{}, + }, + }, + ExpectedResult: &common.VariableValue{}, + }, + &fern.TestCaseWithExpectedResult{ + TestCase: &fern.TestCase{ + ID: "id", + Params: []*common.VariableValue{ + &common.VariableValue{}, + &common.VariableValue{}, + }, + }, + ExpectedResult: &common.VariableValue{}, + }, + }, + MethodName: "methodName", + } + client.Problem.UpdateProblem( + context.TODO(), + "problemId", + request, + ) +} diff --git a/seed/go-sdk/trace/dynamic-snippets/example22/snippet.go b/seed/go-sdk/trace/dynamic-snippets/example22/snippet.go new file mode 100644 index 000000000000..09c003f7aa71 --- /dev/null +++ b/seed/go-sdk/trace/dynamic-snippets/example22/snippet.go @@ -0,0 +1,23 @@ +package example + +import ( + context "context" + + client "github.com/trace/fern/client" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + option.WithToken( + "", + ), + ) + client.Problem.DeleteProblem( + context.TODO(), + "problemId", + ) +} diff --git a/seed/go-sdk/trace/dynamic-snippets/example23/snippet.go b/seed/go-sdk/trace/dynamic-snippets/example23/snippet.go new file mode 100644 index 000000000000..7bec06dc95fe --- /dev/null +++ b/seed/go-sdk/trace/dynamic-snippets/example23/snippet.go @@ -0,0 +1,45 @@ +package example + +import ( + context "context" + + fern "github.com/trace/fern" + client "github.com/trace/fern/client" + common "github.com/trace/fern/common" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + option.WithToken( + "", + ), + ) + request := &fern.GetDefaultStarterFilesRequest{ + InputParams: []*fern.VariableTypeAndName{ + &fern.VariableTypeAndName{ + VariableType: &common.VariableType{ + IntegerType: "integerType", + }, + Name: "name", + }, + &fern.VariableTypeAndName{ + VariableType: &common.VariableType{ + IntegerType: "integerType", + }, + Name: "name", + }, + }, + OutputType: &common.VariableType{ + IntegerType: "integerType", + }, + MethodName: "methodName", + } + client.Problem.GetDefaultStarterFiles( + context.TODO(), + request, + ) +} diff --git a/seed/go-sdk/trace/dynamic-snippets/example24/snippet.go b/seed/go-sdk/trace/dynamic-snippets/example24/snippet.go new file mode 100644 index 000000000000..49b7ed72cb96 --- /dev/null +++ b/seed/go-sdk/trace/dynamic-snippets/example24/snippet.go @@ -0,0 +1,24 @@ +package example + +import ( + context "context" + + client "github.com/trace/fern/client" + common "github.com/trace/fern/common" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + option.WithToken( + "", + ), + ) + client.Submission.CreateExecutionSession( + context.TODO(), + common.LanguageJava.Ptr(), + ) +} diff --git a/seed/go-sdk/trace/dynamic-snippets/example25/snippet.go b/seed/go-sdk/trace/dynamic-snippets/example25/snippet.go new file mode 100644 index 000000000000..da45a0883e42 --- /dev/null +++ b/seed/go-sdk/trace/dynamic-snippets/example25/snippet.go @@ -0,0 +1,23 @@ +package example + +import ( + context "context" + + client "github.com/trace/fern/client" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + option.WithToken( + "", + ), + ) + client.Submission.GetExecutionSession( + context.TODO(), + "sessionId", + ) +} diff --git a/seed/go-sdk/trace/dynamic-snippets/example26/snippet.go b/seed/go-sdk/trace/dynamic-snippets/example26/snippet.go new file mode 100644 index 000000000000..b6683ec4a01c --- /dev/null +++ b/seed/go-sdk/trace/dynamic-snippets/example26/snippet.go @@ -0,0 +1,23 @@ +package example + +import ( + context "context" + + client "github.com/trace/fern/client" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + option.WithToken( + "", + ), + ) + client.Submission.StopExecutionSession( + context.TODO(), + "sessionId", + ) +} diff --git a/seed/go-sdk/trace/dynamic-snippets/example27/snippet.go b/seed/go-sdk/trace/dynamic-snippets/example27/snippet.go new file mode 100644 index 000000000000..348474dd7d14 --- /dev/null +++ b/seed/go-sdk/trace/dynamic-snippets/example27/snippet.go @@ -0,0 +1,22 @@ +package example + +import ( + context "context" + + client "github.com/trace/fern/client" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + option.WithToken( + "", + ), + ) + client.Submission.GetExecutionSessionsState( + context.TODO(), + ) +} diff --git a/seed/go-sdk/trace/dynamic-snippets/example28/snippet.go b/seed/go-sdk/trace/dynamic-snippets/example28/snippet.go new file mode 100644 index 000000000000..c62a3084187c --- /dev/null +++ b/seed/go-sdk/trace/dynamic-snippets/example28/snippet.go @@ -0,0 +1,25 @@ +package example + +import ( + context "context" + + client "github.com/trace/fern/client" + common "github.com/trace/fern/common" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + option.WithToken( + "", + ), + ) + client.Sysprop.SetNumWarmInstances( + context.TODO(), + common.LanguageJava.Ptr(), + 1, + ) +} diff --git a/seed/go-sdk/trace/dynamic-snippets/example29/snippet.go b/seed/go-sdk/trace/dynamic-snippets/example29/snippet.go new file mode 100644 index 000000000000..04b11aa442db --- /dev/null +++ b/seed/go-sdk/trace/dynamic-snippets/example29/snippet.go @@ -0,0 +1,22 @@ +package example + +import ( + context "context" + + client "github.com/trace/fern/client" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + option.WithToken( + "", + ), + ) + client.Sysprop.GetNumWarmInstances( + context.TODO(), + ) +} diff --git a/seed/go-sdk/trace/dynamic-snippets/example3/snippet.go b/seed/go-sdk/trace/dynamic-snippets/example3/snippet.go new file mode 100644 index 000000000000..f88fec0fd9be --- /dev/null +++ b/seed/go-sdk/trace/dynamic-snippets/example3/snippet.go @@ -0,0 +1,31 @@ +package example + +import ( + context "context" + + uuid "github.com/google/uuid" + fern "github.com/trace/fern" + client "github.com/trace/fern/client" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + option.WithToken( + "", + ), + ) + request := &fern.WorkspaceSubmissionStatus{ + Stopped: "stopped", + } + client.Admin.UpdateWorkspaceSubmissionStatus( + context.TODO(), + uuid.MustParse( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + request, + ) +} diff --git a/seed/go-sdk/trace/dynamic-snippets/example30/snippet.go b/seed/go-sdk/trace/dynamic-snippets/example30/snippet.go new file mode 100644 index 000000000000..1119844a131d --- /dev/null +++ b/seed/go-sdk/trace/dynamic-snippets/example30/snippet.go @@ -0,0 +1,22 @@ +package example + +import ( + context "context" + + client "github.com/trace/fern/client" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + option.WithToken( + "", + ), + ) + client.V2.Problem.GetLightweightProblems( + context.TODO(), + ) +} diff --git a/seed/go-sdk/trace/dynamic-snippets/example31/snippet.go b/seed/go-sdk/trace/dynamic-snippets/example31/snippet.go new file mode 100644 index 000000000000..aff1cddd4c05 --- /dev/null +++ b/seed/go-sdk/trace/dynamic-snippets/example31/snippet.go @@ -0,0 +1,22 @@ +package example + +import ( + context "context" + + client "github.com/trace/fern/client" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + option.WithToken( + "", + ), + ) + client.V2.Problem.GetProblems( + context.TODO(), + ) +} diff --git a/seed/go-sdk/trace/dynamic-snippets/example32/snippet.go b/seed/go-sdk/trace/dynamic-snippets/example32/snippet.go new file mode 100644 index 000000000000..8acd81e1bbf1 --- /dev/null +++ b/seed/go-sdk/trace/dynamic-snippets/example32/snippet.go @@ -0,0 +1,23 @@ +package example + +import ( + context "context" + + client "github.com/trace/fern/client" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + option.WithToken( + "", + ), + ) + client.V2.Problem.GetLatestProblem( + context.TODO(), + "problemId", + ) +} diff --git a/seed/go-sdk/trace/dynamic-snippets/example33/snippet.go b/seed/go-sdk/trace/dynamic-snippets/example33/snippet.go new file mode 100644 index 000000000000..8f382b0bb72c --- /dev/null +++ b/seed/go-sdk/trace/dynamic-snippets/example33/snippet.go @@ -0,0 +1,24 @@ +package example + +import ( + context "context" + + client "github.com/trace/fern/client" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + option.WithToken( + "", + ), + ) + client.V2.Problem.GetProblemVersion( + context.TODO(), + "problemId", + 1, + ) +} diff --git a/seed/go-sdk/trace/dynamic-snippets/example34/snippet.go b/seed/go-sdk/trace/dynamic-snippets/example34/snippet.go new file mode 100644 index 000000000000..d82fa0210530 --- /dev/null +++ b/seed/go-sdk/trace/dynamic-snippets/example34/snippet.go @@ -0,0 +1,22 @@ +package example + +import ( + context "context" + + client "github.com/trace/fern/client" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + option.WithToken( + "", + ), + ) + client.V2.V3.Problem.GetLightweightProblems( + context.TODO(), + ) +} diff --git a/seed/go-sdk/trace/dynamic-snippets/example35/snippet.go b/seed/go-sdk/trace/dynamic-snippets/example35/snippet.go new file mode 100644 index 000000000000..54148d602d6f --- /dev/null +++ b/seed/go-sdk/trace/dynamic-snippets/example35/snippet.go @@ -0,0 +1,22 @@ +package example + +import ( + context "context" + + client "github.com/trace/fern/client" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + option.WithToken( + "", + ), + ) + client.V2.V3.Problem.GetProblems( + context.TODO(), + ) +} diff --git a/seed/go-sdk/trace/dynamic-snippets/example36/snippet.go b/seed/go-sdk/trace/dynamic-snippets/example36/snippet.go new file mode 100644 index 000000000000..aaec76e77cbe --- /dev/null +++ b/seed/go-sdk/trace/dynamic-snippets/example36/snippet.go @@ -0,0 +1,23 @@ +package example + +import ( + context "context" + + client "github.com/trace/fern/client" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + option.WithToken( + "", + ), + ) + client.V2.V3.Problem.GetLatestProblem( + context.TODO(), + "problemId", + ) +} diff --git a/seed/go-sdk/trace/dynamic-snippets/example37/snippet.go b/seed/go-sdk/trace/dynamic-snippets/example37/snippet.go new file mode 100644 index 000000000000..ac6768b365d7 --- /dev/null +++ b/seed/go-sdk/trace/dynamic-snippets/example37/snippet.go @@ -0,0 +1,24 @@ +package example + +import ( + context "context" + + client "github.com/trace/fern/client" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + option.WithToken( + "", + ), + ) + client.V2.V3.Problem.GetProblemVersion( + context.TODO(), + "problemId", + 1, + ) +} diff --git a/seed/go-sdk/trace/dynamic-snippets/example4/snippet.go b/seed/go-sdk/trace/dynamic-snippets/example4/snippet.go new file mode 100644 index 000000000000..fa00e12bc232 --- /dev/null +++ b/seed/go-sdk/trace/dynamic-snippets/example4/snippet.go @@ -0,0 +1,34 @@ +package example + +import ( + context "context" + + uuid "github.com/google/uuid" + fern "github.com/trace/fern" + client "github.com/trace/fern/client" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + option.WithToken( + "", + ), + ) + request := &fern.WorkspaceSubmissionUpdate{ + UpdateTime: fern.MustParseDateTime( + "2024-01-15T09:30:00Z", + ), + UpdateInfo: &fern.WorkspaceSubmissionUpdateInfo{}, + } + client.Admin.SendWorkspaceSubmissionUpdate( + context.TODO(), + uuid.MustParse( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + request, + ) +} diff --git a/seed/go-sdk/trace/dynamic-snippets/example5/snippet.go b/seed/go-sdk/trace/dynamic-snippets/example5/snippet.go new file mode 100644 index 000000000000..0d9a6df52af4 --- /dev/null +++ b/seed/go-sdk/trace/dynamic-snippets/example5/snippet.go @@ -0,0 +1,110 @@ +package example + +import ( + context "context" + + uuid "github.com/google/uuid" + fern "github.com/trace/fern" + client "github.com/trace/fern/client" + common "github.com/trace/fern/common" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + option.WithToken( + "", + ), + ) + request := &fern.StoreTracedTestCaseRequest{ + Result: &fern.TestCaseResultWithStdout{ + Result: &fern.TestCaseResult{ + ExpectedResult: &common.VariableValue{}, + ActualResult: &fern.ActualResult{ + Value: &common.VariableValue{}, + }, + Passed: true, + }, + Stdout: "stdout", + }, + TraceResponses: []*fern.TraceResponse{ + &fern.TraceResponse{ + SubmissionID: uuid.MustParse( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + LineNumber: 1, + ReturnValue: &fern.DebugVariableValue{}, + ExpressionLocation: &fern.ExpressionLocation{ + Start: 1, + Offset: 1, + }, + Stack: &fern.StackInformation{ + NumStackFrames: 1, + TopStackFrame: &fern.StackFrame{ + MethodName: "methodName", + LineNumber: 1, + Scopes: []*fern.Scope{ + &fern.Scope{ + Variables: map[string]*fern.DebugVariableValue{ + "variables": &fern.DebugVariableValue{}, + }, + }, + &fern.Scope{ + Variables: map[string]*fern.DebugVariableValue{ + "variables": &fern.DebugVariableValue{}, + }, + }, + }, + }, + }, + Stdout: fern.String( + "stdout", + ), + }, + &fern.TraceResponse{ + SubmissionID: uuid.MustParse( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + LineNumber: 1, + ReturnValue: &fern.DebugVariableValue{}, + ExpressionLocation: &fern.ExpressionLocation{ + Start: 1, + Offset: 1, + }, + Stack: &fern.StackInformation{ + NumStackFrames: 1, + TopStackFrame: &fern.StackFrame{ + MethodName: "methodName", + LineNumber: 1, + Scopes: []*fern.Scope{ + &fern.Scope{ + Variables: map[string]*fern.DebugVariableValue{ + "variables": &fern.DebugVariableValue{}, + }, + }, + &fern.Scope{ + Variables: map[string]*fern.DebugVariableValue{ + "variables": &fern.DebugVariableValue{}, + }, + }, + }, + }, + }, + Stdout: fern.String( + "stdout", + ), + }, + }, + } + client.Admin.StoreTracedTestCase( + context.TODO(), + uuid.MustParse( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + "testCaseId", + request, + ) +} diff --git a/seed/go-sdk/trace/dynamic-snippets/example6/snippet.go b/seed/go-sdk/trace/dynamic-snippets/example6/snippet.go new file mode 100644 index 000000000000..517de99e815d --- /dev/null +++ b/seed/go-sdk/trace/dynamic-snippets/example6/snippet.go @@ -0,0 +1,105 @@ +package example + +import ( + context "context" + + uuid "github.com/google/uuid" + fern "github.com/trace/fern" + client "github.com/trace/fern/client" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + option.WithToken( + "", + ), + ) + request := []*fern.TraceResponseV2{ + &fern.TraceResponseV2{ + SubmissionID: uuid.MustParse( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + LineNumber: 1, + File: &fern.TracedFile{ + Filename: "filename", + Directory: "directory", + }, + ReturnValue: &fern.DebugVariableValue{}, + ExpressionLocation: &fern.ExpressionLocation{ + Start: 1, + Offset: 1, + }, + Stack: &fern.StackInformation{ + NumStackFrames: 1, + TopStackFrame: &fern.StackFrame{ + MethodName: "methodName", + LineNumber: 1, + Scopes: []*fern.Scope{ + &fern.Scope{ + Variables: map[string]*fern.DebugVariableValue{ + "variables": &fern.DebugVariableValue{}, + }, + }, + &fern.Scope{ + Variables: map[string]*fern.DebugVariableValue{ + "variables": &fern.DebugVariableValue{}, + }, + }, + }, + }, + }, + Stdout: fern.String( + "stdout", + ), + }, + &fern.TraceResponseV2{ + SubmissionID: uuid.MustParse( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + LineNumber: 1, + File: &fern.TracedFile{ + Filename: "filename", + Directory: "directory", + }, + ReturnValue: &fern.DebugVariableValue{}, + ExpressionLocation: &fern.ExpressionLocation{ + Start: 1, + Offset: 1, + }, + Stack: &fern.StackInformation{ + NumStackFrames: 1, + TopStackFrame: &fern.StackFrame{ + MethodName: "methodName", + LineNumber: 1, + Scopes: []*fern.Scope{ + &fern.Scope{ + Variables: map[string]*fern.DebugVariableValue{ + "variables": &fern.DebugVariableValue{}, + }, + }, + &fern.Scope{ + Variables: map[string]*fern.DebugVariableValue{ + "variables": &fern.DebugVariableValue{}, + }, + }, + }, + }, + }, + Stdout: fern.String( + "stdout", + ), + }, + } + client.Admin.StoreTracedTestCaseV2( + context.TODO(), + uuid.MustParse( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + "testCaseId", + request, + ) +} diff --git a/seed/go-sdk/trace/dynamic-snippets/example7/snippet.go b/seed/go-sdk/trace/dynamic-snippets/example7/snippet.go new file mode 100644 index 000000000000..100f76bf7c47 --- /dev/null +++ b/seed/go-sdk/trace/dynamic-snippets/example7/snippet.go @@ -0,0 +1,113 @@ +package example + +import ( + context "context" + + uuid "github.com/google/uuid" + fern "github.com/trace/fern" + client "github.com/trace/fern/client" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + option.WithToken( + "", + ), + ) + request := &fern.StoreTracedWorkspaceRequest{ + WorkspaceRunDetails: &fern.WorkspaceRunDetails{ + ExceptionV2: &fern.ExceptionV2{ + Generic: &fern.ExceptionInfo{ + ExceptionType: "exceptionType", + ExceptionMessage: "exceptionMessage", + ExceptionStacktrace: "exceptionStacktrace", + }, + }, + Exception: &fern.ExceptionInfo{ + ExceptionType: "exceptionType", + ExceptionMessage: "exceptionMessage", + ExceptionStacktrace: "exceptionStacktrace", + }, + Stdout: "stdout", + }, + TraceResponses: []*fern.TraceResponse{ + &fern.TraceResponse{ + SubmissionID: uuid.MustParse( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + LineNumber: 1, + ReturnValue: &fern.DebugVariableValue{}, + ExpressionLocation: &fern.ExpressionLocation{ + Start: 1, + Offset: 1, + }, + Stack: &fern.StackInformation{ + NumStackFrames: 1, + TopStackFrame: &fern.StackFrame{ + MethodName: "methodName", + LineNumber: 1, + Scopes: []*fern.Scope{ + &fern.Scope{ + Variables: map[string]*fern.DebugVariableValue{ + "variables": &fern.DebugVariableValue{}, + }, + }, + &fern.Scope{ + Variables: map[string]*fern.DebugVariableValue{ + "variables": &fern.DebugVariableValue{}, + }, + }, + }, + }, + }, + Stdout: fern.String( + "stdout", + ), + }, + &fern.TraceResponse{ + SubmissionID: uuid.MustParse( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + LineNumber: 1, + ReturnValue: &fern.DebugVariableValue{}, + ExpressionLocation: &fern.ExpressionLocation{ + Start: 1, + Offset: 1, + }, + Stack: &fern.StackInformation{ + NumStackFrames: 1, + TopStackFrame: &fern.StackFrame{ + MethodName: "methodName", + LineNumber: 1, + Scopes: []*fern.Scope{ + &fern.Scope{ + Variables: map[string]*fern.DebugVariableValue{ + "variables": &fern.DebugVariableValue{}, + }, + }, + &fern.Scope{ + Variables: map[string]*fern.DebugVariableValue{ + "variables": &fern.DebugVariableValue{}, + }, + }, + }, + }, + }, + Stdout: fern.String( + "stdout", + ), + }, + }, + } + client.Admin.StoreTracedWorkspace( + context.TODO(), + uuid.MustParse( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + request, + ) +} diff --git a/seed/go-sdk/trace/dynamic-snippets/example8/snippet.go b/seed/go-sdk/trace/dynamic-snippets/example8/snippet.go new file mode 100644 index 000000000000..b633f4ab59f1 --- /dev/null +++ b/seed/go-sdk/trace/dynamic-snippets/example8/snippet.go @@ -0,0 +1,104 @@ +package example + +import ( + context "context" + + uuid "github.com/google/uuid" + fern "github.com/trace/fern" + client "github.com/trace/fern/client" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + option.WithToken( + "", + ), + ) + request := []*fern.TraceResponseV2{ + &fern.TraceResponseV2{ + SubmissionID: uuid.MustParse( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + LineNumber: 1, + File: &fern.TracedFile{ + Filename: "filename", + Directory: "directory", + }, + ReturnValue: &fern.DebugVariableValue{}, + ExpressionLocation: &fern.ExpressionLocation{ + Start: 1, + Offset: 1, + }, + Stack: &fern.StackInformation{ + NumStackFrames: 1, + TopStackFrame: &fern.StackFrame{ + MethodName: "methodName", + LineNumber: 1, + Scopes: []*fern.Scope{ + &fern.Scope{ + Variables: map[string]*fern.DebugVariableValue{ + "variables": &fern.DebugVariableValue{}, + }, + }, + &fern.Scope{ + Variables: map[string]*fern.DebugVariableValue{ + "variables": &fern.DebugVariableValue{}, + }, + }, + }, + }, + }, + Stdout: fern.String( + "stdout", + ), + }, + &fern.TraceResponseV2{ + SubmissionID: uuid.MustParse( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + LineNumber: 1, + File: &fern.TracedFile{ + Filename: "filename", + Directory: "directory", + }, + ReturnValue: &fern.DebugVariableValue{}, + ExpressionLocation: &fern.ExpressionLocation{ + Start: 1, + Offset: 1, + }, + Stack: &fern.StackInformation{ + NumStackFrames: 1, + TopStackFrame: &fern.StackFrame{ + MethodName: "methodName", + LineNumber: 1, + Scopes: []*fern.Scope{ + &fern.Scope{ + Variables: map[string]*fern.DebugVariableValue{ + "variables": &fern.DebugVariableValue{}, + }, + }, + &fern.Scope{ + Variables: map[string]*fern.DebugVariableValue{ + "variables": &fern.DebugVariableValue{}, + }, + }, + }, + }, + }, + Stdout: fern.String( + "stdout", + ), + }, + } + client.Admin.StoreTracedWorkspaceV2( + context.TODO(), + uuid.MustParse( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + request, + ) +} diff --git a/seed/go-sdk/trace/dynamic-snippets/example9/snippet.go b/seed/go-sdk/trace/dynamic-snippets/example9/snippet.go new file mode 100644 index 000000000000..2fa4627dcd2a --- /dev/null +++ b/seed/go-sdk/trace/dynamic-snippets/example9/snippet.go @@ -0,0 +1,22 @@ +package example + +import ( + context "context" + + client "github.com/trace/fern/client" + option "github.com/trace/fern/option" +) + +func do() { + client := client.NewClient( + option.WithBaseURL( + "https://api.fern.com", + ), + option.WithToken( + "", + ), + ) + client.Homepage.GetHomepageProblems( + context.TODO(), + ) +} diff --git a/seed/go-sdk/trace/environments.go b/seed/go-sdk/trace/environments.go new file mode 100644 index 000000000000..f6de8ec67105 --- /dev/null +++ b/seed/go-sdk/trace/environments.go @@ -0,0 +1,13 @@ +// Code generated by Fern. DO NOT EDIT. + +package trace + +// Environments defines all of the API environments. +// These values can be used with the WithBaseURL +// RequestOption to override the client's default environment, +// if any. +var Environments = struct { + Prod string +}{ + Prod: "https://api.trace.come", +} diff --git a/seed/go-sdk/trace/error_codes.go b/seed/go-sdk/trace/error_codes.go new file mode 100644 index 000000000000..3a8b01e7d312 --- /dev/null +++ b/seed/go-sdk/trace/error_codes.go @@ -0,0 +1,21 @@ +// Code generated by Fern. DO NOT EDIT. + +package trace + +import ( + core "github.com/trace/fern/core" + internal "github.com/trace/fern/internal" +) + +var ErrorCodes internal.ErrorCodes = internal.ErrorCodes{ + 404: func(apiError *core.APIError) error { + return &PlaylistIDNotFoundError{ + APIError: apiError, + } + }, + 401: func(apiError *core.APIError) error { + return &UnauthorizedError{ + APIError: apiError, + } + }, +} diff --git a/seed/go-sdk/trace/errors.go b/seed/go-sdk/trace/errors.go new file mode 100644 index 000000000000..437b2b8e41f3 --- /dev/null +++ b/seed/go-sdk/trace/errors.go @@ -0,0 +1,44 @@ +// Code generated by Fern. DO NOT EDIT. + +package trace + +import ( + json "encoding/json" + core "github.com/trace/fern/core" +) + +type PlaylistIDNotFoundError struct { + *core.APIError + Body *PlaylistIDNotFoundErrorBody +} + +func (p *PlaylistIDNotFoundError) UnmarshalJSON(data []byte) error { + var body *PlaylistIDNotFoundErrorBody + if err := json.Unmarshal(data, &body); err != nil { + return err + } + p.StatusCode = 404 + p.Body = body + return nil +} + +func (p *PlaylistIDNotFoundError) MarshalJSON() ([]byte, error) { + return json.Marshal(p.Body) +} + +func (p *PlaylistIDNotFoundError) Unwrap() error { + return p.APIError +} + +type UnauthorizedError struct { + *core.APIError +} + +func (u *UnauthorizedError) UnmarshalJSON(data []byte) error { + u.StatusCode = 401 + return nil +} + +func (u *UnauthorizedError) MarshalJSON() ([]byte, error) { + return nil, nil +} diff --git a/seed/go-sdk/trace/file_param.go b/seed/go-sdk/trace/file_param.go new file mode 100644 index 000000000000..205d64bd52bc --- /dev/null +++ b/seed/go-sdk/trace/file_param.go @@ -0,0 +1,41 @@ +package trace + +import ( + "io" +) + +// FileParam is a file type suitable for multipart/form-data uploads. +type FileParam struct { + io.Reader + filename string + contentType string +} + +// FileParamOption adapts the behavior of the FileParam. No options are +// implemented yet, but this interface allows for future extensibility. +type FileParamOption interface { + apply() +} + +// NewFileParam returns a *FileParam type suitable for multipart/form-data uploads. All file +// upload endpoints accept a simple io.Reader, which is usually created by opening a file +// via os.Open. +// +// However, some endpoints require additional metadata about the file such as a specific +// Content-Type or custom filename. FileParam makes it easier to create the correct type +// signature for these endpoints. +func NewFileParam( + reader io.Reader, + filename string, + contentType string, + opts ...FileParamOption, +) *FileParam { + return &FileParam{ + Reader: reader, + filename: filename, + contentType: contentType, + } +} + +func (f *FileParam) Name() string { return f.filename } +func (f *FileParam) ContentType() string { return f.contentType } diff --git a/seed/go-sdk/trace/go.mod b/seed/go-sdk/trace/go.mod new file mode 100644 index 000000000000..094833f3557d --- /dev/null +++ b/seed/go-sdk/trace/go.mod @@ -0,0 +1,16 @@ +module github.com/trace/fern + +go 1.21 + +toolchain go1.23.8 + +require github.com/google/uuid v1.6.0 + +require github.com/stretchr/testify v1.8.4 + +require gopkg.in/yaml.v3 v3.0.1 // indirect + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect +) diff --git a/seed/go-sdk/trace/go.sum b/seed/go-sdk/trace/go.sum new file mode 100644 index 000000000000..fcca6d128057 --- /dev/null +++ b/seed/go-sdk/trace/go.sum @@ -0,0 +1,12 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/seed/go-sdk/trace/homepage/client.go b/seed/go-sdk/trace/homepage/client.go new file mode 100644 index 000000000000..c23613d0bdf2 --- /dev/null +++ b/seed/go-sdk/trace/homepage/client.go @@ -0,0 +1,65 @@ +// Code generated by Fern. DO NOT EDIT. + +package homepage + +import ( + context "context" + + common "github.com/trace/fern/common" + core "github.com/trace/fern/core" + internal "github.com/trace/fern/internal" + option "github.com/trace/fern/option" +) + +type Client struct { + WithRawResponse *RawClient + + options *core.RequestOptions + baseURL string + caller *internal.Caller +} + +func NewClient(options *core.RequestOptions) *Client { + return &Client{ + WithRawResponse: NewRawClient(options), + options: options, + baseURL: options.BaseURL, + caller: internal.NewCaller( + &internal.CallerParams{ + Client: options.HTTPClient, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + }, + ), + } +} + +func (c *Client) GetHomepageProblems( + ctx context.Context, + opts ...option.RequestOption, +) ([]common.ProblemID, error) { + response, err := c.WithRawResponse.GetHomepageProblems( + ctx, + opts..., + ) + if err != nil { + return nil, err + } + return response.Body, nil +} + +func (c *Client) SetHomepageProblems( + ctx context.Context, + request []common.ProblemID, + opts ...option.RequestOption, +) error { + _, err := c.WithRawResponse.SetHomepageProblems( + ctx, + request, + opts..., + ) + if err != nil { + return err + } + return nil +} diff --git a/seed/go-sdk/trace/homepage/raw_client.go b/seed/go-sdk/trace/homepage/raw_client.go new file mode 100644 index 000000000000..535b174e69cd --- /dev/null +++ b/seed/go-sdk/trace/homepage/raw_client.go @@ -0,0 +1,113 @@ +// Code generated by Fern. DO NOT EDIT. + +package homepage + +import ( + context "context" + http "net/http" + + common "github.com/trace/fern/common" + core "github.com/trace/fern/core" + internal "github.com/trace/fern/internal" + option "github.com/trace/fern/option" +) + +type RawClient struct { + baseURL string + caller *internal.Caller + options *core.RequestOptions +} + +func NewRawClient(options *core.RequestOptions) *RawClient { + return &RawClient{ + options: options, + baseURL: options.BaseURL, + caller: internal.NewCaller( + &internal.CallerParams{ + Client: options.HTTPClient, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + }, + ), + } +} + +func (r *RawClient) GetHomepageProblems( + ctx context.Context, + opts ...option.RequestOption, +) (*core.Response[[]common.ProblemID], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.trace.come", + ) + endpointURL := baseURL + "/homepage-problems" + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + var response []common.ProblemID + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodGet, + Headers: headers, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + Response: &response, + }, + ) + if err != nil { + return nil, err + } + return &core.Response[[]common.ProblemID]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: response, + }, nil +} + +func (r *RawClient) SetHomepageProblems( + ctx context.Context, + request []common.ProblemID, + opts ...option.RequestOption, +) (*core.Response[any], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.trace.come", + ) + endpointURL := baseURL + "/homepage-problems" + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: headers, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + Request: request, + }, + ) + if err != nil { + return nil, err + } + return &core.Response[any]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: nil, + }, nil +} diff --git a/seed/go-sdk/trace/internal/caller.go b/seed/go-sdk/trace/internal/caller.go new file mode 100644 index 000000000000..2d32ad234f55 --- /dev/null +++ b/seed/go-sdk/trace/internal/caller.go @@ -0,0 +1,304 @@ +package internal + +import ( + "bytes" + "context" + "encoding/json" + "errors" + "fmt" + "io" + "net/http" + "net/url" + "reflect" + "strings" + + "github.com/trace/fern/core" +) + +const ( + // contentType specifies the JSON Content-Type header value. + contentType = "application/json" + contentTypeHeader = "Content-Type" + contentTypeFormURLEncoded = "application/x-www-form-urlencoded" +) + +// Caller calls APIs and deserializes their response, if any. +type Caller struct { + client core.HTTPClient + retrier *Retrier +} + +// CallerParams represents the parameters used to constrcut a new *Caller. +type CallerParams struct { + Client core.HTTPClient + MaxAttempts uint + DisableRetries bool +} + +// NewCaller returns a new *Caller backed by the given parameters. +func NewCaller(params *CallerParams) *Caller { + var httpClient core.HTTPClient = http.DefaultClient + if params.Client != nil { + httpClient = params.Client + } + return &Caller{ + client: httpClient, + retrier: NewRetrier(buildRetryOptions(params.MaxAttempts, params.DisableRetries)...), + } +} + +// CallParams represents the parameters used to issue an API call. +type CallParams struct { + URL string + Method string + MaxAttempts uint + DisableRetries bool + Headers http.Header + BodyProperties map[string]interface{} + QueryParameters url.Values + Client core.HTTPClient + Request interface{} + Response interface{} + ResponseIsOptional bool + ErrorDecoder ErrorDecoder +} + +// CallResponse is a parsed HTTP response from an API call. +type CallResponse struct { + StatusCode int + Header http.Header +} + +// Call issues an API call according to the given call parameters. +func (c *Caller) Call(ctx context.Context, params *CallParams) (*CallResponse, error) { + url := buildURL(params.URL, params.QueryParameters) + req, err := newRequest( + ctx, + url, + params.Method, + params.Headers, + params.Request, + params.BodyProperties, + ) + if err != nil { + return nil, err + } + + // If the call has been cancelled, don't issue the request. + if err := ctx.Err(); err != nil { + return nil, err + } + + client := c.client + if params.Client != nil { + // Use the HTTP client scoped to the request. + client = params.Client + } + + resp, err := c.retrier.Run( + client.Do, + req, + params.ErrorDecoder, + buildRetryOptions(params.MaxAttempts, params.DisableRetries)..., + ) + if err != nil { + return nil, err + } + + // Close the response body after we're done. + defer func() { _ = resp.Body.Close() }() + + // Check if the call was cancelled before we return the error + // associated with the call and/or unmarshal the response data. + if err := ctx.Err(); err != nil { + return nil, err + } + + if resp.StatusCode < 200 || resp.StatusCode >= 300 { + return nil, decodeError(resp, params.ErrorDecoder) + } + + // Mutate the response parameter in-place. + if params.Response != nil { + if writer, ok := params.Response.(io.Writer); ok { + _, err = io.Copy(writer, resp.Body) + } else { + err = json.NewDecoder(resp.Body).Decode(params.Response) + } + if err != nil { + if err == io.EOF { + if params.ResponseIsOptional { + // The response is optional, so we should ignore the + // io.EOF error + return &CallResponse{ + StatusCode: resp.StatusCode, + Header: resp.Header, + }, nil + } + return nil, fmt.Errorf("expected a %T response, but the server responded with nothing", params.Response) + } + return nil, err + } + } + + return &CallResponse{ + StatusCode: resp.StatusCode, + Header: resp.Header, + }, nil +} + +// buildURL constructs the final URL by appending the given query parameters (if any). +func buildURL( + url string, + queryParameters url.Values, +) string { + if len(queryParameters) == 0 { + return url + } + if strings.ContainsRune(url, '?') { + url += "&" + } else { + url += "?" + } + url += queryParameters.Encode() + return url +} + +// newRequest returns a new *http.Request with all of the fields +// required to issue the call. +func newRequest( + ctx context.Context, + url string, + method string, + endpointHeaders http.Header, + request interface{}, + bodyProperties map[string]interface{}, +) (*http.Request, error) { + // Determine the content type from headers, defaulting to JSON. + reqContentType := contentType + if endpointHeaders != nil { + if ct := endpointHeaders.Get(contentTypeHeader); ct != "" { + reqContentType = ct + } + } + requestBody, err := newRequestBody(request, bodyProperties, reqContentType) + if err != nil { + return nil, err + } + req, err := http.NewRequestWithContext(ctx, method, url, requestBody) + if err != nil { + return nil, err + } + req.Header.Set(contentTypeHeader, reqContentType) + for name, values := range endpointHeaders { + req.Header[name] = values + } + return req, nil +} + +// newRequestBody returns a new io.Reader that represents the HTTP request body. +func newRequestBody(request interface{}, bodyProperties map[string]interface{}, reqContentType string) (io.Reader, error) { + if isNil(request) { + if len(bodyProperties) == 0 { + return nil, nil + } + if reqContentType == contentTypeFormURLEncoded { + return newFormURLEncodedBody(bodyProperties), nil + } + requestBytes, err := json.Marshal(bodyProperties) + if err != nil { + return nil, err + } + return bytes.NewReader(requestBytes), nil + } + if body, ok := request.(io.Reader); ok { + return body, nil + } + // Handle form URL encoded content type. + if reqContentType == contentTypeFormURLEncoded { + return newFormURLEncodedRequestBody(request, bodyProperties) + } + requestBytes, err := MarshalJSONWithExtraProperties(request, bodyProperties) + if err != nil { + return nil, err + } + return bytes.NewReader(requestBytes), nil +} + +// newFormURLEncodedBody returns a new io.Reader that represents a form URL encoded body +// from the given body properties map. +func newFormURLEncodedBody(bodyProperties map[string]interface{}) io.Reader { + values := url.Values{} + for key, val := range bodyProperties { + values.Set(key, fmt.Sprintf("%v", val)) + } + return strings.NewReader(values.Encode()) +} + +// newFormURLEncodedRequestBody returns a new io.Reader that represents a form URL encoded body +// from the given request struct and body properties. +func newFormURLEncodedRequestBody(request interface{}, bodyProperties map[string]interface{}) (io.Reader, error) { + values := url.Values{} + // Marshal the request to JSON first to respect any custom MarshalJSON methods, + // then unmarshal into a map to extract the field values. + jsonBytes, err := json.Marshal(request) + if err != nil { + return nil, err + } + var jsonMap map[string]interface{} + if err := json.Unmarshal(jsonBytes, &jsonMap); err != nil { + return nil, err + } + // Convert the JSON map to form URL encoded values. + for key, val := range jsonMap { + if val == nil { + continue + } + values.Set(key, fmt.Sprintf("%v", val)) + } + // Add any extra body properties. + for key, val := range bodyProperties { + values.Set(key, fmt.Sprintf("%v", val)) + } + return strings.NewReader(values.Encode()), nil +} + +// decodeError decodes the error from the given HTTP response. Note that +// it's the caller's responsibility to close the response body. +func decodeError(response *http.Response, errorDecoder ErrorDecoder) error { + if errorDecoder != nil { + // This endpoint has custom errors, so we'll + // attempt to unmarshal the error into a structured + // type based on the status code. + return errorDecoder(response.StatusCode, response.Header, response.Body) + } + // This endpoint doesn't have any custom error + // types, so we just read the body as-is, and + // put it into a normal error. + bytes, err := io.ReadAll(response.Body) + if err != nil && err != io.EOF { + return err + } + if err == io.EOF { + // The error didn't have a response body, + // so all we can do is return an error + // with the status code. + return core.NewAPIError(response.StatusCode, response.Header, nil) + } + return core.NewAPIError(response.StatusCode, response.Header, errors.New(string(bytes))) +} + +// isNil is used to determine if the request value is equal to nil (i.e. an interface +// value that holds a nil concrete value is itself non-nil). +func isNil(value interface{}) bool { + if value == nil { + return true + } + v := reflect.ValueOf(value) + switch v.Kind() { + case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Pointer, reflect.Slice: + return v.IsNil() + default: + return false + } +} diff --git a/seed/go-sdk/trace/internal/caller_test.go b/seed/go-sdk/trace/internal/caller_test.go new file mode 100644 index 000000000000..f60c41b2a35b --- /dev/null +++ b/seed/go-sdk/trace/internal/caller_test.go @@ -0,0 +1,705 @@ +package internal + +import ( + "bytes" + "context" + "encoding/json" + "errors" + "fmt" + "io" + "net/http" + "net/http/httptest" + "net/url" + "strconv" + "strings" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/trace/fern/core" +) + +// InternalTestCase represents a single test case. +type InternalTestCase struct { + description string + + // Server-side assertions. + givePathSuffix string + giveMethod string + giveResponseIsOptional bool + giveHeader http.Header + giveErrorDecoder ErrorDecoder + giveRequest *InternalTestRequest + giveQueryParams url.Values + giveBodyProperties map[string]interface{} + + // Client-side assertions. + wantResponse *InternalTestResponse + wantError error +} + +// InternalTestRequest a simple request body. +type InternalTestRequest struct { + Id string `json:"id"` +} + +// InternalTestResponse a simple response body. +type InternalTestResponse struct { + Id string `json:"id"` + ExtraBodyProperties map[string]interface{} `json:"extraBodyProperties,omitempty"` + QueryParameters url.Values `json:"queryParameters,omitempty"` +} + +// InternalTestNotFoundError represents a 404. +type InternalTestNotFoundError struct { + *core.APIError + + Message string `json:"message"` +} + +func TestCall(t *testing.T) { + tests := []*InternalTestCase{ + { + description: "GET success", + giveMethod: http.MethodGet, + giveHeader: http.Header{ + "X-API-Status": []string{"success"}, + }, + giveRequest: &InternalTestRequest{ + Id: "123", + }, + wantResponse: &InternalTestResponse{ + Id: "123", + }, + }, + { + description: "GET success with query", + givePathSuffix: "?limit=1", + giveMethod: http.MethodGet, + giveHeader: http.Header{ + "X-API-Status": []string{"success"}, + }, + giveRequest: &InternalTestRequest{ + Id: "123", + }, + wantResponse: &InternalTestResponse{ + Id: "123", + QueryParameters: url.Values{ + "limit": []string{"1"}, + }, + }, + }, + { + description: "GET not found", + giveMethod: http.MethodGet, + giveHeader: http.Header{ + "X-API-Status": []string{"fail"}, + }, + giveRequest: &InternalTestRequest{ + Id: strconv.Itoa(http.StatusNotFound), + }, + giveErrorDecoder: newTestErrorDecoder(t), + wantError: &InternalTestNotFoundError{ + APIError: core.NewAPIError( + http.StatusNotFound, + http.Header{}, + errors.New(`{"message":"ID \"404\" not found"}`), + ), + }, + }, + { + description: "POST empty body", + giveMethod: http.MethodPost, + giveHeader: http.Header{ + "X-API-Status": []string{"fail"}, + }, + giveRequest: nil, + wantError: core.NewAPIError( + http.StatusBadRequest, + http.Header{}, + errors.New("invalid request"), + ), + }, + { + description: "POST optional response", + giveMethod: http.MethodPost, + giveHeader: http.Header{ + "X-API-Status": []string{"success"}, + }, + giveRequest: &InternalTestRequest{ + Id: "123", + }, + giveResponseIsOptional: true, + }, + { + description: "POST API error", + giveMethod: http.MethodPost, + giveHeader: http.Header{ + "X-API-Status": []string{"fail"}, + }, + giveRequest: &InternalTestRequest{ + Id: strconv.Itoa(http.StatusInternalServerError), + }, + wantError: core.NewAPIError( + http.StatusInternalServerError, + http.Header{}, + errors.New("failed to process request"), + ), + }, + { + description: "POST extra properties", + giveMethod: http.MethodPost, + giveHeader: http.Header{ + "X-API-Status": []string{"success"}, + }, + giveRequest: new(InternalTestRequest), + giveBodyProperties: map[string]interface{}{ + "key": "value", + }, + wantResponse: &InternalTestResponse{ + ExtraBodyProperties: map[string]interface{}{ + "key": "value", + }, + }, + }, + { + description: "GET extra query parameters", + giveMethod: http.MethodGet, + giveHeader: http.Header{ + "X-API-Status": []string{"success"}, + }, + giveQueryParams: url.Values{ + "extra": []string{"true"}, + }, + giveRequest: &InternalTestRequest{ + Id: "123", + }, + wantResponse: &InternalTestResponse{ + Id: "123", + QueryParameters: url.Values{ + "extra": []string{"true"}, + }, + }, + }, + { + description: "GET merge extra query parameters", + givePathSuffix: "?limit=1", + giveMethod: http.MethodGet, + giveHeader: http.Header{ + "X-API-Status": []string{"success"}, + }, + giveRequest: &InternalTestRequest{ + Id: "123", + }, + giveQueryParams: url.Values{ + "extra": []string{"true"}, + }, + wantResponse: &InternalTestResponse{ + Id: "123", + QueryParameters: url.Values{ + "limit": []string{"1"}, + "extra": []string{"true"}, + }, + }, + }, + } + for _, test := range tests { + t.Run(test.description, func(t *testing.T) { + var ( + server = newTestServer(t, test) + client = server.Client() + ) + caller := NewCaller( + &CallerParams{ + Client: client, + }, + ) + var response *InternalTestResponse + _, err := caller.Call( + context.Background(), + &CallParams{ + URL: server.URL + test.givePathSuffix, + Method: test.giveMethod, + Headers: test.giveHeader, + BodyProperties: test.giveBodyProperties, + QueryParameters: test.giveQueryParams, + Request: test.giveRequest, + Response: &response, + ResponseIsOptional: test.giveResponseIsOptional, + ErrorDecoder: test.giveErrorDecoder, + }, + ) + if test.wantError != nil { + assert.EqualError(t, err, test.wantError.Error()) + return + } + require.NoError(t, err) + assert.Equal(t, test.wantResponse, response) + }) + } +} + +func TestMergeHeaders(t *testing.T) { + t.Run("both empty", func(t *testing.T) { + merged := MergeHeaders(make(http.Header), make(http.Header)) + assert.Empty(t, merged) + }) + + t.Run("empty left", func(t *testing.T) { + left := make(http.Header) + + right := make(http.Header) + right.Set("X-API-Version", "0.0.1") + + merged := MergeHeaders(left, right) + assert.Equal(t, "0.0.1", merged.Get("X-API-Version")) + }) + + t.Run("empty right", func(t *testing.T) { + left := make(http.Header) + left.Set("X-API-Version", "0.0.1") + + right := make(http.Header) + + merged := MergeHeaders(left, right) + assert.Equal(t, "0.0.1", merged.Get("X-API-Version")) + }) + + t.Run("single value override", func(t *testing.T) { + left := make(http.Header) + left.Set("X-API-Version", "0.0.0") + + right := make(http.Header) + right.Set("X-API-Version", "0.0.1") + + merged := MergeHeaders(left, right) + assert.Equal(t, []string{"0.0.1"}, merged.Values("X-API-Version")) + }) + + t.Run("multiple value override", func(t *testing.T) { + left := make(http.Header) + left.Set("X-API-Versions", "0.0.0") + + right := make(http.Header) + right.Add("X-API-Versions", "0.0.1") + right.Add("X-API-Versions", "0.0.2") + + merged := MergeHeaders(left, right) + assert.Equal(t, []string{"0.0.1", "0.0.2"}, merged.Values("X-API-Versions")) + }) + + t.Run("disjoint merge", func(t *testing.T) { + left := make(http.Header) + left.Set("X-API-Tenancy", "test") + + right := make(http.Header) + right.Set("X-API-Version", "0.0.1") + + merged := MergeHeaders(left, right) + assert.Equal(t, []string{"test"}, merged.Values("X-API-Tenancy")) + assert.Equal(t, []string{"0.0.1"}, merged.Values("X-API-Version")) + }) +} + +// newTestServer returns a new *httptest.Server configured with the +// given test parameters. +func newTestServer(t *testing.T, tc *InternalTestCase) *httptest.Server { + return httptest.NewServer( + http.HandlerFunc( + func(w http.ResponseWriter, r *http.Request) { + assert.Equal(t, tc.giveMethod, r.Method) + assert.Equal(t, contentType, r.Header.Get(contentTypeHeader)) + for header, value := range tc.giveHeader { + assert.Equal(t, value, r.Header.Values(header)) + } + + request := new(InternalTestRequest) + + bytes, err := io.ReadAll(r.Body) + if tc.giveRequest == nil { + require.Empty(t, bytes) + w.WriteHeader(http.StatusBadRequest) + _, err = w.Write([]byte("invalid request")) + require.NoError(t, err) + return + } + require.NoError(t, err) + require.NoError(t, json.Unmarshal(bytes, request)) + + switch request.Id { + case strconv.Itoa(http.StatusNotFound): + notFoundError := &InternalTestNotFoundError{ + APIError: &core.APIError{ + StatusCode: http.StatusNotFound, + }, + Message: fmt.Sprintf("ID %q not found", request.Id), + } + bytes, err = json.Marshal(notFoundError) + require.NoError(t, err) + + w.WriteHeader(http.StatusNotFound) + _, err = w.Write(bytes) + require.NoError(t, err) + return + + case strconv.Itoa(http.StatusInternalServerError): + w.WriteHeader(http.StatusInternalServerError) + _, err = w.Write([]byte("failed to process request")) + require.NoError(t, err) + return + } + + if tc.giveResponseIsOptional { + w.WriteHeader(http.StatusOK) + return + } + + extraBodyProperties := make(map[string]interface{}) + require.NoError(t, json.Unmarshal(bytes, &extraBodyProperties)) + delete(extraBodyProperties, "id") + + response := &InternalTestResponse{ + Id: request.Id, + ExtraBodyProperties: extraBodyProperties, + QueryParameters: r.URL.Query(), + } + bytes, err = json.Marshal(response) + require.NoError(t, err) + + _, err = w.Write(bytes) + require.NoError(t, err) + }, + ), + ) +} + +func TestIsNil(t *testing.T) { + t.Run("nil interface", func(t *testing.T) { + assert.True(t, isNil(nil)) + }) + + t.Run("nil pointer", func(t *testing.T) { + var ptr *string + assert.True(t, isNil(ptr)) + }) + + t.Run("non-nil pointer", func(t *testing.T) { + s := "test" + assert.False(t, isNil(&s)) + }) + + t.Run("nil slice", func(t *testing.T) { + var slice []string + assert.True(t, isNil(slice)) + }) + + t.Run("non-nil slice", func(t *testing.T) { + slice := []string{} + assert.False(t, isNil(slice)) + }) + + t.Run("nil map", func(t *testing.T) { + var m map[string]string + assert.True(t, isNil(m)) + }) + + t.Run("non-nil map", func(t *testing.T) { + m := make(map[string]string) + assert.False(t, isNil(m)) + }) + + t.Run("string value", func(t *testing.T) { + assert.False(t, isNil("test")) + }) + + t.Run("empty string value", func(t *testing.T) { + assert.False(t, isNil("")) + }) + + t.Run("int value", func(t *testing.T) { + assert.False(t, isNil(42)) + }) + + t.Run("zero int value", func(t *testing.T) { + assert.False(t, isNil(0)) + }) + + t.Run("bool value", func(t *testing.T) { + assert.False(t, isNil(true)) + }) + + t.Run("false bool value", func(t *testing.T) { + assert.False(t, isNil(false)) + }) + + t.Run("struct value", func(t *testing.T) { + type testStruct struct { + Field string + } + assert.False(t, isNil(testStruct{Field: "test"})) + }) + + t.Run("empty struct value", func(t *testing.T) { + type testStruct struct { + Field string + } + assert.False(t, isNil(testStruct{})) + }) +} + +// newTestErrorDecoder returns an error decoder suitable for tests. +func newTestErrorDecoder(t *testing.T) func(int, http.Header, io.Reader) error { + return func(statusCode int, header http.Header, body io.Reader) error { + raw, err := io.ReadAll(body) + require.NoError(t, err) + + var ( + apiError = core.NewAPIError(statusCode, header, errors.New(string(raw))) + decoder = json.NewDecoder(bytes.NewReader(raw)) + ) + if statusCode == http.StatusNotFound { + value := new(InternalTestNotFoundError) + value.APIError = apiError + require.NoError(t, decoder.Decode(value)) + + return value + } + return apiError + } +} + +// FormURLEncodedTestRequest is a test struct for form URL encoding tests. +type FormURLEncodedTestRequest struct { + ClientID string `json:"client_id"` + ClientSecret string `json:"client_secret"` + GrantType string `json:"grant_type,omitempty"` + Scope *string `json:"scope,omitempty"` + NilPointer *string `json:"nil_pointer,omitempty"` +} + +func TestNewFormURLEncodedBody(t *testing.T) { + t.Run("simple key-value pairs", func(t *testing.T) { + bodyProperties := map[string]interface{}{ + "client_id": "test_client_id", + "client_secret": "test_client_secret", + "grant_type": "client_credentials", + } + reader := newFormURLEncodedBody(bodyProperties) + body, err := io.ReadAll(reader) + require.NoError(t, err) + + // Parse the body and verify values + values, err := url.ParseQuery(string(body)) + require.NoError(t, err) + + assert.Equal(t, "test_client_id", values.Get("client_id")) + assert.Equal(t, "test_client_secret", values.Get("client_secret")) + assert.Equal(t, "client_credentials", values.Get("grant_type")) + + // Verify it's not JSON + bodyStr := string(body) + assert.False(t, strings.HasPrefix(strings.TrimSpace(bodyStr), "{"), + "Body should not be JSON, got: %s", bodyStr) + }) + + t.Run("special characters requiring URL encoding", func(t *testing.T) { + bodyProperties := map[string]interface{}{ + "value_with_space": "hello world", + "value_with_ampersand": "a&b", + "value_with_equals": "a=b", + "value_with_plus": "a+b", + } + reader := newFormURLEncodedBody(bodyProperties) + body, err := io.ReadAll(reader) + require.NoError(t, err) + + // Parse the body and verify values are correctly decoded + values, err := url.ParseQuery(string(body)) + require.NoError(t, err) + + assert.Equal(t, "hello world", values.Get("value_with_space")) + assert.Equal(t, "a&b", values.Get("value_with_ampersand")) + assert.Equal(t, "a=b", values.Get("value_with_equals")) + assert.Equal(t, "a+b", values.Get("value_with_plus")) + }) + + t.Run("empty map", func(t *testing.T) { + bodyProperties := map[string]interface{}{} + reader := newFormURLEncodedBody(bodyProperties) + body, err := io.ReadAll(reader) + require.NoError(t, err) + assert.Empty(t, string(body)) + }) +} + +func TestNewFormURLEncodedRequestBody(t *testing.T) { + t.Run("struct with json tags", func(t *testing.T) { + scope := "read write" + request := &FormURLEncodedTestRequest{ + ClientID: "test_client_id", + ClientSecret: "test_client_secret", + GrantType: "client_credentials", + Scope: &scope, + NilPointer: nil, + } + reader, err := newFormURLEncodedRequestBody(request, nil) + require.NoError(t, err) + + body, err := io.ReadAll(reader) + require.NoError(t, err) + + // Parse the body and verify values + values, err := url.ParseQuery(string(body)) + require.NoError(t, err) + + assert.Equal(t, "test_client_id", values.Get("client_id")) + assert.Equal(t, "test_client_secret", values.Get("client_secret")) + assert.Equal(t, "client_credentials", values.Get("grant_type")) + assert.Equal(t, "read write", values.Get("scope")) + // nil_pointer should not be present (nil pointer with omitempty) + assert.Empty(t, values.Get("nil_pointer")) + + // Verify it's not JSON + bodyStr := string(body) + assert.False(t, strings.HasPrefix(strings.TrimSpace(bodyStr), "{"), + "Body should not be JSON, got: %s", bodyStr) + }) + + t.Run("struct with omitempty and zero values", func(t *testing.T) { + request := &FormURLEncodedTestRequest{ + ClientID: "test_client_id", + ClientSecret: "test_client_secret", + GrantType: "", // empty string with omitempty should be omitted + Scope: nil, + NilPointer: nil, + } + reader, err := newFormURLEncodedRequestBody(request, nil) + require.NoError(t, err) + + body, err := io.ReadAll(reader) + require.NoError(t, err) + + values, err := url.ParseQuery(string(body)) + require.NoError(t, err) + + assert.Equal(t, "test_client_id", values.Get("client_id")) + assert.Equal(t, "test_client_secret", values.Get("client_secret")) + // grant_type should not be present (empty string with omitempty) + assert.Empty(t, values.Get("grant_type")) + assert.Empty(t, values.Get("scope")) + }) + + t.Run("struct with extra body properties", func(t *testing.T) { + request := &FormURLEncodedTestRequest{ + ClientID: "test_client_id", + ClientSecret: "test_client_secret", + } + bodyProperties := map[string]interface{}{ + "extra_param": "extra_value", + } + reader, err := newFormURLEncodedRequestBody(request, bodyProperties) + require.NoError(t, err) + + body, err := io.ReadAll(reader) + require.NoError(t, err) + + values, err := url.ParseQuery(string(body)) + require.NoError(t, err) + + assert.Equal(t, "test_client_id", values.Get("client_id")) + assert.Equal(t, "test_client_secret", values.Get("client_secret")) + assert.Equal(t, "extra_value", values.Get("extra_param")) + }) + + t.Run("special characters in struct fields", func(t *testing.T) { + scope := "read&write=all+permissions" + request := &FormURLEncodedTestRequest{ + ClientID: "client with spaces", + ClientSecret: "secret&with=special+chars", + Scope: &scope, + } + reader, err := newFormURLEncodedRequestBody(request, nil) + require.NoError(t, err) + + body, err := io.ReadAll(reader) + require.NoError(t, err) + + values, err := url.ParseQuery(string(body)) + require.NoError(t, err) + + assert.Equal(t, "client with spaces", values.Get("client_id")) + assert.Equal(t, "secret&with=special+chars", values.Get("client_secret")) + assert.Equal(t, "read&write=all+permissions", values.Get("scope")) + }) +} + +func TestNewRequestBodyFormURLEncoded(t *testing.T) { + t.Run("selects form encoding when content-type is form-urlencoded", func(t *testing.T) { + request := &FormURLEncodedTestRequest{ + ClientID: "test_client_id", + ClientSecret: "test_client_secret", + GrantType: "client_credentials", + } + reader, err := newRequestBody(request, nil, contentTypeFormURLEncoded) + require.NoError(t, err) + + body, err := io.ReadAll(reader) + require.NoError(t, err) + + // Verify it's form-urlencoded, not JSON + bodyStr := string(body) + assert.False(t, strings.HasPrefix(strings.TrimSpace(bodyStr), "{"), + "Body should not be JSON when Content-Type is form-urlencoded, got: %s", bodyStr) + + // Parse and verify values + values, err := url.ParseQuery(bodyStr) + require.NoError(t, err) + + assert.Equal(t, "test_client_id", values.Get("client_id")) + assert.Equal(t, "test_client_secret", values.Get("client_secret")) + assert.Equal(t, "client_credentials", values.Get("grant_type")) + }) + + t.Run("selects JSON encoding when content-type is application/json", func(t *testing.T) { + request := &FormURLEncodedTestRequest{ + ClientID: "test_client_id", + ClientSecret: "test_client_secret", + } + reader, err := newRequestBody(request, nil, contentType) + require.NoError(t, err) + + body, err := io.ReadAll(reader) + require.NoError(t, err) + + // Verify it's JSON + bodyStr := string(body) + assert.True(t, strings.HasPrefix(strings.TrimSpace(bodyStr), "{"), + "Body should be JSON when Content-Type is application/json, got: %s", bodyStr) + + // Parse and verify it's valid JSON + var parsed map[string]interface{} + err = json.Unmarshal(body, &parsed) + require.NoError(t, err) + + assert.Equal(t, "test_client_id", parsed["client_id"]) + assert.Equal(t, "test_client_secret", parsed["client_secret"]) + }) + + t.Run("form encoding with body properties only (nil request)", func(t *testing.T) { + bodyProperties := map[string]interface{}{ + "client_id": "test_client_id", + "client_secret": "test_client_secret", + } + reader, err := newRequestBody(nil, bodyProperties, contentTypeFormURLEncoded) + require.NoError(t, err) + + body, err := io.ReadAll(reader) + require.NoError(t, err) + + values, err := url.ParseQuery(string(body)) + require.NoError(t, err) + + assert.Equal(t, "test_client_id", values.Get("client_id")) + assert.Equal(t, "test_client_secret", values.Get("client_secret")) + }) +} diff --git a/seed/go-sdk/trace/internal/error_decoder.go b/seed/go-sdk/trace/internal/error_decoder.go new file mode 100644 index 000000000000..9da9e5da85b4 --- /dev/null +++ b/seed/go-sdk/trace/internal/error_decoder.go @@ -0,0 +1,64 @@ +package internal + +import ( + "bytes" + "encoding/json" + "errors" + "fmt" + "io" + "net/http" + + "github.com/trace/fern/core" +) + +// ErrorCodes maps HTTP status codes to error constructors. +type ErrorCodes map[int]func(*core.APIError) error + +// ErrorDecoder decodes *http.Response errors and returns a +// typed API error (e.g. *core.APIError). +type ErrorDecoder func(statusCode int, header http.Header, body io.Reader) error + +// NewErrorDecoder returns a new ErrorDecoder backed by the given error codes. +// errorCodesOverrides is optional and will be merged with the default error codes, +// with overrides taking precedence. +func NewErrorDecoder(errorCodes ErrorCodes, errorCodesOverrides ...ErrorCodes) ErrorDecoder { + // Merge default error codes with overrides + mergedErrorCodes := make(ErrorCodes) + + // Start with default error codes + for statusCode, errorFunc := range errorCodes { + mergedErrorCodes[statusCode] = errorFunc + } + + // Apply overrides if provided + if len(errorCodesOverrides) > 0 && errorCodesOverrides[0] != nil { + for statusCode, errorFunc := range errorCodesOverrides[0] { + mergedErrorCodes[statusCode] = errorFunc + } + } + + return func(statusCode int, header http.Header, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return fmt.Errorf("failed to read error from response body: %w", err) + } + apiError := core.NewAPIError( + statusCode, + header, + errors.New(string(raw)), + ) + newErrorFunc, ok := mergedErrorCodes[statusCode] + if !ok { + // This status code isn't recognized, so we return + // the API error as-is. + return apiError + } + customError := newErrorFunc(apiError) + if err := json.NewDecoder(bytes.NewReader(raw)).Decode(customError); err != nil { + // If we fail to decode the error, we return the + // API error as-is. + return apiError + } + return customError + } +} diff --git a/seed/go-sdk/trace/internal/error_decoder_test.go b/seed/go-sdk/trace/internal/error_decoder_test.go new file mode 100644 index 000000000000..7dc1a20c928f --- /dev/null +++ b/seed/go-sdk/trace/internal/error_decoder_test.go @@ -0,0 +1,59 @@ +package internal + +import ( + "bytes" + "errors" + "net/http" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/trace/fern/core" +) + +func TestErrorDecoder(t *testing.T) { + decoder := NewErrorDecoder( + ErrorCodes{ + http.StatusNotFound: func(apiError *core.APIError) error { + return &InternalTestNotFoundError{APIError: apiError} + }, + }) + + tests := []struct { + description string + giveStatusCode int + giveHeader http.Header + giveBody string + wantError error + }{ + { + description: "unrecognized status code", + giveStatusCode: http.StatusInternalServerError, + giveHeader: http.Header{}, + giveBody: "Internal Server Error", + wantError: core.NewAPIError(http.StatusInternalServerError, http.Header{}, errors.New("Internal Server Error")), + }, + { + description: "not found with valid JSON", + giveStatusCode: http.StatusNotFound, + giveHeader: http.Header{}, + giveBody: `{"message": "Resource not found"}`, + wantError: &InternalTestNotFoundError{ + APIError: core.NewAPIError(http.StatusNotFound, http.Header{}, errors.New(`{"message": "Resource not found"}`)), + Message: "Resource not found", + }, + }, + { + description: "not found with invalid JSON", + giveStatusCode: http.StatusNotFound, + giveHeader: http.Header{}, + giveBody: `Resource not found`, + wantError: core.NewAPIError(http.StatusNotFound, http.Header{}, errors.New("Resource not found")), + }, + } + + for _, tt := range tests { + t.Run(tt.description, func(t *testing.T) { + assert.Equal(t, tt.wantError, decoder(tt.giveStatusCode, tt.giveHeader, bytes.NewReader([]byte(tt.giveBody)))) + }) + } +} diff --git a/seed/go-sdk/trace/internal/explicit_fields.go b/seed/go-sdk/trace/internal/explicit_fields.go new file mode 100644 index 000000000000..4bdf34fc2b7c --- /dev/null +++ b/seed/go-sdk/trace/internal/explicit_fields.go @@ -0,0 +1,116 @@ +package internal + +import ( + "math/big" + "reflect" + "strings" +) + +// HandleExplicitFields processes a struct to remove `omitempty` from +// fields that have been explicitly set (as indicated by their corresponding bit in explicitFields). +// Note that `marshaler` should be an embedded struct to avoid infinite recursion. +// Returns an interface{} that can be passed to json.Marshal. +func HandleExplicitFields(marshaler interface{}, explicitFields *big.Int) interface{} { + val := reflect.ValueOf(marshaler) + typ := reflect.TypeOf(marshaler) + + // Handle pointer types + if val.Kind() == reflect.Ptr { + if val.IsNil() { + return nil + } + val = val.Elem() + typ = typ.Elem() + } + + // Only handle struct types + if val.Kind() != reflect.Struct { + return marshaler + } + + // Handle embedded struct pattern + var sourceVal reflect.Value + var sourceType reflect.Type + + // Check if this is an embedded struct pattern + if typ.NumField() == 1 && typ.Field(0).Anonymous { + // This is likely an embedded struct, get the embedded value + embeddedField := val.Field(0) + sourceVal = embeddedField + sourceType = embeddedField.Type() + } else { + // Regular struct + sourceVal = val + sourceType = typ + } + + // If no explicit fields set, use standard marshaling + if explicitFields == nil || explicitFields.Sign() == 0 { + return marshaler + } + + // Create a new struct type with modified tags + fields := make([]reflect.StructField, 0, sourceType.NumField()) + + for i := 0; i < sourceType.NumField(); i++ { + field := sourceType.Field(i) + + // Skip unexported fields and the explicitFields field itself + if !field.IsExported() || field.Name == "explicitFields" { + continue + } + + // Check if this field has been explicitly set + fieldBit := big.NewInt(1) + fieldBit.Lsh(fieldBit, uint(i)) + if big.NewInt(0).And(explicitFields, fieldBit).Sign() != 0 { + // Remove omitempty from the json tag + tag := field.Tag.Get("json") + if tag != "" && tag != "-" { + // Parse the json tag, remove omitempty from options + parts := strings.Split(tag, ",") + if len(parts) > 1 { + var newParts []string + newParts = append(newParts, parts[0]) // Keep the field name + for _, part := range parts[1:] { + if strings.TrimSpace(part) != "omitempty" { + newParts = append(newParts, part) + } + } + tag = strings.Join(newParts, ",") + } + + // Reconstruct the struct tag + newTag := `json:"` + tag + `"` + if urlTag := field.Tag.Get("url"); urlTag != "" { + newTag += ` url:"` + urlTag + `"` + } + + field.Tag = reflect.StructTag(newTag) + } + } + + fields = append(fields, field) + } + + // Create new struct type with modified tags + newType := reflect.StructOf(fields) + newVal := reflect.New(newType).Elem() + + // Copy field values from original struct to new struct + fieldIndex := 0 + for i := 0; i < sourceType.NumField(); i++ { + originalField := sourceType.Field(i) + + // Skip unexported fields and the explicitFields field itself + if !originalField.IsExported() || originalField.Name == "explicitFields" { + continue + } + + originalValue := sourceVal.Field(i) + newVal.Field(fieldIndex).Set(originalValue) + fieldIndex++ + } + + return newVal.Interface() +} diff --git a/seed/go-sdk/trace/internal/explicit_fields_test.go b/seed/go-sdk/trace/internal/explicit_fields_test.go new file mode 100644 index 000000000000..f44beec447d6 --- /dev/null +++ b/seed/go-sdk/trace/internal/explicit_fields_test.go @@ -0,0 +1,645 @@ +package internal + +import ( + "encoding/json" + "math/big" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +type testExplicitFieldsStruct struct { + Name *string `json:"name,omitempty"` + Code *string `json:"code,omitempty"` + Count *int `json:"count,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + Tags []string `json:"tags,omitempty"` + unexported string `json:"-"` //nolint:unused + explicitFields *big.Int `json:"-"` +} + +var ( + testFieldName = big.NewInt(1 << 0) + testFieldCode = big.NewInt(1 << 1) + testFieldCount = big.NewInt(1 << 2) + testFieldEnabled = big.NewInt(1 << 3) + testFieldTags = big.NewInt(1 << 4) +) + +func (t *testExplicitFieldsStruct) require(field *big.Int) { + if t.explicitFields == nil { + t.explicitFields = big.NewInt(0) + } + t.explicitFields.Or(t.explicitFields, field) +} + +func (t *testExplicitFieldsStruct) SetName(name *string) { + t.Name = name + t.require(testFieldName) +} + +func (t *testExplicitFieldsStruct) SetCode(code *string) { + t.Code = code + t.require(testFieldCode) +} + +func (t *testExplicitFieldsStruct) SetCount(count *int) { + t.Count = count + t.require(testFieldCount) +} + +func (t *testExplicitFieldsStruct) SetEnabled(enabled *bool) { + t.Enabled = enabled + t.require(testFieldEnabled) +} + +func (t *testExplicitFieldsStruct) SetTags(tags []string) { + t.Tags = tags + t.require(testFieldTags) +} + +func (t *testExplicitFieldsStruct) MarshalJSON() ([]byte, error) { + type embed testExplicitFieldsStruct + var marshaler = struct { + embed + }{ + embed: embed(*t), + } + return json.Marshal(HandleExplicitFields(marshaler, t.explicitFields)) +} + +type testStructWithoutExplicitFields struct { + Name *string `json:"name,omitempty"` + Code *string `json:"code,omitempty"` +} + +func TestHandleExplicitFields(t *testing.T) { + tests := []struct { + desc string + giveInput interface{} + wantBytes []byte + wantError string + }{ + { + desc: "nil input", + giveInput: nil, + wantBytes: []byte(`null`), + }, + { + desc: "non-struct input", + giveInput: "string", + wantBytes: []byte(`"string"`), + }, + { + desc: "slice input", + giveInput: []string{"a", "b"}, + wantBytes: []byte(`["a","b"]`), + }, + { + desc: "map input", + giveInput: map[string]interface{}{"key": "value"}, + wantBytes: []byte(`{"key":"value"}`), + }, + { + desc: "struct without explicitFields field", + giveInput: &testStructWithoutExplicitFields{ + Name: stringPtr("test"), + Code: nil, + }, + wantBytes: []byte(`{"name":"test"}`), + }, + { + desc: "struct with no explicit fields set", + giveInput: &testExplicitFieldsStruct{ + Name: stringPtr("test"), + Code: nil, + }, + wantBytes: []byte(`{"name":"test"}`), + }, + { + desc: "struct with explicit nil field", + giveInput: func() *testExplicitFieldsStruct { + s := &testExplicitFieldsStruct{ + Name: stringPtr("test"), + } + s.SetCode(nil) + return s + }(), + wantBytes: []byte(`{"name":"test","code":null}`), + }, + { + desc: "struct with explicit non-nil field", + giveInput: func() *testExplicitFieldsStruct { + s := &testExplicitFieldsStruct{} + s.SetName(stringPtr("explicit")) + s.SetCode(stringPtr("also-explicit")) + return s + }(), + wantBytes: []byte(`{"name":"explicit","code":"also-explicit"}`), + }, + { + desc: "struct with mixed explicit and implicit fields", + giveInput: func() *testExplicitFieldsStruct { + s := &testExplicitFieldsStruct{ + Name: stringPtr("implicit"), + Count: intPtr(42), + } + s.SetCode(nil) // explicit nil + return s + }(), + wantBytes: []byte(`{"name":"implicit","code":null,"count":42}`), + }, + { + desc: "struct with multiple explicit nil fields", + giveInput: func() *testExplicitFieldsStruct { + s := &testExplicitFieldsStruct{ + Name: stringPtr("test"), + } + s.SetCode(nil) + s.SetCount(nil) + return s + }(), + wantBytes: []byte(`{"name":"test","code":null,"count":null}`), + }, + { + desc: "struct with slice field", + giveInput: func() *testExplicitFieldsStruct { + s := &testExplicitFieldsStruct{ + Tags: []string{"tag1", "tag2"}, + } + s.SetTags(nil) // explicit nil slice + return s + }(), + wantBytes: []byte(`{"tags":null}`), + }, + { + desc: "struct with boolean field", + giveInput: func() *testExplicitFieldsStruct { + s := &testExplicitFieldsStruct{} + s.SetEnabled(boolPtr(false)) // explicit false + return s + }(), + wantBytes: []byte(`{"enabled":false}`), + }, + { + desc: "struct with all fields explicit", + giveInput: func() *testExplicitFieldsStruct { + s := &testExplicitFieldsStruct{} + s.SetName(stringPtr("test")) + s.SetCode(nil) + s.SetCount(intPtr(0)) + s.SetEnabled(boolPtr(false)) + s.SetTags([]string{}) + return s + }(), + wantBytes: []byte(`{"name":"test","code":null,"count":0,"enabled":false,"tags":[]}`), + }, + } + + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + var explicitFields *big.Int + if s, ok := tt.giveInput.(*testExplicitFieldsStruct); ok { + explicitFields = s.explicitFields + } + bytes, err := json.Marshal(HandleExplicitFields(tt.giveInput, explicitFields)) + if tt.wantError != "" { + require.EqualError(t, err, tt.wantError) + assert.Nil(t, tt.wantBytes) + return + } + require.NoError(t, err) + assert.JSONEq(t, string(tt.wantBytes), string(bytes)) + + // Verify it's valid JSON + var value interface{} + require.NoError(t, json.Unmarshal(bytes, &value)) + }) + } +} + +func TestHandleExplicitFieldsCustomMarshaler(t *testing.T) { + t.Run("custom marshaler with explicit fields", func(t *testing.T) { + s := &testExplicitFieldsStruct{} + s.SetName(nil) + s.SetCode(stringPtr("test-code")) + + bytes, err := s.MarshalJSON() + require.NoError(t, err) + assert.JSONEq(t, `{"name":null,"code":"test-code"}`, string(bytes)) + }) + + t.Run("custom marshaler with no explicit fields", func(t *testing.T) { + s := &testExplicitFieldsStruct{ + Name: stringPtr("implicit"), + Code: stringPtr("also-implicit"), + } + + bytes, err := s.MarshalJSON() + require.NoError(t, err) + assert.JSONEq(t, `{"name":"implicit","code":"also-implicit"}`, string(bytes)) + }) +} + +func TestHandleExplicitFieldsPointerHandling(t *testing.T) { + t.Run("nil pointer", func(t *testing.T) { + var s *testExplicitFieldsStruct + bytes, err := json.Marshal(HandleExplicitFields(s, nil)) + require.NoError(t, err) + assert.Equal(t, []byte(`null`), bytes) + }) + + t.Run("pointer to struct", func(t *testing.T) { + s := &testExplicitFieldsStruct{} + s.SetName(nil) + + bytes, err := json.Marshal(HandleExplicitFields(s, s.explicitFields)) + require.NoError(t, err) + assert.JSONEq(t, `{"name":null}`, string(bytes)) + }) +} + +func TestHandleExplicitFieldsEmbeddedStruct(t *testing.T) { + t.Run("embedded struct with explicit fields", func(t *testing.T) { + // Create a struct similar to what MarshalJSON creates + s := &testExplicitFieldsStruct{} + s.SetName(nil) + s.SetCode(stringPtr("test-code")) + + type embed testExplicitFieldsStruct + var marshaler = struct { + embed + }{ + embed: embed(*s), + } + + bytes, err := json.Marshal(HandleExplicitFields(marshaler, s.explicitFields)) + require.NoError(t, err) + // Should include both explicit fields (name as null, code as "test-code") + assert.JSONEq(t, `{"name":null,"code":"test-code"}`, string(bytes)) + }) + + t.Run("embedded struct with no explicit fields", func(t *testing.T) { + s := &testExplicitFieldsStruct{ + Name: stringPtr("implicit"), + Code: stringPtr("also-implicit"), + } + + type embed testExplicitFieldsStruct + var marshaler = struct { + embed + }{ + embed: embed(*s), + } + + bytes, err := json.Marshal(HandleExplicitFields(marshaler, s.explicitFields)) + require.NoError(t, err) + // Should only include non-nil fields (omitempty behavior) + assert.JSONEq(t, `{"name":"implicit","code":"also-implicit"}`, string(bytes)) + }) + + t.Run("embedded struct with mixed fields", func(t *testing.T) { + s := &testExplicitFieldsStruct{ + Count: intPtr(42), // implicit field + } + s.SetName(nil) // explicit nil + s.SetCode(stringPtr("explicit")) // explicit value + + type embed testExplicitFieldsStruct + var marshaler = struct { + embed + }{ + embed: embed(*s), + } + + bytes, err := json.Marshal(HandleExplicitFields(marshaler, s.explicitFields)) + require.NoError(t, err) + // Should include explicit null, explicit value, and implicit value + assert.JSONEq(t, `{"name":null,"code":"explicit","count":42}`, string(bytes)) + }) +} + +func TestHandleExplicitFieldsTagHandling(t *testing.T) { + type testStructWithComplexTags struct { + Field1 *string `json:"field1,omitempty" url:"field1,omitempty"` + Field2 *string `json:"field2,omitempty,string" url:"field2"` + Field3 *string `json:"-"` + Field4 *string `json:"field4"` + explicitFields *big.Int `json:"-"` + } + + s := &testStructWithComplexTags{ + Field1: stringPtr("test1"), + Field4: stringPtr("test4"), + explicitFields: big.NewInt(1), // Only first field is explicit + } + + bytes, err := json.Marshal(HandleExplicitFields(s, s.explicitFields)) + require.NoError(t, err) + + // Field1 should have omitempty removed, Field2 should keep omitempty, Field4 should be included + assert.JSONEq(t, `{"field1":"test1","field4":"test4"}`, string(bytes)) +} + +// Test types for nested struct explicit fields testing +type testNestedStruct struct { + NestedName *string `json:"nested_name,omitempty"` + NestedCode *string `json:"nested_code,omitempty"` + explicitFields *big.Int `json:"-"` +} + +type testParentStruct struct { + ParentName *string `json:"parent_name,omitempty"` + Nested *testNestedStruct `json:"nested,omitempty"` + explicitFields *big.Int `json:"-"` +} + +var ( + nestedFieldName = big.NewInt(1 << 0) + nestedFieldCode = big.NewInt(1 << 1) +) + +var ( + parentFieldName = big.NewInt(1 << 0) + parentFieldNested = big.NewInt(1 << 1) +) + +func (n *testNestedStruct) require(field *big.Int) { + if n.explicitFields == nil { + n.explicitFields = big.NewInt(0) + } + n.explicitFields.Or(n.explicitFields, field) +} + +func (n *testNestedStruct) SetNestedName(name *string) { + n.NestedName = name + n.require(nestedFieldName) +} + +func (n *testNestedStruct) SetNestedCode(code *string) { + n.NestedCode = code + n.require(nestedFieldCode) +} + +func (n *testNestedStruct) MarshalJSON() ([]byte, error) { + type embed testNestedStruct + var marshaler = struct { + embed + }{ + embed: embed(*n), + } + return json.Marshal(HandleExplicitFields(marshaler, n.explicitFields)) +} + +func (p *testParentStruct) require(field *big.Int) { + if p.explicitFields == nil { + p.explicitFields = big.NewInt(0) + } + p.explicitFields.Or(p.explicitFields, field) +} + +func (p *testParentStruct) SetParentName(name *string) { + p.ParentName = name + p.require(parentFieldName) +} + +func (p *testParentStruct) SetNested(nested *testNestedStruct) { + p.Nested = nested + p.require(parentFieldNested) +} + +func (p *testParentStruct) MarshalJSON() ([]byte, error) { + type embed testParentStruct + var marshaler = struct { + embed + }{ + embed: embed(*p), + } + return json.Marshal(HandleExplicitFields(marshaler, p.explicitFields)) +} + +func TestHandleExplicitFieldsNestedStruct(t *testing.T) { + tests := []struct { + desc string + setupFunc func() *testParentStruct + wantBytes []byte + }{ + { + desc: "nested struct with explicit nil in nested object", + setupFunc: func() *testParentStruct { + nested := &testNestedStruct{ + NestedName: stringPtr("implicit-nested"), + } + nested.SetNestedCode(nil) // explicit nil + + return &testParentStruct{ + ParentName: stringPtr("implicit-parent"), + Nested: nested, + } + }, + wantBytes: []byte(`{"parent_name":"implicit-parent","nested":{"nested_name":"implicit-nested","nested_code":null}}`), + }, + { + desc: "parent with explicit nil nested struct", + setupFunc: func() *testParentStruct { + parent := &testParentStruct{ + ParentName: stringPtr("implicit-parent"), + } + parent.SetNested(nil) // explicit nil nested struct + return parent + }, + wantBytes: []byte(`{"parent_name":"implicit-parent","nested":null}`), + }, + { + desc: "all explicit fields in nested structure", + setupFunc: func() *testParentStruct { + nested := &testNestedStruct{} + nested.SetNestedName(stringPtr("explicit-nested")) + nested.SetNestedCode(nil) // explicit nil + + parent := &testParentStruct{} + parent.SetParentName(nil) // explicit nil + parent.SetNested(nested) // explicit nested struct + + return parent + }, + wantBytes: []byte(`{"parent_name":null,"nested":{"nested_name":"explicit-nested","nested_code":null}}`), + }, + } + + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + parent := tt.setupFunc() + bytes, err := parent.MarshalJSON() + require.NoError(t, err) + assert.JSONEq(t, string(tt.wantBytes), string(bytes)) + + // Verify it's valid JSON + var value interface{} + require.NoError(t, json.Unmarshal(bytes, &value)) + }) + } +} + +// Test for setter method documentation and behavior +func TestSetterMethodsDocumentation(t *testing.T) { + t.Run("setter prevents omitempty for nil values", func(t *testing.T) { + s := &testExplicitFieldsStruct{} + + // Use setter to explicitly set nil - this should prevent omitempty + s.SetName(nil) + s.SetCode(nil) + + bytes, err := s.MarshalJSON() + require.NoError(t, err) + + // Both fields should be included as null, not omitted + assert.JSONEq(t, `{"name":null,"code":null}`, string(bytes)) + }) + + t.Run("setter prevents omitempty for empty slice", func(t *testing.T) { + s := &testExplicitFieldsStruct{} + + // Use setter to explicitly set empty slice + s.SetTags([]string{}) + + bytes, err := s.MarshalJSON() + require.NoError(t, err) + + // Empty slice should be included as [], not omitted + assert.JSONEq(t, `{"tags":[]}`, string(bytes)) + }) + + t.Run("setter prevents omitempty for zero values", func(t *testing.T) { + s := &testExplicitFieldsStruct{} + + // Use setter to explicitly set zero values + s.SetCount(intPtr(0)) + s.SetEnabled(boolPtr(false)) + + bytes, err := s.MarshalJSON() + require.NoError(t, err) + + // Zero values should be included, not omitted + assert.JSONEq(t, `{"count":0,"enabled":false}`, string(bytes)) + }) + + t.Run("direct assignment is omitted when nil", func(t *testing.T) { + s := &testExplicitFieldsStruct{ + Name: nil, // Direct assignment, not using setter + Code: nil, // Direct assignment, not using setter + } + + bytes, err := s.MarshalJSON() + require.NoError(t, err) + + // Fields not set via setter should be omitted when nil + assert.JSONEq(t, `{}`, string(bytes)) + }) + + t.Run("mix of setter and direct assignment", func(t *testing.T) { + s := &testExplicitFieldsStruct{ + Name: stringPtr("direct"), // Direct assignment + Count: intPtr(42), // Direct assignment + } + s.SetCode(nil) // Setter with nil + s.SetEnabled(boolPtr(false)) // Setter with zero value + + bytes, err := s.MarshalJSON() + require.NoError(t, err) + + // Direct assignments included if non-nil, setter fields always included + assert.JSONEq(t, `{"name":"direct","code":null,"count":42,"enabled":false}`, string(bytes)) + }) +} + +// Test for complex scenarios with multiple setters +func TestComplexSetterScenarios(t *testing.T) { + t.Run("multiple setter calls on same field", func(t *testing.T) { + s := &testExplicitFieldsStruct{} + + // Call setter multiple times - last one should win + s.SetName(stringPtr("first")) + s.SetName(stringPtr("second")) + s.SetName(nil) // Final value is nil + + bytes, err := s.MarshalJSON() + require.NoError(t, err) + + // Should serialize the last set value (nil) + assert.JSONEq(t, `{"name":null}`, string(bytes)) + }) + + t.Run("setter after direct assignment", func(t *testing.T) { + s := &testExplicitFieldsStruct{ + Name: stringPtr("direct"), + } + + // Override with setter + s.SetName(nil) + + bytes, err := s.MarshalJSON() + require.NoError(t, err) + + // Setter should mark field as explicit, so nil is serialized + assert.JSONEq(t, `{"name":null}`, string(bytes)) + }) + + t.Run("all fields set via setters", func(t *testing.T) { + s := &testExplicitFieldsStruct{} + s.SetName(nil) + s.SetCode(stringPtr("")) // Empty string + s.SetCount(intPtr(0)) // Zero + s.SetEnabled(boolPtr(false)) // False + s.SetTags(nil) // Nil slice + + bytes, err := s.MarshalJSON() + require.NoError(t, err) + + // All fields should be present even with nil/zero values + assert.JSONEq(t, `{"name":null,"code":"","count":0,"enabled":false,"tags":null}`, string(bytes)) + }) +} + +// Test for backwards compatibility +func TestBackwardsCompatibility(t *testing.T) { + t.Run("struct without setters behaves normally", func(t *testing.T) { + s := &testStructWithoutExplicitFields{ + Name: stringPtr("test"), + Code: nil, // This should be omitted + } + + bytes, err := json.Marshal(s) + require.NoError(t, err) + + // Without setters, omitempty works normally + assert.JSONEq(t, `{"name":"test"}`, string(bytes)) + }) + + t.Run("struct with explicit fields works with standard json.Marshal", func(t *testing.T) { + s := &testExplicitFieldsStruct{ + Name: stringPtr("test"), + } + s.SetCode(nil) + + // Using the custom MarshalJSON + bytes, err := s.MarshalJSON() + require.NoError(t, err) + + assert.JSONEq(t, `{"name":"test","code":null}`, string(bytes)) + }) +} + +// Helper functions +func stringPtr(s string) *string { + return &s +} + +func intPtr(i int) *int { + return &i +} + +func boolPtr(b bool) *bool { + return &b +} diff --git a/seed/go-sdk/trace/internal/extra_properties.go b/seed/go-sdk/trace/internal/extra_properties.go new file mode 100644 index 000000000000..540c3fd89eeb --- /dev/null +++ b/seed/go-sdk/trace/internal/extra_properties.go @@ -0,0 +1,141 @@ +package internal + +import ( + "bytes" + "encoding/json" + "fmt" + "reflect" + "strings" +) + +// MarshalJSONWithExtraProperty marshals the given value to JSON, including the extra property. +func MarshalJSONWithExtraProperty(marshaler interface{}, key string, value interface{}) ([]byte, error) { + return MarshalJSONWithExtraProperties(marshaler, map[string]interface{}{key: value}) +} + +// MarshalJSONWithExtraProperties marshals the given value to JSON, including any extra properties. +func MarshalJSONWithExtraProperties(marshaler interface{}, extraProperties map[string]interface{}) ([]byte, error) { + bytes, err := json.Marshal(marshaler) + if err != nil { + return nil, err + } + if len(extraProperties) == 0 { + return bytes, nil + } + keys, err := getKeys(marshaler) + if err != nil { + return nil, err + } + for _, key := range keys { + if _, ok := extraProperties[key]; ok { + return nil, fmt.Errorf("cannot add extra property %q because it is already defined on the type", key) + } + } + extraBytes, err := json.Marshal(extraProperties) + if err != nil { + return nil, err + } + if isEmptyJSON(bytes) { + if isEmptyJSON(extraBytes) { + return bytes, nil + } + return extraBytes, nil + } + result := bytes[:len(bytes)-1] + result = append(result, ',') + result = append(result, extraBytes[1:len(extraBytes)-1]...) + result = append(result, '}') + return result, nil +} + +// ExtractExtraProperties extracts any extra properties from the given value. +func ExtractExtraProperties(bytes []byte, value interface{}, exclude ...string) (map[string]interface{}, error) { + val := reflect.ValueOf(value) + for val.Kind() == reflect.Ptr { + if val.IsNil() { + return nil, fmt.Errorf("value must be non-nil to extract extra properties") + } + val = val.Elem() + } + if err := json.Unmarshal(bytes, &value); err != nil { + return nil, err + } + var extraProperties map[string]interface{} + if err := json.Unmarshal(bytes, &extraProperties); err != nil { + return nil, err + } + for i := 0; i < val.Type().NumField(); i++ { + key := jsonKey(val.Type().Field(i)) + if key == "" || key == "-" { + continue + } + delete(extraProperties, key) + } + for _, key := range exclude { + delete(extraProperties, key) + } + if len(extraProperties) == 0 { + return nil, nil + } + return extraProperties, nil +} + +// getKeys returns the keys associated with the given value. The value must be a +// a struct or a map with string keys. +func getKeys(value interface{}) ([]string, error) { + val := reflect.ValueOf(value) + if val.Kind() == reflect.Ptr { + val = val.Elem() + } + if !val.IsValid() { + return nil, nil + } + switch val.Kind() { + case reflect.Struct: + return getKeysForStructType(val.Type()), nil + case reflect.Map: + var keys []string + if val.Type().Key().Kind() != reflect.String { + return nil, fmt.Errorf("cannot extract keys from %T; only structs and maps with string keys are supported", value) + } + for _, key := range val.MapKeys() { + keys = append(keys, key.String()) + } + return keys, nil + default: + return nil, fmt.Errorf("cannot extract keys from %T; only structs and maps with string keys are supported", value) + } +} + +// getKeysForStructType returns all the keys associated with the given struct type, +// visiting embedded fields recursively. +func getKeysForStructType(structType reflect.Type) []string { + if structType.Kind() == reflect.Pointer { + structType = structType.Elem() + } + if structType.Kind() != reflect.Struct { + return nil + } + var keys []string + for i := 0; i < structType.NumField(); i++ { + field := structType.Field(i) + if field.Anonymous { + keys = append(keys, getKeysForStructType(field.Type)...) + continue + } + keys = append(keys, jsonKey(field)) + } + return keys +} + +// jsonKey returns the JSON key from the struct tag of the given field, +// excluding the omitempty flag (if any). +func jsonKey(field reflect.StructField) string { + return strings.TrimSuffix(field.Tag.Get("json"), ",omitempty") +} + +// isEmptyJSON returns true if the given data is empty, the empty JSON object, or +// an explicit null. +func isEmptyJSON(data []byte) bool { + return len(data) <= 2 || bytes.Equal(data, []byte("null")) +} diff --git a/seed/go-sdk/trace/internal/extra_properties_test.go b/seed/go-sdk/trace/internal/extra_properties_test.go new file mode 100644 index 000000000000..aa2510ee5121 --- /dev/null +++ b/seed/go-sdk/trace/internal/extra_properties_test.go @@ -0,0 +1,228 @@ +package internal + +import ( + "encoding/json" + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +type testMarshaler struct { + Name string `json:"name"` + BirthDate time.Time `json:"birthDate"` + CreatedAt time.Time `json:"created_at"` +} + +func (t *testMarshaler) MarshalJSON() ([]byte, error) { + type embed testMarshaler + var marshaler = struct { + embed + BirthDate string `json:"birthDate"` + CreatedAt string `json:"created_at"` + }{ + embed: embed(*t), + BirthDate: t.BirthDate.Format("2006-01-02"), + CreatedAt: t.CreatedAt.Format(time.RFC3339), + } + return MarshalJSONWithExtraProperty(marshaler, "type", "test") +} + +func TestMarshalJSONWithExtraProperties(t *testing.T) { + tests := []struct { + desc string + giveMarshaler interface{} + giveExtraProperties map[string]interface{} + wantBytes []byte + wantError string + }{ + { + desc: "invalid type", + giveMarshaler: []string{"invalid"}, + giveExtraProperties: map[string]interface{}{"key": "overwrite"}, + wantError: `cannot extract keys from []string; only structs and maps with string keys are supported`, + }, + { + desc: "invalid key type", + giveMarshaler: map[int]interface{}{42: "value"}, + giveExtraProperties: map[string]interface{}{"key": "overwrite"}, + wantError: `cannot extract keys from map[int]interface {}; only structs and maps with string keys are supported`, + }, + { + desc: "invalid map overwrite", + giveMarshaler: map[string]interface{}{"key": "value"}, + giveExtraProperties: map[string]interface{}{"key": "overwrite"}, + wantError: `cannot add extra property "key" because it is already defined on the type`, + }, + { + desc: "invalid struct overwrite", + giveMarshaler: new(testMarshaler), + giveExtraProperties: map[string]interface{}{"birthDate": "2000-01-01"}, + wantError: `cannot add extra property "birthDate" because it is already defined on the type`, + }, + { + desc: "invalid struct overwrite embedded type", + giveMarshaler: new(testMarshaler), + giveExtraProperties: map[string]interface{}{"name": "bob"}, + wantError: `cannot add extra property "name" because it is already defined on the type`, + }, + { + desc: "nil", + giveMarshaler: nil, + giveExtraProperties: nil, + wantBytes: []byte(`null`), + }, + { + desc: "empty", + giveMarshaler: map[string]interface{}{}, + giveExtraProperties: map[string]interface{}{}, + wantBytes: []byte(`{}`), + }, + { + desc: "no extra properties", + giveMarshaler: map[string]interface{}{"key": "value"}, + giveExtraProperties: map[string]interface{}{}, + wantBytes: []byte(`{"key":"value"}`), + }, + { + desc: "only extra properties", + giveMarshaler: map[string]interface{}{}, + giveExtraProperties: map[string]interface{}{"key": "value"}, + wantBytes: []byte(`{"key":"value"}`), + }, + { + desc: "single extra property", + giveMarshaler: map[string]interface{}{"key": "value"}, + giveExtraProperties: map[string]interface{}{"extra": "property"}, + wantBytes: []byte(`{"key":"value","extra":"property"}`), + }, + { + desc: "multiple extra properties", + giveMarshaler: map[string]interface{}{"key": "value"}, + giveExtraProperties: map[string]interface{}{"one": 1, "two": 2}, + wantBytes: []byte(`{"key":"value","one":1,"two":2}`), + }, + { + desc: "nested properties", + giveMarshaler: map[string]interface{}{"key": "value"}, + giveExtraProperties: map[string]interface{}{ + "user": map[string]interface{}{ + "age": 42, + "name": "alice", + }, + }, + wantBytes: []byte(`{"key":"value","user":{"age":42,"name":"alice"}}`), + }, + { + desc: "multiple nested properties", + giveMarshaler: map[string]interface{}{"key": "value"}, + giveExtraProperties: map[string]interface{}{ + "metadata": map[string]interface{}{ + "ip": "127.0.0.1", + }, + "user": map[string]interface{}{ + "age": 42, + "name": "alice", + }, + }, + wantBytes: []byte(`{"key":"value","metadata":{"ip":"127.0.0.1"},"user":{"age":42,"name":"alice"}}`), + }, + { + desc: "custom marshaler", + giveMarshaler: &testMarshaler{ + Name: "alice", + BirthDate: time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), + CreatedAt: time.Date(2024, 1, 1, 0, 0, 0, 0, time.UTC), + }, + giveExtraProperties: map[string]interface{}{ + "extra": "property", + }, + wantBytes: []byte(`{"name":"alice","birthDate":"2000-01-01","created_at":"2024-01-01T00:00:00Z","type":"test","extra":"property"}`), + }, + } + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + bytes, err := MarshalJSONWithExtraProperties(tt.giveMarshaler, tt.giveExtraProperties) + if tt.wantError != "" { + require.EqualError(t, err, tt.wantError) + assert.Nil(t, tt.wantBytes) + return + } + require.NoError(t, err) + assert.Equal(t, tt.wantBytes, bytes) + + value := make(map[string]interface{}) + require.NoError(t, json.Unmarshal(bytes, &value)) + }) + } +} + +func TestExtractExtraProperties(t *testing.T) { + t.Run("none", func(t *testing.T) { + type user struct { + Name string `json:"name"` + } + value := &user{ + Name: "alice", + } + extraProperties, err := ExtractExtraProperties([]byte(`{"name": "alice"}`), value) + require.NoError(t, err) + assert.Nil(t, extraProperties) + }) + + t.Run("non-nil pointer", func(t *testing.T) { + type user struct { + Name string `json:"name"` + } + value := &user{ + Name: "alice", + } + extraProperties, err := ExtractExtraProperties([]byte(`{"name": "alice", "age": 42}`), value) + require.NoError(t, err) + assert.Equal(t, map[string]interface{}{"age": float64(42)}, extraProperties) + }) + + t.Run("nil pointer", func(t *testing.T) { + type user struct { + Name string `json:"name"` + } + var value *user + _, err := ExtractExtraProperties([]byte(`{"name": "alice", "age": 42}`), value) + assert.EqualError(t, err, "value must be non-nil to extract extra properties") + }) + + t.Run("non-zero value", func(t *testing.T) { + type user struct { + Name string `json:"name"` + } + value := user{ + Name: "alice", + } + extraProperties, err := ExtractExtraProperties([]byte(`{"name": "alice", "age": 42}`), value) + require.NoError(t, err) + assert.Equal(t, map[string]interface{}{"age": float64(42)}, extraProperties) + }) + + t.Run("zero value", func(t *testing.T) { + type user struct { + Name string `json:"name"` + } + var value user + extraProperties, err := ExtractExtraProperties([]byte(`{"name": "alice", "age": 42}`), value) + require.NoError(t, err) + assert.Equal(t, map[string]interface{}{"age": float64(42)}, extraProperties) + }) + + t.Run("exclude", func(t *testing.T) { + type user struct { + Name string `json:"name"` + } + value := &user{ + Name: "alice", + } + extraProperties, err := ExtractExtraProperties([]byte(`{"name": "alice", "age": 42}`), value, "age") + require.NoError(t, err) + assert.Nil(t, extraProperties) + }) +} diff --git a/seed/go-sdk/trace/internal/http.go b/seed/go-sdk/trace/internal/http.go new file mode 100644 index 000000000000..77863752bb58 --- /dev/null +++ b/seed/go-sdk/trace/internal/http.go @@ -0,0 +1,71 @@ +package internal + +import ( + "fmt" + "net/http" + "net/url" + "reflect" +) + +// HTTPClient is an interface for a subset of the *http.Client. +type HTTPClient interface { + Do(*http.Request) (*http.Response, error) +} + +// ResolveBaseURL resolves the base URL from the given arguments, +// preferring the first non-empty value. +func ResolveBaseURL(values ...string) string { + for _, value := range values { + if value != "" { + return value + } + } + return "" +} + +// EncodeURL encodes the given arguments into the URL, escaping +// values as needed. Pointer arguments are dereferenced before processing. +func EncodeURL(urlFormat string, args ...interface{}) string { + escapedArgs := make([]interface{}, 0, len(args)) + for _, arg := range args { + // Dereference the argument if it's a pointer + value := dereferenceArg(arg) + escapedArgs = append(escapedArgs, url.PathEscape(fmt.Sprintf("%v", value))) + } + return fmt.Sprintf(urlFormat, escapedArgs...) +} + +// dereferenceArg dereferences a pointer argument if necessary, returning the underlying value. +// If the argument is not a pointer or is nil, it returns the argument as-is. +func dereferenceArg(arg interface{}) interface{} { + if arg == nil { + return arg + } + + v := reflect.ValueOf(arg) + + // Keep dereferencing until we get to a non-pointer value or hit nil + for v.Kind() == reflect.Ptr { + if v.IsNil() { + return nil + } + v = v.Elem() + } + + return v.Interface() +} + +// MergeHeaders merges the given headers together, where the right +// takes precedence over the left. +func MergeHeaders(left, right http.Header) http.Header { + for key, values := range right { + if len(values) > 1 { + left[key] = values + continue + } + if value := right.Get(key); value != "" { + left.Set(key, value) + } + } + return left +} diff --git a/seed/go-sdk/trace/internal/query.go b/seed/go-sdk/trace/internal/query.go new file mode 100644 index 000000000000..9b567f7a5563 --- /dev/null +++ b/seed/go-sdk/trace/internal/query.go @@ -0,0 +1,358 @@ +package internal + +import ( + "encoding/base64" + "fmt" + "net/url" + "reflect" + "strings" + "time" + + "github.com/google/uuid" +) + +// RFC3339Milli is a time format string for RFC 3339 with millisecond precision. +// Go's time.RFC3339 omits fractional seconds and time.RFC3339Nano trims trailing +// zeros, so neither produces the fixed ".000" millisecond suffix that many APIs expect. +const RFC3339Milli = "2006-01-02T15:04:05.000Z07:00" + +var ( + bytesType = reflect.TypeOf([]byte{}) + queryEncoderType = reflect.TypeOf(new(QueryEncoder)).Elem() + timeType = reflect.TypeOf(time.Time{}) + uuidType = reflect.TypeOf(uuid.UUID{}) +) + +// QueryEncoder is an interface implemented by any type that wishes to encode +// itself into URL values in a non-standard way. +type QueryEncoder interface { + EncodeQueryValues(key string, v *url.Values) error +} + +// prepareValue handles common validation and unwrapping logic for both functions +func prepareValue(v interface{}) (reflect.Value, url.Values, error) { + values := make(url.Values) + val := reflect.ValueOf(v) + for val.Kind() == reflect.Ptr { + if val.IsNil() { + return reflect.Value{}, values, nil + } + val = val.Elem() + } + + if v == nil { + return reflect.Value{}, values, nil + } + + if val.Kind() != reflect.Struct { + return reflect.Value{}, nil, fmt.Errorf("query: Values() expects struct input. Got %v", val.Kind()) + } + + err := reflectValue(values, val, "") + if err != nil { + return reflect.Value{}, nil, err + } + + return val, values, nil +} + +// QueryValues encodes url.Values from request objects. +// +// Note: This type is inspired by Google's query encoding library, but +// supports far less customization and is tailored to fit this SDK's use case. +// +// Ref: https://github.com/google/go-querystring +func QueryValues(v interface{}) (url.Values, error) { + _, values, err := prepareValue(v) + return values, err +} + +// QueryValuesWithDefaults encodes url.Values from request objects +// and default values, merging the defaults into the request. +// It's expected that the values of defaults are wire names. +func QueryValuesWithDefaults(v interface{}, defaults map[string]interface{}) (url.Values, error) { + val, values, err := prepareValue(v) + if err != nil { + return values, err + } + if !val.IsValid() { + return values, nil + } + + // apply defaults to zero-value fields directly on the original struct + valType := val.Type() + for i := 0; i < val.NumField(); i++ { + field := val.Field(i) + fieldType := valType.Field(i) + fieldName := fieldType.Name + + if fieldType.PkgPath != "" && !fieldType.Anonymous { + // Skip unexported fields. + continue + } + + // check if field is zero value and we have a default for it + if field.CanSet() && field.IsZero() { + tag := fieldType.Tag.Get("url") + if tag == "" || tag == "-" { + continue + } + wireName, _ := parseTag(tag) + if wireName == "" { + wireName = fieldName + } + if defaultVal, exists := defaults[wireName]; exists { + values.Set(wireName, valueString(reflect.ValueOf(defaultVal), tagOptions{}, reflect.StructField{})) + } + } + } + + return values, err +} + +// reflectValue populates the values parameter from the struct fields in val. +// Embedded structs are followed recursively (using the rules defined in the +// Values function documentation) breadth-first. +func reflectValue(values url.Values, val reflect.Value, scope string) error { + typ := val.Type() + for i := 0; i < typ.NumField(); i++ { + sf := typ.Field(i) + if sf.PkgPath != "" && !sf.Anonymous { + // Skip unexported fields. + continue + } + + sv := val.Field(i) + tag := sf.Tag.Get("url") + if tag == "" || tag == "-" { + continue + } + + name, opts := parseTag(tag) + if name == "" { + name = sf.Name + } + + if scope != "" { + name = scope + "[" + name + "]" + } + + if opts.Contains("omitempty") && isEmptyValue(sv) { + continue + } + + if sv.Type().Implements(queryEncoderType) { + // If sv is a nil pointer and the custom encoder is defined on a non-pointer + // method receiver, set sv to the zero value of the underlying type + if !reflect.Indirect(sv).IsValid() && sv.Type().Elem().Implements(queryEncoderType) { + sv = reflect.New(sv.Type().Elem()) + } + + m := sv.Interface().(QueryEncoder) + if err := m.EncodeQueryValues(name, &values); err != nil { + return err + } + continue + } + + // Recursively dereference pointers, but stop at nil pointers. + for sv.Kind() == reflect.Ptr { + if sv.IsNil() { + break + } + sv = sv.Elem() + } + + if sv.Type() == uuidType || sv.Type() == bytesType || sv.Type() == timeType { + values.Add(name, valueString(sv, opts, sf)) + continue + } + + if sv.Kind() == reflect.Slice || sv.Kind() == reflect.Array { + if sv.Len() == 0 { + // Skip if slice or array is empty. + continue + } + for i := 0; i < sv.Len(); i++ { + value := sv.Index(i) + if isStructPointer(value) && !value.IsNil() { + if err := reflectValue(values, value.Elem(), name); err != nil { + return err + } + } else { + values.Add(name, valueString(value, opts, sf)) + } + } + continue + } + + if sv.Kind() == reflect.Map { + if err := reflectMap(values, sv, name); err != nil { + return err + } + continue + } + + if sv.Kind() == reflect.Struct { + if err := reflectValue(values, sv, name); err != nil { + return err + } + continue + } + + values.Add(name, valueString(sv, opts, sf)) + } + + return nil +} + +// reflectMap handles map types specifically, generating query parameters in the format key[mapkey]=value +func reflectMap(values url.Values, val reflect.Value, scope string) error { + if val.IsNil() { + return nil + } + + iter := val.MapRange() + for iter.Next() { + k := iter.Key() + v := iter.Value() + + key := fmt.Sprint(k.Interface()) + paramName := scope + "[" + key + "]" + + for v.Kind() == reflect.Ptr { + if v.IsNil() { + break + } + v = v.Elem() + } + + for v.Kind() == reflect.Interface { + v = v.Elem() + } + + if v.Kind() == reflect.Map { + if err := reflectMap(values, v, paramName); err != nil { + return err + } + continue + } + + if v.Kind() == reflect.Struct { + if err := reflectValue(values, v, paramName); err != nil { + return err + } + continue + } + + if v.Kind() == reflect.Slice || v.Kind() == reflect.Array { + if v.Len() == 0 { + continue + } + for i := 0; i < v.Len(); i++ { + value := v.Index(i) + if isStructPointer(value) && !value.IsNil() { + if err := reflectValue(values, value.Elem(), paramName); err != nil { + return err + } + } else { + values.Add(paramName, valueString(value, tagOptions{}, reflect.StructField{})) + } + } + continue + } + + values.Add(paramName, valueString(v, tagOptions{}, reflect.StructField{})) + } + + return nil +} + +// valueString returns the string representation of a value. +func valueString(v reflect.Value, opts tagOptions, sf reflect.StructField) string { + for v.Kind() == reflect.Ptr { + if v.IsNil() { + return "" + } + v = v.Elem() + } + + if v.Type() == timeType { + t := v.Interface().(time.Time) + if format := sf.Tag.Get("format"); format == "date" { + return t.Format("2006-01-02") + } + return t.Format(RFC3339Milli) + } + + if v.Type() == uuidType { + u := v.Interface().(uuid.UUID) + return u.String() + } + + if v.Type() == bytesType { + b := v.Interface().([]byte) + return base64.StdEncoding.EncodeToString(b) + } + + return fmt.Sprint(v.Interface()) +} + +// isEmptyValue checks if a value should be considered empty for the purposes +// of omitting fields with the "omitempty" option. +func isEmptyValue(v reflect.Value) bool { + type zeroable interface { + IsZero() bool + } + + if !v.IsZero() { + if z, ok := v.Interface().(zeroable); ok { + return z.IsZero() + } + } + + switch v.Kind() { + case reflect.Array, reflect.Map, reflect.Slice, reflect.String: + return v.Len() == 0 + case reflect.Bool: + return !v.Bool() + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return v.Int() == 0 + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return v.Uint() == 0 + case reflect.Float32, reflect.Float64: + return v.Float() == 0 + case reflect.Interface, reflect.Ptr: + return v.IsNil() + case reflect.Invalid, reflect.Complex64, reflect.Complex128, reflect.Chan, reflect.Func, reflect.Struct, reflect.UnsafePointer: + return false + } + + return false +} + +// isStructPointer returns true if the given reflect.Value is a pointer to a struct. +func isStructPointer(v reflect.Value) bool { + return v.Kind() == reflect.Ptr && v.Elem().Kind() == reflect.Struct +} + +// tagOptions is the string following a comma in a struct field's "url" tag, or +// the empty string. It does not include the leading comma. +type tagOptions []string + +// parseTag splits a struct field's url tag into its name and comma-separated +// options. +func parseTag(tag string) (string, tagOptions) { + s := strings.Split(tag, ",") + return s[0], s[1:] +} + +// Contains checks whether the tagOptions contains the specified option. +func (o tagOptions) Contains(option string) bool { + for _, s := range o { + if s == option { + return true + } + } + return false +} diff --git a/seed/go-sdk/trace/internal/query_test.go b/seed/go-sdk/trace/internal/query_test.go new file mode 100644 index 000000000000..5b463e297350 --- /dev/null +++ b/seed/go-sdk/trace/internal/query_test.go @@ -0,0 +1,395 @@ +package internal + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestQueryValues(t *testing.T) { + t.Run("empty optional", func(t *testing.T) { + type nested struct { + Value *string `json:"value,omitempty" url:"value,omitempty"` + } + type example struct { + Nested *nested `json:"nested,omitempty" url:"nested,omitempty"` + } + + values, err := QueryValues(&example{}) + require.NoError(t, err) + assert.Empty(t, values) + }) + + t.Run("empty required", func(t *testing.T) { + type nested struct { + Value *string `json:"value,omitempty" url:"value,omitempty"` + } + type example struct { + Required string `json:"required" url:"required"` + Nested *nested `json:"nested,omitempty" url:"nested,omitempty"` + } + + values, err := QueryValues(&example{}) + require.NoError(t, err) + assert.Equal(t, "required=", values.Encode()) + }) + + t.Run("allow multiple", func(t *testing.T) { + type example struct { + Values []string `json:"values" url:"values"` + } + + values, err := QueryValues( + &example{ + Values: []string{"foo", "bar", "baz"}, + }, + ) + require.NoError(t, err) + assert.Equal(t, "values=foo&values=bar&values=baz", values.Encode()) + }) + + t.Run("nested object", func(t *testing.T) { + type nested struct { + Value *string `json:"value,omitempty" url:"value,omitempty"` + } + type example struct { + Required string `json:"required" url:"required"` + Nested *nested `json:"nested,omitempty" url:"nested,omitempty"` + } + + nestedValue := "nestedValue" + values, err := QueryValues( + &example{ + Required: "requiredValue", + Nested: &nested{ + Value: &nestedValue, + }, + }, + ) + require.NoError(t, err) + assert.Equal(t, "nested%5Bvalue%5D=nestedValue&required=requiredValue", values.Encode()) + }) + + t.Run("url unspecified", func(t *testing.T) { + type example struct { + Required string `json:"required" url:"required"` + NotFound string `json:"notFound"` + } + + values, err := QueryValues( + &example{ + Required: "requiredValue", + NotFound: "notFound", + }, + ) + require.NoError(t, err) + assert.Equal(t, "required=requiredValue", values.Encode()) + }) + + t.Run("url ignored", func(t *testing.T) { + type example struct { + Required string `json:"required" url:"required"` + NotFound string `json:"notFound" url:"-"` + } + + values, err := QueryValues( + &example{ + Required: "requiredValue", + NotFound: "notFound", + }, + ) + require.NoError(t, err) + assert.Equal(t, "required=requiredValue", values.Encode()) + }) + + t.Run("datetime", func(t *testing.T) { + type example struct { + DateTime time.Time `json:"dateTime" url:"dateTime"` + } + + values, err := QueryValues( + &example{ + DateTime: time.Date(1994, 3, 16, 12, 34, 56, 0, time.UTC), + }, + ) + require.NoError(t, err) + assert.Equal(t, "dateTime=1994-03-16T12%3A34%3A56.000Z", values.Encode()) + }) + + t.Run("date", func(t *testing.T) { + type example struct { + Date time.Time `json:"date" url:"date" format:"date"` + } + + values, err := QueryValues( + &example{ + Date: time.Date(1994, 3, 16, 12, 34, 56, 0, time.UTC), + }, + ) + require.NoError(t, err) + assert.Equal(t, "date=1994-03-16", values.Encode()) + }) + + t.Run("optional time", func(t *testing.T) { + type example struct { + Date *time.Time `json:"date,omitempty" url:"date,omitempty" format:"date"` + } + + values, err := QueryValues( + &example{}, + ) + require.NoError(t, err) + assert.Empty(t, values.Encode()) + }) + + t.Run("omitempty with non-pointer zero value", func(t *testing.T) { + type enum string + + type example struct { + Enum enum `json:"enum,omitempty" url:"enum,omitempty"` + } + + values, err := QueryValues( + &example{}, + ) + require.NoError(t, err) + assert.Empty(t, values.Encode()) + }) + + t.Run("object array", func(t *testing.T) { + type object struct { + Key string `json:"key" url:"key"` + Value string `json:"value" url:"value"` + } + type example struct { + Objects []*object `json:"objects,omitempty" url:"objects,omitempty"` + } + + values, err := QueryValues( + &example{ + Objects: []*object{ + { + Key: "hello", + Value: "world", + }, + { + Key: "foo", + Value: "bar", + }, + }, + }, + ) + require.NoError(t, err) + assert.Equal(t, "objects%5Bkey%5D=hello&objects%5Bkey%5D=foo&objects%5Bvalue%5D=world&objects%5Bvalue%5D=bar", values.Encode()) + }) + + t.Run("map", func(t *testing.T) { + type request struct { + Metadata map[string]interface{} `json:"metadata" url:"metadata"` + } + values, err := QueryValues( + &request{ + Metadata: map[string]interface{}{ + "foo": "bar", + "baz": "qux", + }, + }, + ) + require.NoError(t, err) + assert.Equal(t, "metadata%5Bbaz%5D=qux&metadata%5Bfoo%5D=bar", values.Encode()) + }) + + t.Run("nested map", func(t *testing.T) { + type request struct { + Metadata map[string]interface{} `json:"metadata" url:"metadata"` + } + values, err := QueryValues( + &request{ + Metadata: map[string]interface{}{ + "inner": map[string]interface{}{ + "foo": "bar", + }, + }, + }, + ) + require.NoError(t, err) + assert.Equal(t, "metadata%5Binner%5D%5Bfoo%5D=bar", values.Encode()) + }) + + t.Run("nested map array", func(t *testing.T) { + type request struct { + Metadata map[string]interface{} `json:"metadata" url:"metadata"` + } + values, err := QueryValues( + &request{ + Metadata: map[string]interface{}{ + "inner": []string{ + "one", + "two", + "three", + }, + }, + }, + ) + require.NoError(t, err) + assert.Equal(t, "metadata%5Binner%5D=one&metadata%5Binner%5D=two&metadata%5Binner%5D=three", values.Encode()) + }) +} + +func TestQueryValuesWithDefaults(t *testing.T) { + t.Run("apply defaults to zero values", func(t *testing.T) { + type example struct { + Name string `json:"name" url:"name"` + Age int `json:"age" url:"age"` + Enabled bool `json:"enabled" url:"enabled"` + } + + defaults := map[string]interface{}{ + "name": "default-name", + "age": 25, + "enabled": true, + } + + values, err := QueryValuesWithDefaults(&example{}, defaults) + require.NoError(t, err) + assert.Equal(t, "age=25&enabled=true&name=default-name", values.Encode()) + }) + + t.Run("preserve non-zero values over defaults", func(t *testing.T) { + type example struct { + Name string `json:"name" url:"name"` + Age int `json:"age" url:"age"` + Enabled bool `json:"enabled" url:"enabled"` + } + + defaults := map[string]interface{}{ + "name": "default-name", + "age": 25, + "enabled": true, + } + + values, err := QueryValuesWithDefaults(&example{ + Name: "actual-name", + Age: 30, + // Enabled remains false (zero value), should get default + }, defaults) + require.NoError(t, err) + assert.Equal(t, "age=30&enabled=true&name=actual-name", values.Encode()) + }) + + t.Run("ignore defaults for fields not in struct", func(t *testing.T) { + type example struct { + Name string `json:"name" url:"name"` + Age int `json:"age" url:"age"` + } + + defaults := map[string]interface{}{ + "name": "default-name", + "age": 25, + "nonexistent": "should-be-ignored", + } + + values, err := QueryValuesWithDefaults(&example{}, defaults) + require.NoError(t, err) + assert.Equal(t, "age=25&name=default-name", values.Encode()) + }) + + t.Run("type conversion for compatible defaults", func(t *testing.T) { + type example struct { + Count int64 `json:"count" url:"count"` + Rate float64 `json:"rate" url:"rate"` + Message string `json:"message" url:"message"` + } + + defaults := map[string]interface{}{ + "count": int(100), // int -> int64 conversion + "rate": float32(2.5), // float32 -> float64 conversion + "message": "hello", // string -> string (no conversion needed) + } + + values, err := QueryValuesWithDefaults(&example{}, defaults) + require.NoError(t, err) + assert.Equal(t, "count=100&message=hello&rate=2.5", values.Encode()) + }) + + t.Run("mixed with pointer fields and omitempty", func(t *testing.T) { + type example struct { + Required string `json:"required" url:"required"` + Optional *string `json:"optional,omitempty" url:"optional,omitempty"` + Count int `json:"count,omitempty" url:"count,omitempty"` + } + + defaultOptional := "default-optional" + defaults := map[string]interface{}{ + "required": "default-required", + "optional": &defaultOptional, // pointer type + "count": 42, + } + + values, err := QueryValuesWithDefaults(&example{ + Required: "custom-required", // should override default + // Optional is nil, should get default + // Count is 0, should get default + }, defaults) + require.NoError(t, err) + assert.Equal(t, "count=42&optional=default-optional&required=custom-required", values.Encode()) + }) + + t.Run("override non-zero defaults with explicit zero values", func(t *testing.T) { + type example struct { + Name *string `json:"name" url:"name"` + Age *int `json:"age" url:"age"` + Enabled *bool `json:"enabled" url:"enabled"` + } + + defaults := map[string]interface{}{ + "name": "default-name", + "age": 25, + "enabled": true, + } + + // first, test that a properly empty request is overridden: + { + values, err := QueryValuesWithDefaults(&example{}, defaults) + require.NoError(t, err) + assert.Equal(t, "age=25&enabled=true&name=default-name", values.Encode()) + } + + // second, test that a request that contains zeros is not overridden: + var ( + name = "" + age = 0 + enabled = false + ) + values, err := QueryValuesWithDefaults(&example{ + Name: &name, // explicit empty string should override default + Age: &age, // explicit zero should override default + Enabled: &enabled, // explicit false should override default + }, defaults) + require.NoError(t, err) + assert.Equal(t, "age=0&enabled=false&name=", values.Encode()) + }) + + t.Run("nil input returns empty values", func(t *testing.T) { + defaults := map[string]any{ + "name": "default-name", + "age": 25, + } + + // Test with nil + values, err := QueryValuesWithDefaults(nil, defaults) + require.NoError(t, err) + assert.Empty(t, values) + + // Test with nil pointer + type example struct { + Name string `json:"name" url:"name"` + } + var nilPtr *example + values, err = QueryValuesWithDefaults(nilPtr, defaults) + require.NoError(t, err) + assert.Empty(t, values) + }) +} diff --git a/seed/go-sdk/trace/internal/retrier.go b/seed/go-sdk/trace/internal/retrier.go new file mode 100644 index 000000000000..6ebdf9b72a7e --- /dev/null +++ b/seed/go-sdk/trace/internal/retrier.go @@ -0,0 +1,263 @@ +package internal + +import ( + "crypto/rand" + "math/big" + "net/http" + "strconv" + "time" +) + +const ( + defaultRetryAttempts = 2 + minRetryDelay = 1000 * time.Millisecond + maxRetryDelay = 60000 * time.Millisecond +) + +// RetryOption adapts the behavior the *Retrier. +type RetryOption func(*retryOptions) + +// RetryFunc is a retryable HTTP function call (i.e. *http.Client.Do). +type RetryFunc func(*http.Request) (*http.Response, error) + +// WithMaxAttempts configures the maximum number of attempts +// of the *Retrier. +func WithMaxAttempts(attempts uint) RetryOption { + return func(opts *retryOptions) { + opts.attempts = attempts + } +} + +// WithDisableRetries disables retry attempts entirely. The request is issued +// exactly once. Distinct from WithMaxAttempts(0), which falls through to the +// default. +func WithDisableRetries() RetryOption { + return func(opts *retryOptions) { + opts.disabled = true + } +} + +func buildRetryOptions(maxAttempts uint, disableRetries bool) []RetryOption { + var opts []RetryOption + if maxAttempts > 0 { + opts = append(opts, WithMaxAttempts(maxAttempts)) + } + if disableRetries { + opts = append(opts, WithDisableRetries()) + } + return opts +} + +// Retrier retries failed requests a configurable number of times with an +// exponential back-off between each retry. +type Retrier struct { + attempts uint +} + +// NewRetrier constructs a new *Retrier with the given options, if any. +func NewRetrier(opts ...RetryOption) *Retrier { + options := new(retryOptions) + for _, opt := range opts { + opt(options) + } + attempts := uint(defaultRetryAttempts) + if options.attempts > 0 { + attempts = options.attempts + } + return &Retrier{ + attempts: attempts, + } +} + +// Run issues the request and, upon failure, retries the request if possible. +// +// The request will be retried as long as the request is deemed retryable and the +// number of retry attempts has not grown larger than the configured retry limit. +func (r *Retrier) Run( + fn RetryFunc, + request *http.Request, + errorDecoder ErrorDecoder, + opts ...RetryOption, +) (*http.Response, error) { + options := new(retryOptions) + for _, opt := range opts { + opt(options) + } + maxRetryAttempts := r.attempts + if options.attempts > 0 { + maxRetryAttempts = options.attempts + } + if options.disabled { + maxRetryAttempts = 1 + } + var ( + retryAttempt uint + previousError error + ) + return r.run( + fn, + request, + errorDecoder, + maxRetryAttempts, + retryAttempt, + previousError, + ) +} + +func (r *Retrier) run( + fn RetryFunc, + request *http.Request, + errorDecoder ErrorDecoder, + maxRetryAttempts uint, + retryAttempt uint, + previousError error, +) (*http.Response, error) { + if retryAttempt >= maxRetryAttempts { + return nil, previousError + } + + // If the call has been cancelled, don't issue the request. + if err := request.Context().Err(); err != nil { + return nil, err + } + + // Reset the request body for retries since the body may have already been read. + if retryAttempt > 0 && request.GetBody != nil { + requestBody, err := request.GetBody() + if err != nil { + return nil, err + } + request.Body = requestBody + } + + response, err := fn(request) + if err != nil { + return nil, err + } + + if r.shouldRetry(response) { + defer func() { _ = response.Body.Close() }() + + delay, err := r.retryDelay(response, retryAttempt) + if err != nil { + return nil, err + } + + time.Sleep(delay) + + return r.run( + fn, + request, + errorDecoder, + maxRetryAttempts, + retryAttempt+1, + decodeError(response, errorDecoder), + ) + } + + return response, nil +} + +// shouldRetry returns true if the request should be retried based on the given +// response status code. +func (r *Retrier) shouldRetry(response *http.Response) bool { + return response.StatusCode == http.StatusTooManyRequests || + response.StatusCode == http.StatusRequestTimeout || + response.StatusCode >= http.StatusInternalServerError +} + +// retryDelay calculates the delay time based on response headers, +// falling back to exponential backoff if no headers are present. +func (r *Retrier) retryDelay(response *http.Response, retryAttempt uint) (time.Duration, error) { + // Check for Retry-After header first (RFC 7231), applying no jitter + if retryAfter := response.Header.Get("Retry-After"); retryAfter != "" { + // Parse as number of seconds... + if seconds, err := strconv.Atoi(retryAfter); err == nil { + delay := time.Duration(seconds) * time.Second + if delay > 0 { + if delay > maxRetryDelay { + delay = maxRetryDelay + } + return delay, nil + } + } + + // ...or as an HTTP date; both are valid + if retryTime, err := time.Parse(time.RFC1123, retryAfter); err == nil { + delay := time.Until(retryTime) + if delay > 0 { + if delay > maxRetryDelay { + delay = maxRetryDelay + } + return delay, nil + } + } + } + + // Then check for industry-standard X-RateLimit-Reset header, applying positive jitter + if rateLimitReset := response.Header.Get("X-RateLimit-Reset"); rateLimitReset != "" { + if resetTimestamp, err := strconv.ParseInt(rateLimitReset, 10, 64); err == nil { + // Assume Unix timestamp in seconds + resetTime := time.Unix(resetTimestamp, 0) + delay := time.Until(resetTime) + if delay > 0 { + if delay > maxRetryDelay { + delay = maxRetryDelay + } + return r.addPositiveJitter(delay) + } + } + } + + // Fall back to exponential backoff + return r.exponentialBackoff(retryAttempt) +} + +// exponentialBackoff calculates the delay time based on the retry attempt +// and applies symmetric jitter (±10% around the delay). +func (r *Retrier) exponentialBackoff(retryAttempt uint) (time.Duration, error) { + if retryAttempt > 63 { // 2^63+ would overflow uint64 + retryAttempt = 63 + } + + delay := minRetryDelay << retryAttempt + if delay > maxRetryDelay { + delay = maxRetryDelay + } + + return r.addSymmetricJitter(delay) +} + +// addJitterWithRange applies jitter to the given delay. +// minPercent and maxPercent define the jitter range (e.g., 100, 120 for +0% to +20%). +func (r *Retrier) addJitterWithRange(delay time.Duration, minPercent, maxPercent int) (time.Duration, error) { + jitterRange := big.NewInt(int64(delay * time.Duration(maxPercent-minPercent) / 100)) + jitter, err := rand.Int(rand.Reader, jitterRange) + if err != nil { + return 0, err + } + + jitteredDelay := delay + time.Duration(jitter.Int64()) + delay*time.Duration(minPercent-100)/100 + if jitteredDelay < minRetryDelay { + jitteredDelay = minRetryDelay + } + if jitteredDelay > maxRetryDelay { + jitteredDelay = maxRetryDelay + } + return jitteredDelay, nil +} + +// addPositiveJitter applies positive jitter to the given delay (100%-120% range). +func (r *Retrier) addPositiveJitter(delay time.Duration) (time.Duration, error) { + return r.addJitterWithRange(delay, 100, 120) +} + +// addSymmetricJitter applies symmetric jitter to the given delay (90%-110% range). +func (r *Retrier) addSymmetricJitter(delay time.Duration) (time.Duration, error) { + return r.addJitterWithRange(delay, 90, 110) +} + +type retryOptions struct { + attempts uint + disabled bool +} diff --git a/seed/go-sdk/trace/internal/retrier_test.go b/seed/go-sdk/trace/internal/retrier_test.go new file mode 100644 index 000000000000..a582d7d7fa4f --- /dev/null +++ b/seed/go-sdk/trace/internal/retrier_test.go @@ -0,0 +1,352 @@ +package internal + +import ( + "context" + "encoding/json" + "fmt" + "io" + "net/http" + "net/http/httptest" + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/trace/fern/core" +) + +type RetryTestCase struct { + description string + + giveAttempts uint + giveStatusCodes []int + giveResponse *InternalTestResponse + + wantResponse *InternalTestResponse + wantError *core.APIError +} + +func TestRetrier(t *testing.T) { + tests := []*RetryTestCase{ + { + description: "retry request succeeds after multiple failures", + giveAttempts: 3, + giveStatusCodes: []int{ + http.StatusServiceUnavailable, + http.StatusServiceUnavailable, + http.StatusOK, + }, + giveResponse: &InternalTestResponse{ + Id: "1", + }, + wantResponse: &InternalTestResponse{ + Id: "1", + }, + }, + { + description: "retry request fails if MaxAttempts is exceeded", + giveAttempts: 3, + giveStatusCodes: []int{ + http.StatusRequestTimeout, + http.StatusRequestTimeout, + http.StatusRequestTimeout, + http.StatusOK, + }, + wantError: &core.APIError{ + StatusCode: http.StatusRequestTimeout, + }, + }, + { + description: "retry durations increase exponentially and stay within the min and max delay values", + giveAttempts: 4, + giveStatusCodes: []int{ + http.StatusServiceUnavailable, + http.StatusServiceUnavailable, + http.StatusServiceUnavailable, + http.StatusOK, + }, + }, + { + description: "retry does not occur on status code 404", + giveAttempts: 2, + giveStatusCodes: []int{http.StatusNotFound, http.StatusOK}, + wantError: &core.APIError{ + StatusCode: http.StatusNotFound, + }, + }, + { + description: "retries occur on status code 429", + giveAttempts: 2, + giveStatusCodes: []int{http.StatusTooManyRequests, http.StatusOK}, + }, + { + description: "retries occur on status code 408", + giveAttempts: 2, + giveStatusCodes: []int{http.StatusRequestTimeout, http.StatusOK}, + }, + { + description: "retries occur on status code 500", + giveAttempts: 2, + giveStatusCodes: []int{http.StatusInternalServerError, http.StatusOK}, + }, + } + + for _, tc := range tests { + t.Run(tc.description, func(t *testing.T) { + var ( + test = tc + server = newTestRetryServer(t, test) + client = server.Client() + ) + + t.Parallel() + + caller := NewCaller( + &CallerParams{ + Client: client, + }, + ) + + var response *InternalTestResponse + _, err := caller.Call( + context.Background(), + &CallParams{ + URL: server.URL, + Method: http.MethodGet, + Request: &InternalTestRequest{}, + Response: &response, + MaxAttempts: test.giveAttempts, + ResponseIsOptional: true, + }, + ) + + if test.wantError != nil { + require.IsType(t, err, &core.APIError{}) + expectedErrorCode := test.wantError.StatusCode + actualErrorCode := err.(*core.APIError).StatusCode + assert.Equal(t, expectedErrorCode, actualErrorCode) + return + } + + require.NoError(t, err) + assert.Equal(t, test.wantResponse, response) + }) + } +} + +// newTestRetryServer returns a new *httptest.Server configured with the +// given test parameters, suitable for testing retries. +func newTestRetryServer(t *testing.T, tc *RetryTestCase) *httptest.Server { + var index int + timestamps := make([]time.Time, 0, len(tc.giveStatusCodes)) + + return httptest.NewServer( + http.HandlerFunc( + func(w http.ResponseWriter, r *http.Request) { + timestamps = append(timestamps, time.Now()) + if index > 0 && index < len(expectedRetryDurations) { + // Ensure that the duration between retries increases exponentially, + // and that it is within the minimum and maximum retry delay values. + actualDuration := timestamps[index].Sub(timestamps[index-1]) + expectedDurationMin := expectedRetryDurations[index-1] * 50 / 100 + expectedDurationMax := expectedRetryDurations[index-1] * 150 / 100 + assert.True( + t, + actualDuration >= expectedDurationMin && actualDuration <= expectedDurationMax, + "expected duration to be in range [%v, %v], got %v", + expectedDurationMin, + expectedDurationMax, + actualDuration, + ) + assert.LessOrEqual( + t, + actualDuration, + maxRetryDelay, + "expected duration to be less than the maxRetryDelay (%v), got %v", + maxRetryDelay, + actualDuration, + ) + assert.GreaterOrEqual( + t, + actualDuration, + minRetryDelay, + "expected duration to be greater than the minRetryDelay (%v), got %v", + minRetryDelay, + actualDuration, + ) + } + + request := new(InternalTestRequest) + bytes, err := io.ReadAll(r.Body) + require.NoError(t, err) + require.NoError(t, json.Unmarshal(bytes, request)) + require.LessOrEqual(t, index, len(tc.giveStatusCodes)) + + statusCode := tc.giveStatusCodes[index] + + w.WriteHeader(statusCode) + + if tc.giveResponse != nil && statusCode == http.StatusOK { + bytes, err = json.Marshal(tc.giveResponse) + require.NoError(t, err) + _, err = w.Write(bytes) + require.NoError(t, err) + } + + index++ + }, + ), + ) +} + +// expectedRetryDurations holds an array of calculated retry durations, +// where the index of the array should correspond to the retry attempt. +// +// Values are calculated based off of `minRetryDelay * 2^i`. +var expectedRetryDurations = []time.Duration{ + 1000 * time.Millisecond, // 500ms * 2^1 = 1000ms + 2000 * time.Millisecond, // 500ms * 2^2 = 2000ms + 4000 * time.Millisecond, // 500ms * 2^3 = 4000ms + 8000 * time.Millisecond, // 500ms * 2^4 = 8000ms +} + +func TestRetryWithRequestBody(t *testing.T) { + // This test verifies that POST requests with a body are properly retried. + // The request body should be re-sent on each retry attempt. + expectedBody := `{"id":"test-id"}` + var requestBodies []string + var requestCount int + + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + requestCount++ + bodyBytes, err := io.ReadAll(r.Body) + require.NoError(t, err) + requestBodies = append(requestBodies, string(bodyBytes)) + + if requestCount == 1 { + // First request - return retryable error + w.WriteHeader(http.StatusServiceUnavailable) + return + } + // Second request - return success + w.WriteHeader(http.StatusOK) + response := &InternalTestResponse{Id: "success"} + bytes, _ := json.Marshal(response) + _, _ = w.Write(bytes) + })) + defer server.Close() + + caller := NewCaller(&CallerParams{ + Client: server.Client(), + }) + + var response *InternalTestResponse + _, err := caller.Call( + context.Background(), + &CallParams{ + URL: server.URL, + Method: http.MethodPost, + Request: &InternalTestRequest{Id: "test-id"}, + Response: &response, + MaxAttempts: 2, + ResponseIsOptional: true, + }, + ) + + require.NoError(t, err) + require.Equal(t, 2, requestCount, "Expected exactly 2 requests") + require.Len(t, requestBodies, 2, "Expected 2 request bodies to be captured") + + // Both requests should have the same non-empty body + assert.Equal(t, expectedBody, requestBodies[0], "First request body should match expected") + assert.Equal(t, expectedBody, requestBodies[1], "Second request body should match expected (retry should re-send body)") +} + +func TestRetryDelayTiming(t *testing.T) { + tests := []struct { + name string + headerName string + headerValueFunc func() string + expectedMinMs int64 + expectedMaxMs int64 + }{ + { + name: "retry-after with seconds value", + headerName: "retry-after", + headerValueFunc: func() string { + return "1" + }, + expectedMinMs: 500, + expectedMaxMs: 1500, + }, + { + name: "retry-after with HTTP date", + headerName: "retry-after", + headerValueFunc: func() string { + return time.Now().Add(3 * time.Second).Format(time.RFC1123) + }, + expectedMinMs: 1500, + expectedMaxMs: 4500, + }, + { + name: "x-ratelimit-reset with future timestamp", + headerName: "x-ratelimit-reset", + headerValueFunc: func() string { + return fmt.Sprintf("%d", time.Now().Add(3*time.Second).Unix()) + }, + expectedMinMs: 1500, + expectedMaxMs: 4500, + }, + } + + for _, tt := range tests { + tt := tt + t.Run(tt.name, func(t *testing.T) { + t.Parallel() + + var timestamps []time.Time + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + timestamps = append(timestamps, time.Now()) + if len(timestamps) == 1 { + // First request - return retryable error with header + w.Header().Set(tt.headerName, tt.headerValueFunc()) + w.WriteHeader(http.StatusTooManyRequests) + } else { + // Second request - return success + w.WriteHeader(http.StatusOK) + response := &InternalTestResponse{Id: "success"} + bytes, _ := json.Marshal(response) + _, _ = w.Write(bytes) + } + })) + defer server.Close() + + caller := NewCaller(&CallerParams{ + Client: server.Client(), + }) + + var response *InternalTestResponse + _, err := caller.Call( + context.Background(), + &CallParams{ + URL: server.URL, + Method: http.MethodGet, + Request: &InternalTestRequest{}, + Response: &response, + MaxAttempts: 2, + ResponseIsOptional: true, + }, + ) + + require.NoError(t, err) + require.Len(t, timestamps, 2, "Expected exactly 2 requests") + + actualDelayMs := timestamps[1].Sub(timestamps[0]).Milliseconds() + + assert.GreaterOrEqual(t, actualDelayMs, tt.expectedMinMs, + "Actual delay %dms should be >= expected min %dms", actualDelayMs, tt.expectedMinMs) + assert.LessOrEqual(t, actualDelayMs, tt.expectedMaxMs, + "Actual delay %dms should be <= expected max %dms", actualDelayMs, tt.expectedMaxMs) + }) + } +} diff --git a/seed/go-sdk/trace/internal/stringer.go b/seed/go-sdk/trace/internal/stringer.go new file mode 100644 index 000000000000..312801851e0e --- /dev/null +++ b/seed/go-sdk/trace/internal/stringer.go @@ -0,0 +1,13 @@ +package internal + +import "encoding/json" + +// StringifyJSON returns a pretty JSON string representation of +// the given value. +func StringifyJSON(value interface{}) (string, error) { + bytes, err := json.MarshalIndent(value, "", " ") + if err != nil { + return "", err + } + return string(bytes), nil +} diff --git a/seed/go-sdk/trace/internal/time.go b/seed/go-sdk/trace/internal/time.go new file mode 100644 index 000000000000..1dd1306df4ba --- /dev/null +++ b/seed/go-sdk/trace/internal/time.go @@ -0,0 +1,205 @@ +package internal + +import ( + "encoding/json" + "fmt" + "time" +) + +const dateFormat = "2006-01-02" + +// DateTime wraps time.Time and adapts its JSON representation +// to conform to a RFC3339 date (e.g. 2006-01-02). +// +// Ref: https://ijmacd.github.io/rfc3339-iso8601 +type Date struct { + t *time.Time +} + +// NewDate returns a new *Date. If the given time.Time +// is nil, nil will be returned. +func NewDate(t time.Time) *Date { + return &Date{t: &t} +} + +// NewOptionalDate returns a new *Date. If the given time.Time +// is nil, nil will be returned. +func NewOptionalDate(t *time.Time) *Date { + if t == nil { + return nil + } + return &Date{t: t} +} + +// Time returns the Date's underlying time, if any. If the +// date is nil, the zero value is returned. +func (d *Date) Time() time.Time { + if d == nil || d.t == nil { + return time.Time{} + } + return *d.t +} + +// TimePtr returns a pointer to the Date's underlying time.Time, if any. +func (d *Date) TimePtr() *time.Time { + if d == nil || d.t == nil { + return nil + } + if d.t.IsZero() { + return nil + } + return d.t +} + +func (d *Date) MarshalJSON() ([]byte, error) { + if d == nil || d.t == nil { + return nil, nil + } + return json.Marshal(d.t.Format(dateFormat)) +} + +func (d *Date) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + + parsedTime, err := time.Parse(dateFormat, raw) + if err != nil { + return err + } + + *d = Date{t: &parsedTime} + return nil +} + +// DateTime wraps time.Time and adapts its JSON representation +// to conform to a RFC3339 date-time (e.g. 2017-07-21T17:32:28Z). +// +// Ref: https://ijmacd.github.io/rfc3339-iso8601 +type DateTime struct { + t *time.Time +} + +// NewDateTime returns a new *DateTime. +func NewDateTime(t time.Time) *DateTime { + return &DateTime{t: &t} +} + +// NewOptionalDateTime returns a new *DateTime. If the given time.Time +// is nil, nil will be returned. +func NewOptionalDateTime(t *time.Time) *DateTime { + if t == nil { + return nil + } + return &DateTime{t: t} +} + +// Time returns the DateTime's underlying time, if any. If the +// date-time is nil, the zero value is returned. +func (d *DateTime) Time() time.Time { + if d == nil || d.t == nil { + return time.Time{} + } + return *d.t +} + +// TimePtr returns a pointer to the DateTime's underlying time.Time, if any. +func (d *DateTime) TimePtr() *time.Time { + if d == nil || d.t == nil { + return nil + } + if d.t.IsZero() { + return nil + } + return d.t +} + +func (d *DateTime) MarshalJSON() ([]byte, error) { + if d == nil || d.t == nil { + return nil, nil + } + return json.Marshal(d.t.Format(time.RFC3339)) +} + +func (d *DateTime) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + // If the value is not a string, check if it is a number (unix epoch seconds). + var epoch int64 + if numErr := json.Unmarshal(data, &epoch); numErr == nil { + t := time.Unix(epoch, 0).UTC() + *d = DateTime{t: &t} + return nil + } + return err + } + + // Try RFC3339Nano first (superset of RFC3339, supports fractional seconds). + parsedTime, err := time.Parse(time.RFC3339Nano, raw) + if err == nil { + *d = DateTime{t: &parsedTime} + return nil + } + rfc3339NanoErr := err + + // Fall back to ISO 8601 with fractional seconds, without timezone (assume UTC). + parsedTime, err = time.Parse("2006-01-02T15:04:05.999999999", raw) + if err == nil { + parsedTime = parsedTime.UTC() + *d = DateTime{t: &parsedTime} + return nil + } + + // Fall back to ISO 8601 without timezone (assume UTC). + parsedTime, err = time.Parse("2006-01-02T15:04:05", raw) + if err == nil { + parsedTime = parsedTime.UTC() + *d = DateTime{t: &parsedTime} + return nil + } + iso8601Err := err + + // Fall back to space-separated datetime with fractional seconds and timezone offset. + parsedTime, err = time.Parse("2006-01-02 15:04:05.999999999Z07:00", raw) + if err == nil { + *d = DateTime{t: &parsedTime} + return nil + } + + // Fall back to space-separated datetime with timezone offset (e.g. "2025-02-15 10:30:00+00:00"). + parsedTime, err = time.Parse("2006-01-02 15:04:05Z07:00", raw) + if err == nil { + *d = DateTime{t: &parsedTime} + return nil + } + spaceTzErr := err + + // Fall back to space-separated datetime with fractional seconds, no timezone (assume UTC). + parsedTime, err = time.Parse("2006-01-02 15:04:05.999999999", raw) + if err == nil { + parsedTime = parsedTime.UTC() + *d = DateTime{t: &parsedTime} + return nil + } + + // Fall back to space-separated datetime without timezone (assume UTC). + parsedTime, err = time.Parse("2006-01-02 15:04:05", raw) + if err == nil { + parsedTime = parsedTime.UTC() + *d = DateTime{t: &parsedTime} + return nil + } + spaceNoTzErr := err + + // Fall back to date-only format. + parsedTime, err = time.Parse("2006-01-02", raw) + if err == nil { + parsedTime = parsedTime.UTC() + *d = DateTime{t: &parsedTime} + return nil + } + dateOnlyErr := err + + return fmt.Errorf("unable to parse datetime string %q: tried RFC3339Nano (%v), ISO8601 (%v), space-separated with tz (%v), space-separated (%v), date-only (%v)", raw, rfc3339NanoErr, iso8601Err, spaceTzErr, spaceNoTzErr, dateOnlyErr) +} diff --git a/seed/go-sdk/trace/lang_server.go b/seed/go-sdk/trace/lang_server.go new file mode 100644 index 000000000000..a843c977a19c --- /dev/null +++ b/seed/go-sdk/trace/lang_server.go @@ -0,0 +1,178 @@ +// Code generated by Fern. DO NOT EDIT. + +package trace + +import ( + json "encoding/json" + fmt "fmt" + internal "github.com/trace/fern/internal" + big "math/big" +) + +var ( + langServerRequestFieldRequest = big.NewInt(1 << 0) +) + +type LangServerRequest struct { + Request any `json:"request" url:"request"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (l *LangServerRequest) GetRequest() any { + if l == nil { + return nil + } + return l.Request +} + +func (l *LangServerRequest) GetExtraProperties() map[string]interface{} { + if l == nil { + return nil + } + return l.extraProperties +} + +func (l *LangServerRequest) require(field *big.Int) { + if l.explicitFields == nil { + l.explicitFields = big.NewInt(0) + } + l.explicitFields.Or(l.explicitFields, field) +} + +// SetRequest sets the Request field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LangServerRequest) SetRequest(request any) { + l.Request = request + l.require(langServerRequestFieldRequest) +} + +func (l *LangServerRequest) UnmarshalJSON(data []byte) error { + type unmarshaler LangServerRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *l = LangServerRequest(value) + extraProperties, err := internal.ExtractExtraProperties(data, *l) + if err != nil { + return err + } + l.extraProperties = extraProperties + l.rawJSON = json.RawMessage(data) + return nil +} + +func (l *LangServerRequest) MarshalJSON() ([]byte, error) { + type embed LangServerRequest + var marshaler = struct { + embed + }{ + embed: embed(*l), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, l.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (l *LangServerRequest) String() string { + if l == nil { + return "" + } + if len(l.rawJSON) > 0 { + if value, err := internal.StringifyJSON(l.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(l); err == nil { + return value + } + return fmt.Sprintf("%#v", l) +} + +var ( + langServerResponseFieldResponse = big.NewInt(1 << 0) +) + +type LangServerResponse struct { + Response any `json:"response" url:"response"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (l *LangServerResponse) GetResponse() any { + if l == nil { + return nil + } + return l.Response +} + +func (l *LangServerResponse) GetExtraProperties() map[string]interface{} { + if l == nil { + return nil + } + return l.extraProperties +} + +func (l *LangServerResponse) require(field *big.Int) { + if l.explicitFields == nil { + l.explicitFields = big.NewInt(0) + } + l.explicitFields.Or(l.explicitFields, field) +} + +// SetResponse sets the Response field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LangServerResponse) SetResponse(response any) { + l.Response = response + l.require(langServerResponseFieldResponse) +} + +func (l *LangServerResponse) UnmarshalJSON(data []byte) error { + type unmarshaler LangServerResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *l = LangServerResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *l) + if err != nil { + return err + } + l.extraProperties = extraProperties + l.rawJSON = json.RawMessage(data) + return nil +} + +func (l *LangServerResponse) MarshalJSON() ([]byte, error) { + type embed LangServerResponse + var marshaler = struct { + embed + }{ + embed: embed(*l), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, l.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (l *LangServerResponse) String() string { + if l == nil { + return "" + } + if len(l.rawJSON) > 0 { + if value, err := internal.StringifyJSON(l.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(l); err == nil { + return value + } + return fmt.Sprintf("%#v", l) +} diff --git a/seed/go-sdk/trace/lang_server_test.go b/seed/go-sdk/trace/lang_server_test.go new file mode 100644 index 000000000000..c3c682390bab --- /dev/null +++ b/seed/go-sdk/trace/lang_server_test.go @@ -0,0 +1,296 @@ +// Code generated by Fern. DO NOT EDIT. + +package trace + +import ( + json "encoding/json" + assert "github.com/stretchr/testify/assert" + require "github.com/stretchr/testify/require" + testing "testing" +) + +func TestSettersLangServerRequest(t *testing.T) { + t.Run("SetRequest", func(t *testing.T) { + obj := &LangServerRequest{} + var fernTestValueRequest any + obj.SetRequest(fernTestValueRequest) + assert.Equal(t, fernTestValueRequest, obj.Request) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersLangServerRequest(t *testing.T) { + t.Run("GetRequest", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &LangServerRequest{} + var expected any + obj.Request = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetRequest(), "getter should return the property value") + }) + + t.Run("GetRequest_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *LangServerRequest + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetRequest() // Should return zero value + }) + +} + +func TestSettersMarkExplicitLangServerRequest(t *testing.T) { + t.Run("SetRequest_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &LangServerRequest{} + var fernTestValueRequest any + + // Act + obj.SetRequest(fernTestValueRequest) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersLangServerResponse(t *testing.T) { + t.Run("SetResponse", func(t *testing.T) { + obj := &LangServerResponse{} + var fernTestValueResponse any + obj.SetResponse(fernTestValueResponse) + assert.Equal(t, fernTestValueResponse, obj.Response) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersLangServerResponse(t *testing.T) { + t.Run("GetResponse", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &LangServerResponse{} + var expected any + obj.Response = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetResponse(), "getter should return the property value") + }) + + t.Run("GetResponse_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *LangServerResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetResponse() // Should return zero value + }) + +} + +func TestSettersMarkExplicitLangServerResponse(t *testing.T) { + t.Run("SetResponse_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &LangServerResponse{} + var fernTestValueResponse any + + // Act + obj.SetResponse(fernTestValueResponse) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestJSONMarshalingLangServerRequest(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &LangServerRequest{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled LangServerRequest + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj LangServerRequest + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj LangServerRequest + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingLangServerResponse(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &LangServerResponse{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled LangServerResponse + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj LangServerResponse + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj LangServerResponse + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestStringLangServerRequest(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &LangServerRequest{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *LangServerRequest + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringLangServerResponse(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &LangServerResponse{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *LangServerResponse + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestExtraPropertiesLangServerRequest(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &LangServerRequest{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *LangServerRequest + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesLangServerResponse(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &LangServerResponse{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *LangServerResponse + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} diff --git a/seed/go-sdk/trace/migration.go b/seed/go-sdk/trace/migration.go new file mode 100644 index 000000000000..ba022e42c993 --- /dev/null +++ b/seed/go-sdk/trace/migration.go @@ -0,0 +1,162 @@ +// Code generated by Fern. DO NOT EDIT. + +package trace + +import ( + json "encoding/json" + fmt "fmt" + internal "github.com/trace/fern/internal" + big "math/big" +) + +var ( + getAttemptedMigrationsRequestFieldAdminKeyHeader = big.NewInt(1 << 0) +) + +type GetAttemptedMigrationsRequest struct { + AdminKeyHeader string `json:"-" url:"-"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` +} + +func (g *GetAttemptedMigrationsRequest) require(field *big.Int) { + if g.explicitFields == nil { + g.explicitFields = big.NewInt(0) + } + g.explicitFields.Or(g.explicitFields, field) +} + +// SetAdminKeyHeader sets the AdminKeyHeader field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetAttemptedMigrationsRequest) SetAdminKeyHeader(adminKeyHeader string) { + g.AdminKeyHeader = adminKeyHeader + g.require(getAttemptedMigrationsRequestFieldAdminKeyHeader) +} + +var ( + migrationFieldName = big.NewInt(1 << 0) + migrationFieldStatus = big.NewInt(1 << 1) +) + +type Migration struct { + Name string `json:"name" url:"name"` + Status MigrationStatus `json:"status" url:"status"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (m *Migration) GetName() string { + if m == nil { + return "" + } + return m.Name +} + +func (m *Migration) GetStatus() MigrationStatus { + if m == nil { + return "" + } + return m.Status +} + +func (m *Migration) GetExtraProperties() map[string]interface{} { + if m == nil { + return nil + } + return m.extraProperties +} + +func (m *Migration) require(field *big.Int) { + if m.explicitFields == nil { + m.explicitFields = big.NewInt(0) + } + m.explicitFields.Or(m.explicitFields, field) +} + +// SetName sets the Name field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (m *Migration) SetName(name string) { + m.Name = name + m.require(migrationFieldName) +} + +// SetStatus sets the Status field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (m *Migration) SetStatus(status MigrationStatus) { + m.Status = status + m.require(migrationFieldStatus) +} + +func (m *Migration) UnmarshalJSON(data []byte) error { + type unmarshaler Migration + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *m = Migration(value) + extraProperties, err := internal.ExtractExtraProperties(data, *m) + if err != nil { + return err + } + m.extraProperties = extraProperties + m.rawJSON = json.RawMessage(data) + return nil +} + +func (m *Migration) MarshalJSON() ([]byte, error) { + type embed Migration + var marshaler = struct { + embed + }{ + embed: embed(*m), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, m.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (m *Migration) String() string { + if m == nil { + return "" + } + if len(m.rawJSON) > 0 { + if value, err := internal.StringifyJSON(m.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(m); err == nil { + return value + } + return fmt.Sprintf("%#v", m) +} + +type MigrationStatus string + +const ( + // The migration is running + MigrationStatusRunning MigrationStatus = "RUNNING" + // The migration is failed + MigrationStatusFailed MigrationStatus = "FAILED" + MigrationStatusFinished MigrationStatus = "FINISHED" +) + +func NewMigrationStatusFromString(s string) (MigrationStatus, error) { + switch s { + case "RUNNING": + return MigrationStatusRunning, nil + case "FAILED": + return MigrationStatusFailed, nil + case "FINISHED": + return MigrationStatusFinished, nil + } + var t MigrationStatus + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (m MigrationStatus) Ptr() *MigrationStatus { + return &m +} diff --git a/seed/go-sdk/trace/migration/client.go b/seed/go-sdk/trace/migration/client.go new file mode 100644 index 000000000000..8a7ea3c607a9 --- /dev/null +++ b/seed/go-sdk/trace/migration/client.go @@ -0,0 +1,51 @@ +// Code generated by Fern. DO NOT EDIT. + +package migration + +import ( + context "context" + + fern "github.com/trace/fern" + core "github.com/trace/fern/core" + internal "github.com/trace/fern/internal" + option "github.com/trace/fern/option" +) + +type Client struct { + WithRawResponse *RawClient + + options *core.RequestOptions + baseURL string + caller *internal.Caller +} + +func NewClient(options *core.RequestOptions) *Client { + return &Client{ + WithRawResponse: NewRawClient(options), + options: options, + baseURL: options.BaseURL, + caller: internal.NewCaller( + &internal.CallerParams{ + Client: options.HTTPClient, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + }, + ), + } +} + +func (c *Client) GetAttemptedMigrations( + ctx context.Context, + request *fern.GetAttemptedMigrationsRequest, + opts ...option.RequestOption, +) ([]*fern.Migration, error) { + response, err := c.WithRawResponse.GetAttemptedMigrations( + ctx, + request, + opts..., + ) + if err != nil { + return nil, err + } + return response.Body, nil +} diff --git a/seed/go-sdk/trace/migration/raw_client.go b/seed/go-sdk/trace/migration/raw_client.go new file mode 100644 index 000000000000..c902d0985de0 --- /dev/null +++ b/seed/go-sdk/trace/migration/raw_client.go @@ -0,0 +1,75 @@ +// Code generated by Fern. DO NOT EDIT. + +package migration + +import ( + context "context" + http "net/http" + + fern "github.com/trace/fern" + core "github.com/trace/fern/core" + internal "github.com/trace/fern/internal" + option "github.com/trace/fern/option" +) + +type RawClient struct { + baseURL string + caller *internal.Caller + options *core.RequestOptions +} + +func NewRawClient(options *core.RequestOptions) *RawClient { + return &RawClient{ + options: options, + baseURL: options.BaseURL, + caller: internal.NewCaller( + &internal.CallerParams{ + Client: options.HTTPClient, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + }, + ), + } +} + +func (r *RawClient) GetAttemptedMigrations( + ctx context.Context, + request *fern.GetAttemptedMigrationsRequest, + opts ...option.RequestOption, +) (*core.Response[[]*fern.Migration], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.trace.come", + ) + endpointURL := baseURL + "/migration-info/all" + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + headers.Add("admin-key-header", request.AdminKeyHeader) + var response []*fern.Migration + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodGet, + Headers: headers, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + Response: &response, + }, + ) + if err != nil { + return nil, err + } + return &core.Response[[]*fern.Migration]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: response, + }, nil +} diff --git a/seed/go-sdk/trace/migration_test.go b/seed/go-sdk/trace/migration_test.go new file mode 100644 index 000000000000..355ee33fd291 --- /dev/null +++ b/seed/go-sdk/trace/migration_test.go @@ -0,0 +1,296 @@ +// Code generated by Fern. DO NOT EDIT. + +package trace + +import ( + json "encoding/json" + assert "github.com/stretchr/testify/assert" + require "github.com/stretchr/testify/require" + testing "testing" +) + +func TestSettersGetAttemptedMigrationsRequest(t *testing.T) { + t.Run("SetAdminKeyHeader", func(t *testing.T) { + obj := &GetAttemptedMigrationsRequest{} + var fernTestValueAdminKeyHeader string + obj.SetAdminKeyHeader(fernTestValueAdminKeyHeader) + assert.Equal(t, fernTestValueAdminKeyHeader, obj.AdminKeyHeader) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestSettersMarkExplicitGetAttemptedMigrationsRequest(t *testing.T) { + t.Run("SetAdminKeyHeader_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetAttemptedMigrationsRequest{} + var fernTestValueAdminKeyHeader string + + // Act + obj.SetAdminKeyHeader(fernTestValueAdminKeyHeader) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersMigration(t *testing.T) { + t.Run("SetName", func(t *testing.T) { + obj := &Migration{} + var fernTestValueName string + obj.SetName(fernTestValueName) + assert.Equal(t, fernTestValueName, obj.Name) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetStatus", func(t *testing.T) { + obj := &Migration{} + var fernTestValueStatus MigrationStatus + obj.SetStatus(fernTestValueStatus) + assert.Equal(t, fernTestValueStatus, obj.Status) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersMigration(t *testing.T) { + t.Run("GetName", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Migration{} + var expected string + obj.Name = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetName(), "getter should return the property value") + }) + + t.Run("GetName_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *Migration + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetName() // Should return zero value + }) + + t.Run("GetStatus", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Migration{} + var expected MigrationStatus + obj.Status = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetStatus(), "getter should return the property value") + }) + + t.Run("GetStatus_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *Migration + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetStatus() // Should return zero value + }) + +} + +func TestSettersMarkExplicitMigration(t *testing.T) { + t.Run("SetName_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Migration{} + var fernTestValueName string + + // Act + obj.SetName(fernTestValueName) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetStatus_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Migration{} + var fernTestValueStatus MigrationStatus + + // Act + obj.SetStatus(fernTestValueStatus) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestJSONMarshalingMigration(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Migration{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled Migration + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj Migration + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj Migration + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestStringMigration(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &Migration{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *Migration + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestEnumMigrationStatus(t *testing.T) { + t.Run("NewFromString_RUNNING", func(t *testing.T) { + t.Parallel() + val, err := NewMigrationStatusFromString("RUNNING") + assert.NoError(t, err, "valid enum value should not return error") + assert.Equal(t, MigrationStatus("RUNNING"), val, "enum value should match expected wire value") + }) + + t.Run("NewFromString_FAILED", func(t *testing.T) { + t.Parallel() + val, err := NewMigrationStatusFromString("FAILED") + assert.NoError(t, err, "valid enum value should not return error") + assert.Equal(t, MigrationStatus("FAILED"), val, "enum value should match expected wire value") + }) + + t.Run("NewFromString_FINISHED", func(t *testing.T) { + t.Parallel() + val, err := NewMigrationStatusFromString("FINISHED") + assert.NoError(t, err, "valid enum value should not return error") + assert.Equal(t, MigrationStatus("FINISHED"), val, "enum value should match expected wire value") + }) + + t.Run("NewFromString_Invalid", func(t *testing.T) { + _, err := NewMigrationStatusFromString("invalid_value_that_does_not_exist") + assert.Error(t, err) + }) + + t.Run("Ptr", func(t *testing.T) { + val, err := NewMigrationStatusFromString("RUNNING") + assert.NoError(t, err) + ptr := val.Ptr() + assert.NotNil(t, ptr) + assert.Equal(t, val, *ptr) + }) +} + +func TestExtraPropertiesMigration(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &Migration{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *Migration + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} diff --git a/seed/go-sdk/trace/option/request_option.go b/seed/go-sdk/trace/option/request_option.go new file mode 100644 index 000000000000..d563cb51bc6e --- /dev/null +++ b/seed/go-sdk/trace/option/request_option.go @@ -0,0 +1,117 @@ +// Code generated by Fern. DO NOT EDIT. + +package option + +import ( + core "github.com/trace/fern/core" + http "net/http" + url "net/url" +) + +// RequestOption adapts the behavior of an individual request. +type RequestOption = core.RequestOption + +// WithBaseURL sets the base URL, overriding the default +// environment, if any. +func WithBaseURL(baseURL string) *core.BaseURLOption { + return &core.BaseURLOption{ + BaseURL: baseURL, + } +} + +// WithHTTPClient uses the given HTTPClient to issue the request. +func WithHTTPClient(httpClient core.HTTPClient) *core.HTTPClientOption { + return &core.HTTPClientOption{ + HTTPClient: httpClient, + } +} + +// WithHTTPHeader adds the given http.Header to the request. +func WithHTTPHeader(httpHeader http.Header) *core.HTTPHeaderOption { + return &core.HTTPHeaderOption{ + // Clone the headers so they can't be modified after the option call. + HTTPHeader: httpHeader.Clone(), + } +} + +// WithBodyProperties adds the given body properties to the request. +func WithBodyProperties(bodyProperties map[string]interface{}) *core.BodyPropertiesOption { + copiedBodyProperties := make(map[string]interface{}, len(bodyProperties)) + for key, value := range bodyProperties { + copiedBodyProperties[key] = value + } + return &core.BodyPropertiesOption{ + BodyProperties: copiedBodyProperties, + } +} + +// WithQueryParameters adds the given query parameters to the request. +func WithQueryParameters(queryParameters url.Values) *core.QueryParametersOption { + copiedQueryParameters := make(url.Values, len(queryParameters)) + for key, values := range queryParameters { + copiedQueryParameters[key] = values + } + return &core.QueryParametersOption{ + QueryParameters: copiedQueryParameters, + } +} + +// WithMaxAttempts configures the maximum number of retry attempts. +func WithMaxAttempts(attempts uint) *core.MaxAttemptsOption { + return &core.MaxAttemptsOption{ + MaxAttempts: attempts, + } +} + +// WithMaxStreamBufSize configures the maximum buffer size for streaming responses. +// This controls the maximum size of a single message (in bytes) that the stream +// can process. By default, this is set to 1MB. +func WithMaxStreamBufSize(size int) *core.MaxBufSizeOption { + return &core.MaxBufSizeOption{ + MaxBufSize: size, + } +} + +// WithMaxStreamReconnectAttempts caps the number of transparent mid-stream +// reconnect attempts on streaming endpoints that support resumption. The +// reconnect loop honors Last-Event-ID and any server-sent `retry:` directives. +// Has no effect on endpoints that don't support resumption. +func WithMaxStreamReconnectAttempts(attempts uint) *core.MaxStreamReconnectAttemptsOption { + return &core.MaxStreamReconnectAttemptsOption{ + MaxStreamReconnectAttempts: attempts, + } +} + +// WithoutStreamReconnection disables transparent mid-stream reconnection on +// resumable SSE endpoints. Has no effect on non-resumable endpoints. +func WithoutStreamReconnection() *core.WithoutStreamReconnectionOption { + return &core.WithoutStreamReconnectionOption{} +} + +// WithoutRetries disables HTTP-level retry attempts for the request. Use this +// instead of WithMaxAttempts(0), which falls through to the default of 2 +// attempts. +func WithoutRetries() *core.WithoutRetriesOption { + return &core.WithoutRetriesOption{} +} + +// WithToken sets the 'Authorization: Bearer ' request header. +func WithToken(token string) *core.TokenOption { + return &core.TokenOption{ + Token: token, + } +} + +// WithTokenFunc sets a function that returns the 'Authorization: Bearer' token at request time. +func WithTokenFunc(fn func() (string, error)) *core.TokenFuncOption { + return &core.TokenFuncOption{ + TokenFunc: fn, + } +} + +// WithXRandomHeader sets the xRandomHeader request header. +func WithXRandomHeader(xRandomHeader *string) *core.XRandomHeaderOption { + return &core.XRandomHeaderOption{ + XRandomHeader: xRandomHeader, + } +} diff --git a/seed/go-sdk/trace/playlist.go b/seed/go-sdk/trace/playlist.go new file mode 100644 index 000000000000..238f4c79defd --- /dev/null +++ b/seed/go-sdk/trace/playlist.go @@ -0,0 +1,592 @@ +// Code generated by Fern. DO NOT EDIT. + +package trace + +import ( + json "encoding/json" + fmt "fmt" + common "github.com/trace/fern/common" + internal "github.com/trace/fern/internal" + big "math/big" + time "time" +) + +var ( + createPlaylistRequestFieldDatetime = big.NewInt(1 << 0) + createPlaylistRequestFieldOptionalDatetime = big.NewInt(1 << 1) +) + +type CreatePlaylistRequest struct { + Datetime time.Time `json:"-" url:"datetime"` + OptionalDatetime *time.Time `json:"-" url:"optionalDatetime,omitempty"` + Body *PlaylistCreateRequest `json:"-" url:"-"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` +} + +func (c *CreatePlaylistRequest) require(field *big.Int) { + if c.explicitFields == nil { + c.explicitFields = big.NewInt(0) + } + c.explicitFields.Or(c.explicitFields, field) +} + +// SetDatetime sets the Datetime field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CreatePlaylistRequest) SetDatetime(datetime time.Time) { + c.Datetime = datetime + c.require(createPlaylistRequestFieldDatetime) +} + +// SetOptionalDatetime sets the OptionalDatetime field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CreatePlaylistRequest) SetOptionalDatetime(optionalDatetime *time.Time) { + c.OptionalDatetime = optionalDatetime + c.require(createPlaylistRequestFieldOptionalDatetime) +} + +func (c *CreatePlaylistRequest) UnmarshalJSON(data []byte) error { + body := new(PlaylistCreateRequest) + if err := json.Unmarshal(data, &body); err != nil { + return err + } + c.Body = body + return nil +} + +func (c *CreatePlaylistRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(c.Body) +} + +var ( + getPlaylistsRequestFieldLimit = big.NewInt(1 << 0) + getPlaylistsRequestFieldOtherField = big.NewInt(1 << 1) + getPlaylistsRequestFieldMultiLineDocs = big.NewInt(1 << 2) + getPlaylistsRequestFieldOptionalMultipleField = big.NewInt(1 << 3) + getPlaylistsRequestFieldMultipleField = big.NewInt(1 << 4) +) + +type GetPlaylistsRequest struct { + Limit *int `json:"-" url:"limit,omitempty"` + // i'm another field + OtherField string `json:"-" url:"otherField"` + // I'm a multiline + // description + MultiLineDocs string `json:"-" url:"multiLineDocs"` + OptionalMultipleField []*string `json:"-" url:"optionalMultipleField,omitempty"` + MultipleField []string `json:"-" url:"multipleField"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` +} + +func (g *GetPlaylistsRequest) require(field *big.Int) { + if g.explicitFields == nil { + g.explicitFields = big.NewInt(0) + } + g.explicitFields.Or(g.explicitFields, field) +} + +// SetLimit sets the Limit field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetPlaylistsRequest) SetLimit(limit *int) { + g.Limit = limit + g.require(getPlaylistsRequestFieldLimit) +} + +// SetOtherField sets the OtherField field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetPlaylistsRequest) SetOtherField(otherField string) { + g.OtherField = otherField + g.require(getPlaylistsRequestFieldOtherField) +} + +// SetMultiLineDocs sets the MultiLineDocs field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetPlaylistsRequest) SetMultiLineDocs(multiLineDocs string) { + g.MultiLineDocs = multiLineDocs + g.require(getPlaylistsRequestFieldMultiLineDocs) +} + +// SetOptionalMultipleField sets the OptionalMultipleField field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetPlaylistsRequest) SetOptionalMultipleField(optionalMultipleField []*string) { + g.OptionalMultipleField = optionalMultipleField + g.require(getPlaylistsRequestFieldOptionalMultipleField) +} + +// SetMultipleField sets the MultipleField field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetPlaylistsRequest) SetMultipleField(multipleField []string) { + g.MultipleField = multipleField + g.require(getPlaylistsRequestFieldMultipleField) +} + +var ( + playlistFieldName = big.NewInt(1 << 0) + playlistFieldProblems = big.NewInt(1 << 1) + playlistFieldPlaylistID = big.NewInt(1 << 2) + playlistFieldOwnerID = big.NewInt(1 << 3) +) + +type Playlist struct { + Name string `json:"name" url:"name"` + Problems []common.ProblemID `json:"problems" url:"problems"` + PlaylistID PlaylistID `json:"playlist_id" url:"playlist_id"` + OwnerID UserID `json:"owner-id" url:"owner-id"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (p *Playlist) GetName() string { + if p == nil { + return "" + } + return p.Name +} + +func (p *Playlist) GetProblems() []common.ProblemID { + if p == nil { + return nil + } + return p.Problems +} + +func (p *Playlist) GetPlaylistID() PlaylistID { + if p == nil { + return "" + } + return p.PlaylistID +} + +func (p *Playlist) GetOwnerID() UserID { + if p == nil { + return "" + } + return p.OwnerID +} + +func (p *Playlist) GetExtraProperties() map[string]interface{} { + if p == nil { + return nil + } + return p.extraProperties +} + +func (p *Playlist) require(field *big.Int) { + if p.explicitFields == nil { + p.explicitFields = big.NewInt(0) + } + p.explicitFields.Or(p.explicitFields, field) +} + +// SetName sets the Name field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *Playlist) SetName(name string) { + p.Name = name + p.require(playlistFieldName) +} + +// SetProblems sets the Problems field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *Playlist) SetProblems(problems []common.ProblemID) { + p.Problems = problems + p.require(playlistFieldProblems) +} + +// SetPlaylistID sets the PlaylistID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *Playlist) SetPlaylistID(playlistID PlaylistID) { + p.PlaylistID = playlistID + p.require(playlistFieldPlaylistID) +} + +// SetOwnerID sets the OwnerID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *Playlist) SetOwnerID(ownerID UserID) { + p.OwnerID = ownerID + p.require(playlistFieldOwnerID) +} + +func (p *Playlist) UnmarshalJSON(data []byte) error { + type unmarshaler Playlist + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *p = Playlist(value) + extraProperties, err := internal.ExtractExtraProperties(data, *p) + if err != nil { + return err + } + p.extraProperties = extraProperties + p.rawJSON = json.RawMessage(data) + return nil +} + +func (p *Playlist) MarshalJSON() ([]byte, error) { + type embed Playlist + var marshaler = struct { + embed + }{ + embed: embed(*p), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, p.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (p *Playlist) String() string { + if p == nil { + return "" + } + if len(p.rawJSON) > 0 { + if value, err := internal.StringifyJSON(p.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(p); err == nil { + return value + } + return fmt.Sprintf("%#v", p) +} + +var ( + playlistCreateRequestFieldName = big.NewInt(1 << 0) + playlistCreateRequestFieldProblems = big.NewInt(1 << 1) +) + +type PlaylistCreateRequest struct { + Name string `json:"name" url:"name"` + Problems []common.ProblemID `json:"problems" url:"problems"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (p *PlaylistCreateRequest) GetName() string { + if p == nil { + return "" + } + return p.Name +} + +func (p *PlaylistCreateRequest) GetProblems() []common.ProblemID { + if p == nil { + return nil + } + return p.Problems +} + +func (p *PlaylistCreateRequest) GetExtraProperties() map[string]interface{} { + if p == nil { + return nil + } + return p.extraProperties +} + +func (p *PlaylistCreateRequest) require(field *big.Int) { + if p.explicitFields == nil { + p.explicitFields = big.NewInt(0) + } + p.explicitFields.Or(p.explicitFields, field) +} + +// SetName sets the Name field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *PlaylistCreateRequest) SetName(name string) { + p.Name = name + p.require(playlistCreateRequestFieldName) +} + +// SetProblems sets the Problems field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *PlaylistCreateRequest) SetProblems(problems []common.ProblemID) { + p.Problems = problems + p.require(playlistCreateRequestFieldProblems) +} + +func (p *PlaylistCreateRequest) UnmarshalJSON(data []byte) error { + type unmarshaler PlaylistCreateRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *p = PlaylistCreateRequest(value) + extraProperties, err := internal.ExtractExtraProperties(data, *p) + if err != nil { + return err + } + p.extraProperties = extraProperties + p.rawJSON = json.RawMessage(data) + return nil +} + +func (p *PlaylistCreateRequest) MarshalJSON() ([]byte, error) { + type embed PlaylistCreateRequest + var marshaler = struct { + embed + }{ + embed: embed(*p), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, p.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (p *PlaylistCreateRequest) String() string { + if p == nil { + return "" + } + if len(p.rawJSON) > 0 { + if value, err := internal.StringifyJSON(p.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(p); err == nil { + return value + } + return fmt.Sprintf("%#v", p) +} + +type PlaylistID = string + +type PlaylistIDNotFoundErrorBody struct { + Type string + PlaylistID PlaylistID + + rawJSON json.RawMessage +} + +func (p *PlaylistIDNotFoundErrorBody) GetType() string { + if p == nil { + return "" + } + return p.Type +} + +func (p *PlaylistIDNotFoundErrorBody) GetPlaylistID() PlaylistID { + if p == nil { + return "" + } + return p.PlaylistID +} + +func (p *PlaylistIDNotFoundErrorBody) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + p.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", p) + } + switch unmarshaler.Type { + case "playlistId": + var valueUnmarshaler struct { + PlaylistID PlaylistID `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + p.PlaylistID = valueUnmarshaler.PlaylistID + } + p.rawJSON = json.RawMessage(data) + return nil +} + +func (p PlaylistIDNotFoundErrorBody) MarshalJSON() ([]byte, error) { + if err := p.validate(); err != nil { + return nil, err + } + if p.PlaylistID != "" { + var marshaler = struct { + Type string `json:"type"` + PlaylistID PlaylistID `json:"value"` + }{ + Type: "playlistId", + PlaylistID: p.PlaylistID, + } + return json.Marshal(marshaler) + } + if len(p.rawJSON) > 0 { + return p.rawJSON, nil + } + return nil, fmt.Errorf("type %T does not define a non-empty union type", p) +} + +type PlaylistIDNotFoundErrorBodyVisitor interface { + VisitPlaylistID(PlaylistID) error +} + +func (p *PlaylistIDNotFoundErrorBody) Accept(visitor PlaylistIDNotFoundErrorBodyVisitor) error { + if p.PlaylistID != "" { + return visitor.VisitPlaylistID(p.PlaylistID) + } + return fmt.Errorf("type %T does not define a non-empty union type", p) +} + +func (p *PlaylistIDNotFoundErrorBody) validate() error { + if p == nil { + return fmt.Errorf("type %T is nil", p) + } + var fields []string + if p.PlaylistID != "" { + fields = append(fields, "playlistId") + } + if len(fields) == 0 { + if p.Type != "" { + if len(p.rawJSON) > 0 { + return nil + } + return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", p, p.Type) + } + return fmt.Errorf("type %T is empty", p) + } + if len(fields) > 1 { + return fmt.Errorf("type %T defines values for %s, but only one value is allowed", p, fields) + } + if p.Type != "" { + field := fields[0] + if p.Type != field { + return fmt.Errorf( + "type %T defines a discriminant set to %q, but it does not match the %T field; either remove or update the discriminant to match", + p, + p.Type, + p, + ) + } + } + return nil +} + +type ReservedKeywordEnum string + +const ( + ReservedKeywordEnumIs ReservedKeywordEnum = "is" + ReservedKeywordEnumAs ReservedKeywordEnum = "as" +) + +func NewReservedKeywordEnumFromString(s string) (ReservedKeywordEnum, error) { + switch s { + case "is": + return ReservedKeywordEnumIs, nil + case "as": + return ReservedKeywordEnumAs, nil + } + var t ReservedKeywordEnum + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (r ReservedKeywordEnum) Ptr() *ReservedKeywordEnum { + return &r +} + +var ( + updatePlaylistRequestFieldName = big.NewInt(1 << 0) + updatePlaylistRequestFieldProblems = big.NewInt(1 << 1) +) + +type UpdatePlaylistRequest struct { + Name string `json:"name" url:"name"` + // The problems that make up the playlist. + Problems []common.ProblemID `json:"problems" url:"problems"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (u *UpdatePlaylistRequest) GetName() string { + if u == nil { + return "" + } + return u.Name +} + +func (u *UpdatePlaylistRequest) GetProblems() []common.ProblemID { + if u == nil { + return nil + } + return u.Problems +} + +func (u *UpdatePlaylistRequest) GetExtraProperties() map[string]interface{} { + if u == nil { + return nil + } + return u.extraProperties +} + +func (u *UpdatePlaylistRequest) require(field *big.Int) { + if u.explicitFields == nil { + u.explicitFields = big.NewInt(0) + } + u.explicitFields.Or(u.explicitFields, field) +} + +// SetName sets the Name field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (u *UpdatePlaylistRequest) SetName(name string) { + u.Name = name + u.require(updatePlaylistRequestFieldName) +} + +// SetProblems sets the Problems field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (u *UpdatePlaylistRequest) SetProblems(problems []common.ProblemID) { + u.Problems = problems + u.require(updatePlaylistRequestFieldProblems) +} + +func (u *UpdatePlaylistRequest) UnmarshalJSON(data []byte) error { + type unmarshaler UpdatePlaylistRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *u = UpdatePlaylistRequest(value) + extraProperties, err := internal.ExtractExtraProperties(data, *u) + if err != nil { + return err + } + u.extraProperties = extraProperties + u.rawJSON = json.RawMessage(data) + return nil +} + +func (u *UpdatePlaylistRequest) MarshalJSON() ([]byte, error) { + type embed UpdatePlaylistRequest + var marshaler = struct { + embed + }{ + embed: embed(*u), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, u.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (u *UpdatePlaylistRequest) String() string { + if u == nil { + return "" + } + if len(u.rawJSON) > 0 { + if value, err := internal.StringifyJSON(u.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(u); err == nil { + return value + } + return fmt.Sprintf("%#v", u) +} diff --git a/seed/go-sdk/trace/playlist/client.go b/seed/go-sdk/trace/playlist/client.go new file mode 100644 index 000000000000..8ba0505e62fa --- /dev/null +++ b/seed/go-sdk/trace/playlist/client.go @@ -0,0 +1,132 @@ +// Code generated by Fern. DO NOT EDIT. + +package playlist + +import ( + context "context" + + fern "github.com/trace/fern" + core "github.com/trace/fern/core" + internal "github.com/trace/fern/internal" + option "github.com/trace/fern/option" +) + +type Client struct { + WithRawResponse *RawClient + + options *core.RequestOptions + baseURL string + caller *internal.Caller +} + +func NewClient(options *core.RequestOptions) *Client { + return &Client{ + WithRawResponse: NewRawClient(options), + options: options, + baseURL: options.BaseURL, + caller: internal.NewCaller( + &internal.CallerParams{ + Client: options.HTTPClient, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + }, + ), + } +} + +// Create a new playlist +func (c *Client) CreatePlaylist( + ctx context.Context, + serviceParam int, + request *fern.CreatePlaylistRequest, + opts ...option.RequestOption, +) (*fern.Playlist, error) { + response, err := c.WithRawResponse.CreatePlaylist( + ctx, + serviceParam, + request, + opts..., + ) + if err != nil { + return nil, err + } + return response.Body, nil +} + +// Returns the user's playlists +func (c *Client) GetPlaylists( + ctx context.Context, + serviceParam int, + request *fern.GetPlaylistsRequest, + opts ...option.RequestOption, +) ([]*fern.Playlist, error) { + response, err := c.WithRawResponse.GetPlaylists( + ctx, + serviceParam, + request, + opts..., + ) + if err != nil { + return nil, err + } + return response.Body, nil +} + +// Returns a playlist +func (c *Client) GetPlaylist( + ctx context.Context, + serviceParam int, + playlistID fern.PlaylistID, + opts ...option.RequestOption, +) (*fern.Playlist, error) { + response, err := c.WithRawResponse.GetPlaylist( + ctx, + serviceParam, + playlistID, + opts..., + ) + if err != nil { + return nil, err + } + return response.Body, nil +} + +// Updates a playlist +func (c *Client) UpdatePlaylist( + ctx context.Context, + serviceParam int, + playlistID fern.PlaylistID, + request *fern.UpdatePlaylistRequest, + opts ...option.RequestOption, +) (*fern.Playlist, error) { + response, err := c.WithRawResponse.UpdatePlaylist( + ctx, + serviceParam, + playlistID, + request, + opts..., + ) + if err != nil { + return nil, err + } + return response.Body, nil +} + +// Deletes a playlist +func (c *Client) DeletePlaylist( + ctx context.Context, + serviceParam int, + playlistID fern.PlaylistID, + opts ...option.RequestOption, +) error { + _, err := c.WithRawResponse.DeletePlaylist( + ctx, + serviceParam, + playlistID, + opts..., + ) + if err != nil { + return err + } + return nil +} diff --git a/seed/go-sdk/trace/playlist/raw_client.go b/seed/go-sdk/trace/playlist/raw_client.go new file mode 100644 index 000000000000..5e5eae3a845d --- /dev/null +++ b/seed/go-sdk/trace/playlist/raw_client.go @@ -0,0 +1,278 @@ +// Code generated by Fern. DO NOT EDIT. + +package playlist + +import ( + context "context" + http "net/http" + + fern "github.com/trace/fern" + core "github.com/trace/fern/core" + internal "github.com/trace/fern/internal" + option "github.com/trace/fern/option" +) + +type RawClient struct { + baseURL string + caller *internal.Caller + options *core.RequestOptions +} + +func NewRawClient(options *core.RequestOptions) *RawClient { + return &RawClient{ + options: options, + baseURL: options.BaseURL, + caller: internal.NewCaller( + &internal.CallerParams{ + Client: options.HTTPClient, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + }, + ), + } +} + +func (r *RawClient) CreatePlaylist( + ctx context.Context, + serviceParam int, + request *fern.CreatePlaylistRequest, + opts ...option.RequestOption, +) (*core.Response[*fern.Playlist], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.trace.come", + ) + endpointURL := internal.EncodeURL( + baseURL+"/v2/playlist/%v/create", + serviceParam, + ) + queryParams, err := internal.QueryValues(request) + if err != nil { + return nil, err + } + if len(queryParams) > 0 { + endpointURL += "?" + queryParams.Encode() + } + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + var response *fern.Playlist + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: headers, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + Request: request, + Response: &response, + }, + ) + if err != nil { + return nil, err + } + return &core.Response[*fern.Playlist]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: response, + }, nil +} + +func (r *RawClient) GetPlaylists( + ctx context.Context, + serviceParam int, + request *fern.GetPlaylistsRequest, + opts ...option.RequestOption, +) (*core.Response[[]*fern.Playlist], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.trace.come", + ) + endpointURL := internal.EncodeURL( + baseURL+"/v2/playlist/%v/all", + serviceParam, + ) + queryParams, err := internal.QueryValues(request) + if err != nil { + return nil, err + } + if len(queryParams) > 0 { + endpointURL += "?" + queryParams.Encode() + } + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + var response []*fern.Playlist + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodGet, + Headers: headers, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + Response: &response, + }, + ) + if err != nil { + return nil, err + } + return &core.Response[[]*fern.Playlist]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: response, + }, nil +} + +func (r *RawClient) GetPlaylist( + ctx context.Context, + serviceParam int, + playlistID fern.PlaylistID, + opts ...option.RequestOption, +) (*core.Response[*fern.Playlist], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.trace.come", + ) + endpointURL := internal.EncodeURL( + baseURL+"/v2/playlist/%v/%v", + serviceParam, + playlistID, + ) + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + var response *fern.Playlist + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodGet, + Headers: headers, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + Response: &response, + ErrorDecoder: internal.NewErrorDecoder(fern.ErrorCodes), + }, + ) + if err != nil { + return nil, err + } + return &core.Response[*fern.Playlist]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: response, + }, nil +} + +func (r *RawClient) UpdatePlaylist( + ctx context.Context, + serviceParam int, + playlistID fern.PlaylistID, + request *fern.UpdatePlaylistRequest, + opts ...option.RequestOption, +) (*core.Response[*fern.Playlist], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.trace.come", + ) + endpointURL := internal.EncodeURL( + baseURL+"/v2/playlist/%v/%v", + serviceParam, + playlistID, + ) + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + var response *fern.Playlist + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodPut, + Headers: headers, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + Request: request, + Response: &response, + ErrorDecoder: internal.NewErrorDecoder(fern.ErrorCodes), + }, + ) + if err != nil { + return nil, err + } + return &core.Response[*fern.Playlist]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: response, + }, nil +} + +func (r *RawClient) DeletePlaylist( + ctx context.Context, + serviceParam int, + playlistID fern.PlaylistID, + opts ...option.RequestOption, +) (*core.Response[any], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.trace.come", + ) + endpointURL := internal.EncodeURL( + baseURL+"/v2/playlist/%v/%v", + serviceParam, + playlistID, + ) + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodDelete, + Headers: headers, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + }, + ) + if err != nil { + return nil, err + } + return &core.Response[any]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: nil, + }, nil +} diff --git a/seed/go-sdk/trace/playlist_test.go b/seed/go-sdk/trace/playlist_test.go new file mode 100644 index 000000000000..cf2647ae9af9 --- /dev/null +++ b/seed/go-sdk/trace/playlist_test.go @@ -0,0 +1,1144 @@ +// Code generated by Fern. DO NOT EDIT. + +package trace + +import ( + json "encoding/json" + assert "github.com/stretchr/testify/assert" + require "github.com/stretchr/testify/require" + common "github.com/trace/fern/common" + testing "testing" + time "time" +) + +func TestSettersCreatePlaylistRequest(t *testing.T) { + t.Run("SetDatetime", func(t *testing.T) { + obj := &CreatePlaylistRequest{} + var fernTestValueDatetime time.Time + obj.SetDatetime(fernTestValueDatetime) + assert.Equal(t, fernTestValueDatetime, obj.Datetime) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetOptionalDatetime", func(t *testing.T) { + obj := &CreatePlaylistRequest{} + var fernTestValueOptionalDatetime *time.Time + obj.SetOptionalDatetime(fernTestValueOptionalDatetime) + assert.Equal(t, fernTestValueOptionalDatetime, obj.OptionalDatetime) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestSettersMarkExplicitCreatePlaylistRequest(t *testing.T) { + t.Run("SetDatetime_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreatePlaylistRequest{} + var fernTestValueDatetime time.Time + + // Act + obj.SetDatetime(fernTestValueDatetime) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetOptionalDatetime_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreatePlaylistRequest{} + var fernTestValueOptionalDatetime *time.Time + + // Act + obj.SetOptionalDatetime(fernTestValueOptionalDatetime) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersGetPlaylistsRequest(t *testing.T) { + t.Run("SetLimit", func(t *testing.T) { + obj := &GetPlaylistsRequest{} + var fernTestValueLimit *int + obj.SetLimit(fernTestValueLimit) + assert.Equal(t, fernTestValueLimit, obj.Limit) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetOtherField", func(t *testing.T) { + obj := &GetPlaylistsRequest{} + var fernTestValueOtherField string + obj.SetOtherField(fernTestValueOtherField) + assert.Equal(t, fernTestValueOtherField, obj.OtherField) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetMultiLineDocs", func(t *testing.T) { + obj := &GetPlaylistsRequest{} + var fernTestValueMultiLineDocs string + obj.SetMultiLineDocs(fernTestValueMultiLineDocs) + assert.Equal(t, fernTestValueMultiLineDocs, obj.MultiLineDocs) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetOptionalMultipleField", func(t *testing.T) { + obj := &GetPlaylistsRequest{} + var fernTestValueOptionalMultipleField []*string + obj.SetOptionalMultipleField(fernTestValueOptionalMultipleField) + assert.Equal(t, fernTestValueOptionalMultipleField, obj.OptionalMultipleField) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetMultipleField", func(t *testing.T) { + obj := &GetPlaylistsRequest{} + var fernTestValueMultipleField []string + obj.SetMultipleField(fernTestValueMultipleField) + assert.Equal(t, fernTestValueMultipleField, obj.MultipleField) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestSettersMarkExplicitGetPlaylistsRequest(t *testing.T) { + t.Run("SetLimit_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetPlaylistsRequest{} + var fernTestValueLimit *int + + // Act + obj.SetLimit(fernTestValueLimit) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetOtherField_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetPlaylistsRequest{} + var fernTestValueOtherField string + + // Act + obj.SetOtherField(fernTestValueOtherField) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetMultiLineDocs_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetPlaylistsRequest{} + var fernTestValueMultiLineDocs string + + // Act + obj.SetMultiLineDocs(fernTestValueMultiLineDocs) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetOptionalMultipleField_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetPlaylistsRequest{} + var fernTestValueOptionalMultipleField []*string + + // Act + obj.SetOptionalMultipleField(fernTestValueOptionalMultipleField) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetMultipleField_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetPlaylistsRequest{} + var fernTestValueMultipleField []string + + // Act + obj.SetMultipleField(fernTestValueMultipleField) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersPlaylist(t *testing.T) { + t.Run("SetName", func(t *testing.T) { + obj := &Playlist{} + var fernTestValueName string + obj.SetName(fernTestValueName) + assert.Equal(t, fernTestValueName, obj.Name) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetProblems", func(t *testing.T) { + obj := &Playlist{} + var fernTestValueProblems []common.ProblemID + obj.SetProblems(fernTestValueProblems) + assert.Equal(t, fernTestValueProblems, obj.Problems) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetPlaylistID", func(t *testing.T) { + obj := &Playlist{} + var fernTestValuePlaylistID PlaylistID + obj.SetPlaylistID(fernTestValuePlaylistID) + assert.Equal(t, fernTestValuePlaylistID, obj.PlaylistID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetOwnerID", func(t *testing.T) { + obj := &Playlist{} + var fernTestValueOwnerID UserID + obj.SetOwnerID(fernTestValueOwnerID) + assert.Equal(t, fernTestValueOwnerID, obj.OwnerID) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersPlaylist(t *testing.T) { + t.Run("GetName", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Playlist{} + var expected string + obj.Name = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetName(), "getter should return the property value") + }) + + t.Run("GetName_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *Playlist + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetName() // Should return zero value + }) + + t.Run("GetProblems", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Playlist{} + var expected []common.ProblemID + obj.Problems = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetProblems(), "getter should return the property value") + }) + + t.Run("GetProblems_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Playlist{} + obj.Problems = nil + + // Act & Assert + assert.Nil(t, obj.GetProblems(), "getter should return nil when property is nil") + }) + + t.Run("GetProblems_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *Playlist + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetProblems() // Should return zero value + }) + + t.Run("GetPlaylistID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Playlist{} + var expected PlaylistID + obj.PlaylistID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetPlaylistID(), "getter should return the property value") + }) + + t.Run("GetPlaylistID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *Playlist + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetPlaylistID() // Should return zero value + }) + + t.Run("GetOwnerID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Playlist{} + var expected UserID + obj.OwnerID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetOwnerID(), "getter should return the property value") + }) + + t.Run("GetOwnerID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *Playlist + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetOwnerID() // Should return zero value + }) + +} + +func TestSettersMarkExplicitPlaylist(t *testing.T) { + t.Run("SetName_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Playlist{} + var fernTestValueName string + + // Act + obj.SetName(fernTestValueName) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetProblems_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Playlist{} + var fernTestValueProblems []common.ProblemID + + // Act + obj.SetProblems(fernTestValueProblems) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetPlaylistID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Playlist{} + var fernTestValuePlaylistID PlaylistID + + // Act + obj.SetPlaylistID(fernTestValuePlaylistID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetOwnerID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Playlist{} + var fernTestValueOwnerID UserID + + // Act + obj.SetOwnerID(fernTestValueOwnerID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersPlaylistCreateRequest(t *testing.T) { + t.Run("SetName", func(t *testing.T) { + obj := &PlaylistCreateRequest{} + var fernTestValueName string + obj.SetName(fernTestValueName) + assert.Equal(t, fernTestValueName, obj.Name) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetProblems", func(t *testing.T) { + obj := &PlaylistCreateRequest{} + var fernTestValueProblems []common.ProblemID + obj.SetProblems(fernTestValueProblems) + assert.Equal(t, fernTestValueProblems, obj.Problems) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersPlaylistCreateRequest(t *testing.T) { + t.Run("GetName", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &PlaylistCreateRequest{} + var expected string + obj.Name = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetName(), "getter should return the property value") + }) + + t.Run("GetName_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *PlaylistCreateRequest + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetName() // Should return zero value + }) + + t.Run("GetProblems", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &PlaylistCreateRequest{} + var expected []common.ProblemID + obj.Problems = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetProblems(), "getter should return the property value") + }) + + t.Run("GetProblems_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &PlaylistCreateRequest{} + obj.Problems = nil + + // Act & Assert + assert.Nil(t, obj.GetProblems(), "getter should return nil when property is nil") + }) + + t.Run("GetProblems_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *PlaylistCreateRequest + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetProblems() // Should return zero value + }) + +} + +func TestSettersMarkExplicitPlaylistCreateRequest(t *testing.T) { + t.Run("SetName_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &PlaylistCreateRequest{} + var fernTestValueName string + + // Act + obj.SetName(fernTestValueName) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetProblems_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &PlaylistCreateRequest{} + var fernTestValueProblems []common.ProblemID + + // Act + obj.SetProblems(fernTestValueProblems) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestGettersPlaylistIDNotFoundErrorBody(t *testing.T) { + t.Run("GetType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &PlaylistIDNotFoundErrorBody{} + var expected string + obj.Type = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetType(), "getter should return the property value") + }) + + t.Run("GetType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *PlaylistIDNotFoundErrorBody + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetType() // Should return zero value + }) + + t.Run("GetPlaylistID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &PlaylistIDNotFoundErrorBody{} + var expected PlaylistID + obj.PlaylistID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetPlaylistID(), "getter should return the property value") + }) + + t.Run("GetPlaylistID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *PlaylistIDNotFoundErrorBody + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetPlaylistID() // Should return zero value + }) + +} + +func TestSettersUpdatePlaylistRequest(t *testing.T) { + t.Run("SetName", func(t *testing.T) { + obj := &UpdatePlaylistRequest{} + var fernTestValueName string + obj.SetName(fernTestValueName) + assert.Equal(t, fernTestValueName, obj.Name) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetProblems", func(t *testing.T) { + obj := &UpdatePlaylistRequest{} + var fernTestValueProblems []common.ProblemID + obj.SetProblems(fernTestValueProblems) + assert.Equal(t, fernTestValueProblems, obj.Problems) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersUpdatePlaylistRequest(t *testing.T) { + t.Run("GetName", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &UpdatePlaylistRequest{} + var expected string + obj.Name = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetName(), "getter should return the property value") + }) + + t.Run("GetName_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *UpdatePlaylistRequest + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetName() // Should return zero value + }) + + t.Run("GetProblems", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &UpdatePlaylistRequest{} + var expected []common.ProblemID + obj.Problems = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetProblems(), "getter should return the property value") + }) + + t.Run("GetProblems_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &UpdatePlaylistRequest{} + obj.Problems = nil + + // Act & Assert + assert.Nil(t, obj.GetProblems(), "getter should return nil when property is nil") + }) + + t.Run("GetProblems_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *UpdatePlaylistRequest + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetProblems() // Should return zero value + }) + +} + +func TestSettersMarkExplicitUpdatePlaylistRequest(t *testing.T) { + t.Run("SetName_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &UpdatePlaylistRequest{} + var fernTestValueName string + + // Act + obj.SetName(fernTestValueName) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetProblems_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &UpdatePlaylistRequest{} + var fernTestValueProblems []common.ProblemID + + // Act + obj.SetProblems(fernTestValueProblems) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestJSONMarshalingPlaylist(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Playlist{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled Playlist + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj Playlist + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj Playlist + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingPlaylistCreateRequest(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &PlaylistCreateRequest{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled PlaylistCreateRequest + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj PlaylistCreateRequest + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj PlaylistCreateRequest + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingUpdatePlaylistRequest(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &UpdatePlaylistRequest{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled UpdatePlaylistRequest + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj UpdatePlaylistRequest + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj UpdatePlaylistRequest + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestStringPlaylist(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &Playlist{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *Playlist + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringPlaylistCreateRequest(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &PlaylistCreateRequest{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *PlaylistCreateRequest + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringUpdatePlaylistRequest(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &UpdatePlaylistRequest{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *UpdatePlaylistRequest + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestEnumReservedKeywordEnum(t *testing.T) { + t.Run("NewFromString_is", func(t *testing.T) { + t.Parallel() + val, err := NewReservedKeywordEnumFromString("is") + assert.NoError(t, err, "valid enum value should not return error") + assert.Equal(t, ReservedKeywordEnum("is"), val, "enum value should match expected wire value") + }) + + t.Run("NewFromString_as", func(t *testing.T) { + t.Parallel() + val, err := NewReservedKeywordEnumFromString("as") + assert.NoError(t, err, "valid enum value should not return error") + assert.Equal(t, ReservedKeywordEnum("as"), val, "enum value should match expected wire value") + }) + + t.Run("NewFromString_Invalid", func(t *testing.T) { + _, err := NewReservedKeywordEnumFromString("invalid_value_that_does_not_exist") + assert.Error(t, err) + }) + + t.Run("Ptr", func(t *testing.T) { + val, err := NewReservedKeywordEnumFromString("is") + assert.NoError(t, err) + ptr := val.Ptr() + assert.NotNil(t, ptr) + assert.Equal(t, val, *ptr) + }) +} + +func TestExtraPropertiesPlaylist(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &Playlist{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *Playlist + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesPlaylistCreateRequest(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &PlaylistCreateRequest{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *PlaylistCreateRequest + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesUpdatePlaylistRequest(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &UpdatePlaylistRequest{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *UpdatePlaylistRequest + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} diff --git a/seed/go-sdk/trace/pointer.go b/seed/go-sdk/trace/pointer.go new file mode 100644 index 000000000000..84b6e1866135 --- /dev/null +++ b/seed/go-sdk/trace/pointer.go @@ -0,0 +1,137 @@ +package trace + +import ( + "time" + + "github.com/google/uuid" +) + +// Bool returns a pointer to the given bool value. +func Bool(b bool) *bool { + return &b +} + +// Byte returns a pointer to the given byte value. +func Byte(b byte) *byte { + return &b +} + +// Bytes returns a pointer to the given []byte value. +func Bytes(b []byte) *[]byte { + return &b +} + +// Complex64 returns a pointer to the given complex64 value. +func Complex64(c complex64) *complex64 { + return &c +} + +// Complex128 returns a pointer to the given complex128 value. +func Complex128(c complex128) *complex128 { + return &c +} + +// Float32 returns a pointer to the given float32 value. +func Float32(f float32) *float32 { + return &f +} + +// Float64 returns a pointer to the given float64 value. +func Float64(f float64) *float64 { + return &f +} + +// Int returns a pointer to the given int value. +func Int(i int) *int { + return &i +} + +// Int8 returns a pointer to the given int8 value. +func Int8(i int8) *int8 { + return &i +} + +// Int16 returns a pointer to the given int16 value. +func Int16(i int16) *int16 { + return &i +} + +// Int32 returns a pointer to the given int32 value. +func Int32(i int32) *int32 { + return &i +} + +// Int64 returns a pointer to the given int64 value. +func Int64(i int64) *int64 { + return &i +} + +// Rune returns a pointer to the given rune value. +func Rune(r rune) *rune { + return &r +} + +// String returns a pointer to the given string value. +func String(s string) *string { + return &s +} + +// Uint returns a pointer to the given uint value. +func Uint(u uint) *uint { + return &u +} + +// Uint8 returns a pointer to the given uint8 value. +func Uint8(u uint8) *uint8 { + return &u +} + +// Uint16 returns a pointer to the given uint16 value. +func Uint16(u uint16) *uint16 { + return &u +} + +// Uint32 returns a pointer to the given uint32 value. +func Uint32(u uint32) *uint32 { + return &u +} + +// Uint64 returns a pointer to the given uint64 value. +func Uint64(u uint64) *uint64 { + return &u +} + +// Uintptr returns a pointer to the given uintptr value. +func Uintptr(u uintptr) *uintptr { + return &u +} + +// UUID returns a pointer to the given uuid.UUID value. +func UUID(u uuid.UUID) *uuid.UUID { + return &u +} + +// Time returns a pointer to the given time.Time value. +func Time(t time.Time) *time.Time { + return &t +} + +// MustParseDate attempts to parse the given string as a +// date time.Time, and panics upon failure. +func MustParseDate(date string) time.Time { + t, err := time.Parse("2006-01-02", date) + if err != nil { + panic(err) + } + return t +} + +// MustParseDateTime attempts to parse the given string as a +// datetime time.Time, and panics upon failure. +func MustParseDateTime(datetime string) time.Time { + t, err := time.Parse(time.RFC3339, datetime) + if err != nil { + panic(err) + } + return t +} diff --git a/seed/go-sdk/trace/pointer_test.go b/seed/go-sdk/trace/pointer_test.go new file mode 100644 index 000000000000..7e6d1b314541 --- /dev/null +++ b/seed/go-sdk/trace/pointer_test.go @@ -0,0 +1,211 @@ +package trace + +import ( + "testing" + "time" + + "github.com/google/uuid" + "github.com/stretchr/testify/assert" +) + +func TestBool(t *testing.T) { + value := true + ptr := Bool(value) + assert.NotNil(t, ptr) + assert.Equal(t, value, *ptr) +} + +func TestByte(t *testing.T) { + value := byte(42) + ptr := Byte(value) + assert.NotNil(t, ptr) + assert.Equal(t, value, *ptr) +} + +func TestComplex64(t *testing.T) { + value := complex64(1 + 2i) + ptr := Complex64(value) + assert.NotNil(t, ptr) + assert.Equal(t, value, *ptr) +} + +func TestComplex128(t *testing.T) { + value := complex128(1 + 2i) + ptr := Complex128(value) + assert.NotNil(t, ptr) + assert.Equal(t, value, *ptr) +} + +func TestFloat32(t *testing.T) { + value := float32(3.14) + ptr := Float32(value) + assert.NotNil(t, ptr) + assert.Equal(t, value, *ptr) +} + +func TestFloat64(t *testing.T) { + value := 3.14159 + ptr := Float64(value) + assert.NotNil(t, ptr) + assert.Equal(t, value, *ptr) +} + +func TestInt(t *testing.T) { + value := 42 + ptr := Int(value) + assert.NotNil(t, ptr) + assert.Equal(t, value, *ptr) +} + +func TestInt8(t *testing.T) { + value := int8(42) + ptr := Int8(value) + assert.NotNil(t, ptr) + assert.Equal(t, value, *ptr) +} + +func TestInt16(t *testing.T) { + value := int16(42) + ptr := Int16(value) + assert.NotNil(t, ptr) + assert.Equal(t, value, *ptr) +} + +func TestInt32(t *testing.T) { + value := int32(42) + ptr := Int32(value) + assert.NotNil(t, ptr) + assert.Equal(t, value, *ptr) +} + +func TestInt64(t *testing.T) { + value := int64(42) + ptr := Int64(value) + assert.NotNil(t, ptr) + assert.Equal(t, value, *ptr) +} + +func TestRune(t *testing.T) { + value := 'A' + ptr := Rune(value) + assert.NotNil(t, ptr) + assert.Equal(t, value, *ptr) +} + +func TestString(t *testing.T) { + value := "hello" + ptr := String(value) + assert.NotNil(t, ptr) + assert.Equal(t, value, *ptr) +} + +func TestUint(t *testing.T) { + value := uint(42) + ptr := Uint(value) + assert.NotNil(t, ptr) + assert.Equal(t, value, *ptr) +} + +func TestUint8(t *testing.T) { + value := uint8(42) + ptr := Uint8(value) + assert.NotNil(t, ptr) + assert.Equal(t, value, *ptr) +} + +func TestUint16(t *testing.T) { + value := uint16(42) + ptr := Uint16(value) + assert.NotNil(t, ptr) + assert.Equal(t, value, *ptr) +} + +func TestUint32(t *testing.T) { + value := uint32(42) + ptr := Uint32(value) + assert.NotNil(t, ptr) + assert.Equal(t, value, *ptr) +} + +func TestUint64(t *testing.T) { + value := uint64(42) + ptr := Uint64(value) + assert.NotNil(t, ptr) + assert.Equal(t, value, *ptr) +} + +func TestUintptr(t *testing.T) { + value := uintptr(42) + ptr := Uintptr(value) + assert.NotNil(t, ptr) + assert.Equal(t, value, *ptr) +} + +func TestUUID(t *testing.T) { + value := uuid.New() + ptr := UUID(value) + assert.NotNil(t, ptr) + assert.Equal(t, value, *ptr) +} + +func TestTime(t *testing.T) { + value := time.Now() + ptr := Time(value) + assert.NotNil(t, ptr) + assert.Equal(t, value, *ptr) +} + +func TestMustParseDate(t *testing.T) { + t.Run("valid date", func(t *testing.T) { + result := MustParseDate("2024-01-15") + expected, _ := time.Parse("2006-01-02", "2024-01-15") + assert.Equal(t, expected, result) + }) + + t.Run("invalid date panics", func(t *testing.T) { + assert.Panics(t, func() { + MustParseDate("invalid-date") + }) + }) +} + +func TestMustParseDateTime(t *testing.T) { + t.Run("valid datetime", func(t *testing.T) { + result := MustParseDateTime("2024-01-15T10:30:00Z") + expected, _ := time.Parse(time.RFC3339, "2024-01-15T10:30:00Z") + assert.Equal(t, expected, result) + }) + + t.Run("invalid datetime panics", func(t *testing.T) { + assert.Panics(t, func() { + MustParseDateTime("invalid-datetime") + }) + }) +} + +func TestPointerHelpersWithZeroValues(t *testing.T) { + t.Run("zero bool", func(t *testing.T) { + ptr := Bool(false) + assert.NotNil(t, ptr) + assert.Equal(t, false, *ptr) + }) + + t.Run("zero int", func(t *testing.T) { + ptr := Int(0) + assert.NotNil(t, ptr) + assert.Equal(t, 0, *ptr) + }) + + t.Run("empty string", func(t *testing.T) { + ptr := String("") + assert.NotNil(t, ptr) + assert.Equal(t, "", *ptr) + }) + + t.Run("zero time", func(t *testing.T) { + zeroTime := time.Time{} + ptr := Time(zeroTime) + assert.NotNil(t, ptr) + assert.Equal(t, zeroTime, *ptr) + }) +} diff --git a/seed/go-sdk/trace/problem.go b/seed/go-sdk/trace/problem.go new file mode 100644 index 000000000000..cad1ced6c6f2 --- /dev/null +++ b/seed/go-sdk/trace/problem.go @@ -0,0 +1,1219 @@ +// Code generated by Fern. DO NOT EDIT. + +package trace + +import ( + json "encoding/json" + fmt "fmt" + common "github.com/trace/fern/common" + internal "github.com/trace/fern/internal" + big "math/big" +) + +var ( + getDefaultStarterFilesRequestFieldInputParams = big.NewInt(1 << 0) + getDefaultStarterFilesRequestFieldOutputType = big.NewInt(1 << 1) + getDefaultStarterFilesRequestFieldMethodName = big.NewInt(1 << 2) +) + +type GetDefaultStarterFilesRequest struct { + InputParams []*VariableTypeAndName `json:"inputParams" url:"-"` + OutputType *common.VariableType `json:"outputType" url:"-"` + // The name of the `method` that the student has to complete. + // The method name cannot include the following characters: + // - Greater Than `>` + // - Less Than `<“ + // - Equals `=` + // - Period `.` + MethodName string `json:"methodName" url:"-"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` +} + +func (g *GetDefaultStarterFilesRequest) require(field *big.Int) { + if g.explicitFields == nil { + g.explicitFields = big.NewInt(0) + } + g.explicitFields.Or(g.explicitFields, field) +} + +// SetInputParams sets the InputParams field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetDefaultStarterFilesRequest) SetInputParams(inputParams []*VariableTypeAndName) { + g.InputParams = inputParams + g.require(getDefaultStarterFilesRequestFieldInputParams) +} + +// SetOutputType sets the OutputType field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetDefaultStarterFilesRequest) SetOutputType(outputType *common.VariableType) { + g.OutputType = outputType + g.require(getDefaultStarterFilesRequestFieldOutputType) +} + +// SetMethodName sets the MethodName field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetDefaultStarterFilesRequest) SetMethodName(methodName string) { + g.MethodName = methodName + g.require(getDefaultStarterFilesRequestFieldMethodName) +} + +func (g *GetDefaultStarterFilesRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetDefaultStarterFilesRequest + var body unmarshaler + if err := json.Unmarshal(data, &body); err != nil { + return err + } + *g = GetDefaultStarterFilesRequest(body) + return nil +} + +func (g *GetDefaultStarterFilesRequest) MarshalJSON() ([]byte, error) { + type embed GetDefaultStarterFilesRequest + var marshaler = struct { + embed + }{ + embed: embed(*g), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, g.explicitFields) + return json.Marshal(explicitMarshaler) +} + +type CreateProblemError struct { + ErrorType string + Generic *GenericCreateProblemError + + rawJSON json.RawMessage +} + +func (c *CreateProblemError) GetErrorType() string { + if c == nil { + return "" + } + return c.ErrorType +} + +func (c *CreateProblemError) GetGeneric() *GenericCreateProblemError { + if c == nil { + return nil + } + return c.Generic +} + +func (c *CreateProblemError) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + ErrorType string `json:"_type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + c.ErrorType = unmarshaler.ErrorType + if unmarshaler.ErrorType == "" { + return fmt.Errorf("%T did not include discriminant _type", c) + } + switch unmarshaler.ErrorType { + case "generic": + value := new(GenericCreateProblemError) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.Generic = value + } + c.rawJSON = json.RawMessage(data) + return nil +} + +func (c CreateProblemError) MarshalJSON() ([]byte, error) { + if err := c.validate(); err != nil { + return nil, err + } + if c.Generic != nil { + return internal.MarshalJSONWithExtraProperty(c.Generic, "_type", "generic") + } + if len(c.rawJSON) > 0 { + return c.rawJSON, nil + } + return nil, fmt.Errorf("type %T does not define a non-empty union type", c) +} + +type CreateProblemErrorVisitor interface { + VisitGeneric(*GenericCreateProblemError) error +} + +func (c *CreateProblemError) Accept(visitor CreateProblemErrorVisitor) error { + if c.Generic != nil { + return visitor.VisitGeneric(c.Generic) + } + return fmt.Errorf("type %T does not define a non-empty union type", c) +} + +func (c *CreateProblemError) validate() error { + if c == nil { + return fmt.Errorf("type %T is nil", c) + } + var fields []string + if c.Generic != nil { + fields = append(fields, "generic") + } + if len(fields) == 0 { + if c.ErrorType != "" { + if len(c.rawJSON) > 0 { + return nil + } + return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", c, c.ErrorType) + } + return fmt.Errorf("type %T is empty", c) + } + if len(fields) > 1 { + return fmt.Errorf("type %T defines values for %s, but only one value is allowed", c, fields) + } + if c.ErrorType != "" { + field := fields[0] + if c.ErrorType != field { + return fmt.Errorf( + "type %T defines a discriminant set to %q, but it does not match the %T field; either remove or update the discriminant to match", + c, + c.ErrorType, + c, + ) + } + } + return nil +} + +var ( + createProblemRequestFieldProblemName = big.NewInt(1 << 0) + createProblemRequestFieldProblemDescription = big.NewInt(1 << 1) + createProblemRequestFieldFiles = big.NewInt(1 << 2) + createProblemRequestFieldInputParams = big.NewInt(1 << 3) + createProblemRequestFieldOutputType = big.NewInt(1 << 4) + createProblemRequestFieldTestcases = big.NewInt(1 << 5) + createProblemRequestFieldMethodName = big.NewInt(1 << 6) +) + +type CreateProblemRequest struct { + ProblemName string `json:"problemName" url:"problemName"` + ProblemDescription *common.ProblemDescription `json:"problemDescription" url:"problemDescription"` + Files map[common.Language]*ProblemFiles `json:"files" url:"files"` + InputParams []*VariableTypeAndName `json:"inputParams" url:"inputParams"` + OutputType *common.VariableType `json:"outputType" url:"outputType"` + Testcases []*TestCaseWithExpectedResult `json:"testcases" url:"testcases"` + MethodName string `json:"methodName" url:"methodName"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (c *CreateProblemRequest) GetProblemName() string { + if c == nil { + return "" + } + return c.ProblemName +} + +func (c *CreateProblemRequest) GetProblemDescription() *common.ProblemDescription { + if c == nil { + return nil + } + return c.ProblemDescription +} + +func (c *CreateProblemRequest) GetFiles() map[common.Language]*ProblemFiles { + if c == nil { + return nil + } + return c.Files +} + +func (c *CreateProblemRequest) GetInputParams() []*VariableTypeAndName { + if c == nil { + return nil + } + return c.InputParams +} + +func (c *CreateProblemRequest) GetOutputType() *common.VariableType { + if c == nil { + return nil + } + return c.OutputType +} + +func (c *CreateProblemRequest) GetTestcases() []*TestCaseWithExpectedResult { + if c == nil { + return nil + } + return c.Testcases +} + +func (c *CreateProblemRequest) GetMethodName() string { + if c == nil { + return "" + } + return c.MethodName +} + +func (c *CreateProblemRequest) GetExtraProperties() map[string]interface{} { + if c == nil { + return nil + } + return c.extraProperties +} + +func (c *CreateProblemRequest) require(field *big.Int) { + if c.explicitFields == nil { + c.explicitFields = big.NewInt(0) + } + c.explicitFields.Or(c.explicitFields, field) +} + +// SetProblemName sets the ProblemName field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CreateProblemRequest) SetProblemName(problemName string) { + c.ProblemName = problemName + c.require(createProblemRequestFieldProblemName) +} + +// SetProblemDescription sets the ProblemDescription field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CreateProblemRequest) SetProblemDescription(problemDescription *common.ProblemDescription) { + c.ProblemDescription = problemDescription + c.require(createProblemRequestFieldProblemDescription) +} + +// SetFiles sets the Files field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CreateProblemRequest) SetFiles(files map[common.Language]*ProblemFiles) { + c.Files = files + c.require(createProblemRequestFieldFiles) +} + +// SetInputParams sets the InputParams field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CreateProblemRequest) SetInputParams(inputParams []*VariableTypeAndName) { + c.InputParams = inputParams + c.require(createProblemRequestFieldInputParams) +} + +// SetOutputType sets the OutputType field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CreateProblemRequest) SetOutputType(outputType *common.VariableType) { + c.OutputType = outputType + c.require(createProblemRequestFieldOutputType) +} + +// SetTestcases sets the Testcases field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CreateProblemRequest) SetTestcases(testcases []*TestCaseWithExpectedResult) { + c.Testcases = testcases + c.require(createProblemRequestFieldTestcases) +} + +// SetMethodName sets the MethodName field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CreateProblemRequest) SetMethodName(methodName string) { + c.MethodName = methodName + c.require(createProblemRequestFieldMethodName) +} + +func (c *CreateProblemRequest) UnmarshalJSON(data []byte) error { + type unmarshaler CreateProblemRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CreateProblemRequest(value) + extraProperties, err := internal.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + c.rawJSON = json.RawMessage(data) + return nil +} + +func (c *CreateProblemRequest) MarshalJSON() ([]byte, error) { + type embed CreateProblemRequest + var marshaler = struct { + embed + }{ + embed: embed(*c), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, c.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (c *CreateProblemRequest) String() string { + if c == nil { + return "" + } + if len(c.rawJSON) > 0 { + if value, err := internal.StringifyJSON(c.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +type CreateProblemResponse struct { + Type string + Success common.ProblemID + Error *CreateProblemError + + rawJSON json.RawMessage +} + +func (c *CreateProblemResponse) GetType() string { + if c == nil { + return "" + } + return c.Type +} + +func (c *CreateProblemResponse) GetSuccess() common.ProblemID { + if c == nil { + return "" + } + return c.Success +} + +func (c *CreateProblemResponse) GetError() *CreateProblemError { + if c == nil { + return nil + } + return c.Error +} + +func (c *CreateProblemResponse) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + c.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", c) + } + switch unmarshaler.Type { + case "success": + var valueUnmarshaler struct { + Success common.ProblemID `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + c.Success = valueUnmarshaler.Success + case "error": + var valueUnmarshaler struct { + Error *CreateProblemError `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + c.Error = valueUnmarshaler.Error + } + c.rawJSON = json.RawMessage(data) + return nil +} + +func (c CreateProblemResponse) MarshalJSON() ([]byte, error) { + if err := c.validate(); err != nil { + return nil, err + } + if c.Success != "" { + var marshaler = struct { + Type string `json:"type"` + Success common.ProblemID `json:"value"` + }{ + Type: "success", + Success: c.Success, + } + return json.Marshal(marshaler) + } + if c.Error != nil { + var marshaler = struct { + Type string `json:"type"` + Error *CreateProblemError `json:"value"` + }{ + Type: "error", + Error: c.Error, + } + return json.Marshal(marshaler) + } + if len(c.rawJSON) > 0 { + return c.rawJSON, nil + } + return nil, fmt.Errorf("type %T does not define a non-empty union type", c) +} + +type CreateProblemResponseVisitor interface { + VisitSuccess(common.ProblemID) error + VisitError(*CreateProblemError) error +} + +func (c *CreateProblemResponse) Accept(visitor CreateProblemResponseVisitor) error { + if c.Success != "" { + return visitor.VisitSuccess(c.Success) + } + if c.Error != nil { + return visitor.VisitError(c.Error) + } + return fmt.Errorf("type %T does not define a non-empty union type", c) +} + +func (c *CreateProblemResponse) validate() error { + if c == nil { + return fmt.Errorf("type %T is nil", c) + } + var fields []string + if c.Success != "" { + fields = append(fields, "success") + } + if c.Error != nil { + fields = append(fields, "error") + } + if len(fields) == 0 { + if c.Type != "" { + if len(c.rawJSON) > 0 { + return nil + } + return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", c, c.Type) + } + return fmt.Errorf("type %T is empty", c) + } + if len(fields) > 1 { + return fmt.Errorf("type %T defines values for %s, but only one value is allowed", c, fields) + } + if c.Type != "" { + field := fields[0] + if c.Type != field { + return fmt.Errorf( + "type %T defines a discriminant set to %q, but it does not match the %T field; either remove or update the discriminant to match", + c, + c.Type, + c, + ) + } + } + return nil +} + +var ( + genericCreateProblemErrorFieldMessage = big.NewInt(1 << 0) + genericCreateProblemErrorFieldType = big.NewInt(1 << 1) + genericCreateProblemErrorFieldStacktrace = big.NewInt(1 << 2) +) + +type GenericCreateProblemError struct { + Message string `json:"message" url:"message"` + Type string `json:"type" url:"type"` + Stacktrace string `json:"stacktrace" url:"stacktrace"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (g *GenericCreateProblemError) GetMessage() string { + if g == nil { + return "" + } + return g.Message +} + +func (g *GenericCreateProblemError) GetType() string { + if g == nil { + return "" + } + return g.Type +} + +func (g *GenericCreateProblemError) GetStacktrace() string { + if g == nil { + return "" + } + return g.Stacktrace +} + +func (g *GenericCreateProblemError) GetExtraProperties() map[string]interface{} { + if g == nil { + return nil + } + return g.extraProperties +} + +func (g *GenericCreateProblemError) require(field *big.Int) { + if g.explicitFields == nil { + g.explicitFields = big.NewInt(0) + } + g.explicitFields.Or(g.explicitFields, field) +} + +// SetMessage sets the Message field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GenericCreateProblemError) SetMessage(message string) { + g.Message = message + g.require(genericCreateProblemErrorFieldMessage) +} + +// SetType sets the Type field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GenericCreateProblemError) SetType(type_ string) { + g.Type = type_ + g.require(genericCreateProblemErrorFieldType) +} + +// SetStacktrace sets the Stacktrace field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GenericCreateProblemError) SetStacktrace(stacktrace string) { + g.Stacktrace = stacktrace + g.require(genericCreateProblemErrorFieldStacktrace) +} + +func (g *GenericCreateProblemError) UnmarshalJSON(data []byte) error { + type unmarshaler GenericCreateProblemError + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GenericCreateProblemError(value) + extraProperties, err := internal.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + g.rawJSON = json.RawMessage(data) + return nil +} + +func (g *GenericCreateProblemError) MarshalJSON() ([]byte, error) { + type embed GenericCreateProblemError + var marshaler = struct { + embed + }{ + embed: embed(*g), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, g.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (g *GenericCreateProblemError) String() string { + if g == nil { + return "" + } + if len(g.rawJSON) > 0 { + if value, err := internal.StringifyJSON(g.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +var ( + getDefaultStarterFilesResponseFieldFiles = big.NewInt(1 << 0) +) + +type GetDefaultStarterFilesResponse struct { + Files map[common.Language]*ProblemFiles `json:"files" url:"files"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (g *GetDefaultStarterFilesResponse) GetFiles() map[common.Language]*ProblemFiles { + if g == nil { + return nil + } + return g.Files +} + +func (g *GetDefaultStarterFilesResponse) GetExtraProperties() map[string]interface{} { + if g == nil { + return nil + } + return g.extraProperties +} + +func (g *GetDefaultStarterFilesResponse) require(field *big.Int) { + if g.explicitFields == nil { + g.explicitFields = big.NewInt(0) + } + g.explicitFields.Or(g.explicitFields, field) +} + +// SetFiles sets the Files field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetDefaultStarterFilesResponse) SetFiles(files map[common.Language]*ProblemFiles) { + g.Files = files + g.require(getDefaultStarterFilesResponseFieldFiles) +} + +func (g *GetDefaultStarterFilesResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetDefaultStarterFilesResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetDefaultStarterFilesResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + g.rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetDefaultStarterFilesResponse) MarshalJSON() ([]byte, error) { + type embed GetDefaultStarterFilesResponse + var marshaler = struct { + embed + }{ + embed: embed(*g), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, g.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (g *GetDefaultStarterFilesResponse) String() string { + if g == nil { + return "" + } + if len(g.rawJSON) > 0 { + if value, err := internal.StringifyJSON(g.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +var ( + problemFilesFieldSolutionFile = big.NewInt(1 << 0) + problemFilesFieldReadOnlyFiles = big.NewInt(1 << 1) +) + +type ProblemFiles struct { + SolutionFile *FileInfo `json:"solutionFile" url:"solutionFile"` + ReadOnlyFiles []*FileInfo `json:"readOnlyFiles" url:"readOnlyFiles"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (p *ProblemFiles) GetSolutionFile() *FileInfo { + if p == nil { + return nil + } + return p.SolutionFile +} + +func (p *ProblemFiles) GetReadOnlyFiles() []*FileInfo { + if p == nil { + return nil + } + return p.ReadOnlyFiles +} + +func (p *ProblemFiles) GetExtraProperties() map[string]interface{} { + if p == nil { + return nil + } + return p.extraProperties +} + +func (p *ProblemFiles) require(field *big.Int) { + if p.explicitFields == nil { + p.explicitFields = big.NewInt(0) + } + p.explicitFields.Or(p.explicitFields, field) +} + +// SetSolutionFile sets the SolutionFile field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ProblemFiles) SetSolutionFile(solutionFile *FileInfo) { + p.SolutionFile = solutionFile + p.require(problemFilesFieldSolutionFile) +} + +// SetReadOnlyFiles sets the ReadOnlyFiles field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ProblemFiles) SetReadOnlyFiles(readOnlyFiles []*FileInfo) { + p.ReadOnlyFiles = readOnlyFiles + p.require(problemFilesFieldReadOnlyFiles) +} + +func (p *ProblemFiles) UnmarshalJSON(data []byte) error { + type unmarshaler ProblemFiles + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *p = ProblemFiles(value) + extraProperties, err := internal.ExtractExtraProperties(data, *p) + if err != nil { + return err + } + p.extraProperties = extraProperties + p.rawJSON = json.RawMessage(data) + return nil +} + +func (p *ProblemFiles) MarshalJSON() ([]byte, error) { + type embed ProblemFiles + var marshaler = struct { + embed + }{ + embed: embed(*p), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, p.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (p *ProblemFiles) String() string { + if p == nil { + return "" + } + if len(p.rawJSON) > 0 { + if value, err := internal.StringifyJSON(p.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(p); err == nil { + return value + } + return fmt.Sprintf("%#v", p) +} + +var ( + problemInfoFieldProblemID = big.NewInt(1 << 0) + problemInfoFieldProblemDescription = big.NewInt(1 << 1) + problemInfoFieldProblemName = big.NewInt(1 << 2) + problemInfoFieldProblemVersion = big.NewInt(1 << 3) + problemInfoFieldFiles = big.NewInt(1 << 4) + problemInfoFieldInputParams = big.NewInt(1 << 5) + problemInfoFieldOutputType = big.NewInt(1 << 6) + problemInfoFieldTestcases = big.NewInt(1 << 7) + problemInfoFieldMethodName = big.NewInt(1 << 8) + problemInfoFieldSupportsCustomTestCases = big.NewInt(1 << 9) +) + +type ProblemInfo struct { + ProblemID common.ProblemID `json:"problemId" url:"problemId"` + ProblemDescription *common.ProblemDescription `json:"problemDescription" url:"problemDescription"` + ProblemName string `json:"problemName" url:"problemName"` + ProblemVersion int `json:"problemVersion" url:"problemVersion"` + Files map[common.Language]*ProblemFiles `json:"files" url:"files"` + InputParams []*VariableTypeAndName `json:"inputParams" url:"inputParams"` + OutputType *common.VariableType `json:"outputType" url:"outputType"` + Testcases []*TestCaseWithExpectedResult `json:"testcases" url:"testcases"` + MethodName string `json:"methodName" url:"methodName"` + SupportsCustomTestCases bool `json:"supportsCustomTestCases" url:"supportsCustomTestCases"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (p *ProblemInfo) GetProblemID() common.ProblemID { + if p == nil { + return "" + } + return p.ProblemID +} + +func (p *ProblemInfo) GetProblemDescription() *common.ProblemDescription { + if p == nil { + return nil + } + return p.ProblemDescription +} + +func (p *ProblemInfo) GetProblemName() string { + if p == nil { + return "" + } + return p.ProblemName +} + +func (p *ProblemInfo) GetProblemVersion() int { + if p == nil { + return 0 + } + return p.ProblemVersion +} + +func (p *ProblemInfo) GetFiles() map[common.Language]*ProblemFiles { + if p == nil { + return nil + } + return p.Files +} + +func (p *ProblemInfo) GetInputParams() []*VariableTypeAndName { + if p == nil { + return nil + } + return p.InputParams +} + +func (p *ProblemInfo) GetOutputType() *common.VariableType { + if p == nil { + return nil + } + return p.OutputType +} + +func (p *ProblemInfo) GetTestcases() []*TestCaseWithExpectedResult { + if p == nil { + return nil + } + return p.Testcases +} + +func (p *ProblemInfo) GetMethodName() string { + if p == nil { + return "" + } + return p.MethodName +} + +func (p *ProblemInfo) GetSupportsCustomTestCases() bool { + if p == nil { + return false + } + return p.SupportsCustomTestCases +} + +func (p *ProblemInfo) GetExtraProperties() map[string]interface{} { + if p == nil { + return nil + } + return p.extraProperties +} + +func (p *ProblemInfo) require(field *big.Int) { + if p.explicitFields == nil { + p.explicitFields = big.NewInt(0) + } + p.explicitFields.Or(p.explicitFields, field) +} + +// SetProblemID sets the ProblemID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ProblemInfo) SetProblemID(problemID common.ProblemID) { + p.ProblemID = problemID + p.require(problemInfoFieldProblemID) +} + +// SetProblemDescription sets the ProblemDescription field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ProblemInfo) SetProblemDescription(problemDescription *common.ProblemDescription) { + p.ProblemDescription = problemDescription + p.require(problemInfoFieldProblemDescription) +} + +// SetProblemName sets the ProblemName field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ProblemInfo) SetProblemName(problemName string) { + p.ProblemName = problemName + p.require(problemInfoFieldProblemName) +} + +// SetProblemVersion sets the ProblemVersion field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ProblemInfo) SetProblemVersion(problemVersion int) { + p.ProblemVersion = problemVersion + p.require(problemInfoFieldProblemVersion) +} + +// SetFiles sets the Files field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ProblemInfo) SetFiles(files map[common.Language]*ProblemFiles) { + p.Files = files + p.require(problemInfoFieldFiles) +} + +// SetInputParams sets the InputParams field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ProblemInfo) SetInputParams(inputParams []*VariableTypeAndName) { + p.InputParams = inputParams + p.require(problemInfoFieldInputParams) +} + +// SetOutputType sets the OutputType field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ProblemInfo) SetOutputType(outputType *common.VariableType) { + p.OutputType = outputType + p.require(problemInfoFieldOutputType) +} + +// SetTestcases sets the Testcases field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ProblemInfo) SetTestcases(testcases []*TestCaseWithExpectedResult) { + p.Testcases = testcases + p.require(problemInfoFieldTestcases) +} + +// SetMethodName sets the MethodName field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ProblemInfo) SetMethodName(methodName string) { + p.MethodName = methodName + p.require(problemInfoFieldMethodName) +} + +// SetSupportsCustomTestCases sets the SupportsCustomTestCases field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ProblemInfo) SetSupportsCustomTestCases(supportsCustomTestCases bool) { + p.SupportsCustomTestCases = supportsCustomTestCases + p.require(problemInfoFieldSupportsCustomTestCases) +} + +func (p *ProblemInfo) UnmarshalJSON(data []byte) error { + type unmarshaler ProblemInfo + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *p = ProblemInfo(value) + extraProperties, err := internal.ExtractExtraProperties(data, *p) + if err != nil { + return err + } + p.extraProperties = extraProperties + p.rawJSON = json.RawMessage(data) + return nil +} + +func (p *ProblemInfo) MarshalJSON() ([]byte, error) { + type embed ProblemInfo + var marshaler = struct { + embed + }{ + embed: embed(*p), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, p.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (p *ProblemInfo) String() string { + if p == nil { + return "" + } + if len(p.rawJSON) > 0 { + if value, err := internal.StringifyJSON(p.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(p); err == nil { + return value + } + return fmt.Sprintf("%#v", p) +} + +var ( + updateProblemResponseFieldProblemVersion = big.NewInt(1 << 0) +) + +type UpdateProblemResponse struct { + ProblemVersion int `json:"problemVersion" url:"problemVersion"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (u *UpdateProblemResponse) GetProblemVersion() int { + if u == nil { + return 0 + } + return u.ProblemVersion +} + +func (u *UpdateProblemResponse) GetExtraProperties() map[string]interface{} { + if u == nil { + return nil + } + return u.extraProperties +} + +func (u *UpdateProblemResponse) require(field *big.Int) { + if u.explicitFields == nil { + u.explicitFields = big.NewInt(0) + } + u.explicitFields.Or(u.explicitFields, field) +} + +// SetProblemVersion sets the ProblemVersion field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (u *UpdateProblemResponse) SetProblemVersion(problemVersion int) { + u.ProblemVersion = problemVersion + u.require(updateProblemResponseFieldProblemVersion) +} + +func (u *UpdateProblemResponse) UnmarshalJSON(data []byte) error { + type unmarshaler UpdateProblemResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *u = UpdateProblemResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *u) + if err != nil { + return err + } + u.extraProperties = extraProperties + u.rawJSON = json.RawMessage(data) + return nil +} + +func (u *UpdateProblemResponse) MarshalJSON() ([]byte, error) { + type embed UpdateProblemResponse + var marshaler = struct { + embed + }{ + embed: embed(*u), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, u.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (u *UpdateProblemResponse) String() string { + if u == nil { + return "" + } + if len(u.rawJSON) > 0 { + if value, err := internal.StringifyJSON(u.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(u); err == nil { + return value + } + return fmt.Sprintf("%#v", u) +} + +var ( + variableTypeAndNameFieldVariableType = big.NewInt(1 << 0) + variableTypeAndNameFieldName = big.NewInt(1 << 1) +) + +type VariableTypeAndName struct { + VariableType *common.VariableType `json:"variableType" url:"variableType"` + Name string `json:"name" url:"name"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (v *VariableTypeAndName) GetVariableType() *common.VariableType { + if v == nil { + return nil + } + return v.VariableType +} + +func (v *VariableTypeAndName) GetName() string { + if v == nil { + return "" + } + return v.Name +} + +func (v *VariableTypeAndName) GetExtraProperties() map[string]interface{} { + if v == nil { + return nil + } + return v.extraProperties +} + +func (v *VariableTypeAndName) require(field *big.Int) { + if v.explicitFields == nil { + v.explicitFields = big.NewInt(0) + } + v.explicitFields.Or(v.explicitFields, field) +} + +// SetVariableType sets the VariableType field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (v *VariableTypeAndName) SetVariableType(variableType *common.VariableType) { + v.VariableType = variableType + v.require(variableTypeAndNameFieldVariableType) +} + +// SetName sets the Name field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (v *VariableTypeAndName) SetName(name string) { + v.Name = name + v.require(variableTypeAndNameFieldName) +} + +func (v *VariableTypeAndName) UnmarshalJSON(data []byte) error { + type unmarshaler VariableTypeAndName + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *v = VariableTypeAndName(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err + } + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil +} + +func (v *VariableTypeAndName) MarshalJSON() ([]byte, error) { + type embed VariableTypeAndName + var marshaler = struct { + embed + }{ + embed: embed(*v), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, v.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (v *VariableTypeAndName) String() string { + if v == nil { + return "" + } + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(v); err == nil { + return value + } + return fmt.Sprintf("%#v", v) +} diff --git a/seed/go-sdk/trace/problem/client.go b/seed/go-sdk/trace/problem/client.go new file mode 100644 index 000000000000..e631d5b899d2 --- /dev/null +++ b/seed/go-sdk/trace/problem/client.go @@ -0,0 +1,106 @@ +// Code generated by Fern. DO NOT EDIT. + +package problem + +import ( + context "context" + + fern "github.com/trace/fern" + common "github.com/trace/fern/common" + core "github.com/trace/fern/core" + internal "github.com/trace/fern/internal" + option "github.com/trace/fern/option" +) + +type Client struct { + WithRawResponse *RawClient + + options *core.RequestOptions + baseURL string + caller *internal.Caller +} + +func NewClient(options *core.RequestOptions) *Client { + return &Client{ + WithRawResponse: NewRawClient(options), + options: options, + baseURL: options.BaseURL, + caller: internal.NewCaller( + &internal.CallerParams{ + Client: options.HTTPClient, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + }, + ), + } +} + +// Creates a problem +func (c *Client) CreateProblem( + ctx context.Context, + request *fern.CreateProblemRequest, + opts ...option.RequestOption, +) (*fern.CreateProblemResponse, error) { + response, err := c.WithRawResponse.CreateProblem( + ctx, + request, + opts..., + ) + if err != nil { + return nil, err + } + return response.Body, nil +} + +// Updates a problem +func (c *Client) UpdateProblem( + ctx context.Context, + problemID common.ProblemID, + request *fern.CreateProblemRequest, + opts ...option.RequestOption, +) (*fern.UpdateProblemResponse, error) { + response, err := c.WithRawResponse.UpdateProblem( + ctx, + problemID, + request, + opts..., + ) + if err != nil { + return nil, err + } + return response.Body, nil +} + +// Soft deletes a problem +func (c *Client) DeleteProblem( + ctx context.Context, + problemID common.ProblemID, + opts ...option.RequestOption, +) error { + _, err := c.WithRawResponse.DeleteProblem( + ctx, + problemID, + opts..., + ) + if err != nil { + return err + } + return nil +} + +// Returns default starter files for problem +func (c *Client) GetDefaultStarterFiles( + ctx context.Context, + request *fern.GetDefaultStarterFilesRequest, + opts ...option.RequestOption, +) (*fern.GetDefaultStarterFilesResponse, error) { + response, err := c.WithRawResponse.GetDefaultStarterFiles( + ctx, + request, + opts..., + ) + if err != nil { + return nil, err + } + return response.Body, nil +} diff --git a/seed/go-sdk/trace/problem/raw_client.go b/seed/go-sdk/trace/problem/raw_client.go new file mode 100644 index 000000000000..2df999e5cc52 --- /dev/null +++ b/seed/go-sdk/trace/problem/raw_client.go @@ -0,0 +1,206 @@ +// Code generated by Fern. DO NOT EDIT. + +package problem + +import ( + context "context" + http "net/http" + + fern "github.com/trace/fern" + common "github.com/trace/fern/common" + core "github.com/trace/fern/core" + internal "github.com/trace/fern/internal" + option "github.com/trace/fern/option" +) + +type RawClient struct { + baseURL string + caller *internal.Caller + options *core.RequestOptions +} + +func NewRawClient(options *core.RequestOptions) *RawClient { + return &RawClient{ + options: options, + baseURL: options.BaseURL, + caller: internal.NewCaller( + &internal.CallerParams{ + Client: options.HTTPClient, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + }, + ), + } +} + +func (r *RawClient) CreateProblem( + ctx context.Context, + request *fern.CreateProblemRequest, + opts ...option.RequestOption, +) (*core.Response[*fern.CreateProblemResponse], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.trace.come", + ) + endpointURL := baseURL + "/problem-crud/create" + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + var response *fern.CreateProblemResponse + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: headers, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + Request: request, + Response: &response, + }, + ) + if err != nil { + return nil, err + } + return &core.Response[*fern.CreateProblemResponse]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: response, + }, nil +} + +func (r *RawClient) UpdateProblem( + ctx context.Context, + problemID common.ProblemID, + request *fern.CreateProblemRequest, + opts ...option.RequestOption, +) (*core.Response[*fern.UpdateProblemResponse], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.trace.come", + ) + endpointURL := internal.EncodeURL( + baseURL+"/problem-crud/update/%v", + problemID, + ) + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + var response *fern.UpdateProblemResponse + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: headers, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + Request: request, + Response: &response, + }, + ) + if err != nil { + return nil, err + } + return &core.Response[*fern.UpdateProblemResponse]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: response, + }, nil +} + +func (r *RawClient) DeleteProblem( + ctx context.Context, + problemID common.ProblemID, + opts ...option.RequestOption, +) (*core.Response[any], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.trace.come", + ) + endpointURL := internal.EncodeURL( + baseURL+"/problem-crud/delete/%v", + problemID, + ) + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodDelete, + Headers: headers, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + }, + ) + if err != nil { + return nil, err + } + return &core.Response[any]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: nil, + }, nil +} + +func (r *RawClient) GetDefaultStarterFiles( + ctx context.Context, + request *fern.GetDefaultStarterFilesRequest, + opts ...option.RequestOption, +) (*core.Response[*fern.GetDefaultStarterFilesResponse], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.trace.come", + ) + endpointURL := baseURL + "/problem-crud/default-starter-files" + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + var response *fern.GetDefaultStarterFilesResponse + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: headers, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + Request: request, + Response: &response, + }, + ) + if err != nil { + return nil, err + } + return &core.Response[*fern.GetDefaultStarterFilesResponse]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: response, + }, nil +} diff --git a/seed/go-sdk/trace/problem_test.go b/seed/go-sdk/trace/problem_test.go new file mode 100644 index 000000000000..b19ed9046cd4 --- /dev/null +++ b/seed/go-sdk/trace/problem_test.go @@ -0,0 +1,2594 @@ +// Code generated by Fern. DO NOT EDIT. + +package trace + +import ( + json "encoding/json" + assert "github.com/stretchr/testify/assert" + require "github.com/stretchr/testify/require" + common "github.com/trace/fern/common" + testing "testing" +) + +func TestSettersGetDefaultStarterFilesRequest(t *testing.T) { + t.Run("SetInputParams", func(t *testing.T) { + obj := &GetDefaultStarterFilesRequest{} + var fernTestValueInputParams []*VariableTypeAndName + obj.SetInputParams(fernTestValueInputParams) + assert.Equal(t, fernTestValueInputParams, obj.InputParams) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetOutputType", func(t *testing.T) { + obj := &GetDefaultStarterFilesRequest{} + var fernTestValueOutputType *common.VariableType + obj.SetOutputType(fernTestValueOutputType) + assert.Equal(t, fernTestValueOutputType, obj.OutputType) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetMethodName", func(t *testing.T) { + obj := &GetDefaultStarterFilesRequest{} + var fernTestValueMethodName string + obj.SetMethodName(fernTestValueMethodName) + assert.Equal(t, fernTestValueMethodName, obj.MethodName) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestSettersMarkExplicitGetDefaultStarterFilesRequest(t *testing.T) { + t.Run("SetInputParams_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetDefaultStarterFilesRequest{} + var fernTestValueInputParams []*VariableTypeAndName + + // Act + obj.SetInputParams(fernTestValueInputParams) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetOutputType_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetDefaultStarterFilesRequest{} + var fernTestValueOutputType *common.VariableType + + // Act + obj.SetOutputType(fernTestValueOutputType) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetMethodName_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetDefaultStarterFilesRequest{} + var fernTestValueMethodName string + + // Act + obj.SetMethodName(fernTestValueMethodName) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestGettersCreateProblemError(t *testing.T) { + t.Run("GetErrorType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemError{} + var expected string + obj.ErrorType = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetErrorType(), "getter should return the property value") + }) + + t.Run("GetErrorType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CreateProblemError + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetErrorType() // Should return zero value + }) + + t.Run("GetGeneric", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemError{} + var expected *GenericCreateProblemError + obj.Generic = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetGeneric(), "getter should return the property value") + }) + + t.Run("GetGeneric_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemError{} + obj.Generic = nil + + // Act & Assert + assert.Nil(t, obj.GetGeneric(), "getter should return nil when property is nil") + }) + + t.Run("GetGeneric_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CreateProblemError + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetGeneric() // Should return zero value + }) + +} + +func TestSettersCreateProblemRequest(t *testing.T) { + t.Run("SetProblemName", func(t *testing.T) { + obj := &CreateProblemRequest{} + var fernTestValueProblemName string + obj.SetProblemName(fernTestValueProblemName) + assert.Equal(t, fernTestValueProblemName, obj.ProblemName) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetProblemDescription", func(t *testing.T) { + obj := &CreateProblemRequest{} + var fernTestValueProblemDescription *common.ProblemDescription + obj.SetProblemDescription(fernTestValueProblemDescription) + assert.Equal(t, fernTestValueProblemDescription, obj.ProblemDescription) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetFiles", func(t *testing.T) { + obj := &CreateProblemRequest{} + var fernTestValueFiles map[common.Language]*ProblemFiles + obj.SetFiles(fernTestValueFiles) + assert.Equal(t, fernTestValueFiles, obj.Files) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetInputParams", func(t *testing.T) { + obj := &CreateProblemRequest{} + var fernTestValueInputParams []*VariableTypeAndName + obj.SetInputParams(fernTestValueInputParams) + assert.Equal(t, fernTestValueInputParams, obj.InputParams) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetOutputType", func(t *testing.T) { + obj := &CreateProblemRequest{} + var fernTestValueOutputType *common.VariableType + obj.SetOutputType(fernTestValueOutputType) + assert.Equal(t, fernTestValueOutputType, obj.OutputType) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetTestcases", func(t *testing.T) { + obj := &CreateProblemRequest{} + var fernTestValueTestcases []*TestCaseWithExpectedResult + obj.SetTestcases(fernTestValueTestcases) + assert.Equal(t, fernTestValueTestcases, obj.Testcases) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetMethodName", func(t *testing.T) { + obj := &CreateProblemRequest{} + var fernTestValueMethodName string + obj.SetMethodName(fernTestValueMethodName) + assert.Equal(t, fernTestValueMethodName, obj.MethodName) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersCreateProblemRequest(t *testing.T) { + t.Run("GetProblemName", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequest{} + var expected string + obj.ProblemName = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetProblemName(), "getter should return the property value") + }) + + t.Run("GetProblemName_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CreateProblemRequest + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetProblemName() // Should return zero value + }) + + t.Run("GetProblemDescription", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequest{} + var expected *common.ProblemDescription + obj.ProblemDescription = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetProblemDescription(), "getter should return the property value") + }) + + t.Run("GetProblemDescription_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequest{} + obj.ProblemDescription = nil + + // Act & Assert + assert.Nil(t, obj.GetProblemDescription(), "getter should return nil when property is nil") + }) + + t.Run("GetProblemDescription_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CreateProblemRequest + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetProblemDescription() // Should return zero value + }) + + t.Run("GetFiles", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequest{} + var expected map[common.Language]*ProblemFiles + obj.Files = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetFiles(), "getter should return the property value") + }) + + t.Run("GetFiles_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequest{} + obj.Files = nil + + // Act & Assert + assert.Nil(t, obj.GetFiles(), "getter should return nil when property is nil") + }) + + t.Run("GetFiles_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CreateProblemRequest + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetFiles() // Should return zero value + }) + + t.Run("GetInputParams", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequest{} + var expected []*VariableTypeAndName + obj.InputParams = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetInputParams(), "getter should return the property value") + }) + + t.Run("GetInputParams_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequest{} + obj.InputParams = nil + + // Act & Assert + assert.Nil(t, obj.GetInputParams(), "getter should return nil when property is nil") + }) + + t.Run("GetInputParams_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CreateProblemRequest + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetInputParams() // Should return zero value + }) + + t.Run("GetOutputType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequest{} + var expected *common.VariableType + obj.OutputType = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetOutputType(), "getter should return the property value") + }) + + t.Run("GetOutputType_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequest{} + obj.OutputType = nil + + // Act & Assert + assert.Nil(t, obj.GetOutputType(), "getter should return nil when property is nil") + }) + + t.Run("GetOutputType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CreateProblemRequest + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetOutputType() // Should return zero value + }) + + t.Run("GetTestcases", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequest{} + var expected []*TestCaseWithExpectedResult + obj.Testcases = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTestcases(), "getter should return the property value") + }) + + t.Run("GetTestcases_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequest{} + obj.Testcases = nil + + // Act & Assert + assert.Nil(t, obj.GetTestcases(), "getter should return nil when property is nil") + }) + + t.Run("GetTestcases_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CreateProblemRequest + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTestcases() // Should return zero value + }) + + t.Run("GetMethodName", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequest{} + var expected string + obj.MethodName = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetMethodName(), "getter should return the property value") + }) + + t.Run("GetMethodName_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CreateProblemRequest + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetMethodName() // Should return zero value + }) + +} + +func TestSettersMarkExplicitCreateProblemRequest(t *testing.T) { + t.Run("SetProblemName_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequest{} + var fernTestValueProblemName string + + // Act + obj.SetProblemName(fernTestValueProblemName) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetProblemDescription_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequest{} + var fernTestValueProblemDescription *common.ProblemDescription + + // Act + obj.SetProblemDescription(fernTestValueProblemDescription) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetFiles_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequest{} + var fernTestValueFiles map[common.Language]*ProblemFiles + + // Act + obj.SetFiles(fernTestValueFiles) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetInputParams_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequest{} + var fernTestValueInputParams []*VariableTypeAndName + + // Act + obj.SetInputParams(fernTestValueInputParams) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetOutputType_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequest{} + var fernTestValueOutputType *common.VariableType + + // Act + obj.SetOutputType(fernTestValueOutputType) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetTestcases_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequest{} + var fernTestValueTestcases []*TestCaseWithExpectedResult + + // Act + obj.SetTestcases(fernTestValueTestcases) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetMethodName_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequest{} + var fernTestValueMethodName string + + // Act + obj.SetMethodName(fernTestValueMethodName) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestGettersCreateProblemResponse(t *testing.T) { + t.Run("GetType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemResponse{} + var expected string + obj.Type = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetType(), "getter should return the property value") + }) + + t.Run("GetType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CreateProblemResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetType() // Should return zero value + }) + + t.Run("GetSuccess", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemResponse{} + var expected common.ProblemID + obj.Success = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSuccess(), "getter should return the property value") + }) + + t.Run("GetSuccess_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CreateProblemResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSuccess() // Should return zero value + }) + + t.Run("GetError", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemResponse{} + var expected *CreateProblemError + obj.Error = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetError(), "getter should return the property value") + }) + + t.Run("GetError_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemResponse{} + obj.Error = nil + + // Act & Assert + assert.Nil(t, obj.GetError(), "getter should return nil when property is nil") + }) + + t.Run("GetError_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CreateProblemResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetError() // Should return zero value + }) + +} + +func TestSettersGenericCreateProblemError(t *testing.T) { + t.Run("SetMessage", func(t *testing.T) { + obj := &GenericCreateProblemError{} + var fernTestValueMessage string + obj.SetMessage(fernTestValueMessage) + assert.Equal(t, fernTestValueMessage, obj.Message) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetType", func(t *testing.T) { + obj := &GenericCreateProblemError{} + var fernTestValueType string + obj.SetType(fernTestValueType) + assert.Equal(t, fernTestValueType, obj.Type) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetStacktrace", func(t *testing.T) { + obj := &GenericCreateProblemError{} + var fernTestValueStacktrace string + obj.SetStacktrace(fernTestValueStacktrace) + assert.Equal(t, fernTestValueStacktrace, obj.Stacktrace) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersGenericCreateProblemError(t *testing.T) { + t.Run("GetMessage", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GenericCreateProblemError{} + var expected string + obj.Message = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetMessage(), "getter should return the property value") + }) + + t.Run("GetMessage_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GenericCreateProblemError + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetMessage() // Should return zero value + }) + + t.Run("GetType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GenericCreateProblemError{} + var expected string + obj.Type = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetType(), "getter should return the property value") + }) + + t.Run("GetType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GenericCreateProblemError + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetType() // Should return zero value + }) + + t.Run("GetStacktrace", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GenericCreateProblemError{} + var expected string + obj.Stacktrace = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetStacktrace(), "getter should return the property value") + }) + + t.Run("GetStacktrace_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GenericCreateProblemError + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetStacktrace() // Should return zero value + }) + +} + +func TestSettersMarkExplicitGenericCreateProblemError(t *testing.T) { + t.Run("SetMessage_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GenericCreateProblemError{} + var fernTestValueMessage string + + // Act + obj.SetMessage(fernTestValueMessage) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetType_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GenericCreateProblemError{} + var fernTestValueType string + + // Act + obj.SetType(fernTestValueType) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetStacktrace_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GenericCreateProblemError{} + var fernTestValueStacktrace string + + // Act + obj.SetStacktrace(fernTestValueStacktrace) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersGetDefaultStarterFilesResponse(t *testing.T) { + t.Run("SetFiles", func(t *testing.T) { + obj := &GetDefaultStarterFilesResponse{} + var fernTestValueFiles map[common.Language]*ProblemFiles + obj.SetFiles(fernTestValueFiles) + assert.Equal(t, fernTestValueFiles, obj.Files) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersGetDefaultStarterFilesResponse(t *testing.T) { + t.Run("GetFiles", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetDefaultStarterFilesResponse{} + var expected map[common.Language]*ProblemFiles + obj.Files = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetFiles(), "getter should return the property value") + }) + + t.Run("GetFiles_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetDefaultStarterFilesResponse{} + obj.Files = nil + + // Act & Assert + assert.Nil(t, obj.GetFiles(), "getter should return nil when property is nil") + }) + + t.Run("GetFiles_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetDefaultStarterFilesResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetFiles() // Should return zero value + }) + +} + +func TestSettersMarkExplicitGetDefaultStarterFilesResponse(t *testing.T) { + t.Run("SetFiles_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetDefaultStarterFilesResponse{} + var fernTestValueFiles map[common.Language]*ProblemFiles + + // Act + obj.SetFiles(fernTestValueFiles) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersProblemFiles(t *testing.T) { + t.Run("SetSolutionFile", func(t *testing.T) { + obj := &ProblemFiles{} + var fernTestValueSolutionFile *FileInfo + obj.SetSolutionFile(fernTestValueSolutionFile) + assert.Equal(t, fernTestValueSolutionFile, obj.SolutionFile) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetReadOnlyFiles", func(t *testing.T) { + obj := &ProblemFiles{} + var fernTestValueReadOnlyFiles []*FileInfo + obj.SetReadOnlyFiles(fernTestValueReadOnlyFiles) + assert.Equal(t, fernTestValueReadOnlyFiles, obj.ReadOnlyFiles) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersProblemFiles(t *testing.T) { + t.Run("GetSolutionFile", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemFiles{} + var expected *FileInfo + obj.SolutionFile = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSolutionFile(), "getter should return the property value") + }) + + t.Run("GetSolutionFile_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemFiles{} + obj.SolutionFile = nil + + // Act & Assert + assert.Nil(t, obj.GetSolutionFile(), "getter should return nil when property is nil") + }) + + t.Run("GetSolutionFile_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemFiles + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSolutionFile() // Should return zero value + }) + + t.Run("GetReadOnlyFiles", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemFiles{} + var expected []*FileInfo + obj.ReadOnlyFiles = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetReadOnlyFiles(), "getter should return the property value") + }) + + t.Run("GetReadOnlyFiles_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemFiles{} + obj.ReadOnlyFiles = nil + + // Act & Assert + assert.Nil(t, obj.GetReadOnlyFiles(), "getter should return nil when property is nil") + }) + + t.Run("GetReadOnlyFiles_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemFiles + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetReadOnlyFiles() // Should return zero value + }) + +} + +func TestSettersMarkExplicitProblemFiles(t *testing.T) { + t.Run("SetSolutionFile_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemFiles{} + var fernTestValueSolutionFile *FileInfo + + // Act + obj.SetSolutionFile(fernTestValueSolutionFile) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetReadOnlyFiles_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemFiles{} + var fernTestValueReadOnlyFiles []*FileInfo + + // Act + obj.SetReadOnlyFiles(fernTestValueReadOnlyFiles) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersProblemInfo(t *testing.T) { + t.Run("SetProblemID", func(t *testing.T) { + obj := &ProblemInfo{} + var fernTestValueProblemID common.ProblemID + obj.SetProblemID(fernTestValueProblemID) + assert.Equal(t, fernTestValueProblemID, obj.ProblemID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetProblemDescription", func(t *testing.T) { + obj := &ProblemInfo{} + var fernTestValueProblemDescription *common.ProblemDescription + obj.SetProblemDescription(fernTestValueProblemDescription) + assert.Equal(t, fernTestValueProblemDescription, obj.ProblemDescription) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetProblemName", func(t *testing.T) { + obj := &ProblemInfo{} + var fernTestValueProblemName string + obj.SetProblemName(fernTestValueProblemName) + assert.Equal(t, fernTestValueProblemName, obj.ProblemName) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetProblemVersion", func(t *testing.T) { + obj := &ProblemInfo{} + var fernTestValueProblemVersion int + obj.SetProblemVersion(fernTestValueProblemVersion) + assert.Equal(t, fernTestValueProblemVersion, obj.ProblemVersion) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetFiles", func(t *testing.T) { + obj := &ProblemInfo{} + var fernTestValueFiles map[common.Language]*ProblemFiles + obj.SetFiles(fernTestValueFiles) + assert.Equal(t, fernTestValueFiles, obj.Files) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetInputParams", func(t *testing.T) { + obj := &ProblemInfo{} + var fernTestValueInputParams []*VariableTypeAndName + obj.SetInputParams(fernTestValueInputParams) + assert.Equal(t, fernTestValueInputParams, obj.InputParams) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetOutputType", func(t *testing.T) { + obj := &ProblemInfo{} + var fernTestValueOutputType *common.VariableType + obj.SetOutputType(fernTestValueOutputType) + assert.Equal(t, fernTestValueOutputType, obj.OutputType) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetTestcases", func(t *testing.T) { + obj := &ProblemInfo{} + var fernTestValueTestcases []*TestCaseWithExpectedResult + obj.SetTestcases(fernTestValueTestcases) + assert.Equal(t, fernTestValueTestcases, obj.Testcases) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetMethodName", func(t *testing.T) { + obj := &ProblemInfo{} + var fernTestValueMethodName string + obj.SetMethodName(fernTestValueMethodName) + assert.Equal(t, fernTestValueMethodName, obj.MethodName) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetSupportsCustomTestCases", func(t *testing.T) { + obj := &ProblemInfo{} + var fernTestValueSupportsCustomTestCases bool + obj.SetSupportsCustomTestCases(fernTestValueSupportsCustomTestCases) + assert.Equal(t, fernTestValueSupportsCustomTestCases, obj.SupportsCustomTestCases) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersProblemInfo(t *testing.T) { + t.Run("GetProblemID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfo{} + var expected common.ProblemID + obj.ProblemID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetProblemID(), "getter should return the property value") + }) + + t.Run("GetProblemID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemInfo + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetProblemID() // Should return zero value + }) + + t.Run("GetProblemDescription", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfo{} + var expected *common.ProblemDescription + obj.ProblemDescription = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetProblemDescription(), "getter should return the property value") + }) + + t.Run("GetProblemDescription_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfo{} + obj.ProblemDescription = nil + + // Act & Assert + assert.Nil(t, obj.GetProblemDescription(), "getter should return nil when property is nil") + }) + + t.Run("GetProblemDescription_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemInfo + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetProblemDescription() // Should return zero value + }) + + t.Run("GetProblemName", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfo{} + var expected string + obj.ProblemName = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetProblemName(), "getter should return the property value") + }) + + t.Run("GetProblemName_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemInfo + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetProblemName() // Should return zero value + }) + + t.Run("GetProblemVersion", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfo{} + var expected int + obj.ProblemVersion = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetProblemVersion(), "getter should return the property value") + }) + + t.Run("GetProblemVersion_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemInfo + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetProblemVersion() // Should return zero value + }) + + t.Run("GetFiles", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfo{} + var expected map[common.Language]*ProblemFiles + obj.Files = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetFiles(), "getter should return the property value") + }) + + t.Run("GetFiles_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfo{} + obj.Files = nil + + // Act & Assert + assert.Nil(t, obj.GetFiles(), "getter should return nil when property is nil") + }) + + t.Run("GetFiles_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemInfo + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetFiles() // Should return zero value + }) + + t.Run("GetInputParams", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfo{} + var expected []*VariableTypeAndName + obj.InputParams = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetInputParams(), "getter should return the property value") + }) + + t.Run("GetInputParams_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfo{} + obj.InputParams = nil + + // Act & Assert + assert.Nil(t, obj.GetInputParams(), "getter should return nil when property is nil") + }) + + t.Run("GetInputParams_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemInfo + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetInputParams() // Should return zero value + }) + + t.Run("GetOutputType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfo{} + var expected *common.VariableType + obj.OutputType = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetOutputType(), "getter should return the property value") + }) + + t.Run("GetOutputType_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfo{} + obj.OutputType = nil + + // Act & Assert + assert.Nil(t, obj.GetOutputType(), "getter should return nil when property is nil") + }) + + t.Run("GetOutputType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemInfo + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetOutputType() // Should return zero value + }) + + t.Run("GetTestcases", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfo{} + var expected []*TestCaseWithExpectedResult + obj.Testcases = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTestcases(), "getter should return the property value") + }) + + t.Run("GetTestcases_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfo{} + obj.Testcases = nil + + // Act & Assert + assert.Nil(t, obj.GetTestcases(), "getter should return nil when property is nil") + }) + + t.Run("GetTestcases_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemInfo + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTestcases() // Should return zero value + }) + + t.Run("GetMethodName", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfo{} + var expected string + obj.MethodName = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetMethodName(), "getter should return the property value") + }) + + t.Run("GetMethodName_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemInfo + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetMethodName() // Should return zero value + }) + + t.Run("GetSupportsCustomTestCases", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfo{} + var expected bool + obj.SupportsCustomTestCases = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSupportsCustomTestCases(), "getter should return the property value") + }) + + t.Run("GetSupportsCustomTestCases_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemInfo + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSupportsCustomTestCases() // Should return zero value + }) + +} + +func TestSettersMarkExplicitProblemInfo(t *testing.T) { + t.Run("SetProblemID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfo{} + var fernTestValueProblemID common.ProblemID + + // Act + obj.SetProblemID(fernTestValueProblemID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetProblemDescription_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfo{} + var fernTestValueProblemDescription *common.ProblemDescription + + // Act + obj.SetProblemDescription(fernTestValueProblemDescription) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetProblemName_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfo{} + var fernTestValueProblemName string + + // Act + obj.SetProblemName(fernTestValueProblemName) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetProblemVersion_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfo{} + var fernTestValueProblemVersion int + + // Act + obj.SetProblemVersion(fernTestValueProblemVersion) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetFiles_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfo{} + var fernTestValueFiles map[common.Language]*ProblemFiles + + // Act + obj.SetFiles(fernTestValueFiles) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetInputParams_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfo{} + var fernTestValueInputParams []*VariableTypeAndName + + // Act + obj.SetInputParams(fernTestValueInputParams) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetOutputType_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfo{} + var fernTestValueOutputType *common.VariableType + + // Act + obj.SetOutputType(fernTestValueOutputType) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetTestcases_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfo{} + var fernTestValueTestcases []*TestCaseWithExpectedResult + + // Act + obj.SetTestcases(fernTestValueTestcases) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetMethodName_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfo{} + var fernTestValueMethodName string + + // Act + obj.SetMethodName(fernTestValueMethodName) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetSupportsCustomTestCases_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfo{} + var fernTestValueSupportsCustomTestCases bool + + // Act + obj.SetSupportsCustomTestCases(fernTestValueSupportsCustomTestCases) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersUpdateProblemResponse(t *testing.T) { + t.Run("SetProblemVersion", func(t *testing.T) { + obj := &UpdateProblemResponse{} + var fernTestValueProblemVersion int + obj.SetProblemVersion(fernTestValueProblemVersion) + assert.Equal(t, fernTestValueProblemVersion, obj.ProblemVersion) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersUpdateProblemResponse(t *testing.T) { + t.Run("GetProblemVersion", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &UpdateProblemResponse{} + var expected int + obj.ProblemVersion = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetProblemVersion(), "getter should return the property value") + }) + + t.Run("GetProblemVersion_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *UpdateProblemResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetProblemVersion() // Should return zero value + }) + +} + +func TestSettersMarkExplicitUpdateProblemResponse(t *testing.T) { + t.Run("SetProblemVersion_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &UpdateProblemResponse{} + var fernTestValueProblemVersion int + + // Act + obj.SetProblemVersion(fernTestValueProblemVersion) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersVariableTypeAndName(t *testing.T) { + t.Run("SetVariableType", func(t *testing.T) { + obj := &VariableTypeAndName{} + var fernTestValueVariableType *common.VariableType + obj.SetVariableType(fernTestValueVariableType) + assert.Equal(t, fernTestValueVariableType, obj.VariableType) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetName", func(t *testing.T) { + obj := &VariableTypeAndName{} + var fernTestValueName string + obj.SetName(fernTestValueName) + assert.Equal(t, fernTestValueName, obj.Name) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersVariableTypeAndName(t *testing.T) { + t.Run("GetVariableType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VariableTypeAndName{} + var expected *common.VariableType + obj.VariableType = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetVariableType(), "getter should return the property value") + }) + + t.Run("GetVariableType_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VariableTypeAndName{} + obj.VariableType = nil + + // Act & Assert + assert.Nil(t, obj.GetVariableType(), "getter should return nil when property is nil") + }) + + t.Run("GetVariableType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VariableTypeAndName + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetVariableType() // Should return zero value + }) + + t.Run("GetName", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VariableTypeAndName{} + var expected string + obj.Name = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetName(), "getter should return the property value") + }) + + t.Run("GetName_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VariableTypeAndName + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetName() // Should return zero value + }) + +} + +func TestSettersMarkExplicitVariableTypeAndName(t *testing.T) { + t.Run("SetVariableType_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VariableTypeAndName{} + var fernTestValueVariableType *common.VariableType + + // Act + obj.SetVariableType(fernTestValueVariableType) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetName_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VariableTypeAndName{} + var fernTestValueName string + + // Act + obj.SetName(fernTestValueName) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestJSONMarshalingCreateProblemRequest(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequest{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled CreateProblemRequest + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj CreateProblemRequest + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj CreateProblemRequest + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingGenericCreateProblemError(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GenericCreateProblemError{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled GenericCreateProblemError + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj GenericCreateProblemError + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj GenericCreateProblemError + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingGetDefaultStarterFilesResponse(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetDefaultStarterFilesResponse{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled GetDefaultStarterFilesResponse + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj GetDefaultStarterFilesResponse + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj GetDefaultStarterFilesResponse + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingProblemFiles(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemFiles{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled ProblemFiles + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj ProblemFiles + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj ProblemFiles + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingProblemInfo(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfo{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled ProblemInfo + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj ProblemInfo + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj ProblemInfo + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingUpdateProblemResponse(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &UpdateProblemResponse{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled UpdateProblemResponse + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj UpdateProblemResponse + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj UpdateProblemResponse + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingVariableTypeAndName(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VariableTypeAndName{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled VariableTypeAndName + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj VariableTypeAndName + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj VariableTypeAndName + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestStringCreateProblemRequest(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &CreateProblemRequest{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CreateProblemRequest + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringGenericCreateProblemError(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &GenericCreateProblemError{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GenericCreateProblemError + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringGetDefaultStarterFilesResponse(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &GetDefaultStarterFilesResponse{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetDefaultStarterFilesResponse + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringProblemFiles(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &ProblemFiles{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemFiles + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringProblemInfo(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &ProblemInfo{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemInfo + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringUpdateProblemResponse(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &UpdateProblemResponse{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *UpdateProblemResponse + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringVariableTypeAndName(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &VariableTypeAndName{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VariableTypeAndName + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestExtraPropertiesCreateProblemRequest(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &CreateProblemRequest{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CreateProblemRequest + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesGenericCreateProblemError(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &GenericCreateProblemError{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GenericCreateProblemError + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesGetDefaultStarterFilesResponse(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &GetDefaultStarterFilesResponse{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetDefaultStarterFilesResponse + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesProblemFiles(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &ProblemFiles{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemFiles + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesProblemInfo(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &ProblemInfo{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemInfo + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesUpdateProblemResponse(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &UpdateProblemResponse{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *UpdateProblemResponse + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesVariableTypeAndName(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &VariableTypeAndName{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VariableTypeAndName + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} diff --git a/seed/go-sdk/trace/reference.md b/seed/go-sdk/trace/reference.md new file mode 100644 index 000000000000..44ebe5a2e6e2 --- /dev/null +++ b/seed/go-sdk/trace/reference.md @@ -0,0 +1,2524 @@ +# Reference +## V2 +
client.V2.Test() -> error +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +client.V2.Test( + context.TODO(), + ) +} +``` +
+
+
+
+ + +
+
+
+ +## Admin +
client.Admin.UpdateTestSubmissionStatus(SubmissionID, request) -> error +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +request := &fern.TestSubmissionStatus{ + Stopped: "stopped", + } +client.Admin.UpdateTestSubmissionStatus( + context.TODO(), + uuid.MustParse( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + request, + ) +} +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**submissionID:** `fern.SubmissionID` + +
+
+ +
+
+ +**request:** `*fern.TestSubmissionStatus` + +
+
+
+
+ + +
+
+
+ +
client.Admin.SendTestSubmissionUpdate(SubmissionID, request) -> error +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +request := &fern.TestSubmissionUpdate{ + UpdateTime: fern.MustParseDateTime( + "2024-01-15T09:30:00Z", + ), + UpdateInfo: &fern.TestSubmissionUpdateInfo{}, + } +client.Admin.SendTestSubmissionUpdate( + context.TODO(), + uuid.MustParse( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + request, + ) +} +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**submissionID:** `fern.SubmissionID` + +
+
+ +
+
+ +**request:** `*fern.TestSubmissionUpdate` + +
+
+
+
+ + +
+
+
+ +
client.Admin.UpdateWorkspaceSubmissionStatus(SubmissionID, request) -> error +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +request := &fern.WorkspaceSubmissionStatus{ + Stopped: "stopped", + } +client.Admin.UpdateWorkspaceSubmissionStatus( + context.TODO(), + uuid.MustParse( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + request, + ) +} +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**submissionID:** `fern.SubmissionID` + +
+
+ +
+
+ +**request:** `*fern.WorkspaceSubmissionStatus` + +
+
+
+
+ + +
+
+
+ +
client.Admin.SendWorkspaceSubmissionUpdate(SubmissionID, request) -> error +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +request := &fern.WorkspaceSubmissionUpdate{ + UpdateTime: fern.MustParseDateTime( + "2024-01-15T09:30:00Z", + ), + UpdateInfo: &fern.WorkspaceSubmissionUpdateInfo{}, + } +client.Admin.SendWorkspaceSubmissionUpdate( + context.TODO(), + uuid.MustParse( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + request, + ) +} +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**submissionID:** `fern.SubmissionID` + +
+
+ +
+
+ +**request:** `*fern.WorkspaceSubmissionUpdate` + +
+
+
+
+ + +
+
+
+ +
client.Admin.StoreTracedTestCase(SubmissionID, TestCaseID, request) -> error +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +request := &fern.StoreTracedTestCaseRequest{ + Result: &fern.TestCaseResultWithStdout{ + Result: &fern.TestCaseResult{ + ExpectedResult: &common.VariableValue{}, + ActualResult: &fern.ActualResult{ + Value: &common.VariableValue{}, + }, + Passed: true, + }, + Stdout: "stdout", + }, + TraceResponses: []*fern.TraceResponse{ + &fern.TraceResponse{ + SubmissionID: uuid.MustParse( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + LineNumber: 1, + ReturnValue: &fern.DebugVariableValue{}, + ExpressionLocation: &fern.ExpressionLocation{ + Start: 1, + Offset: 1, + }, + Stack: &fern.StackInformation{ + NumStackFrames: 1, + TopStackFrame: &fern.StackFrame{ + MethodName: "methodName", + LineNumber: 1, + Scopes: []*fern.Scope{ + &fern.Scope{ + Variables: map[string]*fern.DebugVariableValue{ + "variables": &fern.DebugVariableValue{}, + }, + }, + &fern.Scope{ + Variables: map[string]*fern.DebugVariableValue{ + "variables": &fern.DebugVariableValue{}, + }, + }, + }, + }, + }, + Stdout: fern.String( + "stdout", + ), + }, + &fern.TraceResponse{ + SubmissionID: uuid.MustParse( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + LineNumber: 1, + ReturnValue: &fern.DebugVariableValue{}, + ExpressionLocation: &fern.ExpressionLocation{ + Start: 1, + Offset: 1, + }, + Stack: &fern.StackInformation{ + NumStackFrames: 1, + TopStackFrame: &fern.StackFrame{ + MethodName: "methodName", + LineNumber: 1, + Scopes: []*fern.Scope{ + &fern.Scope{ + Variables: map[string]*fern.DebugVariableValue{ + "variables": &fern.DebugVariableValue{}, + }, + }, + &fern.Scope{ + Variables: map[string]*fern.DebugVariableValue{ + "variables": &fern.DebugVariableValue{}, + }, + }, + }, + }, + }, + Stdout: fern.String( + "stdout", + ), + }, + }, + } +client.Admin.StoreTracedTestCase( + context.TODO(), + uuid.MustParse( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + "testCaseId", + request, + ) +} +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**submissionID:** `fern.SubmissionID` + +
+
+ +
+
+ +**testCaseID:** `string` + +
+
+ +
+
+ +**result:** `*fern.TestCaseResultWithStdout` + +
+
+ +
+
+ +**traceResponses:** `[]*fern.TraceResponse` + +
+
+
+
+ + +
+
+
+ +
client.Admin.StoreTracedTestCaseV2(SubmissionID, TestCaseID, request) -> error +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +request := []*fern.TraceResponseV2{ + &fern.TraceResponseV2{ + SubmissionID: uuid.MustParse( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + LineNumber: 1, + File: &fern.TracedFile{ + Filename: "filename", + Directory: "directory", + }, + ReturnValue: &fern.DebugVariableValue{}, + ExpressionLocation: &fern.ExpressionLocation{ + Start: 1, + Offset: 1, + }, + Stack: &fern.StackInformation{ + NumStackFrames: 1, + TopStackFrame: &fern.StackFrame{ + MethodName: "methodName", + LineNumber: 1, + Scopes: []*fern.Scope{ + &fern.Scope{ + Variables: map[string]*fern.DebugVariableValue{ + "variables": &fern.DebugVariableValue{}, + }, + }, + &fern.Scope{ + Variables: map[string]*fern.DebugVariableValue{ + "variables": &fern.DebugVariableValue{}, + }, + }, + }, + }, + }, + Stdout: fern.String( + "stdout", + ), + }, + &fern.TraceResponseV2{ + SubmissionID: uuid.MustParse( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + LineNumber: 1, + File: &fern.TracedFile{ + Filename: "filename", + Directory: "directory", + }, + ReturnValue: &fern.DebugVariableValue{}, + ExpressionLocation: &fern.ExpressionLocation{ + Start: 1, + Offset: 1, + }, + Stack: &fern.StackInformation{ + NumStackFrames: 1, + TopStackFrame: &fern.StackFrame{ + MethodName: "methodName", + LineNumber: 1, + Scopes: []*fern.Scope{ + &fern.Scope{ + Variables: map[string]*fern.DebugVariableValue{ + "variables": &fern.DebugVariableValue{}, + }, + }, + &fern.Scope{ + Variables: map[string]*fern.DebugVariableValue{ + "variables": &fern.DebugVariableValue{}, + }, + }, + }, + }, + }, + Stdout: fern.String( + "stdout", + ), + }, + } +client.Admin.StoreTracedTestCaseV2( + context.TODO(), + uuid.MustParse( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + "testCaseId", + request, + ) +} +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**submissionID:** `fern.SubmissionID` + +
+
+ +
+
+ +**testCaseID:** `v2.TestCaseID` + +
+
+ +
+
+ +**request:** `[]*fern.TraceResponseV2` + +
+
+
+
+ + +
+
+
+ +
client.Admin.StoreTracedWorkspace(SubmissionID, request) -> error +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +request := &fern.StoreTracedWorkspaceRequest{ + WorkspaceRunDetails: &fern.WorkspaceRunDetails{ + ExceptionV2: &fern.ExceptionV2{ + Generic: &fern.ExceptionInfo{ + ExceptionType: "exceptionType", + ExceptionMessage: "exceptionMessage", + ExceptionStacktrace: "exceptionStacktrace", + }, + }, + Exception: &fern.ExceptionInfo{ + ExceptionType: "exceptionType", + ExceptionMessage: "exceptionMessage", + ExceptionStacktrace: "exceptionStacktrace", + }, + Stdout: "stdout", + }, + TraceResponses: []*fern.TraceResponse{ + &fern.TraceResponse{ + SubmissionID: uuid.MustParse( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + LineNumber: 1, + ReturnValue: &fern.DebugVariableValue{}, + ExpressionLocation: &fern.ExpressionLocation{ + Start: 1, + Offset: 1, + }, + Stack: &fern.StackInformation{ + NumStackFrames: 1, + TopStackFrame: &fern.StackFrame{ + MethodName: "methodName", + LineNumber: 1, + Scopes: []*fern.Scope{ + &fern.Scope{ + Variables: map[string]*fern.DebugVariableValue{ + "variables": &fern.DebugVariableValue{}, + }, + }, + &fern.Scope{ + Variables: map[string]*fern.DebugVariableValue{ + "variables": &fern.DebugVariableValue{}, + }, + }, + }, + }, + }, + Stdout: fern.String( + "stdout", + ), + }, + &fern.TraceResponse{ + SubmissionID: uuid.MustParse( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + LineNumber: 1, + ReturnValue: &fern.DebugVariableValue{}, + ExpressionLocation: &fern.ExpressionLocation{ + Start: 1, + Offset: 1, + }, + Stack: &fern.StackInformation{ + NumStackFrames: 1, + TopStackFrame: &fern.StackFrame{ + MethodName: "methodName", + LineNumber: 1, + Scopes: []*fern.Scope{ + &fern.Scope{ + Variables: map[string]*fern.DebugVariableValue{ + "variables": &fern.DebugVariableValue{}, + }, + }, + &fern.Scope{ + Variables: map[string]*fern.DebugVariableValue{ + "variables": &fern.DebugVariableValue{}, + }, + }, + }, + }, + }, + Stdout: fern.String( + "stdout", + ), + }, + }, + } +client.Admin.StoreTracedWorkspace( + context.TODO(), + uuid.MustParse( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + request, + ) +} +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**submissionID:** `fern.SubmissionID` + +
+
+ +
+
+ +**workspaceRunDetails:** `*fern.WorkspaceRunDetails` + +
+
+ +
+
+ +**traceResponses:** `[]*fern.TraceResponse` + +
+
+
+
+ + +
+
+
+ +
client.Admin.StoreTracedWorkspaceV2(SubmissionID, request) -> error +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +request := []*fern.TraceResponseV2{ + &fern.TraceResponseV2{ + SubmissionID: uuid.MustParse( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + LineNumber: 1, + File: &fern.TracedFile{ + Filename: "filename", + Directory: "directory", + }, + ReturnValue: &fern.DebugVariableValue{}, + ExpressionLocation: &fern.ExpressionLocation{ + Start: 1, + Offset: 1, + }, + Stack: &fern.StackInformation{ + NumStackFrames: 1, + TopStackFrame: &fern.StackFrame{ + MethodName: "methodName", + LineNumber: 1, + Scopes: []*fern.Scope{ + &fern.Scope{ + Variables: map[string]*fern.DebugVariableValue{ + "variables": &fern.DebugVariableValue{}, + }, + }, + &fern.Scope{ + Variables: map[string]*fern.DebugVariableValue{ + "variables": &fern.DebugVariableValue{}, + }, + }, + }, + }, + }, + Stdout: fern.String( + "stdout", + ), + }, + &fern.TraceResponseV2{ + SubmissionID: uuid.MustParse( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + LineNumber: 1, + File: &fern.TracedFile{ + Filename: "filename", + Directory: "directory", + }, + ReturnValue: &fern.DebugVariableValue{}, + ExpressionLocation: &fern.ExpressionLocation{ + Start: 1, + Offset: 1, + }, + Stack: &fern.StackInformation{ + NumStackFrames: 1, + TopStackFrame: &fern.StackFrame{ + MethodName: "methodName", + LineNumber: 1, + Scopes: []*fern.Scope{ + &fern.Scope{ + Variables: map[string]*fern.DebugVariableValue{ + "variables": &fern.DebugVariableValue{}, + }, + }, + &fern.Scope{ + Variables: map[string]*fern.DebugVariableValue{ + "variables": &fern.DebugVariableValue{}, + }, + }, + }, + }, + }, + Stdout: fern.String( + "stdout", + ), + }, + } +client.Admin.StoreTracedWorkspaceV2( + context.TODO(), + uuid.MustParse( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + request, + ) +} +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**submissionID:** `fern.SubmissionID` + +
+
+ +
+
+ +**request:** `[]*fern.TraceResponseV2` + +
+
+
+
+ + +
+
+
+ +## Homepage +
client.Homepage.GetHomepageProblems() -> []common.ProblemID +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +client.Homepage.GetHomepageProblems( + context.TODO(), + ) +} +``` +
+
+
+
+ + +
+
+
+ +
client.Homepage.SetHomepageProblems(request) -> error +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +request := []common.ProblemID{ + "string", + "string", + } +client.Homepage.SetHomepageProblems( + context.TODO(), + request, + ) +} +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `[]common.ProblemID` + +
+
+
+
+ + +
+
+
+ +## Migration +
client.Migration.GetAttemptedMigrations() -> []*fern.Migration +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +request := &fern.GetAttemptedMigrationsRequest{ + AdminKeyHeader: "admin-key-header", + } +client.Migration.GetAttemptedMigrations( + context.TODO(), + request, + ) +} +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**adminKeyHeader:** `string` + +
+
+
+
+ + +
+
+
+ +## Playlist +
client.Playlist.CreatePlaylist(ServiceParam, request) -> *fern.Playlist +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a new playlist +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +request := &fern.CreatePlaylistRequest{ + Datetime: fern.MustParseDateTime( + "2024-01-15T09:30:00Z", + ), + OptionalDatetime: fern.Time( + fern.MustParseDateTime( + "2024-01-15T09:30:00Z", + ), + ), + Body: &fern.PlaylistCreateRequest{ + Name: "name", + Problems: []common.ProblemID{ + "problems", + "problems", + }, + }, + } +client.Playlist.CreatePlaylist( + context.TODO(), + 1, + request, + ) +} +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**serviceParam:** `int` + +
+
+ +
+
+ +**datetime:** `time.Time` + +
+
+ +
+
+ +**optionalDatetime:** `*time.Time` + +
+
+ +
+
+ +**request:** `*fern.PlaylistCreateRequest` + +
+
+
+
+ + +
+
+
+ +
client.Playlist.GetPlaylists(ServiceParam) -> []*fern.Playlist +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns the user's playlists +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +request := &fern.GetPlaylistsRequest{ + Limit: fern.Int( + 1, + ), + OtherField: "otherField", + MultiLineDocs: "multiLineDocs", + OptionalMultipleField: []*string{ + fern.String( + "optionalMultipleField", + ), + }, + MultipleField: []string{ + "multipleField", + }, + } +client.Playlist.GetPlaylists( + context.TODO(), + 1, + request, + ) +} +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**serviceParam:** `int` + +
+
+ +
+
+ +**limit:** `*int` + +
+
+ +
+
+ +**otherField:** `string` — i'm another field + +
+
+ +
+
+ +**multiLineDocs:** `string` + +I'm a multiline +description + +
+
+ +
+
+ +**optionalMultipleField:** `*string` + +
+
+ +
+
+ +**multipleField:** `string` + +
+
+
+
+ + +
+
+
+ +
client.Playlist.GetPlaylist(ServiceParam, PlaylistID) -> *fern.Playlist +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a playlist +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +client.Playlist.GetPlaylist( + context.TODO(), + 1, + "playlistId", + ) +} +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**serviceParam:** `int` + +
+
+ +
+
+ +**playlistID:** `fern.PlaylistID` + +
+
+
+
+ + +
+
+
+ +
client.Playlist.UpdatePlaylist(ServiceParam, PlaylistID, request) -> *fern.Playlist +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates a playlist +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +request := &fern.UpdatePlaylistRequest{ + Name: "name", + Problems: []common.ProblemID{ + "problems", + "problems", + }, + } +client.Playlist.UpdatePlaylist( + context.TODO(), + 1, + "playlistId", + request, + ) +} +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**serviceParam:** `int` + +
+
+ +
+
+ +**playlistID:** `fern.PlaylistID` + +
+
+ +
+
+ +**request:** `*fern.UpdatePlaylistRequest` + +
+
+
+
+ + +
+
+
+ +
client.Playlist.DeletePlaylist(ServiceParam, PlaylistID) -> error +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes a playlist +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +client.Playlist.DeletePlaylist( + context.TODO(), + 1, + "playlist_id", + ) +} +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**serviceParam:** `int` + +
+
+ +
+
+ +**playlistID:** `fern.PlaylistID` + +
+
+
+
+ + +
+
+
+ +## Problem +
client.Problem.CreateProblem(request) -> *fern.CreateProblemResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a problem +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +request := &fern.CreateProblemRequest{ + ProblemName: "problemName", + ProblemDescription: &common.ProblemDescription{ + Boards: []*common.ProblemDescriptionBoard{ + &common.ProblemDescriptionBoard{}, + &common.ProblemDescriptionBoard{}, + }, + }, + Files: map[common.Language]*fern.ProblemFiles{ + common.LanguageJava: &fern.ProblemFiles{ + SolutionFile: &fern.FileInfo{ + Filename: "filename", + Contents: "contents", + }, + ReadOnlyFiles: []*fern.FileInfo{ + &fern.FileInfo{ + Filename: "filename", + Contents: "contents", + }, + &fern.FileInfo{ + Filename: "filename", + Contents: "contents", + }, + }, + }, + }, + InputParams: []*fern.VariableTypeAndName{ + &fern.VariableTypeAndName{ + VariableType: &common.VariableType{ + IntegerType: "integerType", + }, + Name: "name", + }, + &fern.VariableTypeAndName{ + VariableType: &common.VariableType{ + IntegerType: "integerType", + }, + Name: "name", + }, + }, + OutputType: &common.VariableType{ + IntegerType: "integerType", + }, + Testcases: []*fern.TestCaseWithExpectedResult{ + &fern.TestCaseWithExpectedResult{ + TestCase: &fern.TestCase{ + ID: "id", + Params: []*common.VariableValue{ + &common.VariableValue{}, + &common.VariableValue{}, + }, + }, + ExpectedResult: &common.VariableValue{}, + }, + &fern.TestCaseWithExpectedResult{ + TestCase: &fern.TestCase{ + ID: "id", + Params: []*common.VariableValue{ + &common.VariableValue{}, + &common.VariableValue{}, + }, + }, + ExpectedResult: &common.VariableValue{}, + }, + }, + MethodName: "methodName", + } +client.Problem.CreateProblem( + context.TODO(), + request, + ) +} +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `*fern.CreateProblemRequest` + +
+
+
+
+ + +
+
+
+ +
client.Problem.UpdateProblem(ProblemID, request) -> *fern.UpdateProblemResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates a problem +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +request := &fern.CreateProblemRequest{ + ProblemName: "problemName", + ProblemDescription: &common.ProblemDescription{ + Boards: []*common.ProblemDescriptionBoard{ + &common.ProblemDescriptionBoard{}, + &common.ProblemDescriptionBoard{}, + }, + }, + Files: map[common.Language]*fern.ProblemFiles{ + common.LanguageJava: &fern.ProblemFiles{ + SolutionFile: &fern.FileInfo{ + Filename: "filename", + Contents: "contents", + }, + ReadOnlyFiles: []*fern.FileInfo{ + &fern.FileInfo{ + Filename: "filename", + Contents: "contents", + }, + &fern.FileInfo{ + Filename: "filename", + Contents: "contents", + }, + }, + }, + }, + InputParams: []*fern.VariableTypeAndName{ + &fern.VariableTypeAndName{ + VariableType: &common.VariableType{ + IntegerType: "integerType", + }, + Name: "name", + }, + &fern.VariableTypeAndName{ + VariableType: &common.VariableType{ + IntegerType: "integerType", + }, + Name: "name", + }, + }, + OutputType: &common.VariableType{ + IntegerType: "integerType", + }, + Testcases: []*fern.TestCaseWithExpectedResult{ + &fern.TestCaseWithExpectedResult{ + TestCase: &fern.TestCase{ + ID: "id", + Params: []*common.VariableValue{ + &common.VariableValue{}, + &common.VariableValue{}, + }, + }, + ExpectedResult: &common.VariableValue{}, + }, + &fern.TestCaseWithExpectedResult{ + TestCase: &fern.TestCase{ + ID: "id", + Params: []*common.VariableValue{ + &common.VariableValue{}, + &common.VariableValue{}, + }, + }, + ExpectedResult: &common.VariableValue{}, + }, + }, + MethodName: "methodName", + } +client.Problem.UpdateProblem( + context.TODO(), + "problemId", + request, + ) +} +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**problemID:** `common.ProblemID` + +
+
+ +
+
+ +**request:** `*fern.CreateProblemRequest` + +
+
+
+
+ + +
+
+
+ +
client.Problem.DeleteProblem(ProblemID) -> error +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Soft deletes a problem +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +client.Problem.DeleteProblem( + context.TODO(), + "problemId", + ) +} +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**problemID:** `common.ProblemID` + +
+
+
+
+ + +
+
+
+ +
client.Problem.GetDefaultStarterFiles(request) -> *fern.GetDefaultStarterFilesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns default starter files for problem +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +request := &fern.GetDefaultStarterFilesRequest{ + InputParams: []*fern.VariableTypeAndName{ + &fern.VariableTypeAndName{ + VariableType: &common.VariableType{ + IntegerType: "integerType", + }, + Name: "name", + }, + &fern.VariableTypeAndName{ + VariableType: &common.VariableType{ + IntegerType: "integerType", + }, + Name: "name", + }, + }, + OutputType: &common.VariableType{ + IntegerType: "integerType", + }, + MethodName: "methodName", + } +client.Problem.GetDefaultStarterFiles( + context.TODO(), + request, + ) +} +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**inputParams:** `[]*fern.VariableTypeAndName` + +
+
+ +
+
+ +**outputType:** `*common.VariableType` + +
+
+ +
+
+ +**methodName:** `string` + +The name of the `method` that the student has to complete. +The method name cannot include the following characters: + - Greater Than `>` + - Less Than `<`` + - Equals `=` + - Period `.` + +
+
+
+
+ + +
+
+
+ +## Submission +
client.Submission.CreateExecutionSession(Language) -> *fern.ExecutionSessionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns sessionId and execution server URL for session. Spins up server. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +client.Submission.CreateExecutionSession( + context.TODO(), + common.LanguageJava.Ptr(), + ) +} +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**language:** `*common.Language` + +
+
+
+
+ + +
+
+
+ +
client.Submission.GetExecutionSession(SessionID) -> *fern.ExecutionSessionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns execution server URL for session. Returns empty if session isn't registered. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +client.Submission.GetExecutionSession( + context.TODO(), + "sessionId", + ) +} +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**sessionID:** `string` + +
+
+
+
+ + +
+
+
+ +
client.Submission.StopExecutionSession(SessionID) -> error +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Stops execution session. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +client.Submission.StopExecutionSession( + context.TODO(), + "sessionId", + ) +} +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**sessionID:** `string` + +
+
+
+
+ + +
+
+
+ +
client.Submission.GetExecutionSessionsState() -> *fern.GetExecutionSessionStateResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +client.Submission.GetExecutionSessionsState( + context.TODO(), + ) +} +``` +
+
+
+
+ + +
+
+
+ +## Sysprop +
client.Sysprop.SetNumWarmInstances(Language, NumWarmInstances) -> error +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +client.Sysprop.SetNumWarmInstances( + context.TODO(), + common.LanguageJava.Ptr(), + 1, + ) +} +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**language:** `*common.Language` + +
+
+ +
+
+ +**numWarmInstances:** `int` + +
+
+
+
+ + +
+
+
+ +
client.Sysprop.GetNumWarmInstances() -> map[*common.Language]int +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +client.Sysprop.GetNumWarmInstances( + context.TODO(), + ) +} +``` +
+
+
+
+ + +
+
+
+ +## V2 Problem +
client.V2.Problem.GetLightweightProblems() -> []*v2.LightweightProblemInfoV2 +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns lightweight versions of all problems +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +client.V2.Problem.GetLightweightProblems( + context.TODO(), + ) +} +``` +
+
+
+
+ + +
+
+
+ +
client.V2.Problem.GetProblems() -> []*v2.ProblemInfoV2 +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns latest versions of all problems +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +client.V2.Problem.GetProblems( + context.TODO(), + ) +} +``` +
+
+
+
+ + +
+
+
+ +
client.V2.Problem.GetLatestProblem(ProblemID) -> *v2.ProblemInfoV2 +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns latest version of a problem +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +client.V2.Problem.GetLatestProblem( + context.TODO(), + "problemId", + ) +} +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**problemID:** `common.ProblemID` + +
+
+
+
+ + +
+
+
+ +
client.V2.Problem.GetProblemVersion(ProblemID, ProblemVersion) -> *v2.ProblemInfoV2 +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns requested version of a problem +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +client.V2.Problem.GetProblemVersion( + context.TODO(), + "problemId", + 1, + ) +} +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**problemID:** `common.ProblemID` + +
+
+ +
+
+ +**problemVersion:** `int` + +
+
+
+
+ + +
+
+
+ +## V2 V3 Problem +
client.V2.V3.Problem.GetLightweightProblems() -> []*v3.LightweightProblemInfoV2 +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns lightweight versions of all problems +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +client.V2.Problem.GetLightweightProblems( + context.TODO(), + ) +} +``` +
+
+
+
+ + +
+
+
+ +
client.V2.V3.Problem.GetProblems() -> []*v3.ProblemInfoV2 +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns latest versions of all problems +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +client.V2.Problem.GetProblems( + context.TODO(), + ) +} +``` +
+
+
+
+ + +
+
+
+ +
client.V2.V3.Problem.GetLatestProblem(ProblemID) -> *v3.ProblemInfoV2 +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns latest version of a problem +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +client.V2.Problem.GetLatestProblem( + context.TODO(), + "problemId", + ) +} +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**problemID:** `common.ProblemID` + +
+
+
+
+ + +
+
+
+ +
client.V2.V3.Problem.GetProblemVersion(ProblemID, ProblemVersion) -> *v3.ProblemInfoV2 +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns requested version of a problem +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +client.V2.Problem.GetProblemVersion( + context.TODO(), + "problemId", + 1, + ) +} +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**problemID:** `common.ProblemID` + +
+
+ +
+
+ +**problemVersion:** `int` + +
+
+
+
+ + +
+
+
+ diff --git a/seed/go-sdk/trace/snippet-templates.json b/seed/go-sdk/trace/snippet-templates.json deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/seed/go-sdk/trace/snippet.json b/seed/go-sdk/trace/snippet.json index e69de29bb2d1..dfe0740260ff 100644 --- a/seed/go-sdk/trace/snippet.json +++ b/seed/go-sdk/trace/snippet.json @@ -0,0 +1,389 @@ +{ + "endpoints": [ + { + "id": { + "path": "/", + "method": "GET", + "identifier_override": "endpoint_v2.test" + }, + "snippet": { + "type": "go", + "client": "import (\n\tcontext \"context\"\n\tfernclient \"github.com/trace/fern/client\"\n\toption \"github.com/trace/fern/option\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n)\nerr := client.V2.Test(\n\tcontext.TODO(),\n)\n" + } + }, + { + "id": { + "path": "/admin/store-test-submission-status-v2/{submissionId}", + "method": "POST", + "identifier_override": "endpoint_admin.sendTestSubmissionUpdate" + }, + "snippet": { + "type": "go", + "client": "import (\n\tcontext \"context\"\n\tfern \"github.com/trace/fern\"\n\tfernclient \"github.com/trace/fern/client\"\n\toption \"github.com/trace/fern/option\"\n\tuuid \"github.com/google/uuid\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n)\nerr := client.Admin.SendTestSubmissionUpdate(\n\tcontext.TODO(),\n\tuuid.MustParse(\n\t\t\"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32\",\n\t),\n\t\u0026fern.TestSubmissionUpdate{\n\t\tUpdateTime: fern.MustParseDateTime(\n\t\t\t\"2024-01-15T09:30:00Z\",\n\t\t),\n\t\tUpdateInfo: \u0026fern.TestSubmissionUpdateInfo{\n\t\t\tRunning: fern.RunningSubmissionStateQueueingSubmission,\n\t\t},\n\t},\n)\n" + } + }, + { + "id": { + "path": "/admin/store-test-submission-status/{submissionId}", + "method": "POST", + "identifier_override": "endpoint_admin.updateTestSubmissionStatus" + }, + "snippet": { + "type": "go", + "client": "import (\n\tcontext \"context\"\n\tfern \"github.com/trace/fern\"\n\tfernclient \"github.com/trace/fern/client\"\n\toption \"github.com/trace/fern/option\"\n\tuuid \"github.com/google/uuid\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n)\nerr := client.Admin.UpdateTestSubmissionStatus(\n\tcontext.TODO(),\n\tuuid.MustParse(\n\t\t\"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32\",\n\t),\n\t\u0026fern.TestSubmissionStatus{\n\t\tType: \"stopped\",\n\t},\n)\n" + } + }, + { + "id": { + "path": "/admin/store-test-trace-v2/submission/{submissionId}/testCase/{testCaseId}", + "method": "POST", + "identifier_override": "endpoint_admin.storeTracedTestCaseV2" + }, + "snippet": { + "type": "go", + "client": "import (\n\tcontext \"context\"\n\tfern \"github.com/trace/fern\"\n\tfernclient \"github.com/trace/fern/client\"\n\toption \"github.com/trace/fern/option\"\n\tuuid \"github.com/google/uuid\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n)\nerr := client.Admin.StoreTracedTestCaseV2(\n\tcontext.TODO(),\n\tuuid.MustParse(\n\t\t\"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32\",\n\t),\n\t\"testCaseId\",\n\t[]*fern.TraceResponseV2{\n\t\t\u0026fern.TraceResponseV2{\n\t\t\tSubmissionID: uuid.MustParse(\n\t\t\t\t\"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32\",\n\t\t\t),\n\t\t\tLineNumber: 1,\n\t\t\tFile: \u0026fern.TracedFile{\n\t\t\t\tFilename: \"filename\",\n\t\t\t\tDirectory: \"directory\",\n\t\t\t},\n\t\t\tReturnValue: \u0026fern.DebugVariableValue{\n\t\t\t\tIntegerValue: 1,\n\t\t\t},\n\t\t\tExpressionLocation: \u0026fern.ExpressionLocation{\n\t\t\t\tStart: 1,\n\t\t\t\tOffset: 1,\n\t\t\t},\n\t\t\tStack: \u0026fern.StackInformation{\n\t\t\t\tNumStackFrames: 1,\n\t\t\t\tTopStackFrame: \u0026fern.StackFrame{\n\t\t\t\t\tMethodName: \"methodName\",\n\t\t\t\t\tLineNumber: 1,\n\t\t\t\t\tScopes: []*fern.Scope{\n\t\t\t\t\t\t\u0026fern.Scope{\n\t\t\t\t\t\t\tVariables: map[string]*fern.DebugVariableValue{\n\t\t\t\t\t\t\t\t\"variables\": \u0026fern.DebugVariableValue{\n\t\t\t\t\t\t\t\t\tIntegerValue: 1,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\u0026fern.Scope{\n\t\t\t\t\t\t\tVariables: map[string]*fern.DebugVariableValue{\n\t\t\t\t\t\t\t\t\"variables\": \u0026fern.DebugVariableValue{\n\t\t\t\t\t\t\t\t\tIntegerValue: 1,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tStdout: fern.String(\n\t\t\t\t\"stdout\",\n\t\t\t),\n\t\t},\n\t\t\u0026fern.TraceResponseV2{\n\t\t\tSubmissionID: uuid.MustParse(\n\t\t\t\t\"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32\",\n\t\t\t),\n\t\t\tLineNumber: 1,\n\t\t\tFile: \u0026fern.TracedFile{\n\t\t\t\tFilename: \"filename\",\n\t\t\t\tDirectory: \"directory\",\n\t\t\t},\n\t\t\tReturnValue: \u0026fern.DebugVariableValue{\n\t\t\t\tIntegerValue: 1,\n\t\t\t},\n\t\t\tExpressionLocation: \u0026fern.ExpressionLocation{\n\t\t\t\tStart: 1,\n\t\t\t\tOffset: 1,\n\t\t\t},\n\t\t\tStack: \u0026fern.StackInformation{\n\t\t\t\tNumStackFrames: 1,\n\t\t\t\tTopStackFrame: \u0026fern.StackFrame{\n\t\t\t\t\tMethodName: \"methodName\",\n\t\t\t\t\tLineNumber: 1,\n\t\t\t\t\tScopes: []*fern.Scope{\n\t\t\t\t\t\t\u0026fern.Scope{\n\t\t\t\t\t\t\tVariables: map[string]*fern.DebugVariableValue{\n\t\t\t\t\t\t\t\t\"variables\": \u0026fern.DebugVariableValue{\n\t\t\t\t\t\t\t\t\tIntegerValue: 1,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\u0026fern.Scope{\n\t\t\t\t\t\t\tVariables: map[string]*fern.DebugVariableValue{\n\t\t\t\t\t\t\t\t\"variables\": \u0026fern.DebugVariableValue{\n\t\t\t\t\t\t\t\t\tIntegerValue: 1,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tStdout: fern.String(\n\t\t\t\t\"stdout\",\n\t\t\t),\n\t\t},\n\t},\n)\n" + } + }, + { + "id": { + "path": "/admin/store-test-trace/submission/{submissionId}/testCase/{testCaseId}", + "method": "POST", + "identifier_override": "endpoint_admin.storeTracedTestCase" + }, + "snippet": { + "type": "go", + "client": "import (\n\tcontext \"context\"\n\tfern \"github.com/trace/fern\"\n\tfernclient \"github.com/trace/fern/client\"\n\toption \"github.com/trace/fern/option\"\n\tuuid \"github.com/google/uuid\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n)\nerr := client.Admin.StoreTracedTestCase(\n\tcontext.TODO(),\n\tuuid.MustParse(\n\t\t\"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32\",\n\t),\n\t\"testCaseId\",\n\t\u0026fern.StoreTracedTestCaseRequest{\n\t\tResult: \u0026fern.TestCaseResultWithStdout{\n\t\t\tResult: \u0026fern.TestCaseResult{\n\t\t\t\tExpectedResult: \u0026fern.VariableValue{\n\t\t\t\t\tIntegerValue: 1,\n\t\t\t\t},\n\t\t\t\tActualResult: \u0026fern.ActualResult{\n\t\t\t\t\tValue: \u0026fern.VariableValue{\n\t\t\t\t\t\tIntegerValue: 1,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tPassed: true,\n\t\t\t},\n\t\t\tStdout: \"stdout\",\n\t\t},\n\t\tTraceResponses: []*fern.TraceResponse{\n\t\t\t\u0026fern.TraceResponse{\n\t\t\t\tSubmissionID: uuid.MustParse(\n\t\t\t\t\t\"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32\",\n\t\t\t\t),\n\t\t\t\tLineNumber: 1,\n\t\t\t\tReturnValue: \u0026fern.DebugVariableValue{\n\t\t\t\t\tIntegerValue: 1,\n\t\t\t\t},\n\t\t\t\tExpressionLocation: \u0026fern.ExpressionLocation{\n\t\t\t\t\tStart: 1,\n\t\t\t\t\tOffset: 1,\n\t\t\t\t},\n\t\t\t\tStack: \u0026fern.StackInformation{\n\t\t\t\t\tNumStackFrames: 1,\n\t\t\t\t\tTopStackFrame: \u0026fern.StackFrame{\n\t\t\t\t\t\tMethodName: \"methodName\",\n\t\t\t\t\t\tLineNumber: 1,\n\t\t\t\t\t\tScopes: []*fern.Scope{\n\t\t\t\t\t\t\t\u0026fern.Scope{\n\t\t\t\t\t\t\t\tVariables: map[string]*fern.DebugVariableValue{\n\t\t\t\t\t\t\t\t\t\"variables\": \u0026fern.DebugVariableValue{\n\t\t\t\t\t\t\t\t\t\tIntegerValue: 1,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\u0026fern.Scope{\n\t\t\t\t\t\t\t\tVariables: map[string]*fern.DebugVariableValue{\n\t\t\t\t\t\t\t\t\t\"variables\": \u0026fern.DebugVariableValue{\n\t\t\t\t\t\t\t\t\t\tIntegerValue: 1,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tStdout: fern.String(\n\t\t\t\t\t\"stdout\",\n\t\t\t\t),\n\t\t\t},\n\t\t\t\u0026fern.TraceResponse{\n\t\t\t\tSubmissionID: uuid.MustParse(\n\t\t\t\t\t\"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32\",\n\t\t\t\t),\n\t\t\t\tLineNumber: 1,\n\t\t\t\tReturnValue: \u0026fern.DebugVariableValue{\n\t\t\t\t\tIntegerValue: 1,\n\t\t\t\t},\n\t\t\t\tExpressionLocation: \u0026fern.ExpressionLocation{\n\t\t\t\t\tStart: 1,\n\t\t\t\t\tOffset: 1,\n\t\t\t\t},\n\t\t\t\tStack: \u0026fern.StackInformation{\n\t\t\t\t\tNumStackFrames: 1,\n\t\t\t\t\tTopStackFrame: \u0026fern.StackFrame{\n\t\t\t\t\t\tMethodName: \"methodName\",\n\t\t\t\t\t\tLineNumber: 1,\n\t\t\t\t\t\tScopes: []*fern.Scope{\n\t\t\t\t\t\t\t\u0026fern.Scope{\n\t\t\t\t\t\t\t\tVariables: map[string]*fern.DebugVariableValue{\n\t\t\t\t\t\t\t\t\t\"variables\": \u0026fern.DebugVariableValue{\n\t\t\t\t\t\t\t\t\t\tIntegerValue: 1,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\u0026fern.Scope{\n\t\t\t\t\t\t\t\tVariables: map[string]*fern.DebugVariableValue{\n\t\t\t\t\t\t\t\t\t\"variables\": \u0026fern.DebugVariableValue{\n\t\t\t\t\t\t\t\t\t\tIntegerValue: 1,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tStdout: fern.String(\n\t\t\t\t\t\"stdout\",\n\t\t\t\t),\n\t\t\t},\n\t\t},\n\t},\n)\n" + } + }, + { + "id": { + "path": "/admin/store-workspace-submission-status-v2/{submissionId}", + "method": "POST", + "identifier_override": "endpoint_admin.sendWorkspaceSubmissionUpdate" + }, + "snippet": { + "type": "go", + "client": "import (\n\tcontext \"context\"\n\tfern \"github.com/trace/fern\"\n\tfernclient \"github.com/trace/fern/client\"\n\toption \"github.com/trace/fern/option\"\n\tuuid \"github.com/google/uuid\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n)\nerr := client.Admin.SendWorkspaceSubmissionUpdate(\n\tcontext.TODO(),\n\tuuid.MustParse(\n\t\t\"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32\",\n\t),\n\t\u0026fern.WorkspaceSubmissionUpdate{\n\t\tUpdateTime: fern.MustParseDateTime(\n\t\t\t\"2024-01-15T09:30:00Z\",\n\t\t),\n\t\tUpdateInfo: \u0026fern.WorkspaceSubmissionUpdateInfo{\n\t\t\tRunning: fern.RunningSubmissionStateQueueingSubmission,\n\t\t},\n\t},\n)\n" + } + }, + { + "id": { + "path": "/admin/store-workspace-submission-status/{submissionId}", + "method": "POST", + "identifier_override": "endpoint_admin.updateWorkspaceSubmissionStatus" + }, + "snippet": { + "type": "go", + "client": "import (\n\tcontext \"context\"\n\tfern \"github.com/trace/fern\"\n\tfernclient \"github.com/trace/fern/client\"\n\toption \"github.com/trace/fern/option\"\n\tuuid \"github.com/google/uuid\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n)\nerr := client.Admin.UpdateWorkspaceSubmissionStatus(\n\tcontext.TODO(),\n\tuuid.MustParse(\n\t\t\"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32\",\n\t),\n\t\u0026fern.WorkspaceSubmissionStatus{\n\t\tType: \"stopped\",\n\t},\n)\n" + } + }, + { + "id": { + "path": "/admin/store-workspace-trace-v2/submission/{submissionId}", + "method": "POST", + "identifier_override": "endpoint_admin.storeTracedWorkspaceV2" + }, + "snippet": { + "type": "go", + "client": "import (\n\tcontext \"context\"\n\tfern \"github.com/trace/fern\"\n\tfernclient \"github.com/trace/fern/client\"\n\toption \"github.com/trace/fern/option\"\n\tuuid \"github.com/google/uuid\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n)\nerr := client.Admin.StoreTracedWorkspaceV2(\n\tcontext.TODO(),\n\tuuid.MustParse(\n\t\t\"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32\",\n\t),\n\t[]*fern.TraceResponseV2{\n\t\t\u0026fern.TraceResponseV2{\n\t\t\tSubmissionID: uuid.MustParse(\n\t\t\t\t\"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32\",\n\t\t\t),\n\t\t\tLineNumber: 1,\n\t\t\tFile: \u0026fern.TracedFile{\n\t\t\t\tFilename: \"filename\",\n\t\t\t\tDirectory: \"directory\",\n\t\t\t},\n\t\t\tReturnValue: \u0026fern.DebugVariableValue{\n\t\t\t\tIntegerValue: 1,\n\t\t\t},\n\t\t\tExpressionLocation: \u0026fern.ExpressionLocation{\n\t\t\t\tStart: 1,\n\t\t\t\tOffset: 1,\n\t\t\t},\n\t\t\tStack: \u0026fern.StackInformation{\n\t\t\t\tNumStackFrames: 1,\n\t\t\t\tTopStackFrame: \u0026fern.StackFrame{\n\t\t\t\t\tMethodName: \"methodName\",\n\t\t\t\t\tLineNumber: 1,\n\t\t\t\t\tScopes: []*fern.Scope{\n\t\t\t\t\t\t\u0026fern.Scope{\n\t\t\t\t\t\t\tVariables: map[string]*fern.DebugVariableValue{\n\t\t\t\t\t\t\t\t\"variables\": \u0026fern.DebugVariableValue{\n\t\t\t\t\t\t\t\t\tIntegerValue: 1,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\u0026fern.Scope{\n\t\t\t\t\t\t\tVariables: map[string]*fern.DebugVariableValue{\n\t\t\t\t\t\t\t\t\"variables\": \u0026fern.DebugVariableValue{\n\t\t\t\t\t\t\t\t\tIntegerValue: 1,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tStdout: fern.String(\n\t\t\t\t\"stdout\",\n\t\t\t),\n\t\t},\n\t\t\u0026fern.TraceResponseV2{\n\t\t\tSubmissionID: uuid.MustParse(\n\t\t\t\t\"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32\",\n\t\t\t),\n\t\t\tLineNumber: 1,\n\t\t\tFile: \u0026fern.TracedFile{\n\t\t\t\tFilename: \"filename\",\n\t\t\t\tDirectory: \"directory\",\n\t\t\t},\n\t\t\tReturnValue: \u0026fern.DebugVariableValue{\n\t\t\t\tIntegerValue: 1,\n\t\t\t},\n\t\t\tExpressionLocation: \u0026fern.ExpressionLocation{\n\t\t\t\tStart: 1,\n\t\t\t\tOffset: 1,\n\t\t\t},\n\t\t\tStack: \u0026fern.StackInformation{\n\t\t\t\tNumStackFrames: 1,\n\t\t\t\tTopStackFrame: \u0026fern.StackFrame{\n\t\t\t\t\tMethodName: \"methodName\",\n\t\t\t\t\tLineNumber: 1,\n\t\t\t\t\tScopes: []*fern.Scope{\n\t\t\t\t\t\t\u0026fern.Scope{\n\t\t\t\t\t\t\tVariables: map[string]*fern.DebugVariableValue{\n\t\t\t\t\t\t\t\t\"variables\": \u0026fern.DebugVariableValue{\n\t\t\t\t\t\t\t\t\tIntegerValue: 1,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\u0026fern.Scope{\n\t\t\t\t\t\t\tVariables: map[string]*fern.DebugVariableValue{\n\t\t\t\t\t\t\t\t\"variables\": \u0026fern.DebugVariableValue{\n\t\t\t\t\t\t\t\t\tIntegerValue: 1,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tStdout: fern.String(\n\t\t\t\t\"stdout\",\n\t\t\t),\n\t\t},\n\t},\n)\n" + } + }, + { + "id": { + "path": "/admin/store-workspace-trace/submission/{submissionId}", + "method": "POST", + "identifier_override": "endpoint_admin.storeTracedWorkspace" + }, + "snippet": { + "type": "go", + "client": "import (\n\tcontext \"context\"\n\tfern \"github.com/trace/fern\"\n\tfernclient \"github.com/trace/fern/client\"\n\toption \"github.com/trace/fern/option\"\n\tuuid \"github.com/google/uuid\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n)\nerr := client.Admin.StoreTracedWorkspace(\n\tcontext.TODO(),\n\tuuid.MustParse(\n\t\t\"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32\",\n\t),\n\t\u0026fern.StoreTracedWorkspaceRequest{\n\t\tWorkspaceRunDetails: \u0026fern.WorkspaceRunDetails{\n\t\t\tExceptionV2: \u0026fern.ExceptionV2{\n\t\t\t\tGeneric: \u0026fern.ExceptionInfo{\n\t\t\t\t\tExceptionType: \"exceptionType\",\n\t\t\t\t\tExceptionMessage: \"exceptionMessage\",\n\t\t\t\t\tExceptionStacktrace: \"exceptionStacktrace\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tException: \u0026fern.ExceptionInfo{\n\t\t\t\tExceptionType: \"exceptionType\",\n\t\t\t\tExceptionMessage: \"exceptionMessage\",\n\t\t\t\tExceptionStacktrace: \"exceptionStacktrace\",\n\t\t\t},\n\t\t\tStdout: \"stdout\",\n\t\t},\n\t\tTraceResponses: []*fern.TraceResponse{\n\t\t\t\u0026fern.TraceResponse{\n\t\t\t\tSubmissionID: uuid.MustParse(\n\t\t\t\t\t\"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32\",\n\t\t\t\t),\n\t\t\t\tLineNumber: 1,\n\t\t\t\tReturnValue: \u0026fern.DebugVariableValue{\n\t\t\t\t\tIntegerValue: 1,\n\t\t\t\t},\n\t\t\t\tExpressionLocation: \u0026fern.ExpressionLocation{\n\t\t\t\t\tStart: 1,\n\t\t\t\t\tOffset: 1,\n\t\t\t\t},\n\t\t\t\tStack: \u0026fern.StackInformation{\n\t\t\t\t\tNumStackFrames: 1,\n\t\t\t\t\tTopStackFrame: \u0026fern.StackFrame{\n\t\t\t\t\t\tMethodName: \"methodName\",\n\t\t\t\t\t\tLineNumber: 1,\n\t\t\t\t\t\tScopes: []*fern.Scope{\n\t\t\t\t\t\t\t\u0026fern.Scope{\n\t\t\t\t\t\t\t\tVariables: map[string]*fern.DebugVariableValue{\n\t\t\t\t\t\t\t\t\t\"variables\": \u0026fern.DebugVariableValue{\n\t\t\t\t\t\t\t\t\t\tIntegerValue: 1,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\u0026fern.Scope{\n\t\t\t\t\t\t\t\tVariables: map[string]*fern.DebugVariableValue{\n\t\t\t\t\t\t\t\t\t\"variables\": \u0026fern.DebugVariableValue{\n\t\t\t\t\t\t\t\t\t\tIntegerValue: 1,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tStdout: fern.String(\n\t\t\t\t\t\"stdout\",\n\t\t\t\t),\n\t\t\t},\n\t\t\t\u0026fern.TraceResponse{\n\t\t\t\tSubmissionID: uuid.MustParse(\n\t\t\t\t\t\"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32\",\n\t\t\t\t),\n\t\t\t\tLineNumber: 1,\n\t\t\t\tReturnValue: \u0026fern.DebugVariableValue{\n\t\t\t\t\tIntegerValue: 1,\n\t\t\t\t},\n\t\t\t\tExpressionLocation: \u0026fern.ExpressionLocation{\n\t\t\t\t\tStart: 1,\n\t\t\t\t\tOffset: 1,\n\t\t\t\t},\n\t\t\t\tStack: \u0026fern.StackInformation{\n\t\t\t\t\tNumStackFrames: 1,\n\t\t\t\t\tTopStackFrame: \u0026fern.StackFrame{\n\t\t\t\t\t\tMethodName: \"methodName\",\n\t\t\t\t\t\tLineNumber: 1,\n\t\t\t\t\t\tScopes: []*fern.Scope{\n\t\t\t\t\t\t\t\u0026fern.Scope{\n\t\t\t\t\t\t\t\tVariables: map[string]*fern.DebugVariableValue{\n\t\t\t\t\t\t\t\t\t\"variables\": \u0026fern.DebugVariableValue{\n\t\t\t\t\t\t\t\t\t\tIntegerValue: 1,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\u0026fern.Scope{\n\t\t\t\t\t\t\t\tVariables: map[string]*fern.DebugVariableValue{\n\t\t\t\t\t\t\t\t\t\"variables\": \u0026fern.DebugVariableValue{\n\t\t\t\t\t\t\t\t\t\tIntegerValue: 1,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tStdout: fern.String(\n\t\t\t\t\t\"stdout\",\n\t\t\t\t),\n\t\t\t},\n\t\t},\n\t},\n)\n" + } + }, + { + "id": { + "path": "/homepage-problems", + "method": "GET", + "identifier_override": "endpoint_homepage.getHomepageProblems" + }, + "snippet": { + "type": "go", + "client": "import (\n\tcontext \"context\"\n\tfernclient \"github.com/trace/fern/client\"\n\toption \"github.com/trace/fern/option\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n)\nresponse, err := client.Homepage.GetHomepageProblems(\n\tcontext.TODO(),\n)\n" + } + }, + { + "id": { + "path": "/homepage-problems", + "method": "POST", + "identifier_override": "endpoint_homepage.setHomepageProblems" + }, + "snippet": { + "type": "go", + "client": "import (\n\tcontext \"context\"\n\tfern \"github.com/trace/fern\"\n\tfernclient \"github.com/trace/fern/client\"\n\toption \"github.com/trace/fern/option\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n)\nerr := client.Homepage.SetHomepageProblems(\n\tcontext.TODO(),\n\t[]fern.ProblemID{\n\t\t\"string\",\n\t\t\"string\",\n\t},\n)\n" + } + }, + { + "id": { + "path": "/migration-info/all", + "method": "GET", + "identifier_override": "endpoint_migration.getAttemptedMigrations" + }, + "snippet": { + "type": "go", + "client": "import (\n\tcontext \"context\"\n\tfern \"github.com/trace/fern\"\n\tfernclient \"github.com/trace/fern/client\"\n\toption \"github.com/trace/fern/option\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n)\nresponse, err := client.Migration.GetAttemptedMigrations(\n\tcontext.TODO(),\n\t\u0026fern.GetAttemptedMigrationsRequest{\n\t\tAdminKeyHeader: \"admin-key-header\",\n\t},\n)\n" + } + }, + { + "id": { + "path": "/problem-crud/create", + "method": "POST", + "identifier_override": "endpoint_problem.createProblem" + }, + "snippet": { + "type": "go", + "client": "import (\n\tcontext \"context\"\n\tfern \"github.com/trace/fern\"\n\tfernclient \"github.com/trace/fern/client\"\n\toption \"github.com/trace/fern/option\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n)\nresponse, err := client.Problem.CreateProblem(\n\tcontext.TODO(),\n\t\u0026fern.CreateProblemRequest{\n\t\tProblemName: \"problemName\",\n\t\tProblemDescription: \u0026fern.ProblemDescription{\n\t\t\tBoards: []*fern.ProblemDescriptionBoard{\n\t\t\t\t\u0026fern.ProblemDescriptionBoard{\n\t\t\t\t\tHTML: \"boards\",\n\t\t\t\t},\n\t\t\t\t\u0026fern.ProblemDescriptionBoard{\n\t\t\t\t\tHTML: \"boards\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tFiles: map[fern.Language]*fern.ProblemFiles{\n\t\t\tfern.LanguageJava: \u0026fern.ProblemFiles{\n\t\t\t\tSolutionFile: \u0026fern.FileInfo{\n\t\t\t\t\tFilename: \"filename\",\n\t\t\t\t\tContents: \"contents\",\n\t\t\t\t},\n\t\t\t\tReadOnlyFiles: []*fern.FileInfo{\n\t\t\t\t\t\u0026fern.FileInfo{\n\t\t\t\t\t\tFilename: \"filename\",\n\t\t\t\t\t\tContents: \"contents\",\n\t\t\t\t\t},\n\t\t\t\t\t\u0026fern.FileInfo{\n\t\t\t\t\t\tFilename: \"filename\",\n\t\t\t\t\t\tContents: \"contents\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tInputParams: []*fern.VariableTypeAndName{\n\t\t\t\u0026fern.VariableTypeAndName{\n\t\t\t\tVariableType: \u0026fern.VariableType{\n\t\t\t\t\tType: \"integerType\",\n\t\t\t\t},\n\t\t\t\tName: \"name\",\n\t\t\t},\n\t\t\t\u0026fern.VariableTypeAndName{\n\t\t\t\tVariableType: \u0026fern.VariableType{\n\t\t\t\t\tType: \"integerType\",\n\t\t\t\t},\n\t\t\t\tName: \"name\",\n\t\t\t},\n\t\t},\n\t\tOutputType: \u0026fern.VariableType{\n\t\t\tType: \"integerType\",\n\t\t},\n\t\tTestcases: []*fern.TestCaseWithExpectedResult{\n\t\t\t\u0026fern.TestCaseWithExpectedResult{\n\t\t\t\tTestCase: \u0026fern.TestCase{\n\t\t\t\t\tID: \"id\",\n\t\t\t\t\tParams: []*fern.VariableValue{\n\t\t\t\t\t\t\u0026fern.VariableValue{\n\t\t\t\t\t\t\tIntegerValue: 1,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\u0026fern.VariableValue{\n\t\t\t\t\t\t\tIntegerValue: 1,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tExpectedResult: \u0026fern.VariableValue{\n\t\t\t\t\tIntegerValue: 1,\n\t\t\t\t},\n\t\t\t},\n\t\t\t\u0026fern.TestCaseWithExpectedResult{\n\t\t\t\tTestCase: \u0026fern.TestCase{\n\t\t\t\t\tID: \"id\",\n\t\t\t\t\tParams: []*fern.VariableValue{\n\t\t\t\t\t\t\u0026fern.VariableValue{\n\t\t\t\t\t\t\tIntegerValue: 1,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\u0026fern.VariableValue{\n\t\t\t\t\t\t\tIntegerValue: 1,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tExpectedResult: \u0026fern.VariableValue{\n\t\t\t\t\tIntegerValue: 1,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tMethodName: \"methodName\",\n\t},\n)\n" + } + }, + { + "id": { + "path": "/problem-crud/default-starter-files", + "method": "POST", + "identifier_override": "endpoint_problem.getDefaultStarterFiles" + }, + "snippet": { + "type": "go", + "client": "import (\n\tcontext \"context\"\n\tfern \"github.com/trace/fern\"\n\tfernclient \"github.com/trace/fern/client\"\n\toption \"github.com/trace/fern/option\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n)\nresponse, err := client.Problem.GetDefaultStarterFiles(\n\tcontext.TODO(),\n\t\u0026fern.GetDefaultStarterFilesRequest{\n\t\tInputParams: []*fern.VariableTypeAndName{\n\t\t\t\u0026fern.VariableTypeAndName{\n\t\t\t\tVariableType: \u0026fern.VariableType{\n\t\t\t\t\tType: \"integerType\",\n\t\t\t\t},\n\t\t\t\tName: \"name\",\n\t\t\t},\n\t\t\t\u0026fern.VariableTypeAndName{\n\t\t\t\tVariableType: \u0026fern.VariableType{\n\t\t\t\t\tType: \"integerType\",\n\t\t\t\t},\n\t\t\t\tName: \"name\",\n\t\t\t},\n\t\t},\n\t\tOutputType: \u0026fern.VariableType{\n\t\t\tType: \"integerType\",\n\t\t},\n\t\tMethodName: \"methodName\",\n\t},\n)\n" + } + }, + { + "id": { + "path": "/problem-crud/delete/{problemId}", + "method": "DELETE", + "identifier_override": "endpoint_problem.deleteProblem" + }, + "snippet": { + "type": "go", + "client": "import (\n\tcontext \"context\"\n\tfernclient \"github.com/trace/fern/client\"\n\toption \"github.com/trace/fern/option\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n)\nerr := client.Problem.DeleteProblem(\n\tcontext.TODO(),\n\t\"problemId\",\n)\n" + } + }, + { + "id": { + "path": "/problem-crud/update/{problemId}", + "method": "POST", + "identifier_override": "endpoint_problem.updateProblem" + }, + "snippet": { + "type": "go", + "client": "import (\n\tcontext \"context\"\n\tfern \"github.com/trace/fern\"\n\tfernclient \"github.com/trace/fern/client\"\n\toption \"github.com/trace/fern/option\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n)\nresponse, err := client.Problem.UpdateProblem(\n\tcontext.TODO(),\n\t\"problemId\",\n\t\u0026fern.CreateProblemRequest{\n\t\tProblemName: \"problemName\",\n\t\tProblemDescription: \u0026fern.ProblemDescription{\n\t\t\tBoards: []*fern.ProblemDescriptionBoard{\n\t\t\t\t\u0026fern.ProblemDescriptionBoard{\n\t\t\t\t\tHTML: \"boards\",\n\t\t\t\t},\n\t\t\t\t\u0026fern.ProblemDescriptionBoard{\n\t\t\t\t\tHTML: \"boards\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tFiles: map[fern.Language]*fern.ProblemFiles{\n\t\t\tfern.LanguageJava: \u0026fern.ProblemFiles{\n\t\t\t\tSolutionFile: \u0026fern.FileInfo{\n\t\t\t\t\tFilename: \"filename\",\n\t\t\t\t\tContents: \"contents\",\n\t\t\t\t},\n\t\t\t\tReadOnlyFiles: []*fern.FileInfo{\n\t\t\t\t\t\u0026fern.FileInfo{\n\t\t\t\t\t\tFilename: \"filename\",\n\t\t\t\t\t\tContents: \"contents\",\n\t\t\t\t\t},\n\t\t\t\t\t\u0026fern.FileInfo{\n\t\t\t\t\t\tFilename: \"filename\",\n\t\t\t\t\t\tContents: \"contents\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tInputParams: []*fern.VariableTypeAndName{\n\t\t\t\u0026fern.VariableTypeAndName{\n\t\t\t\tVariableType: \u0026fern.VariableType{\n\t\t\t\t\tType: \"integerType\",\n\t\t\t\t},\n\t\t\t\tName: \"name\",\n\t\t\t},\n\t\t\t\u0026fern.VariableTypeAndName{\n\t\t\t\tVariableType: \u0026fern.VariableType{\n\t\t\t\t\tType: \"integerType\",\n\t\t\t\t},\n\t\t\t\tName: \"name\",\n\t\t\t},\n\t\t},\n\t\tOutputType: \u0026fern.VariableType{\n\t\t\tType: \"integerType\",\n\t\t},\n\t\tTestcases: []*fern.TestCaseWithExpectedResult{\n\t\t\t\u0026fern.TestCaseWithExpectedResult{\n\t\t\t\tTestCase: \u0026fern.TestCase{\n\t\t\t\t\tID: \"id\",\n\t\t\t\t\tParams: []*fern.VariableValue{\n\t\t\t\t\t\t\u0026fern.VariableValue{\n\t\t\t\t\t\t\tIntegerValue: 1,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\u0026fern.VariableValue{\n\t\t\t\t\t\t\tIntegerValue: 1,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tExpectedResult: \u0026fern.VariableValue{\n\t\t\t\t\tIntegerValue: 1,\n\t\t\t\t},\n\t\t\t},\n\t\t\t\u0026fern.TestCaseWithExpectedResult{\n\t\t\t\tTestCase: \u0026fern.TestCase{\n\t\t\t\t\tID: \"id\",\n\t\t\t\t\tParams: []*fern.VariableValue{\n\t\t\t\t\t\t\u0026fern.VariableValue{\n\t\t\t\t\t\t\tIntegerValue: 1,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\u0026fern.VariableValue{\n\t\t\t\t\t\t\tIntegerValue: 1,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tExpectedResult: \u0026fern.VariableValue{\n\t\t\t\t\tIntegerValue: 1,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tMethodName: \"methodName\",\n\t},\n)\n" + } + }, + { + "id": { + "path": "/problems-v2/lightweight-problem-info", + "method": "GET", + "identifier_override": "endpoint_v2/problem.getLightweightProblems" + }, + "snippet": { + "type": "go", + "client": "import (\n\tcontext \"context\"\n\tfernclient \"github.com/trace/fern/client\"\n\toption \"github.com/trace/fern/option\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n)\nresponse, err := client.V2.Problem.GetLightweightProblems(\n\tcontext.TODO(),\n)\n" + } + }, + { + "id": { + "path": "/problems-v2/lightweight-problem-info", + "method": "GET", + "identifier_override": "endpoint_v2/v3/problem.getLightweightProblems" + }, + "snippet": { + "type": "go", + "client": "import (\n\tcontext \"context\"\n\tfernclient \"github.com/trace/fern/client\"\n\toption \"github.com/trace/fern/option\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n)\nresponse, err := client.V2.V3.Problem.GetLightweightProblems(\n\tcontext.TODO(),\n)\n" + } + }, + { + "id": { + "path": "/problems-v2/problem-info", + "method": "GET", + "identifier_override": "endpoint_v2/problem.getProblems" + }, + "snippet": { + "type": "go", + "client": "import (\n\tcontext \"context\"\n\tfernclient \"github.com/trace/fern/client\"\n\toption \"github.com/trace/fern/option\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n)\nresponse, err := client.V2.Problem.GetProblems(\n\tcontext.TODO(),\n)\n" + } + }, + { + "id": { + "path": "/problems-v2/problem-info", + "method": "GET", + "identifier_override": "endpoint_v2/v3/problem.getProblems" + }, + "snippet": { + "type": "go", + "client": "import (\n\tcontext \"context\"\n\tfernclient \"github.com/trace/fern/client\"\n\toption \"github.com/trace/fern/option\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n)\nresponse, err := client.V2.V3.Problem.GetProblems(\n\tcontext.TODO(),\n)\n" + } + }, + { + "id": { + "path": "/problems-v2/problem-info/{problemId}", + "method": "GET", + "identifier_override": "endpoint_v2/problem.getLatestProblem" + }, + "snippet": { + "type": "go", + "client": "import (\n\tcontext \"context\"\n\tfernclient \"github.com/trace/fern/client\"\n\toption \"github.com/trace/fern/option\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n)\nresponse, err := client.V2.Problem.GetLatestProblem(\n\tcontext.TODO(),\n\t\"problemId\",\n)\n" + } + }, + { + "id": { + "path": "/problems-v2/problem-info/{problemId}", + "method": "GET", + "identifier_override": "endpoint_v2/v3/problem.getLatestProblem" + }, + "snippet": { + "type": "go", + "client": "import (\n\tcontext \"context\"\n\tfernclient \"github.com/trace/fern/client\"\n\toption \"github.com/trace/fern/option\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n)\nresponse, err := client.V2.V3.Problem.GetLatestProblem(\n\tcontext.TODO(),\n\t\"problemId\",\n)\n" + } + }, + { + "id": { + "path": "/problems-v2/problem-info/{problemId}/version/{problemVersion}", + "method": "GET", + "identifier_override": "endpoint_v2/problem.getProblemVersion" + }, + "snippet": { + "type": "go", + "client": "import (\n\tcontext \"context\"\n\tfernclient \"github.com/trace/fern/client\"\n\toption \"github.com/trace/fern/option\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n)\nresponse, err := client.V2.Problem.GetProblemVersion(\n\tcontext.TODO(),\n\t\"problemId\",\n\t1,\n)\n" + } + }, + { + "id": { + "path": "/problems-v2/problem-info/{problemId}/version/{problemVersion}", + "method": "GET", + "identifier_override": "endpoint_v2/v3/problem.getProblemVersion" + }, + "snippet": { + "type": "go", + "client": "import (\n\tcontext \"context\"\n\tfernclient \"github.com/trace/fern/client\"\n\toption \"github.com/trace/fern/option\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n)\nresponse, err := client.V2.V3.Problem.GetProblemVersion(\n\tcontext.TODO(),\n\t\"problemId\",\n\t1,\n)\n" + } + }, + { + "id": { + "path": "/sessions/create-session/{language}", + "method": "POST", + "identifier_override": "endpoint_submission.createExecutionSession" + }, + "snippet": { + "type": "go", + "client": "import (\n\tcontext \"context\"\n\tfern \"github.com/trace/fern\"\n\tfernclient \"github.com/trace/fern/client\"\n\toption \"github.com/trace/fern/option\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n)\nresponse, err := client.Submission.CreateExecutionSession(\n\tcontext.TODO(),\n\tfern.LanguageJava,\n)\n" + } + }, + { + "id": { + "path": "/sessions/execution-sessions-state", + "method": "GET", + "identifier_override": "endpoint_submission.getExecutionSessionsState" + }, + "snippet": { + "type": "go", + "client": "import (\n\tcontext \"context\"\n\tfernclient \"github.com/trace/fern/client\"\n\toption \"github.com/trace/fern/option\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n)\nresponse, err := client.Submission.GetExecutionSessionsState(\n\tcontext.TODO(),\n)\n" + } + }, + { + "id": { + "path": "/sessions/stop/{sessionId}", + "method": "DELETE", + "identifier_override": "endpoint_submission.stopExecutionSession" + }, + "snippet": { + "type": "go", + "client": "import (\n\tcontext \"context\"\n\tfernclient \"github.com/trace/fern/client\"\n\toption \"github.com/trace/fern/option\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n)\nerr := client.Submission.StopExecutionSession(\n\tcontext.TODO(),\n\t\"sessionId\",\n)\n" + } + }, + { + "id": { + "path": "/sessions/{sessionId}", + "method": "GET", + "identifier_override": "endpoint_submission.getExecutionSession" + }, + "snippet": { + "type": "go", + "client": "import (\n\tcontext \"context\"\n\tfernclient \"github.com/trace/fern/client\"\n\toption \"github.com/trace/fern/option\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n)\nresponse, err := client.Submission.GetExecutionSession(\n\tcontext.TODO(),\n\t\"sessionId\",\n)\n" + } + }, + { + "id": { + "path": "/sysprop/num-warm-instances", + "method": "GET", + "identifier_override": "endpoint_sysprop.getNumWarmInstances" + }, + "snippet": { + "type": "go", + "client": "import (\n\tcontext \"context\"\n\tfernclient \"github.com/trace/fern/client\"\n\toption \"github.com/trace/fern/option\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n)\nresponse, err := client.Sysprop.GetNumWarmInstances(\n\tcontext.TODO(),\n)\n" + } + }, + { + "id": { + "path": "/sysprop/num-warm-instances/{language}/{numWarmInstances}", + "method": "PUT", + "identifier_override": "endpoint_sysprop.setNumWarmInstances" + }, + "snippet": { + "type": "go", + "client": "import (\n\tcontext \"context\"\n\tfern \"github.com/trace/fern\"\n\tfernclient \"github.com/trace/fern/client\"\n\toption \"github.com/trace/fern/option\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n)\nerr := client.Sysprop.SetNumWarmInstances(\n\tcontext.TODO(),\n\tfern.LanguageJava,\n\t1,\n)\n" + } + }, + { + "id": { + "path": "/v2/playlist/{serviceParam}/all", + "method": "GET", + "identifier_override": "endpoint_playlist.getPlaylists" + }, + "snippet": { + "type": "go", + "client": "import (\n\tcontext \"context\"\n\tfern \"github.com/trace/fern\"\n\tfernclient \"github.com/trace/fern/client\"\n\toption \"github.com/trace/fern/option\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n)\nresponse, err := client.Playlist.GetPlaylists(\n\tcontext.TODO(),\n\t1,\n\t\u0026fern.GetPlaylistsRequest{\n\t\tLimit: fern.Int(\n\t\t\t1,\n\t\t),\n\t\tOtherField: \"otherField\",\n\t\tMultiLineDocs: \"multiLineDocs\",\n\t\tOptionalMultipleField: []*string{\n\t\t\tfern.String(\n\t\t\t\t\"optionalMultipleField\",\n\t\t\t),\n\t\t},\n\t\tMultipleField: []string{\n\t\t\t\"multipleField\",\n\t\t},\n\t},\n)\n" + } + }, + { + "id": { + "path": "/v2/playlist/{serviceParam}/create", + "method": "POST", + "identifier_override": "endpoint_playlist.createPlaylist" + }, + "snippet": { + "type": "go", + "client": "import (\n\tcontext \"context\"\n\tfern \"github.com/trace/fern\"\n\tfernclient \"github.com/trace/fern/client\"\n\toption \"github.com/trace/fern/option\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n)\nresponse, err := client.Playlist.CreatePlaylist(\n\tcontext.TODO(),\n\t1,\n\t\u0026fern.CreatePlaylistRequest{\n\t\tDatetime: fern.MustParseDateTime(\n\t\t\t\"2024-01-15T09:30:00Z\",\n\t\t),\n\t\tOptionalDatetime: fern.Time(\n\t\t\tfern.MustParseDateTime(\n\t\t\t\t\"2024-01-15T09:30:00Z\",\n\t\t\t),\n\t\t),\n\t\tBody: \u0026fern.PlaylistCreateRequest{\n\t\t\tName: \"name\",\n\t\t\tProblems: []fern.ProblemID{\n\t\t\t\t\"problems\",\n\t\t\t\t\"problems\",\n\t\t\t},\n\t\t},\n\t},\n)\n" + } + }, + { + "id": { + "path": "/v2/playlist/{serviceParam}/{playlistId}", + "method": "GET", + "identifier_override": "endpoint_playlist.getPlaylist" + }, + "snippet": { + "type": "go", + "client": "import (\n\tcontext \"context\"\n\tfernclient \"github.com/trace/fern/client\"\n\toption \"github.com/trace/fern/option\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n)\nresponse, err := client.Playlist.GetPlaylist(\n\tcontext.TODO(),\n\t1,\n\t\"playlistId\",\n)\n" + } + }, + { + "id": { + "path": "/v2/playlist/{serviceParam}/{playlistId}", + "method": "PUT", + "identifier_override": "endpoint_playlist.updatePlaylist" + }, + "snippet": { + "type": "go", + "client": "import (\n\tcontext \"context\"\n\tfern \"github.com/trace/fern\"\n\tfernclient \"github.com/trace/fern/client\"\n\toption \"github.com/trace/fern/option\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n)\nresponse, err := client.Playlist.UpdatePlaylist(\n\tcontext.TODO(),\n\t1,\n\t\"playlistId\",\n\t\u0026fern.UpdatePlaylistRequest{\n\t\tName: \"name\",\n\t\tProblems: []fern.ProblemID{\n\t\t\t\"problems\",\n\t\t\t\"problems\",\n\t\t},\n\t},\n)\n" + } + }, + { + "id": { + "path": "/v2/playlist/{serviceParam}/{playlist_id}", + "method": "DELETE", + "identifier_override": "endpoint_playlist.deletePlaylist" + }, + "snippet": { + "type": "go", + "client": "import (\n\tcontext \"context\"\n\tfernclient \"github.com/trace/fern/client\"\n\toption \"github.com/trace/fern/option\"\n)\n\nclient := fernclient.NewClient(\n\toption.WithToken(\n\t\t\"\u003cYOUR_AUTH_TOKEN\u003e\",\n\t),\n)\nerr := client.Playlist.DeletePlaylist(\n\tcontext.TODO(),\n\t1,\n\t\"playlist_id\",\n)\n" + } + } + ] +} \ No newline at end of file diff --git a/seed/go-sdk/trace/submission.go b/seed/go-sdk/trace/submission.go new file mode 100644 index 000000000000..d74901d1607f --- /dev/null +++ b/seed/go-sdk/trace/submission.go @@ -0,0 +1,9389 @@ +// Code generated by Fern. DO NOT EDIT. + +package trace + +import ( + json "encoding/json" + fmt "fmt" + uuid "github.com/google/uuid" + common "github.com/trace/fern/common" + v2 "github.com/trace/fern/common/v2" + internal "github.com/trace/fern/internal" + big "math/big" + time "time" +) + +type ActualResult struct { + Type string + Value *common.VariableValue + Exception *ExceptionInfo + ExceptionV2 *ExceptionV2 + + rawJSON json.RawMessage +} + +func (a *ActualResult) GetType() string { + if a == nil { + return "" + } + return a.Type +} + +func (a *ActualResult) GetValue() *common.VariableValue { + if a == nil { + return nil + } + return a.Value +} + +func (a *ActualResult) GetException() *ExceptionInfo { + if a == nil { + return nil + } + return a.Exception +} + +func (a *ActualResult) GetExceptionV2() *ExceptionV2 { + if a == nil { + return nil + } + return a.ExceptionV2 +} + +func (a *ActualResult) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + a.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", a) + } + switch unmarshaler.Type { + case "value": + var valueUnmarshaler struct { + Value *common.VariableValue `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + a.Value = valueUnmarshaler.Value + case "exception": + value := new(ExceptionInfo) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + a.Exception = value + case "exceptionV2": + var valueUnmarshaler struct { + ExceptionV2 *ExceptionV2 `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + a.ExceptionV2 = valueUnmarshaler.ExceptionV2 + } + a.rawJSON = json.RawMessage(data) + return nil +} + +func (a ActualResult) MarshalJSON() ([]byte, error) { + if err := a.validate(); err != nil { + return nil, err + } + if a.Value != nil { + var marshaler = struct { + Type string `json:"type"` + Value *common.VariableValue `json:"value"` + }{ + Type: "value", + Value: a.Value, + } + return json.Marshal(marshaler) + } + if a.Exception != nil { + return internal.MarshalJSONWithExtraProperty(a.Exception, "type", "exception") + } + if a.ExceptionV2 != nil { + var marshaler = struct { + Type string `json:"type"` + ExceptionV2 *ExceptionV2 `json:"value"` + }{ + Type: "exceptionV2", + ExceptionV2: a.ExceptionV2, + } + return json.Marshal(marshaler) + } + if len(a.rawJSON) > 0 { + return a.rawJSON, nil + } + return nil, fmt.Errorf("type %T does not define a non-empty union type", a) +} + +type ActualResultVisitor interface { + VisitValue(*common.VariableValue) error + VisitException(*ExceptionInfo) error + VisitExceptionV2(*ExceptionV2) error +} + +func (a *ActualResult) Accept(visitor ActualResultVisitor) error { + if a.Value != nil { + return visitor.VisitValue(a.Value) + } + if a.Exception != nil { + return visitor.VisitException(a.Exception) + } + if a.ExceptionV2 != nil { + return visitor.VisitExceptionV2(a.ExceptionV2) + } + return fmt.Errorf("type %T does not define a non-empty union type", a) +} + +func (a *ActualResult) validate() error { + if a == nil { + return fmt.Errorf("type %T is nil", a) + } + var fields []string + if a.Value != nil { + fields = append(fields, "value") + } + if a.Exception != nil { + fields = append(fields, "exception") + } + if a.ExceptionV2 != nil { + fields = append(fields, "exceptionV2") + } + if len(fields) == 0 { + if a.Type != "" { + if len(a.rawJSON) > 0 { + return nil + } + return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", a, a.Type) + } + return fmt.Errorf("type %T is empty", a) + } + if len(fields) > 1 { + return fmt.Errorf("type %T defines values for %s, but only one value is allowed", a, fields) + } + if a.Type != "" { + field := fields[0] + if a.Type != field { + return fmt.Errorf( + "type %T defines a discriminant set to %q, but it does not match the %T field; either remove or update the discriminant to match", + a, + a.Type, + a, + ) + } + } + return nil +} + +var ( + buildingExecutorResponseFieldSubmissionID = big.NewInt(1 << 0) + buildingExecutorResponseFieldStatus = big.NewInt(1 << 1) +) + +type BuildingExecutorResponse struct { + SubmissionID SubmissionID `json:"submissionId" url:"submissionId"` + Status ExecutionSessionStatus `json:"status" url:"status"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (b *BuildingExecutorResponse) GetSubmissionID() SubmissionID { + if b == nil { + return uuid.Nil + } + return b.SubmissionID +} + +func (b *BuildingExecutorResponse) GetStatus() ExecutionSessionStatus { + if b == nil { + return "" + } + return b.Status +} + +func (b *BuildingExecutorResponse) GetExtraProperties() map[string]interface{} { + if b == nil { + return nil + } + return b.extraProperties +} + +func (b *BuildingExecutorResponse) require(field *big.Int) { + if b.explicitFields == nil { + b.explicitFields = big.NewInt(0) + } + b.explicitFields.Or(b.explicitFields, field) +} + +// SetSubmissionID sets the SubmissionID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BuildingExecutorResponse) SetSubmissionID(submissionID SubmissionID) { + b.SubmissionID = submissionID + b.require(buildingExecutorResponseFieldSubmissionID) +} + +// SetStatus sets the Status field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BuildingExecutorResponse) SetStatus(status ExecutionSessionStatus) { + b.Status = status + b.require(buildingExecutorResponseFieldStatus) +} + +func (b *BuildingExecutorResponse) UnmarshalJSON(data []byte) error { + type unmarshaler BuildingExecutorResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *b = BuildingExecutorResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *b) + if err != nil { + return err + } + b.extraProperties = extraProperties + b.rawJSON = json.RawMessage(data) + return nil +} + +func (b *BuildingExecutorResponse) MarshalJSON() ([]byte, error) { + type embed BuildingExecutorResponse + var marshaler = struct { + embed + }{ + embed: embed(*b), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, b.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (b *BuildingExecutorResponse) String() string { + if b == nil { + return "" + } + if len(b.rawJSON) > 0 { + if value, err := internal.StringifyJSON(b.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(b); err == nil { + return value + } + return fmt.Sprintf("%#v", b) +} + +type CodeExecutionUpdate struct { + Type string + // Statuses if an executor for the session isn't ready (Before RunningResponse). + BuildingExecutor *BuildingExecutorResponse + // Sent once a test submission is executing. + Running *RunningResponse + // Sent if a submission cannot be run (i.e. Compile Error). + Errored *ErroredResponse + // Sent if a submission is stopped. + Stopped *StoppedResponse + // Graded testcases without trace information. + Graded *GradedResponse + // Graded submission for v2 problems. + GradedV2 *GradedResponseV2 + // Workspace run without trace information. + WorkspaceRan *WorkspaceRanResponse + // Gives progress about what is being recorded. + Recording *RecordingResponseNotification + // Graded testcases with trace information. + Recorded *RecordedResponseNotification + // Sent if an invalid request is sent for a submission. + InvalidRequest *InvalidRequestResponse + // Sent once a submission is graded and fully recorded. + Finished *FinishedResponse + + rawJSON json.RawMessage +} + +func (c *CodeExecutionUpdate) GetType() string { + if c == nil { + return "" + } + return c.Type +} + +func (c *CodeExecutionUpdate) GetBuildingExecutor() *BuildingExecutorResponse { + if c == nil { + return nil + } + return c.BuildingExecutor +} + +func (c *CodeExecutionUpdate) GetRunning() *RunningResponse { + if c == nil { + return nil + } + return c.Running +} + +func (c *CodeExecutionUpdate) GetErrored() *ErroredResponse { + if c == nil { + return nil + } + return c.Errored +} + +func (c *CodeExecutionUpdate) GetStopped() *StoppedResponse { + if c == nil { + return nil + } + return c.Stopped +} + +func (c *CodeExecutionUpdate) GetGraded() *GradedResponse { + if c == nil { + return nil + } + return c.Graded +} + +func (c *CodeExecutionUpdate) GetGradedV2() *GradedResponseV2 { + if c == nil { + return nil + } + return c.GradedV2 +} + +func (c *CodeExecutionUpdate) GetWorkspaceRan() *WorkspaceRanResponse { + if c == nil { + return nil + } + return c.WorkspaceRan +} + +func (c *CodeExecutionUpdate) GetRecording() *RecordingResponseNotification { + if c == nil { + return nil + } + return c.Recording +} + +func (c *CodeExecutionUpdate) GetRecorded() *RecordedResponseNotification { + if c == nil { + return nil + } + return c.Recorded +} + +func (c *CodeExecutionUpdate) GetInvalidRequest() *InvalidRequestResponse { + if c == nil { + return nil + } + return c.InvalidRequest +} + +func (c *CodeExecutionUpdate) GetFinished() *FinishedResponse { + if c == nil { + return nil + } + return c.Finished +} + +func (c *CodeExecutionUpdate) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + c.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", c) + } + switch unmarshaler.Type { + case "buildingExecutor": + value := new(BuildingExecutorResponse) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.BuildingExecutor = value + case "running": + value := new(RunningResponse) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.Running = value + case "errored": + value := new(ErroredResponse) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.Errored = value + case "stopped": + value := new(StoppedResponse) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.Stopped = value + case "graded": + value := new(GradedResponse) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.Graded = value + case "gradedV2": + value := new(GradedResponseV2) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.GradedV2 = value + case "workspaceRan": + value := new(WorkspaceRanResponse) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.WorkspaceRan = value + case "recording": + value := new(RecordingResponseNotification) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.Recording = value + case "recorded": + value := new(RecordedResponseNotification) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.Recorded = value + case "invalidRequest": + value := new(InvalidRequestResponse) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.InvalidRequest = value + case "finished": + value := new(FinishedResponse) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.Finished = value + } + c.rawJSON = json.RawMessage(data) + return nil +} + +func (c CodeExecutionUpdate) MarshalJSON() ([]byte, error) { + if err := c.validate(); err != nil { + return nil, err + } + if c.BuildingExecutor != nil { + return internal.MarshalJSONWithExtraProperty(c.BuildingExecutor, "type", "buildingExecutor") + } + if c.Running != nil { + return internal.MarshalJSONWithExtraProperty(c.Running, "type", "running") + } + if c.Errored != nil { + return internal.MarshalJSONWithExtraProperty(c.Errored, "type", "errored") + } + if c.Stopped != nil { + return internal.MarshalJSONWithExtraProperty(c.Stopped, "type", "stopped") + } + if c.Graded != nil { + return internal.MarshalJSONWithExtraProperty(c.Graded, "type", "graded") + } + if c.GradedV2 != nil { + return internal.MarshalJSONWithExtraProperty(c.GradedV2, "type", "gradedV2") + } + if c.WorkspaceRan != nil { + return internal.MarshalJSONWithExtraProperty(c.WorkspaceRan, "type", "workspaceRan") + } + if c.Recording != nil { + return internal.MarshalJSONWithExtraProperty(c.Recording, "type", "recording") + } + if c.Recorded != nil { + return internal.MarshalJSONWithExtraProperty(c.Recorded, "type", "recorded") + } + if c.InvalidRequest != nil { + return internal.MarshalJSONWithExtraProperty(c.InvalidRequest, "type", "invalidRequest") + } + if c.Finished != nil { + return internal.MarshalJSONWithExtraProperty(c.Finished, "type", "finished") + } + if len(c.rawJSON) > 0 { + return c.rawJSON, nil + } + return nil, fmt.Errorf("type %T does not define a non-empty union type", c) +} + +type CodeExecutionUpdateVisitor interface { + VisitBuildingExecutor(*BuildingExecutorResponse) error + VisitRunning(*RunningResponse) error + VisitErrored(*ErroredResponse) error + VisitStopped(*StoppedResponse) error + VisitGraded(*GradedResponse) error + VisitGradedV2(*GradedResponseV2) error + VisitWorkspaceRan(*WorkspaceRanResponse) error + VisitRecording(*RecordingResponseNotification) error + VisitRecorded(*RecordedResponseNotification) error + VisitInvalidRequest(*InvalidRequestResponse) error + VisitFinished(*FinishedResponse) error +} + +func (c *CodeExecutionUpdate) Accept(visitor CodeExecutionUpdateVisitor) error { + if c.BuildingExecutor != nil { + return visitor.VisitBuildingExecutor(c.BuildingExecutor) + } + if c.Running != nil { + return visitor.VisitRunning(c.Running) + } + if c.Errored != nil { + return visitor.VisitErrored(c.Errored) + } + if c.Stopped != nil { + return visitor.VisitStopped(c.Stopped) + } + if c.Graded != nil { + return visitor.VisitGraded(c.Graded) + } + if c.GradedV2 != nil { + return visitor.VisitGradedV2(c.GradedV2) + } + if c.WorkspaceRan != nil { + return visitor.VisitWorkspaceRan(c.WorkspaceRan) + } + if c.Recording != nil { + return visitor.VisitRecording(c.Recording) + } + if c.Recorded != nil { + return visitor.VisitRecorded(c.Recorded) + } + if c.InvalidRequest != nil { + return visitor.VisitInvalidRequest(c.InvalidRequest) + } + if c.Finished != nil { + return visitor.VisitFinished(c.Finished) + } + return fmt.Errorf("type %T does not define a non-empty union type", c) +} + +func (c *CodeExecutionUpdate) validate() error { + if c == nil { + return fmt.Errorf("type %T is nil", c) + } + var fields []string + if c.BuildingExecutor != nil { + fields = append(fields, "buildingExecutor") + } + if c.Running != nil { + fields = append(fields, "running") + } + if c.Errored != nil { + fields = append(fields, "errored") + } + if c.Stopped != nil { + fields = append(fields, "stopped") + } + if c.Graded != nil { + fields = append(fields, "graded") + } + if c.GradedV2 != nil { + fields = append(fields, "gradedV2") + } + if c.WorkspaceRan != nil { + fields = append(fields, "workspaceRan") + } + if c.Recording != nil { + fields = append(fields, "recording") + } + if c.Recorded != nil { + fields = append(fields, "recorded") + } + if c.InvalidRequest != nil { + fields = append(fields, "invalidRequest") + } + if c.Finished != nil { + fields = append(fields, "finished") + } + if len(fields) == 0 { + if c.Type != "" { + if len(c.rawJSON) > 0 { + return nil + } + return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", c, c.Type) + } + return fmt.Errorf("type %T is empty", c) + } + if len(fields) > 1 { + return fmt.Errorf("type %T defines values for %s, but only one value is allowed", c, fields) + } + if c.Type != "" { + field := fields[0] + if c.Type != field { + return fmt.Errorf( + "type %T defines a discriminant set to %q, but it does not match the %T field; either remove or update the discriminant to match", + c, + c.Type, + c, + ) + } + } + return nil +} + +var ( + compileErrorFieldMessage = big.NewInt(1 << 0) +) + +type CompileError struct { + Message string `json:"message" url:"message"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (c *CompileError) GetMessage() string { + if c == nil { + return "" + } + return c.Message +} + +func (c *CompileError) GetExtraProperties() map[string]interface{} { + if c == nil { + return nil + } + return c.extraProperties +} + +func (c *CompileError) require(field *big.Int) { + if c.explicitFields == nil { + c.explicitFields = big.NewInt(0) + } + c.explicitFields.Or(c.explicitFields, field) +} + +// SetMessage sets the Message field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CompileError) SetMessage(message string) { + c.Message = message + c.require(compileErrorFieldMessage) +} + +func (c *CompileError) UnmarshalJSON(data []byte) error { + type unmarshaler CompileError + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CompileError(value) + extraProperties, err := internal.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + c.rawJSON = json.RawMessage(data) + return nil +} + +func (c *CompileError) MarshalJSON() ([]byte, error) { + type embed CompileError + var marshaler = struct { + embed + }{ + embed: embed(*c), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, c.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (c *CompileError) String() string { + if c == nil { + return "" + } + if len(c.rawJSON) > 0 { + if value, err := internal.StringifyJSON(c.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +var ( + customTestCasesUnsupportedFieldProblemID = big.NewInt(1 << 0) + customTestCasesUnsupportedFieldSubmissionID = big.NewInt(1 << 1) +) + +type CustomTestCasesUnsupported struct { + ProblemID common.ProblemID `json:"problemId" url:"problemId"` + SubmissionID SubmissionID `json:"submissionId" url:"submissionId"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (c *CustomTestCasesUnsupported) GetProblemID() common.ProblemID { + if c == nil { + return "" + } + return c.ProblemID +} + +func (c *CustomTestCasesUnsupported) GetSubmissionID() SubmissionID { + if c == nil { + return uuid.Nil + } + return c.SubmissionID +} + +func (c *CustomTestCasesUnsupported) GetExtraProperties() map[string]interface{} { + if c == nil { + return nil + } + return c.extraProperties +} + +func (c *CustomTestCasesUnsupported) require(field *big.Int) { + if c.explicitFields == nil { + c.explicitFields = big.NewInt(0) + } + c.explicitFields.Or(c.explicitFields, field) +} + +// SetProblemID sets the ProblemID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CustomTestCasesUnsupported) SetProblemID(problemID common.ProblemID) { + c.ProblemID = problemID + c.require(customTestCasesUnsupportedFieldProblemID) +} + +// SetSubmissionID sets the SubmissionID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CustomTestCasesUnsupported) SetSubmissionID(submissionID SubmissionID) { + c.SubmissionID = submissionID + c.require(customTestCasesUnsupportedFieldSubmissionID) +} + +func (c *CustomTestCasesUnsupported) UnmarshalJSON(data []byte) error { + type unmarshaler CustomTestCasesUnsupported + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomTestCasesUnsupported(value) + extraProperties, err := internal.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + c.rawJSON = json.RawMessage(data) + return nil +} + +func (c *CustomTestCasesUnsupported) MarshalJSON() ([]byte, error) { + type embed CustomTestCasesUnsupported + var marshaler = struct { + embed + }{ + embed: embed(*c), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, c.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (c *CustomTestCasesUnsupported) String() string { + if c == nil { + return "" + } + if len(c.rawJSON) > 0 { + if value, err := internal.StringifyJSON(c.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +type ErrorInfo struct { + Type string + CompileError *CompileError + // If the submission cannot be executed and throws a runtime error before getting to any of the testcases. + RuntimeError *RuntimeError + // If the trace backend encounters an unexpected error. + InternalError *InternalError + + rawJSON json.RawMessage +} + +func (e *ErrorInfo) GetType() string { + if e == nil { + return "" + } + return e.Type +} + +func (e *ErrorInfo) GetCompileError() *CompileError { + if e == nil { + return nil + } + return e.CompileError +} + +func (e *ErrorInfo) GetRuntimeError() *RuntimeError { + if e == nil { + return nil + } + return e.RuntimeError +} + +func (e *ErrorInfo) GetInternalError() *InternalError { + if e == nil { + return nil + } + return e.InternalError +} + +func (e *ErrorInfo) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + e.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", e) + } + switch unmarshaler.Type { + case "compileError": + value := new(CompileError) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + e.CompileError = value + case "runtimeError": + value := new(RuntimeError) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + e.RuntimeError = value + case "internalError": + value := new(InternalError) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + e.InternalError = value + } + e.rawJSON = json.RawMessage(data) + return nil +} + +func (e ErrorInfo) MarshalJSON() ([]byte, error) { + if err := e.validate(); err != nil { + return nil, err + } + if e.CompileError != nil { + return internal.MarshalJSONWithExtraProperty(e.CompileError, "type", "compileError") + } + if e.RuntimeError != nil { + return internal.MarshalJSONWithExtraProperty(e.RuntimeError, "type", "runtimeError") + } + if e.InternalError != nil { + return internal.MarshalJSONWithExtraProperty(e.InternalError, "type", "internalError") + } + if len(e.rawJSON) > 0 { + return e.rawJSON, nil + } + return nil, fmt.Errorf("type %T does not define a non-empty union type", e) +} + +type ErrorInfoVisitor interface { + VisitCompileError(*CompileError) error + VisitRuntimeError(*RuntimeError) error + VisitInternalError(*InternalError) error +} + +func (e *ErrorInfo) Accept(visitor ErrorInfoVisitor) error { + if e.CompileError != nil { + return visitor.VisitCompileError(e.CompileError) + } + if e.RuntimeError != nil { + return visitor.VisitRuntimeError(e.RuntimeError) + } + if e.InternalError != nil { + return visitor.VisitInternalError(e.InternalError) + } + return fmt.Errorf("type %T does not define a non-empty union type", e) +} + +func (e *ErrorInfo) validate() error { + if e == nil { + return fmt.Errorf("type %T is nil", e) + } + var fields []string + if e.CompileError != nil { + fields = append(fields, "compileError") + } + if e.RuntimeError != nil { + fields = append(fields, "runtimeError") + } + if e.InternalError != nil { + fields = append(fields, "internalError") + } + if len(fields) == 0 { + if e.Type != "" { + if len(e.rawJSON) > 0 { + return nil + } + return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", e, e.Type) + } + return fmt.Errorf("type %T is empty", e) + } + if len(fields) > 1 { + return fmt.Errorf("type %T defines values for %s, but only one value is allowed", e, fields) + } + if e.Type != "" { + field := fields[0] + if e.Type != field { + return fmt.Errorf( + "type %T defines a discriminant set to %q, but it does not match the %T field; either remove or update the discriminant to match", + e, + e.Type, + e, + ) + } + } + return nil +} + +var ( + erroredResponseFieldSubmissionID = big.NewInt(1 << 0) + erroredResponseFieldErrorInfo = big.NewInt(1 << 1) +) + +type ErroredResponse struct { + SubmissionID SubmissionID `json:"submissionId" url:"submissionId"` + ErrorInfo *ErrorInfo `json:"errorInfo" url:"errorInfo"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (e *ErroredResponse) GetSubmissionID() SubmissionID { + if e == nil { + return uuid.Nil + } + return e.SubmissionID +} + +func (e *ErroredResponse) GetErrorInfo() *ErrorInfo { + if e == nil { + return nil + } + return e.ErrorInfo +} + +func (e *ErroredResponse) GetExtraProperties() map[string]interface{} { + if e == nil { + return nil + } + return e.extraProperties +} + +func (e *ErroredResponse) require(field *big.Int) { + if e.explicitFields == nil { + e.explicitFields = big.NewInt(0) + } + e.explicitFields.Or(e.explicitFields, field) +} + +// SetSubmissionID sets the SubmissionID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (e *ErroredResponse) SetSubmissionID(submissionID SubmissionID) { + e.SubmissionID = submissionID + e.require(erroredResponseFieldSubmissionID) +} + +// SetErrorInfo sets the ErrorInfo field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (e *ErroredResponse) SetErrorInfo(errorInfo *ErrorInfo) { + e.ErrorInfo = errorInfo + e.require(erroredResponseFieldErrorInfo) +} + +func (e *ErroredResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ErroredResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *e = ErroredResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *e) + if err != nil { + return err + } + e.extraProperties = extraProperties + e.rawJSON = json.RawMessage(data) + return nil +} + +func (e *ErroredResponse) MarshalJSON() ([]byte, error) { + type embed ErroredResponse + var marshaler = struct { + embed + }{ + embed: embed(*e), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, e.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (e *ErroredResponse) String() string { + if e == nil { + return "" + } + if len(e.rawJSON) > 0 { + if value, err := internal.StringifyJSON(e.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(e); err == nil { + return value + } + return fmt.Sprintf("%#v", e) +} + +var ( + exceptionInfoFieldExceptionType = big.NewInt(1 << 0) + exceptionInfoFieldExceptionMessage = big.NewInt(1 << 1) + exceptionInfoFieldExceptionStacktrace = big.NewInt(1 << 2) +) + +type ExceptionInfo struct { + ExceptionType string `json:"exceptionType" url:"exceptionType"` + ExceptionMessage string `json:"exceptionMessage" url:"exceptionMessage"` + ExceptionStacktrace string `json:"exceptionStacktrace" url:"exceptionStacktrace"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (e *ExceptionInfo) GetExceptionType() string { + if e == nil { + return "" + } + return e.ExceptionType +} + +func (e *ExceptionInfo) GetExceptionMessage() string { + if e == nil { + return "" + } + return e.ExceptionMessage +} + +func (e *ExceptionInfo) GetExceptionStacktrace() string { + if e == nil { + return "" + } + return e.ExceptionStacktrace +} + +func (e *ExceptionInfo) GetExtraProperties() map[string]interface{} { + if e == nil { + return nil + } + return e.extraProperties +} + +func (e *ExceptionInfo) require(field *big.Int) { + if e.explicitFields == nil { + e.explicitFields = big.NewInt(0) + } + e.explicitFields.Or(e.explicitFields, field) +} + +// SetExceptionType sets the ExceptionType field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (e *ExceptionInfo) SetExceptionType(exceptionType string) { + e.ExceptionType = exceptionType + e.require(exceptionInfoFieldExceptionType) +} + +// SetExceptionMessage sets the ExceptionMessage field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (e *ExceptionInfo) SetExceptionMessage(exceptionMessage string) { + e.ExceptionMessage = exceptionMessage + e.require(exceptionInfoFieldExceptionMessage) +} + +// SetExceptionStacktrace sets the ExceptionStacktrace field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (e *ExceptionInfo) SetExceptionStacktrace(exceptionStacktrace string) { + e.ExceptionStacktrace = exceptionStacktrace + e.require(exceptionInfoFieldExceptionStacktrace) +} + +func (e *ExceptionInfo) UnmarshalJSON(data []byte) error { + type unmarshaler ExceptionInfo + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *e = ExceptionInfo(value) + extraProperties, err := internal.ExtractExtraProperties(data, *e) + if err != nil { + return err + } + e.extraProperties = extraProperties + e.rawJSON = json.RawMessage(data) + return nil +} + +func (e *ExceptionInfo) MarshalJSON() ([]byte, error) { + type embed ExceptionInfo + var marshaler = struct { + embed + }{ + embed: embed(*e), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, e.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (e *ExceptionInfo) String() string { + if e == nil { + return "" + } + if len(e.rawJSON) > 0 { + if value, err := internal.StringifyJSON(e.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(e); err == nil { + return value + } + return fmt.Sprintf("%#v", e) +} + +type ExceptionV2 struct { + Type string + Generic *ExceptionInfo + Timeout interface{} + + rawJSON json.RawMessage +} + +func (e *ExceptionV2) GetType() string { + if e == nil { + return "" + } + return e.Type +} + +func (e *ExceptionV2) GetGeneric() *ExceptionInfo { + if e == nil { + return nil + } + return e.Generic +} + +func (e *ExceptionV2) GetTimeout() interface{} { + if e == nil { + return nil + } + return e.Timeout +} + +func (e *ExceptionV2) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + e.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", e) + } + switch unmarshaler.Type { + case "generic": + value := new(ExceptionInfo) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + e.Generic = value + case "timeout": + value := make(map[string]interface{}) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + e.Timeout = value + } + e.rawJSON = json.RawMessage(data) + return nil +} + +func (e ExceptionV2) MarshalJSON() ([]byte, error) { + if err := e.validate(); err != nil { + return nil, err + } + if e.Generic != nil { + return internal.MarshalJSONWithExtraProperty(e.Generic, "type", "generic") + } + if e.Timeout != nil { + var marshaler = struct { + Type string `json:"type"` + Timeout interface{} `json:"timeout,omitempty"` + }{ + Type: "timeout", + Timeout: e.Timeout, + } + return json.Marshal(marshaler) + } + if len(e.rawJSON) > 0 { + return e.rawJSON, nil + } + return nil, fmt.Errorf("type %T does not define a non-empty union type", e) +} + +type ExceptionV2Visitor interface { + VisitGeneric(*ExceptionInfo) error + VisitTimeout(interface{}) error +} + +func (e *ExceptionV2) Accept(visitor ExceptionV2Visitor) error { + if e.Generic != nil { + return visitor.VisitGeneric(e.Generic) + } + if e.Timeout != nil { + return visitor.VisitTimeout(e.Timeout) + } + return fmt.Errorf("type %T does not define a non-empty union type", e) +} + +func (e *ExceptionV2) validate() error { + if e == nil { + return fmt.Errorf("type %T is nil", e) + } + var fields []string + if e.Generic != nil { + fields = append(fields, "generic") + } + if e.Timeout != nil { + fields = append(fields, "timeout") + } + if len(fields) == 0 { + if e.Type != "" { + if len(e.rawJSON) > 0 { + return nil + } + return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", e, e.Type) + } + return fmt.Errorf("type %T is empty", e) + } + if len(fields) > 1 { + return fmt.Errorf("type %T defines values for %s, but only one value is allowed", e, fields) + } + if e.Type != "" { + field := fields[0] + if e.Type != field { + return fmt.Errorf( + "type %T defines a discriminant set to %q, but it does not match the %T field; either remove or update the discriminant to match", + e, + e.Type, + e, + ) + } + } + return nil +} + +var ( + executionSessionResponseFieldSessionID = big.NewInt(1 << 0) + executionSessionResponseFieldExecutionSessionURL = big.NewInt(1 << 1) + executionSessionResponseFieldLanguage = big.NewInt(1 << 2) + executionSessionResponseFieldStatus = big.NewInt(1 << 3) +) + +type ExecutionSessionResponse struct { + SessionID string `json:"sessionId" url:"sessionId"` + ExecutionSessionURL *string `json:"executionSessionUrl,omitempty" url:"executionSessionUrl,omitempty"` + Language common.Language `json:"language" url:"language"` + Status ExecutionSessionStatus `json:"status" url:"status"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (e *ExecutionSessionResponse) GetSessionID() string { + if e == nil { + return "" + } + return e.SessionID +} + +func (e *ExecutionSessionResponse) GetExecutionSessionURL() *string { + if e == nil { + return nil + } + return e.ExecutionSessionURL +} + +func (e *ExecutionSessionResponse) GetLanguage() common.Language { + if e == nil { + return "" + } + return e.Language +} + +func (e *ExecutionSessionResponse) GetStatus() ExecutionSessionStatus { + if e == nil { + return "" + } + return e.Status +} + +func (e *ExecutionSessionResponse) GetExtraProperties() map[string]interface{} { + if e == nil { + return nil + } + return e.extraProperties +} + +func (e *ExecutionSessionResponse) require(field *big.Int) { + if e.explicitFields == nil { + e.explicitFields = big.NewInt(0) + } + e.explicitFields.Or(e.explicitFields, field) +} + +// SetSessionID sets the SessionID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (e *ExecutionSessionResponse) SetSessionID(sessionID string) { + e.SessionID = sessionID + e.require(executionSessionResponseFieldSessionID) +} + +// SetExecutionSessionURL sets the ExecutionSessionURL field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (e *ExecutionSessionResponse) SetExecutionSessionURL(executionSessionURL *string) { + e.ExecutionSessionURL = executionSessionURL + e.require(executionSessionResponseFieldExecutionSessionURL) +} + +// SetLanguage sets the Language field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (e *ExecutionSessionResponse) SetLanguage(language common.Language) { + e.Language = language + e.require(executionSessionResponseFieldLanguage) +} + +// SetStatus sets the Status field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (e *ExecutionSessionResponse) SetStatus(status ExecutionSessionStatus) { + e.Status = status + e.require(executionSessionResponseFieldStatus) +} + +func (e *ExecutionSessionResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ExecutionSessionResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *e = ExecutionSessionResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *e) + if err != nil { + return err + } + e.extraProperties = extraProperties + e.rawJSON = json.RawMessage(data) + return nil +} + +func (e *ExecutionSessionResponse) MarshalJSON() ([]byte, error) { + type embed ExecutionSessionResponse + var marshaler = struct { + embed + }{ + embed: embed(*e), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, e.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (e *ExecutionSessionResponse) String() string { + if e == nil { + return "" + } + if len(e.rawJSON) > 0 { + if value, err := internal.StringifyJSON(e.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(e); err == nil { + return value + } + return fmt.Sprintf("%#v", e) +} + +var ( + executionSessionStateFieldLastTimeContacted = big.NewInt(1 << 0) + executionSessionStateFieldSessionID = big.NewInt(1 << 1) + executionSessionStateFieldIsWarmInstance = big.NewInt(1 << 2) + executionSessionStateFieldAwsTaskID = big.NewInt(1 << 3) + executionSessionStateFieldLanguage = big.NewInt(1 << 4) + executionSessionStateFieldStatus = big.NewInt(1 << 5) +) + +type ExecutionSessionState struct { + LastTimeContacted *string `json:"lastTimeContacted,omitempty" url:"lastTimeContacted,omitempty"` + // The auto-generated session id. Formatted as a uuid. + SessionID string `json:"sessionId" url:"sessionId"` + IsWarmInstance bool `json:"isWarmInstance" url:"isWarmInstance"` + AwsTaskID *string `json:"awsTaskId,omitempty" url:"awsTaskId,omitempty"` + Language common.Language `json:"language" url:"language"` + Status ExecutionSessionStatus `json:"status" url:"status"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (e *ExecutionSessionState) GetLastTimeContacted() *string { + if e == nil { + return nil + } + return e.LastTimeContacted +} + +func (e *ExecutionSessionState) GetSessionID() string { + if e == nil { + return "" + } + return e.SessionID +} + +func (e *ExecutionSessionState) GetIsWarmInstance() bool { + if e == nil { + return false + } + return e.IsWarmInstance +} + +func (e *ExecutionSessionState) GetAwsTaskID() *string { + if e == nil { + return nil + } + return e.AwsTaskID +} + +func (e *ExecutionSessionState) GetLanguage() common.Language { + if e == nil { + return "" + } + return e.Language +} + +func (e *ExecutionSessionState) GetStatus() ExecutionSessionStatus { + if e == nil { + return "" + } + return e.Status +} + +func (e *ExecutionSessionState) GetExtraProperties() map[string]interface{} { + if e == nil { + return nil + } + return e.extraProperties +} + +func (e *ExecutionSessionState) require(field *big.Int) { + if e.explicitFields == nil { + e.explicitFields = big.NewInt(0) + } + e.explicitFields.Or(e.explicitFields, field) +} + +// SetLastTimeContacted sets the LastTimeContacted field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (e *ExecutionSessionState) SetLastTimeContacted(lastTimeContacted *string) { + e.LastTimeContacted = lastTimeContacted + e.require(executionSessionStateFieldLastTimeContacted) +} + +// SetSessionID sets the SessionID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (e *ExecutionSessionState) SetSessionID(sessionID string) { + e.SessionID = sessionID + e.require(executionSessionStateFieldSessionID) +} + +// SetIsWarmInstance sets the IsWarmInstance field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (e *ExecutionSessionState) SetIsWarmInstance(isWarmInstance bool) { + e.IsWarmInstance = isWarmInstance + e.require(executionSessionStateFieldIsWarmInstance) +} + +// SetAwsTaskID sets the AwsTaskID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (e *ExecutionSessionState) SetAwsTaskID(awsTaskID *string) { + e.AwsTaskID = awsTaskID + e.require(executionSessionStateFieldAwsTaskID) +} + +// SetLanguage sets the Language field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (e *ExecutionSessionState) SetLanguage(language common.Language) { + e.Language = language + e.require(executionSessionStateFieldLanguage) +} + +// SetStatus sets the Status field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (e *ExecutionSessionState) SetStatus(status ExecutionSessionStatus) { + e.Status = status + e.require(executionSessionStateFieldStatus) +} + +func (e *ExecutionSessionState) UnmarshalJSON(data []byte) error { + type unmarshaler ExecutionSessionState + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *e = ExecutionSessionState(value) + extraProperties, err := internal.ExtractExtraProperties(data, *e) + if err != nil { + return err + } + e.extraProperties = extraProperties + e.rawJSON = json.RawMessage(data) + return nil +} + +func (e *ExecutionSessionState) MarshalJSON() ([]byte, error) { + type embed ExecutionSessionState + var marshaler = struct { + embed + }{ + embed: embed(*e), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, e.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (e *ExecutionSessionState) String() string { + if e == nil { + return "" + } + if len(e.rawJSON) > 0 { + if value, err := internal.StringifyJSON(e.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(e); err == nil { + return value + } + return fmt.Sprintf("%#v", e) +} + +type ExecutionSessionStatus string + +const ( + ExecutionSessionStatusCreatingContainer ExecutionSessionStatus = "CREATING_CONTAINER" + ExecutionSessionStatusProvisioningContainer ExecutionSessionStatus = "PROVISIONING_CONTAINER" + ExecutionSessionStatusPendingContainer ExecutionSessionStatus = "PENDING_CONTAINER" + ExecutionSessionStatusRunningContainer ExecutionSessionStatus = "RUNNING_CONTAINER" + ExecutionSessionStatusLiveContainer ExecutionSessionStatus = "LIVE_CONTAINER" + ExecutionSessionStatusFailedToLaunch ExecutionSessionStatus = "FAILED_TO_LAUNCH" +) + +func NewExecutionSessionStatusFromString(s string) (ExecutionSessionStatus, error) { + switch s { + case "CREATING_CONTAINER": + return ExecutionSessionStatusCreatingContainer, nil + case "PROVISIONING_CONTAINER": + return ExecutionSessionStatusProvisioningContainer, nil + case "PENDING_CONTAINER": + return ExecutionSessionStatusPendingContainer, nil + case "RUNNING_CONTAINER": + return ExecutionSessionStatusRunningContainer, nil + case "LIVE_CONTAINER": + return ExecutionSessionStatusLiveContainer, nil + case "FAILED_TO_LAUNCH": + return ExecutionSessionStatusFailedToLaunch, nil + } + var t ExecutionSessionStatus + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (e ExecutionSessionStatus) Ptr() *ExecutionSessionStatus { + return &e +} + +var ( + existingSubmissionExecutingFieldSubmissionID = big.NewInt(1 << 0) +) + +type ExistingSubmissionExecuting struct { + SubmissionID SubmissionID `json:"submissionId" url:"submissionId"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (e *ExistingSubmissionExecuting) GetSubmissionID() SubmissionID { + if e == nil { + return uuid.Nil + } + return e.SubmissionID +} + +func (e *ExistingSubmissionExecuting) GetExtraProperties() map[string]interface{} { + if e == nil { + return nil + } + return e.extraProperties +} + +func (e *ExistingSubmissionExecuting) require(field *big.Int) { + if e.explicitFields == nil { + e.explicitFields = big.NewInt(0) + } + e.explicitFields.Or(e.explicitFields, field) +} + +// SetSubmissionID sets the SubmissionID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (e *ExistingSubmissionExecuting) SetSubmissionID(submissionID SubmissionID) { + e.SubmissionID = submissionID + e.require(existingSubmissionExecutingFieldSubmissionID) +} + +func (e *ExistingSubmissionExecuting) UnmarshalJSON(data []byte) error { + type unmarshaler ExistingSubmissionExecuting + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *e = ExistingSubmissionExecuting(value) + extraProperties, err := internal.ExtractExtraProperties(data, *e) + if err != nil { + return err + } + e.extraProperties = extraProperties + e.rawJSON = json.RawMessage(data) + return nil +} + +func (e *ExistingSubmissionExecuting) MarshalJSON() ([]byte, error) { + type embed ExistingSubmissionExecuting + var marshaler = struct { + embed + }{ + embed: embed(*e), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, e.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (e *ExistingSubmissionExecuting) String() string { + if e == nil { + return "" + } + if len(e.rawJSON) > 0 { + if value, err := internal.StringifyJSON(e.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(e); err == nil { + return value + } + return fmt.Sprintf("%#v", e) +} + +var ( + expressionLocationFieldStart = big.NewInt(1 << 0) + expressionLocationFieldOffset = big.NewInt(1 << 1) +) + +type ExpressionLocation struct { + Start int `json:"start" url:"start"` + Offset int `json:"offset" url:"offset"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (e *ExpressionLocation) GetStart() int { + if e == nil { + return 0 + } + return e.Start +} + +func (e *ExpressionLocation) GetOffset() int { + if e == nil { + return 0 + } + return e.Offset +} + +func (e *ExpressionLocation) GetExtraProperties() map[string]interface{} { + if e == nil { + return nil + } + return e.extraProperties +} + +func (e *ExpressionLocation) require(field *big.Int) { + if e.explicitFields == nil { + e.explicitFields = big.NewInt(0) + } + e.explicitFields.Or(e.explicitFields, field) +} + +// SetStart sets the Start field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (e *ExpressionLocation) SetStart(start int) { + e.Start = start + e.require(expressionLocationFieldStart) +} + +// SetOffset sets the Offset field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (e *ExpressionLocation) SetOffset(offset int) { + e.Offset = offset + e.require(expressionLocationFieldOffset) +} + +func (e *ExpressionLocation) UnmarshalJSON(data []byte) error { + type unmarshaler ExpressionLocation + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *e = ExpressionLocation(value) + extraProperties, err := internal.ExtractExtraProperties(data, *e) + if err != nil { + return err + } + e.extraProperties = extraProperties + e.rawJSON = json.RawMessage(data) + return nil +} + +func (e *ExpressionLocation) MarshalJSON() ([]byte, error) { + type embed ExpressionLocation + var marshaler = struct { + embed + }{ + embed: embed(*e), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, e.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (e *ExpressionLocation) String() string { + if e == nil { + return "" + } + if len(e.rawJSON) > 0 { + if value, err := internal.StringifyJSON(e.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(e); err == nil { + return value + } + return fmt.Sprintf("%#v", e) +} + +var ( + finishedResponseFieldSubmissionID = big.NewInt(1 << 0) +) + +type FinishedResponse struct { + SubmissionID SubmissionID `json:"submissionId" url:"submissionId"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (f *FinishedResponse) GetSubmissionID() SubmissionID { + if f == nil { + return uuid.Nil + } + return f.SubmissionID +} + +func (f *FinishedResponse) GetExtraProperties() map[string]interface{} { + if f == nil { + return nil + } + return f.extraProperties +} + +func (f *FinishedResponse) require(field *big.Int) { + if f.explicitFields == nil { + f.explicitFields = big.NewInt(0) + } + f.explicitFields.Or(f.explicitFields, field) +} + +// SetSubmissionID sets the SubmissionID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (f *FinishedResponse) SetSubmissionID(submissionID SubmissionID) { + f.SubmissionID = submissionID + f.require(finishedResponseFieldSubmissionID) +} + +func (f *FinishedResponse) UnmarshalJSON(data []byte) error { + type unmarshaler FinishedResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *f = FinishedResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *f) + if err != nil { + return err + } + f.extraProperties = extraProperties + f.rawJSON = json.RawMessage(data) + return nil +} + +func (f *FinishedResponse) MarshalJSON() ([]byte, error) { + type embed FinishedResponse + var marshaler = struct { + embed + }{ + embed: embed(*f), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, f.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (f *FinishedResponse) String() string { + if f == nil { + return "" + } + if len(f.rawJSON) > 0 { + if value, err := internal.StringifyJSON(f.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(f); err == nil { + return value + } + return fmt.Sprintf("%#v", f) +} + +var ( + getExecutionSessionStateResponseFieldStates = big.NewInt(1 << 0) + getExecutionSessionStateResponseFieldNumWarmingInstances = big.NewInt(1 << 1) + getExecutionSessionStateResponseFieldWarmingSessionIDs = big.NewInt(1 << 2) +) + +type GetExecutionSessionStateResponse struct { + States map[string]*ExecutionSessionState `json:"states" url:"states"` + NumWarmingInstances *int `json:"numWarmingInstances,omitempty" url:"numWarmingInstances,omitempty"` + WarmingSessionIDs []string `json:"warmingSessionIds" url:"warmingSessionIds"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (g *GetExecutionSessionStateResponse) GetStates() map[string]*ExecutionSessionState { + if g == nil { + return nil + } + return g.States +} + +func (g *GetExecutionSessionStateResponse) GetNumWarmingInstances() *int { + if g == nil { + return nil + } + return g.NumWarmingInstances +} + +func (g *GetExecutionSessionStateResponse) GetWarmingSessionIDs() []string { + if g == nil { + return nil + } + return g.WarmingSessionIDs +} + +func (g *GetExecutionSessionStateResponse) GetExtraProperties() map[string]interface{} { + if g == nil { + return nil + } + return g.extraProperties +} + +func (g *GetExecutionSessionStateResponse) require(field *big.Int) { + if g.explicitFields == nil { + g.explicitFields = big.NewInt(0) + } + g.explicitFields.Or(g.explicitFields, field) +} + +// SetStates sets the States field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetExecutionSessionStateResponse) SetStates(states map[string]*ExecutionSessionState) { + g.States = states + g.require(getExecutionSessionStateResponseFieldStates) +} + +// SetNumWarmingInstances sets the NumWarmingInstances field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetExecutionSessionStateResponse) SetNumWarmingInstances(numWarmingInstances *int) { + g.NumWarmingInstances = numWarmingInstances + g.require(getExecutionSessionStateResponseFieldNumWarmingInstances) +} + +// SetWarmingSessionIDs sets the WarmingSessionIDs field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetExecutionSessionStateResponse) SetWarmingSessionIDs(warmingSessionIDs []string) { + g.WarmingSessionIDs = warmingSessionIDs + g.require(getExecutionSessionStateResponseFieldWarmingSessionIDs) +} + +func (g *GetExecutionSessionStateResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetExecutionSessionStateResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetExecutionSessionStateResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + g.rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetExecutionSessionStateResponse) MarshalJSON() ([]byte, error) { + type embed GetExecutionSessionStateResponse + var marshaler = struct { + embed + }{ + embed: embed(*g), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, g.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (g *GetExecutionSessionStateResponse) String() string { + if g == nil { + return "" + } + if len(g.rawJSON) > 0 { + if value, err := internal.StringifyJSON(g.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +var ( + getSubmissionStateResponseFieldTimeSubmitted = big.NewInt(1 << 0) + getSubmissionStateResponseFieldSubmission = big.NewInt(1 << 1) + getSubmissionStateResponseFieldLanguage = big.NewInt(1 << 2) + getSubmissionStateResponseFieldSubmissionTypeState = big.NewInt(1 << 3) +) + +type GetSubmissionStateResponse struct { + TimeSubmitted *time.Time `json:"timeSubmitted,omitempty" url:"timeSubmitted,omitempty"` + Submission string `json:"submission" url:"submission"` + Language common.Language `json:"language" url:"language"` + SubmissionTypeState *SubmissionTypeState `json:"submissionTypeState" url:"submissionTypeState"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (g *GetSubmissionStateResponse) GetTimeSubmitted() *time.Time { + if g == nil { + return nil + } + return g.TimeSubmitted +} + +func (g *GetSubmissionStateResponse) GetSubmission() string { + if g == nil { + return "" + } + return g.Submission +} + +func (g *GetSubmissionStateResponse) GetLanguage() common.Language { + if g == nil { + return "" + } + return g.Language +} + +func (g *GetSubmissionStateResponse) GetSubmissionTypeState() *SubmissionTypeState { + if g == nil { + return nil + } + return g.SubmissionTypeState +} + +func (g *GetSubmissionStateResponse) GetExtraProperties() map[string]interface{} { + if g == nil { + return nil + } + return g.extraProperties +} + +func (g *GetSubmissionStateResponse) require(field *big.Int) { + if g.explicitFields == nil { + g.explicitFields = big.NewInt(0) + } + g.explicitFields.Or(g.explicitFields, field) +} + +// SetTimeSubmitted sets the TimeSubmitted field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetSubmissionStateResponse) SetTimeSubmitted(timeSubmitted *time.Time) { + g.TimeSubmitted = timeSubmitted + g.require(getSubmissionStateResponseFieldTimeSubmitted) +} + +// SetSubmission sets the Submission field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetSubmissionStateResponse) SetSubmission(submission string) { + g.Submission = submission + g.require(getSubmissionStateResponseFieldSubmission) +} + +// SetLanguage sets the Language field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetSubmissionStateResponse) SetLanguage(language common.Language) { + g.Language = language + g.require(getSubmissionStateResponseFieldLanguage) +} + +// SetSubmissionTypeState sets the SubmissionTypeState field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetSubmissionStateResponse) SetSubmissionTypeState(submissionTypeState *SubmissionTypeState) { + g.SubmissionTypeState = submissionTypeState + g.require(getSubmissionStateResponseFieldSubmissionTypeState) +} + +func (g *GetSubmissionStateResponse) UnmarshalJSON(data []byte) error { + type embed GetSubmissionStateResponse + var unmarshaler = struct { + embed + TimeSubmitted *internal.DateTime `json:"timeSubmitted,omitempty"` + }{ + embed: embed(*g), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + *g = GetSubmissionStateResponse(unmarshaler.embed) + g.TimeSubmitted = unmarshaler.TimeSubmitted.TimePtr() + extraProperties, err := internal.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + g.rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetSubmissionStateResponse) MarshalJSON() ([]byte, error) { + type embed GetSubmissionStateResponse + var marshaler = struct { + embed + TimeSubmitted *internal.DateTime `json:"timeSubmitted,omitempty"` + }{ + embed: embed(*g), + TimeSubmitted: internal.NewOptionalDateTime(g.TimeSubmitted), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, g.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (g *GetSubmissionStateResponse) String() string { + if g == nil { + return "" + } + if len(g.rawJSON) > 0 { + if value, err := internal.StringifyJSON(g.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +var ( + getTraceResponsesPageRequestFieldOffset = big.NewInt(1 << 0) +) + +type GetTraceResponsesPageRequest struct { + Offset *int `json:"offset,omitempty" url:"offset,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (g *GetTraceResponsesPageRequest) GetOffset() *int { + if g == nil { + return nil + } + return g.Offset +} + +func (g *GetTraceResponsesPageRequest) GetExtraProperties() map[string]interface{} { + if g == nil { + return nil + } + return g.extraProperties +} + +func (g *GetTraceResponsesPageRequest) require(field *big.Int) { + if g.explicitFields == nil { + g.explicitFields = big.NewInt(0) + } + g.explicitFields.Or(g.explicitFields, field) +} + +// SetOffset sets the Offset field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetTraceResponsesPageRequest) SetOffset(offset *int) { + g.Offset = offset + g.require(getTraceResponsesPageRequestFieldOffset) +} + +func (g *GetTraceResponsesPageRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetTraceResponsesPageRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetTraceResponsesPageRequest(value) + extraProperties, err := internal.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + g.rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetTraceResponsesPageRequest) MarshalJSON() ([]byte, error) { + type embed GetTraceResponsesPageRequest + var marshaler = struct { + embed + }{ + embed: embed(*g), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, g.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (g *GetTraceResponsesPageRequest) String() string { + if g == nil { + return "" + } + if len(g.rawJSON) > 0 { + if value, err := internal.StringifyJSON(g.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +var ( + gradedResponseFieldSubmissionID = big.NewInt(1 << 0) + gradedResponseFieldTestCases = big.NewInt(1 << 1) +) + +type GradedResponse struct { + SubmissionID SubmissionID `json:"submissionId" url:"submissionId"` + TestCases map[string]*TestCaseResultWithStdout `json:"testCases" url:"testCases"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (g *GradedResponse) GetSubmissionID() SubmissionID { + if g == nil { + return uuid.Nil + } + return g.SubmissionID +} + +func (g *GradedResponse) GetTestCases() map[string]*TestCaseResultWithStdout { + if g == nil { + return nil + } + return g.TestCases +} + +func (g *GradedResponse) GetExtraProperties() map[string]interface{} { + if g == nil { + return nil + } + return g.extraProperties +} + +func (g *GradedResponse) require(field *big.Int) { + if g.explicitFields == nil { + g.explicitFields = big.NewInt(0) + } + g.explicitFields.Or(g.explicitFields, field) +} + +// SetSubmissionID sets the SubmissionID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GradedResponse) SetSubmissionID(submissionID SubmissionID) { + g.SubmissionID = submissionID + g.require(gradedResponseFieldSubmissionID) +} + +// SetTestCases sets the TestCases field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GradedResponse) SetTestCases(testCases map[string]*TestCaseResultWithStdout) { + g.TestCases = testCases + g.require(gradedResponseFieldTestCases) +} + +func (g *GradedResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GradedResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GradedResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + g.rawJSON = json.RawMessage(data) + return nil +} + +func (g *GradedResponse) MarshalJSON() ([]byte, error) { + type embed GradedResponse + var marshaler = struct { + embed + }{ + embed: embed(*g), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, g.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (g *GradedResponse) String() string { + if g == nil { + return "" + } + if len(g.rawJSON) > 0 { + if value, err := internal.StringifyJSON(g.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +var ( + gradedResponseV2FieldSubmissionID = big.NewInt(1 << 0) + gradedResponseV2FieldTestCases = big.NewInt(1 << 1) +) + +type GradedResponseV2 struct { + SubmissionID SubmissionID `json:"submissionId" url:"submissionId"` + TestCases map[v2.TestCaseID]*TestCaseGrade `json:"testCases" url:"testCases"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (g *GradedResponseV2) GetSubmissionID() SubmissionID { + if g == nil { + return uuid.Nil + } + return g.SubmissionID +} + +func (g *GradedResponseV2) GetTestCases() map[v2.TestCaseID]*TestCaseGrade { + if g == nil { + return nil + } + return g.TestCases +} + +func (g *GradedResponseV2) GetExtraProperties() map[string]interface{} { + if g == nil { + return nil + } + return g.extraProperties +} + +func (g *GradedResponseV2) require(field *big.Int) { + if g.explicitFields == nil { + g.explicitFields = big.NewInt(0) + } + g.explicitFields.Or(g.explicitFields, field) +} + +// SetSubmissionID sets the SubmissionID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GradedResponseV2) SetSubmissionID(submissionID SubmissionID) { + g.SubmissionID = submissionID + g.require(gradedResponseV2FieldSubmissionID) +} + +// SetTestCases sets the TestCases field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GradedResponseV2) SetTestCases(testCases map[v2.TestCaseID]*TestCaseGrade) { + g.TestCases = testCases + g.require(gradedResponseV2FieldTestCases) +} + +func (g *GradedResponseV2) UnmarshalJSON(data []byte) error { + type unmarshaler GradedResponseV2 + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GradedResponseV2(value) + extraProperties, err := internal.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + g.rawJSON = json.RawMessage(data) + return nil +} + +func (g *GradedResponseV2) MarshalJSON() ([]byte, error) { + type embed GradedResponseV2 + var marshaler = struct { + embed + }{ + embed: embed(*g), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, g.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (g *GradedResponseV2) String() string { + if g == nil { + return "" + } + if len(g.rawJSON) > 0 { + if value, err := internal.StringifyJSON(g.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +var ( + gradedTestCaseUpdateFieldTestCaseID = big.NewInt(1 << 0) + gradedTestCaseUpdateFieldGrade = big.NewInt(1 << 1) +) + +type GradedTestCaseUpdate struct { + TestCaseID v2.TestCaseID `json:"testCaseId" url:"testCaseId"` + Grade *TestCaseGrade `json:"grade" url:"grade"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (g *GradedTestCaseUpdate) GetTestCaseID() v2.TestCaseID { + if g == nil { + return "" + } + return g.TestCaseID +} + +func (g *GradedTestCaseUpdate) GetGrade() *TestCaseGrade { + if g == nil { + return nil + } + return g.Grade +} + +func (g *GradedTestCaseUpdate) GetExtraProperties() map[string]interface{} { + if g == nil { + return nil + } + return g.extraProperties +} + +func (g *GradedTestCaseUpdate) require(field *big.Int) { + if g.explicitFields == nil { + g.explicitFields = big.NewInt(0) + } + g.explicitFields.Or(g.explicitFields, field) +} + +// SetTestCaseID sets the TestCaseID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GradedTestCaseUpdate) SetTestCaseID(testCaseID v2.TestCaseID) { + g.TestCaseID = testCaseID + g.require(gradedTestCaseUpdateFieldTestCaseID) +} + +// SetGrade sets the Grade field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GradedTestCaseUpdate) SetGrade(grade *TestCaseGrade) { + g.Grade = grade + g.require(gradedTestCaseUpdateFieldGrade) +} + +func (g *GradedTestCaseUpdate) UnmarshalJSON(data []byte) error { + type unmarshaler GradedTestCaseUpdate + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GradedTestCaseUpdate(value) + extraProperties, err := internal.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + g.rawJSON = json.RawMessage(data) + return nil +} + +func (g *GradedTestCaseUpdate) MarshalJSON() ([]byte, error) { + type embed GradedTestCaseUpdate + var marshaler = struct { + embed + }{ + embed: embed(*g), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, g.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (g *GradedTestCaseUpdate) String() string { + if g == nil { + return "" + } + if len(g.rawJSON) > 0 { + if value, err := internal.StringifyJSON(g.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +var ( + initializeProblemRequestFieldProblemID = big.NewInt(1 << 0) + initializeProblemRequestFieldProblemVersion = big.NewInt(1 << 1) +) + +type InitializeProblemRequest struct { + ProblemID common.ProblemID `json:"problemId" url:"problemId"` + ProblemVersion *int `json:"problemVersion,omitempty" url:"problemVersion,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (i *InitializeProblemRequest) GetProblemID() common.ProblemID { + if i == nil { + return "" + } + return i.ProblemID +} + +func (i *InitializeProblemRequest) GetProblemVersion() *int { + if i == nil { + return nil + } + return i.ProblemVersion +} + +func (i *InitializeProblemRequest) GetExtraProperties() map[string]interface{} { + if i == nil { + return nil + } + return i.extraProperties +} + +func (i *InitializeProblemRequest) require(field *big.Int) { + if i.explicitFields == nil { + i.explicitFields = big.NewInt(0) + } + i.explicitFields.Or(i.explicitFields, field) +} + +// SetProblemID sets the ProblemID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (i *InitializeProblemRequest) SetProblemID(problemID common.ProblemID) { + i.ProblemID = problemID + i.require(initializeProblemRequestFieldProblemID) +} + +// SetProblemVersion sets the ProblemVersion field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (i *InitializeProblemRequest) SetProblemVersion(problemVersion *int) { + i.ProblemVersion = problemVersion + i.require(initializeProblemRequestFieldProblemVersion) +} + +func (i *InitializeProblemRequest) UnmarshalJSON(data []byte) error { + type unmarshaler InitializeProblemRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *i = InitializeProblemRequest(value) + extraProperties, err := internal.ExtractExtraProperties(data, *i) + if err != nil { + return err + } + i.extraProperties = extraProperties + i.rawJSON = json.RawMessage(data) + return nil +} + +func (i *InitializeProblemRequest) MarshalJSON() ([]byte, error) { + type embed InitializeProblemRequest + var marshaler = struct { + embed + }{ + embed: embed(*i), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, i.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (i *InitializeProblemRequest) String() string { + if i == nil { + return "" + } + if len(i.rawJSON) > 0 { + if value, err := internal.StringifyJSON(i.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(i); err == nil { + return value + } + return fmt.Sprintf("%#v", i) +} + +var ( + internalErrorFieldExceptionInfo = big.NewInt(1 << 0) +) + +type InternalError struct { + ExceptionInfo *ExceptionInfo `json:"exceptionInfo" url:"exceptionInfo"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (i *InternalError) GetExceptionInfo() *ExceptionInfo { + if i == nil { + return nil + } + return i.ExceptionInfo +} + +func (i *InternalError) GetExtraProperties() map[string]interface{} { + if i == nil { + return nil + } + return i.extraProperties +} + +func (i *InternalError) require(field *big.Int) { + if i.explicitFields == nil { + i.explicitFields = big.NewInt(0) + } + i.explicitFields.Or(i.explicitFields, field) +} + +// SetExceptionInfo sets the ExceptionInfo field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (i *InternalError) SetExceptionInfo(exceptionInfo *ExceptionInfo) { + i.ExceptionInfo = exceptionInfo + i.require(internalErrorFieldExceptionInfo) +} + +func (i *InternalError) UnmarshalJSON(data []byte) error { + type unmarshaler InternalError + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *i = InternalError(value) + extraProperties, err := internal.ExtractExtraProperties(data, *i) + if err != nil { + return err + } + i.extraProperties = extraProperties + i.rawJSON = json.RawMessage(data) + return nil +} + +func (i *InternalError) MarshalJSON() ([]byte, error) { + type embed InternalError + var marshaler = struct { + embed + }{ + embed: embed(*i), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, i.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (i *InternalError) String() string { + if i == nil { + return "" + } + if len(i.rawJSON) > 0 { + if value, err := internal.StringifyJSON(i.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(i); err == nil { + return value + } + return fmt.Sprintf("%#v", i) +} + +type InvalidRequestCause struct { + Type string + // The submission request references a submission id that doesn't exist. + SubmissionIDNotFound *SubmissionIDNotFound + CustomTestCasesUnsupported *CustomTestCasesUnsupported + // The submission request was routed to an incorrect language executor. + UnexpectedLanguage *UnexpectedLanguageError + + rawJSON json.RawMessage +} + +func (i *InvalidRequestCause) GetType() string { + if i == nil { + return "" + } + return i.Type +} + +func (i *InvalidRequestCause) GetSubmissionIDNotFound() *SubmissionIDNotFound { + if i == nil { + return nil + } + return i.SubmissionIDNotFound +} + +func (i *InvalidRequestCause) GetCustomTestCasesUnsupported() *CustomTestCasesUnsupported { + if i == nil { + return nil + } + return i.CustomTestCasesUnsupported +} + +func (i *InvalidRequestCause) GetUnexpectedLanguage() *UnexpectedLanguageError { + if i == nil { + return nil + } + return i.UnexpectedLanguage +} + +func (i *InvalidRequestCause) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + i.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", i) + } + switch unmarshaler.Type { + case "submissionIdNotFound": + value := new(SubmissionIDNotFound) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + i.SubmissionIDNotFound = value + case "customTestCasesUnsupported": + value := new(CustomTestCasesUnsupported) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + i.CustomTestCasesUnsupported = value + case "unexpectedLanguage": + value := new(UnexpectedLanguageError) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + i.UnexpectedLanguage = value + } + i.rawJSON = json.RawMessage(data) + return nil +} + +func (i InvalidRequestCause) MarshalJSON() ([]byte, error) { + if err := i.validate(); err != nil { + return nil, err + } + if i.SubmissionIDNotFound != nil { + return internal.MarshalJSONWithExtraProperty(i.SubmissionIDNotFound, "type", "submissionIdNotFound") + } + if i.CustomTestCasesUnsupported != nil { + return internal.MarshalJSONWithExtraProperty(i.CustomTestCasesUnsupported, "type", "customTestCasesUnsupported") + } + if i.UnexpectedLanguage != nil { + return internal.MarshalJSONWithExtraProperty(i.UnexpectedLanguage, "type", "unexpectedLanguage") + } + if len(i.rawJSON) > 0 { + return i.rawJSON, nil + } + return nil, fmt.Errorf("type %T does not define a non-empty union type", i) +} + +type InvalidRequestCauseVisitor interface { + VisitSubmissionIDNotFound(*SubmissionIDNotFound) error + VisitCustomTestCasesUnsupported(*CustomTestCasesUnsupported) error + VisitUnexpectedLanguage(*UnexpectedLanguageError) error +} + +func (i *InvalidRequestCause) Accept(visitor InvalidRequestCauseVisitor) error { + if i.SubmissionIDNotFound != nil { + return visitor.VisitSubmissionIDNotFound(i.SubmissionIDNotFound) + } + if i.CustomTestCasesUnsupported != nil { + return visitor.VisitCustomTestCasesUnsupported(i.CustomTestCasesUnsupported) + } + if i.UnexpectedLanguage != nil { + return visitor.VisitUnexpectedLanguage(i.UnexpectedLanguage) + } + return fmt.Errorf("type %T does not define a non-empty union type", i) +} + +func (i *InvalidRequestCause) validate() error { + if i == nil { + return fmt.Errorf("type %T is nil", i) + } + var fields []string + if i.SubmissionIDNotFound != nil { + fields = append(fields, "submissionIdNotFound") + } + if i.CustomTestCasesUnsupported != nil { + fields = append(fields, "customTestCasesUnsupported") + } + if i.UnexpectedLanguage != nil { + fields = append(fields, "unexpectedLanguage") + } + if len(fields) == 0 { + if i.Type != "" { + if len(i.rawJSON) > 0 { + return nil + } + return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", i, i.Type) + } + return fmt.Errorf("type %T is empty", i) + } + if len(fields) > 1 { + return fmt.Errorf("type %T defines values for %s, but only one value is allowed", i, fields) + } + if i.Type != "" { + field := fields[0] + if i.Type != field { + return fmt.Errorf( + "type %T defines a discriminant set to %q, but it does not match the %T field; either remove or update the discriminant to match", + i, + i.Type, + i, + ) + } + } + return nil +} + +var ( + invalidRequestResponseFieldRequest = big.NewInt(1 << 0) + invalidRequestResponseFieldCause = big.NewInt(1 << 1) +) + +type InvalidRequestResponse struct { + Request *SubmissionRequest `json:"request" url:"request"` + Cause *InvalidRequestCause `json:"cause" url:"cause"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (i *InvalidRequestResponse) GetRequest() *SubmissionRequest { + if i == nil { + return nil + } + return i.Request +} + +func (i *InvalidRequestResponse) GetCause() *InvalidRequestCause { + if i == nil { + return nil + } + return i.Cause +} + +func (i *InvalidRequestResponse) GetExtraProperties() map[string]interface{} { + if i == nil { + return nil + } + return i.extraProperties +} + +func (i *InvalidRequestResponse) require(field *big.Int) { + if i.explicitFields == nil { + i.explicitFields = big.NewInt(0) + } + i.explicitFields.Or(i.explicitFields, field) +} + +// SetRequest sets the Request field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (i *InvalidRequestResponse) SetRequest(request *SubmissionRequest) { + i.Request = request + i.require(invalidRequestResponseFieldRequest) +} + +// SetCause sets the Cause field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (i *InvalidRequestResponse) SetCause(cause *InvalidRequestCause) { + i.Cause = cause + i.require(invalidRequestResponseFieldCause) +} + +func (i *InvalidRequestResponse) UnmarshalJSON(data []byte) error { + type unmarshaler InvalidRequestResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *i = InvalidRequestResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *i) + if err != nil { + return err + } + i.extraProperties = extraProperties + i.rawJSON = json.RawMessage(data) + return nil +} + +func (i *InvalidRequestResponse) MarshalJSON() ([]byte, error) { + type embed InvalidRequestResponse + var marshaler = struct { + embed + }{ + embed: embed(*i), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, i.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (i *InvalidRequestResponse) String() string { + if i == nil { + return "" + } + if len(i.rawJSON) > 0 { + if value, err := internal.StringifyJSON(i.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(i); err == nil { + return value + } + return fmt.Sprintf("%#v", i) +} + +var ( + lightweightStackframeInformationFieldNumStackFrames = big.NewInt(1 << 0) + lightweightStackframeInformationFieldTopStackFrameMethodName = big.NewInt(1 << 1) +) + +type LightweightStackframeInformation struct { + NumStackFrames int `json:"numStackFrames" url:"numStackFrames"` + TopStackFrameMethodName string `json:"topStackFrameMethodName" url:"topStackFrameMethodName"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (l *LightweightStackframeInformation) GetNumStackFrames() int { + if l == nil { + return 0 + } + return l.NumStackFrames +} + +func (l *LightweightStackframeInformation) GetTopStackFrameMethodName() string { + if l == nil { + return "" + } + return l.TopStackFrameMethodName +} + +func (l *LightweightStackframeInformation) GetExtraProperties() map[string]interface{} { + if l == nil { + return nil + } + return l.extraProperties +} + +func (l *LightweightStackframeInformation) require(field *big.Int) { + if l.explicitFields == nil { + l.explicitFields = big.NewInt(0) + } + l.explicitFields.Or(l.explicitFields, field) +} + +// SetNumStackFrames sets the NumStackFrames field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LightweightStackframeInformation) SetNumStackFrames(numStackFrames int) { + l.NumStackFrames = numStackFrames + l.require(lightweightStackframeInformationFieldNumStackFrames) +} + +// SetTopStackFrameMethodName sets the TopStackFrameMethodName field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LightweightStackframeInformation) SetTopStackFrameMethodName(topStackFrameMethodName string) { + l.TopStackFrameMethodName = topStackFrameMethodName + l.require(lightweightStackframeInformationFieldTopStackFrameMethodName) +} + +func (l *LightweightStackframeInformation) UnmarshalJSON(data []byte) error { + type unmarshaler LightweightStackframeInformation + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *l = LightweightStackframeInformation(value) + extraProperties, err := internal.ExtractExtraProperties(data, *l) + if err != nil { + return err + } + l.extraProperties = extraProperties + l.rawJSON = json.RawMessage(data) + return nil +} + +func (l *LightweightStackframeInformation) MarshalJSON() ([]byte, error) { + type embed LightweightStackframeInformation + var marshaler = struct { + embed + }{ + embed: embed(*l), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, l.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (l *LightweightStackframeInformation) String() string { + if l == nil { + return "" + } + if len(l.rawJSON) > 0 { + if value, err := internal.StringifyJSON(l.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(l); err == nil { + return value + } + return fmt.Sprintf("%#v", l) +} + +var ( + recordedResponseNotificationFieldSubmissionID = big.NewInt(1 << 0) + recordedResponseNotificationFieldTraceResponsesSize = big.NewInt(1 << 1) + recordedResponseNotificationFieldTestCaseID = big.NewInt(1 << 2) +) + +type RecordedResponseNotification struct { + SubmissionID SubmissionID `json:"submissionId" url:"submissionId"` + TraceResponsesSize int `json:"traceResponsesSize" url:"traceResponsesSize"` + TestCaseID *string `json:"testCaseId,omitempty" url:"testCaseId,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (r *RecordedResponseNotification) GetSubmissionID() SubmissionID { + if r == nil { + return uuid.Nil + } + return r.SubmissionID +} + +func (r *RecordedResponseNotification) GetTraceResponsesSize() int { + if r == nil { + return 0 + } + return r.TraceResponsesSize +} + +func (r *RecordedResponseNotification) GetTestCaseID() *string { + if r == nil { + return nil + } + return r.TestCaseID +} + +func (r *RecordedResponseNotification) GetExtraProperties() map[string]interface{} { + if r == nil { + return nil + } + return r.extraProperties +} + +func (r *RecordedResponseNotification) require(field *big.Int) { + if r.explicitFields == nil { + r.explicitFields = big.NewInt(0) + } + r.explicitFields.Or(r.explicitFields, field) +} + +// SetSubmissionID sets the SubmissionID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (r *RecordedResponseNotification) SetSubmissionID(submissionID SubmissionID) { + r.SubmissionID = submissionID + r.require(recordedResponseNotificationFieldSubmissionID) +} + +// SetTraceResponsesSize sets the TraceResponsesSize field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (r *RecordedResponseNotification) SetTraceResponsesSize(traceResponsesSize int) { + r.TraceResponsesSize = traceResponsesSize + r.require(recordedResponseNotificationFieldTraceResponsesSize) +} + +// SetTestCaseID sets the TestCaseID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (r *RecordedResponseNotification) SetTestCaseID(testCaseID *string) { + r.TestCaseID = testCaseID + r.require(recordedResponseNotificationFieldTestCaseID) +} + +func (r *RecordedResponseNotification) UnmarshalJSON(data []byte) error { + type unmarshaler RecordedResponseNotification + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *r = RecordedResponseNotification(value) + extraProperties, err := internal.ExtractExtraProperties(data, *r) + if err != nil { + return err + } + r.extraProperties = extraProperties + r.rawJSON = json.RawMessage(data) + return nil +} + +func (r *RecordedResponseNotification) MarshalJSON() ([]byte, error) { + type embed RecordedResponseNotification + var marshaler = struct { + embed + }{ + embed: embed(*r), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, r.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (r *RecordedResponseNotification) String() string { + if r == nil { + return "" + } + if len(r.rawJSON) > 0 { + if value, err := internal.StringifyJSON(r.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(r); err == nil { + return value + } + return fmt.Sprintf("%#v", r) +} + +var ( + recordedTestCaseUpdateFieldTestCaseID = big.NewInt(1 << 0) + recordedTestCaseUpdateFieldTraceResponsesSize = big.NewInt(1 << 1) +) + +type RecordedTestCaseUpdate struct { + TestCaseID v2.TestCaseID `json:"testCaseId" url:"testCaseId"` + TraceResponsesSize int `json:"traceResponsesSize" url:"traceResponsesSize"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (r *RecordedTestCaseUpdate) GetTestCaseID() v2.TestCaseID { + if r == nil { + return "" + } + return r.TestCaseID +} + +func (r *RecordedTestCaseUpdate) GetTraceResponsesSize() int { + if r == nil { + return 0 + } + return r.TraceResponsesSize +} + +func (r *RecordedTestCaseUpdate) GetExtraProperties() map[string]interface{} { + if r == nil { + return nil + } + return r.extraProperties +} + +func (r *RecordedTestCaseUpdate) require(field *big.Int) { + if r.explicitFields == nil { + r.explicitFields = big.NewInt(0) + } + r.explicitFields.Or(r.explicitFields, field) +} + +// SetTestCaseID sets the TestCaseID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (r *RecordedTestCaseUpdate) SetTestCaseID(testCaseID v2.TestCaseID) { + r.TestCaseID = testCaseID + r.require(recordedTestCaseUpdateFieldTestCaseID) +} + +// SetTraceResponsesSize sets the TraceResponsesSize field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (r *RecordedTestCaseUpdate) SetTraceResponsesSize(traceResponsesSize int) { + r.TraceResponsesSize = traceResponsesSize + r.require(recordedTestCaseUpdateFieldTraceResponsesSize) +} + +func (r *RecordedTestCaseUpdate) UnmarshalJSON(data []byte) error { + type unmarshaler RecordedTestCaseUpdate + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *r = RecordedTestCaseUpdate(value) + extraProperties, err := internal.ExtractExtraProperties(data, *r) + if err != nil { + return err + } + r.extraProperties = extraProperties + r.rawJSON = json.RawMessage(data) + return nil +} + +func (r *RecordedTestCaseUpdate) MarshalJSON() ([]byte, error) { + type embed RecordedTestCaseUpdate + var marshaler = struct { + embed + }{ + embed: embed(*r), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, r.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (r *RecordedTestCaseUpdate) String() string { + if r == nil { + return "" + } + if len(r.rawJSON) > 0 { + if value, err := internal.StringifyJSON(r.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(r); err == nil { + return value + } + return fmt.Sprintf("%#v", r) +} + +var ( + recordingResponseNotificationFieldSubmissionID = big.NewInt(1 << 0) + recordingResponseNotificationFieldTestCaseID = big.NewInt(1 << 1) + recordingResponseNotificationFieldLineNumber = big.NewInt(1 << 2) + recordingResponseNotificationFieldLightweightStackInfo = big.NewInt(1 << 3) + recordingResponseNotificationFieldTracedFile = big.NewInt(1 << 4) +) + +type RecordingResponseNotification struct { + SubmissionID SubmissionID `json:"submissionId" url:"submissionId"` + TestCaseID *string `json:"testCaseId,omitempty" url:"testCaseId,omitempty"` + LineNumber int `json:"lineNumber" url:"lineNumber"` + LightweightStackInfo *LightweightStackframeInformation `json:"lightweightStackInfo" url:"lightweightStackInfo"` + TracedFile *TracedFile `json:"tracedFile,omitempty" url:"tracedFile,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (r *RecordingResponseNotification) GetSubmissionID() SubmissionID { + if r == nil { + return uuid.Nil + } + return r.SubmissionID +} + +func (r *RecordingResponseNotification) GetTestCaseID() *string { + if r == nil { + return nil + } + return r.TestCaseID +} + +func (r *RecordingResponseNotification) GetLineNumber() int { + if r == nil { + return 0 + } + return r.LineNumber +} + +func (r *RecordingResponseNotification) GetLightweightStackInfo() *LightweightStackframeInformation { + if r == nil { + return nil + } + return r.LightweightStackInfo +} + +func (r *RecordingResponseNotification) GetTracedFile() *TracedFile { + if r == nil { + return nil + } + return r.TracedFile +} + +func (r *RecordingResponseNotification) GetExtraProperties() map[string]interface{} { + if r == nil { + return nil + } + return r.extraProperties +} + +func (r *RecordingResponseNotification) require(field *big.Int) { + if r.explicitFields == nil { + r.explicitFields = big.NewInt(0) + } + r.explicitFields.Or(r.explicitFields, field) +} + +// SetSubmissionID sets the SubmissionID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (r *RecordingResponseNotification) SetSubmissionID(submissionID SubmissionID) { + r.SubmissionID = submissionID + r.require(recordingResponseNotificationFieldSubmissionID) +} + +// SetTestCaseID sets the TestCaseID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (r *RecordingResponseNotification) SetTestCaseID(testCaseID *string) { + r.TestCaseID = testCaseID + r.require(recordingResponseNotificationFieldTestCaseID) +} + +// SetLineNumber sets the LineNumber field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (r *RecordingResponseNotification) SetLineNumber(lineNumber int) { + r.LineNumber = lineNumber + r.require(recordingResponseNotificationFieldLineNumber) +} + +// SetLightweightStackInfo sets the LightweightStackInfo field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (r *RecordingResponseNotification) SetLightweightStackInfo(lightweightStackInfo *LightweightStackframeInformation) { + r.LightweightStackInfo = lightweightStackInfo + r.require(recordingResponseNotificationFieldLightweightStackInfo) +} + +// SetTracedFile sets the TracedFile field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (r *RecordingResponseNotification) SetTracedFile(tracedFile *TracedFile) { + r.TracedFile = tracedFile + r.require(recordingResponseNotificationFieldTracedFile) +} + +func (r *RecordingResponseNotification) UnmarshalJSON(data []byte) error { + type unmarshaler RecordingResponseNotification + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *r = RecordingResponseNotification(value) + extraProperties, err := internal.ExtractExtraProperties(data, *r) + if err != nil { + return err + } + r.extraProperties = extraProperties + r.rawJSON = json.RawMessage(data) + return nil +} + +func (r *RecordingResponseNotification) MarshalJSON() ([]byte, error) { + type embed RecordingResponseNotification + var marshaler = struct { + embed + }{ + embed: embed(*r), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, r.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (r *RecordingResponseNotification) String() string { + if r == nil { + return "" + } + if len(r.rawJSON) > 0 { + if value, err := internal.StringifyJSON(r.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(r); err == nil { + return value + } + return fmt.Sprintf("%#v", r) +} + +var ( + runningResponseFieldSubmissionID = big.NewInt(1 << 0) + runningResponseFieldState = big.NewInt(1 << 1) +) + +type RunningResponse struct { + SubmissionID SubmissionID `json:"submissionId" url:"submissionId"` + State RunningSubmissionState `json:"state" url:"state"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (r *RunningResponse) GetSubmissionID() SubmissionID { + if r == nil { + return uuid.Nil + } + return r.SubmissionID +} + +func (r *RunningResponse) GetState() RunningSubmissionState { + if r == nil { + return "" + } + return r.State +} + +func (r *RunningResponse) GetExtraProperties() map[string]interface{} { + if r == nil { + return nil + } + return r.extraProperties +} + +func (r *RunningResponse) require(field *big.Int) { + if r.explicitFields == nil { + r.explicitFields = big.NewInt(0) + } + r.explicitFields.Or(r.explicitFields, field) +} + +// SetSubmissionID sets the SubmissionID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (r *RunningResponse) SetSubmissionID(submissionID SubmissionID) { + r.SubmissionID = submissionID + r.require(runningResponseFieldSubmissionID) +} + +// SetState sets the State field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (r *RunningResponse) SetState(state RunningSubmissionState) { + r.State = state + r.require(runningResponseFieldState) +} + +func (r *RunningResponse) UnmarshalJSON(data []byte) error { + type unmarshaler RunningResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *r = RunningResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *r) + if err != nil { + return err + } + r.extraProperties = extraProperties + r.rawJSON = json.RawMessage(data) + return nil +} + +func (r *RunningResponse) MarshalJSON() ([]byte, error) { + type embed RunningResponse + var marshaler = struct { + embed + }{ + embed: embed(*r), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, r.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (r *RunningResponse) String() string { + if r == nil { + return "" + } + if len(r.rawJSON) > 0 { + if value, err := internal.StringifyJSON(r.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(r); err == nil { + return value + } + return fmt.Sprintf("%#v", r) +} + +type RunningSubmissionState string + +const ( + RunningSubmissionStateQueueingSubmission RunningSubmissionState = "QUEUEING_SUBMISSION" + RunningSubmissionStateKillingHistoricalSubmissions RunningSubmissionState = "KILLING_HISTORICAL_SUBMISSIONS" + RunningSubmissionStateWritingSubmissionToFile RunningSubmissionState = "WRITING_SUBMISSION_TO_FILE" + RunningSubmissionStateCompilingSubmission RunningSubmissionState = "COMPILING_SUBMISSION" + RunningSubmissionStateRunningSubmission RunningSubmissionState = "RUNNING_SUBMISSION" +) + +func NewRunningSubmissionStateFromString(s string) (RunningSubmissionState, error) { + switch s { + case "QUEUEING_SUBMISSION": + return RunningSubmissionStateQueueingSubmission, nil + case "KILLING_HISTORICAL_SUBMISSIONS": + return RunningSubmissionStateKillingHistoricalSubmissions, nil + case "WRITING_SUBMISSION_TO_FILE": + return RunningSubmissionStateWritingSubmissionToFile, nil + case "COMPILING_SUBMISSION": + return RunningSubmissionStateCompilingSubmission, nil + case "RUNNING_SUBMISSION": + return RunningSubmissionStateRunningSubmission, nil + } + var t RunningSubmissionState + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (r RunningSubmissionState) Ptr() *RunningSubmissionState { + return &r +} + +var ( + runtimeErrorFieldMessage = big.NewInt(1 << 0) +) + +type RuntimeError struct { + Message string `json:"message" url:"message"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (r *RuntimeError) GetMessage() string { + if r == nil { + return "" + } + return r.Message +} + +func (r *RuntimeError) GetExtraProperties() map[string]interface{} { + if r == nil { + return nil + } + return r.extraProperties +} + +func (r *RuntimeError) require(field *big.Int) { + if r.explicitFields == nil { + r.explicitFields = big.NewInt(0) + } + r.explicitFields.Or(r.explicitFields, field) +} + +// SetMessage sets the Message field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (r *RuntimeError) SetMessage(message string) { + r.Message = message + r.require(runtimeErrorFieldMessage) +} + +func (r *RuntimeError) UnmarshalJSON(data []byte) error { + type unmarshaler RuntimeError + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *r = RuntimeError(value) + extraProperties, err := internal.ExtractExtraProperties(data, *r) + if err != nil { + return err + } + r.extraProperties = extraProperties + r.rawJSON = json.RawMessage(data) + return nil +} + +func (r *RuntimeError) MarshalJSON() ([]byte, error) { + type embed RuntimeError + var marshaler = struct { + embed + }{ + embed: embed(*r), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, r.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (r *RuntimeError) String() string { + if r == nil { + return "" + } + if len(r.rawJSON) > 0 { + if value, err := internal.StringifyJSON(r.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(r); err == nil { + return value + } + return fmt.Sprintf("%#v", r) +} + +var ( + scopeFieldVariables = big.NewInt(1 << 0) +) + +type Scope struct { + Variables map[string]*DebugVariableValue `json:"variables" url:"variables"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *Scope) GetVariables() map[string]*DebugVariableValue { + if s == nil { + return nil + } + return s.Variables +} + +func (s *Scope) GetExtraProperties() map[string]interface{} { + if s == nil { + return nil + } + return s.extraProperties +} + +func (s *Scope) require(field *big.Int) { + if s.explicitFields == nil { + s.explicitFields = big.NewInt(0) + } + s.explicitFields.Or(s.explicitFields, field) +} + +// SetVariables sets the Variables field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *Scope) SetVariables(variables map[string]*DebugVariableValue) { + s.Variables = variables + s.require(scopeFieldVariables) +} + +func (s *Scope) UnmarshalJSON(data []byte) error { + type unmarshaler Scope + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = Scope(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *Scope) MarshalJSON() ([]byte, error) { + type embed Scope + var marshaler = struct { + embed + }{ + embed: embed(*s), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, s.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (s *Scope) String() string { + if s == nil { + return "" + } + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type ShareID = string + +var ( + stackFrameFieldMethodName = big.NewInt(1 << 0) + stackFrameFieldLineNumber = big.NewInt(1 << 1) + stackFrameFieldScopes = big.NewInt(1 << 2) +) + +type StackFrame struct { + MethodName string `json:"methodName" url:"methodName"` + LineNumber int `json:"lineNumber" url:"lineNumber"` + Scopes []*Scope `json:"scopes" url:"scopes"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *StackFrame) GetMethodName() string { + if s == nil { + return "" + } + return s.MethodName +} + +func (s *StackFrame) GetLineNumber() int { + if s == nil { + return 0 + } + return s.LineNumber +} + +func (s *StackFrame) GetScopes() []*Scope { + if s == nil { + return nil + } + return s.Scopes +} + +func (s *StackFrame) GetExtraProperties() map[string]interface{} { + if s == nil { + return nil + } + return s.extraProperties +} + +func (s *StackFrame) require(field *big.Int) { + if s.explicitFields == nil { + s.explicitFields = big.NewInt(0) + } + s.explicitFields.Or(s.explicitFields, field) +} + +// SetMethodName sets the MethodName field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *StackFrame) SetMethodName(methodName string) { + s.MethodName = methodName + s.require(stackFrameFieldMethodName) +} + +// SetLineNumber sets the LineNumber field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *StackFrame) SetLineNumber(lineNumber int) { + s.LineNumber = lineNumber + s.require(stackFrameFieldLineNumber) +} + +// SetScopes sets the Scopes field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *StackFrame) SetScopes(scopes []*Scope) { + s.Scopes = scopes + s.require(stackFrameFieldScopes) +} + +func (s *StackFrame) UnmarshalJSON(data []byte) error { + type unmarshaler StackFrame + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = StackFrame(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *StackFrame) MarshalJSON() ([]byte, error) { + type embed StackFrame + var marshaler = struct { + embed + }{ + embed: embed(*s), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, s.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (s *StackFrame) String() string { + if s == nil { + return "" + } + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +var ( + stackInformationFieldNumStackFrames = big.NewInt(1 << 0) + stackInformationFieldTopStackFrame = big.NewInt(1 << 1) +) + +type StackInformation struct { + NumStackFrames int `json:"numStackFrames" url:"numStackFrames"` + TopStackFrame *StackFrame `json:"topStackFrame,omitempty" url:"topStackFrame,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *StackInformation) GetNumStackFrames() int { + if s == nil { + return 0 + } + return s.NumStackFrames +} + +func (s *StackInformation) GetTopStackFrame() *StackFrame { + if s == nil { + return nil + } + return s.TopStackFrame +} + +func (s *StackInformation) GetExtraProperties() map[string]interface{} { + if s == nil { + return nil + } + return s.extraProperties +} + +func (s *StackInformation) require(field *big.Int) { + if s.explicitFields == nil { + s.explicitFields = big.NewInt(0) + } + s.explicitFields.Or(s.explicitFields, field) +} + +// SetNumStackFrames sets the NumStackFrames field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *StackInformation) SetNumStackFrames(numStackFrames int) { + s.NumStackFrames = numStackFrames + s.require(stackInformationFieldNumStackFrames) +} + +// SetTopStackFrame sets the TopStackFrame field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *StackInformation) SetTopStackFrame(topStackFrame *StackFrame) { + s.TopStackFrame = topStackFrame + s.require(stackInformationFieldTopStackFrame) +} + +func (s *StackInformation) UnmarshalJSON(data []byte) error { + type unmarshaler StackInformation + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = StackInformation(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *StackInformation) MarshalJSON() ([]byte, error) { + type embed StackInformation + var marshaler = struct { + embed + }{ + embed: embed(*s), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, s.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (s *StackInformation) String() string { + if s == nil { + return "" + } + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +var ( + stderrResponseFieldSubmissionID = big.NewInt(1 << 0) + stderrResponseFieldStderr = big.NewInt(1 << 1) +) + +type StderrResponse struct { + SubmissionID SubmissionID `json:"submissionId" url:"submissionId"` + Stderr string `json:"stderr" url:"stderr"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *StderrResponse) GetSubmissionID() SubmissionID { + if s == nil { + return uuid.Nil + } + return s.SubmissionID +} + +func (s *StderrResponse) GetStderr() string { + if s == nil { + return "" + } + return s.Stderr +} + +func (s *StderrResponse) GetExtraProperties() map[string]interface{} { + if s == nil { + return nil + } + return s.extraProperties +} + +func (s *StderrResponse) require(field *big.Int) { + if s.explicitFields == nil { + s.explicitFields = big.NewInt(0) + } + s.explicitFields.Or(s.explicitFields, field) +} + +// SetSubmissionID sets the SubmissionID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *StderrResponse) SetSubmissionID(submissionID SubmissionID) { + s.SubmissionID = submissionID + s.require(stderrResponseFieldSubmissionID) +} + +// SetStderr sets the Stderr field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *StderrResponse) SetStderr(stderr string) { + s.Stderr = stderr + s.require(stderrResponseFieldStderr) +} + +func (s *StderrResponse) UnmarshalJSON(data []byte) error { + type unmarshaler StderrResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = StderrResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *StderrResponse) MarshalJSON() ([]byte, error) { + type embed StderrResponse + var marshaler = struct { + embed + }{ + embed: embed(*s), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, s.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (s *StderrResponse) String() string { + if s == nil { + return "" + } + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +var ( + stdoutResponseFieldSubmissionID = big.NewInt(1 << 0) + stdoutResponseFieldStdout = big.NewInt(1 << 1) +) + +type StdoutResponse struct { + SubmissionID SubmissionID `json:"submissionId" url:"submissionId"` + Stdout string `json:"stdout" url:"stdout"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *StdoutResponse) GetSubmissionID() SubmissionID { + if s == nil { + return uuid.Nil + } + return s.SubmissionID +} + +func (s *StdoutResponse) GetStdout() string { + if s == nil { + return "" + } + return s.Stdout +} + +func (s *StdoutResponse) GetExtraProperties() map[string]interface{} { + if s == nil { + return nil + } + return s.extraProperties +} + +func (s *StdoutResponse) require(field *big.Int) { + if s.explicitFields == nil { + s.explicitFields = big.NewInt(0) + } + s.explicitFields.Or(s.explicitFields, field) +} + +// SetSubmissionID sets the SubmissionID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *StdoutResponse) SetSubmissionID(submissionID SubmissionID) { + s.SubmissionID = submissionID + s.require(stdoutResponseFieldSubmissionID) +} + +// SetStdout sets the Stdout field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *StdoutResponse) SetStdout(stdout string) { + s.Stdout = stdout + s.require(stdoutResponseFieldStdout) +} + +func (s *StdoutResponse) UnmarshalJSON(data []byte) error { + type unmarshaler StdoutResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = StdoutResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *StdoutResponse) MarshalJSON() ([]byte, error) { + type embed StdoutResponse + var marshaler = struct { + embed + }{ + embed: embed(*s), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, s.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (s *StdoutResponse) String() string { + if s == nil { + return "" + } + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +var ( + stopRequestFieldSubmissionID = big.NewInt(1 << 0) +) + +type StopRequest struct { + SubmissionID SubmissionID `json:"submissionId" url:"submissionId"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *StopRequest) GetSubmissionID() SubmissionID { + if s == nil { + return uuid.Nil + } + return s.SubmissionID +} + +func (s *StopRequest) GetExtraProperties() map[string]interface{} { + if s == nil { + return nil + } + return s.extraProperties +} + +func (s *StopRequest) require(field *big.Int) { + if s.explicitFields == nil { + s.explicitFields = big.NewInt(0) + } + s.explicitFields.Or(s.explicitFields, field) +} + +// SetSubmissionID sets the SubmissionID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *StopRequest) SetSubmissionID(submissionID SubmissionID) { + s.SubmissionID = submissionID + s.require(stopRequestFieldSubmissionID) +} + +func (s *StopRequest) UnmarshalJSON(data []byte) error { + type unmarshaler StopRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = StopRequest(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *StopRequest) MarshalJSON() ([]byte, error) { + type embed StopRequest + var marshaler = struct { + embed + }{ + embed: embed(*s), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, s.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (s *StopRequest) String() string { + if s == nil { + return "" + } + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +var ( + stoppedResponseFieldSubmissionID = big.NewInt(1 << 0) +) + +type StoppedResponse struct { + SubmissionID SubmissionID `json:"submissionId" url:"submissionId"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *StoppedResponse) GetSubmissionID() SubmissionID { + if s == nil { + return uuid.Nil + } + return s.SubmissionID +} + +func (s *StoppedResponse) GetExtraProperties() map[string]interface{} { + if s == nil { + return nil + } + return s.extraProperties +} + +func (s *StoppedResponse) require(field *big.Int) { + if s.explicitFields == nil { + s.explicitFields = big.NewInt(0) + } + s.explicitFields.Or(s.explicitFields, field) +} + +// SetSubmissionID sets the SubmissionID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *StoppedResponse) SetSubmissionID(submissionID SubmissionID) { + s.SubmissionID = submissionID + s.require(stoppedResponseFieldSubmissionID) +} + +func (s *StoppedResponse) UnmarshalJSON(data []byte) error { + type unmarshaler StoppedResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = StoppedResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *StoppedResponse) MarshalJSON() ([]byte, error) { + type embed StoppedResponse + var marshaler = struct { + embed + }{ + embed: embed(*s), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, s.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (s *StoppedResponse) String() string { + if s == nil { + return "" + } + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +var ( + submissionFileInfoFieldDirectory = big.NewInt(1 << 0) + submissionFileInfoFieldFilename = big.NewInt(1 << 1) + submissionFileInfoFieldContents = big.NewInt(1 << 2) +) + +type SubmissionFileInfo struct { + Directory string `json:"directory" url:"directory"` + Filename string `json:"filename" url:"filename"` + Contents string `json:"contents" url:"contents"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SubmissionFileInfo) GetDirectory() string { + if s == nil { + return "" + } + return s.Directory +} + +func (s *SubmissionFileInfo) GetFilename() string { + if s == nil { + return "" + } + return s.Filename +} + +func (s *SubmissionFileInfo) GetContents() string { + if s == nil { + return "" + } + return s.Contents +} + +func (s *SubmissionFileInfo) GetExtraProperties() map[string]interface{} { + if s == nil { + return nil + } + return s.extraProperties +} + +func (s *SubmissionFileInfo) require(field *big.Int) { + if s.explicitFields == nil { + s.explicitFields = big.NewInt(0) + } + s.explicitFields.Or(s.explicitFields, field) +} + +// SetDirectory sets the Directory field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SubmissionFileInfo) SetDirectory(directory string) { + s.Directory = directory + s.require(submissionFileInfoFieldDirectory) +} + +// SetFilename sets the Filename field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SubmissionFileInfo) SetFilename(filename string) { + s.Filename = filename + s.require(submissionFileInfoFieldFilename) +} + +// SetContents sets the Contents field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SubmissionFileInfo) SetContents(contents string) { + s.Contents = contents + s.require(submissionFileInfoFieldContents) +} + +func (s *SubmissionFileInfo) UnmarshalJSON(data []byte) error { + type unmarshaler SubmissionFileInfo + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SubmissionFileInfo(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SubmissionFileInfo) MarshalJSON() ([]byte, error) { + type embed SubmissionFileInfo + var marshaler = struct { + embed + }{ + embed: embed(*s), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, s.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (s *SubmissionFileInfo) String() string { + if s == nil { + return "" + } + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SubmissionID = uuid.UUID + +var ( + submissionIDNotFoundFieldMissingSubmissionID = big.NewInt(1 << 0) +) + +type SubmissionIDNotFound struct { + MissingSubmissionID SubmissionID `json:"missingSubmissionId" url:"missingSubmissionId"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SubmissionIDNotFound) GetMissingSubmissionID() SubmissionID { + if s == nil { + return uuid.Nil + } + return s.MissingSubmissionID +} + +func (s *SubmissionIDNotFound) GetExtraProperties() map[string]interface{} { + if s == nil { + return nil + } + return s.extraProperties +} + +func (s *SubmissionIDNotFound) require(field *big.Int) { + if s.explicitFields == nil { + s.explicitFields = big.NewInt(0) + } + s.explicitFields.Or(s.explicitFields, field) +} + +// SetMissingSubmissionID sets the MissingSubmissionID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SubmissionIDNotFound) SetMissingSubmissionID(missingSubmissionID SubmissionID) { + s.MissingSubmissionID = missingSubmissionID + s.require(submissionIDNotFoundFieldMissingSubmissionID) +} + +func (s *SubmissionIDNotFound) UnmarshalJSON(data []byte) error { + type unmarshaler SubmissionIDNotFound + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SubmissionIDNotFound(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SubmissionIDNotFound) MarshalJSON() ([]byte, error) { + type embed SubmissionIDNotFound + var marshaler = struct { + embed + }{ + embed: embed(*s), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, s.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (s *SubmissionIDNotFound) String() string { + if s == nil { + return "" + } + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type SubmissionRequest struct { + Type string + InitializeProblemRequest *InitializeProblemRequest + InitializeWorkspaceRequest interface{} + SubmitV2 *SubmitRequestV2 + WorkspaceSubmit *WorkspaceSubmitRequest + Stop *StopRequest + + rawJSON json.RawMessage +} + +func (s *SubmissionRequest) GetType() string { + if s == nil { + return "" + } + return s.Type +} + +func (s *SubmissionRequest) GetInitializeProblemRequest() *InitializeProblemRequest { + if s == nil { + return nil + } + return s.InitializeProblemRequest +} + +func (s *SubmissionRequest) GetInitializeWorkspaceRequest() interface{} { + if s == nil { + return nil + } + return s.InitializeWorkspaceRequest +} + +func (s *SubmissionRequest) GetSubmitV2() *SubmitRequestV2 { + if s == nil { + return nil + } + return s.SubmitV2 +} + +func (s *SubmissionRequest) GetWorkspaceSubmit() *WorkspaceSubmitRequest { + if s == nil { + return nil + } + return s.WorkspaceSubmit +} + +func (s *SubmissionRequest) GetStop() *StopRequest { + if s == nil { + return nil + } + return s.Stop +} + +func (s *SubmissionRequest) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + s.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", s) + } + switch unmarshaler.Type { + case "initializeProblemRequest": + value := new(InitializeProblemRequest) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + s.InitializeProblemRequest = value + case "initializeWorkspaceRequest": + value := make(map[string]interface{}) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + s.InitializeWorkspaceRequest = value + case "submitV2": + value := new(SubmitRequestV2) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + s.SubmitV2 = value + case "workspaceSubmit": + value := new(WorkspaceSubmitRequest) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + s.WorkspaceSubmit = value + case "stop": + value := new(StopRequest) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + s.Stop = value + } + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s SubmissionRequest) MarshalJSON() ([]byte, error) { + if err := s.validate(); err != nil { + return nil, err + } + if s.InitializeProblemRequest != nil { + return internal.MarshalJSONWithExtraProperty(s.InitializeProblemRequest, "type", "initializeProblemRequest") + } + if s.InitializeWorkspaceRequest != nil { + var marshaler = struct { + Type string `json:"type"` + InitializeWorkspaceRequest interface{} `json:"initializeWorkspaceRequest,omitempty"` + }{ + Type: "initializeWorkspaceRequest", + InitializeWorkspaceRequest: s.InitializeWorkspaceRequest, + } + return json.Marshal(marshaler) + } + if s.SubmitV2 != nil { + return internal.MarshalJSONWithExtraProperty(s.SubmitV2, "type", "submitV2") + } + if s.WorkspaceSubmit != nil { + return internal.MarshalJSONWithExtraProperty(s.WorkspaceSubmit, "type", "workspaceSubmit") + } + if s.Stop != nil { + return internal.MarshalJSONWithExtraProperty(s.Stop, "type", "stop") + } + if len(s.rawJSON) > 0 { + return s.rawJSON, nil + } + return nil, fmt.Errorf("type %T does not define a non-empty union type", s) +} + +type SubmissionRequestVisitor interface { + VisitInitializeProblemRequest(*InitializeProblemRequest) error + VisitInitializeWorkspaceRequest(interface{}) error + VisitSubmitV2(*SubmitRequestV2) error + VisitWorkspaceSubmit(*WorkspaceSubmitRequest) error + VisitStop(*StopRequest) error +} + +func (s *SubmissionRequest) Accept(visitor SubmissionRequestVisitor) error { + if s.InitializeProblemRequest != nil { + return visitor.VisitInitializeProblemRequest(s.InitializeProblemRequest) + } + if s.InitializeWorkspaceRequest != nil { + return visitor.VisitInitializeWorkspaceRequest(s.InitializeWorkspaceRequest) + } + if s.SubmitV2 != nil { + return visitor.VisitSubmitV2(s.SubmitV2) + } + if s.WorkspaceSubmit != nil { + return visitor.VisitWorkspaceSubmit(s.WorkspaceSubmit) + } + if s.Stop != nil { + return visitor.VisitStop(s.Stop) + } + return fmt.Errorf("type %T does not define a non-empty union type", s) +} + +func (s *SubmissionRequest) validate() error { + if s == nil { + return fmt.Errorf("type %T is nil", s) + } + var fields []string + if s.InitializeProblemRequest != nil { + fields = append(fields, "initializeProblemRequest") + } + if s.InitializeWorkspaceRequest != nil { + fields = append(fields, "initializeWorkspaceRequest") + } + if s.SubmitV2 != nil { + fields = append(fields, "submitV2") + } + if s.WorkspaceSubmit != nil { + fields = append(fields, "workspaceSubmit") + } + if s.Stop != nil { + fields = append(fields, "stop") + } + if len(fields) == 0 { + if s.Type != "" { + if len(s.rawJSON) > 0 { + return nil + } + return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", s, s.Type) + } + return fmt.Errorf("type %T is empty", s) + } + if len(fields) > 1 { + return fmt.Errorf("type %T defines values for %s, but only one value is allowed", s, fields) + } + if s.Type != "" { + field := fields[0] + if s.Type != field { + return fmt.Errorf( + "type %T defines a discriminant set to %q, but it does not match the %T field; either remove or update the discriminant to match", + s, + s.Type, + s, + ) + } + } + return nil +} + +type SubmissionResponse struct { + Type string + ServerInitialized interface{} + ProblemInitialized common.ProblemID + WorkspaceInitialized interface{} + ServerErrored *ExceptionInfo + CodeExecutionUpdate *CodeExecutionUpdate + Terminated *TerminatedResponse + + rawJSON json.RawMessage +} + +func (s *SubmissionResponse) GetType() string { + if s == nil { + return "" + } + return s.Type +} + +func (s *SubmissionResponse) GetServerInitialized() interface{} { + if s == nil { + return nil + } + return s.ServerInitialized +} + +func (s *SubmissionResponse) GetProblemInitialized() common.ProblemID { + if s == nil { + return "" + } + return s.ProblemInitialized +} + +func (s *SubmissionResponse) GetWorkspaceInitialized() interface{} { + if s == nil { + return nil + } + return s.WorkspaceInitialized +} + +func (s *SubmissionResponse) GetServerErrored() *ExceptionInfo { + if s == nil { + return nil + } + return s.ServerErrored +} + +func (s *SubmissionResponse) GetCodeExecutionUpdate() *CodeExecutionUpdate { + if s == nil { + return nil + } + return s.CodeExecutionUpdate +} + +func (s *SubmissionResponse) GetTerminated() *TerminatedResponse { + if s == nil { + return nil + } + return s.Terminated +} + +func (s *SubmissionResponse) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + s.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", s) + } + switch unmarshaler.Type { + case "serverInitialized": + value := make(map[string]interface{}) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + s.ServerInitialized = value + case "problemInitialized": + var valueUnmarshaler struct { + ProblemInitialized common.ProblemID `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + s.ProblemInitialized = valueUnmarshaler.ProblemInitialized + case "workspaceInitialized": + value := make(map[string]interface{}) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + s.WorkspaceInitialized = value + case "serverErrored": + value := new(ExceptionInfo) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + s.ServerErrored = value + case "codeExecutionUpdate": + var valueUnmarshaler struct { + CodeExecutionUpdate *CodeExecutionUpdate `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + s.CodeExecutionUpdate = valueUnmarshaler.CodeExecutionUpdate + case "terminated": + value := new(TerminatedResponse) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + s.Terminated = value + } + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s SubmissionResponse) MarshalJSON() ([]byte, error) { + if err := s.validate(); err != nil { + return nil, err + } + if s.ServerInitialized != nil { + var marshaler = struct { + Type string `json:"type"` + ServerInitialized interface{} `json:"serverInitialized,omitempty"` + }{ + Type: "serverInitialized", + ServerInitialized: s.ServerInitialized, + } + return json.Marshal(marshaler) + } + if s.ProblemInitialized != "" { + var marshaler = struct { + Type string `json:"type"` + ProblemInitialized common.ProblemID `json:"value"` + }{ + Type: "problemInitialized", + ProblemInitialized: s.ProblemInitialized, + } + return json.Marshal(marshaler) + } + if s.WorkspaceInitialized != nil { + var marshaler = struct { + Type string `json:"type"` + WorkspaceInitialized interface{} `json:"workspaceInitialized,omitempty"` + }{ + Type: "workspaceInitialized", + WorkspaceInitialized: s.WorkspaceInitialized, + } + return json.Marshal(marshaler) + } + if s.ServerErrored != nil { + return internal.MarshalJSONWithExtraProperty(s.ServerErrored, "type", "serverErrored") + } + if s.CodeExecutionUpdate != nil { + var marshaler = struct { + Type string `json:"type"` + CodeExecutionUpdate *CodeExecutionUpdate `json:"value"` + }{ + Type: "codeExecutionUpdate", + CodeExecutionUpdate: s.CodeExecutionUpdate, + } + return json.Marshal(marshaler) + } + if s.Terminated != nil { + return internal.MarshalJSONWithExtraProperty(s.Terminated, "type", "terminated") + } + if len(s.rawJSON) > 0 { + return s.rawJSON, nil + } + return nil, fmt.Errorf("type %T does not define a non-empty union type", s) +} + +type SubmissionResponseVisitor interface { + VisitServerInitialized(interface{}) error + VisitProblemInitialized(common.ProblemID) error + VisitWorkspaceInitialized(interface{}) error + VisitServerErrored(*ExceptionInfo) error + VisitCodeExecutionUpdate(*CodeExecutionUpdate) error + VisitTerminated(*TerminatedResponse) error +} + +func (s *SubmissionResponse) Accept(visitor SubmissionResponseVisitor) error { + if s.ServerInitialized != nil { + return visitor.VisitServerInitialized(s.ServerInitialized) + } + if s.ProblemInitialized != "" { + return visitor.VisitProblemInitialized(s.ProblemInitialized) + } + if s.WorkspaceInitialized != nil { + return visitor.VisitWorkspaceInitialized(s.WorkspaceInitialized) + } + if s.ServerErrored != nil { + return visitor.VisitServerErrored(s.ServerErrored) + } + if s.CodeExecutionUpdate != nil { + return visitor.VisitCodeExecutionUpdate(s.CodeExecutionUpdate) + } + if s.Terminated != nil { + return visitor.VisitTerminated(s.Terminated) + } + return fmt.Errorf("type %T does not define a non-empty union type", s) +} + +func (s *SubmissionResponse) validate() error { + if s == nil { + return fmt.Errorf("type %T is nil", s) + } + var fields []string + if s.ServerInitialized != nil { + fields = append(fields, "serverInitialized") + } + if s.ProblemInitialized != "" { + fields = append(fields, "problemInitialized") + } + if s.WorkspaceInitialized != nil { + fields = append(fields, "workspaceInitialized") + } + if s.ServerErrored != nil { + fields = append(fields, "serverErrored") + } + if s.CodeExecutionUpdate != nil { + fields = append(fields, "codeExecutionUpdate") + } + if s.Terminated != nil { + fields = append(fields, "terminated") + } + if len(fields) == 0 { + if s.Type != "" { + if len(s.rawJSON) > 0 { + return nil + } + return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", s, s.Type) + } + return fmt.Errorf("type %T is empty", s) + } + if len(fields) > 1 { + return fmt.Errorf("type %T defines values for %s, but only one value is allowed", s, fields) + } + if s.Type != "" { + field := fields[0] + if s.Type != field { + return fmt.Errorf( + "type %T defines a discriminant set to %q, but it does not match the %T field; either remove or update the discriminant to match", + s, + s.Type, + s, + ) + } + } + return nil +} + +type SubmissionStatusForTestCase struct { + Type string + Graded *TestCaseResultWithStdout + GradedV2 *TestCaseGrade + Traced *TracedTestCase + + rawJSON json.RawMessage +} + +func (s *SubmissionStatusForTestCase) GetType() string { + if s == nil { + return "" + } + return s.Type +} + +func (s *SubmissionStatusForTestCase) GetGraded() *TestCaseResultWithStdout { + if s == nil { + return nil + } + return s.Graded +} + +func (s *SubmissionStatusForTestCase) GetGradedV2() *TestCaseGrade { + if s == nil { + return nil + } + return s.GradedV2 +} + +func (s *SubmissionStatusForTestCase) GetTraced() *TracedTestCase { + if s == nil { + return nil + } + return s.Traced +} + +func (s *SubmissionStatusForTestCase) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + s.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", s) + } + switch unmarshaler.Type { + case "graded": + value := new(TestCaseResultWithStdout) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + s.Graded = value + case "gradedV2": + var valueUnmarshaler struct { + GradedV2 *TestCaseGrade `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + s.GradedV2 = valueUnmarshaler.GradedV2 + case "traced": + value := new(TracedTestCase) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + s.Traced = value + } + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s SubmissionStatusForTestCase) MarshalJSON() ([]byte, error) { + if err := s.validate(); err != nil { + return nil, err + } + if s.Graded != nil { + return internal.MarshalJSONWithExtraProperty(s.Graded, "type", "graded") + } + if s.GradedV2 != nil { + var marshaler = struct { + Type string `json:"type"` + GradedV2 *TestCaseGrade `json:"value"` + }{ + Type: "gradedV2", + GradedV2: s.GradedV2, + } + return json.Marshal(marshaler) + } + if s.Traced != nil { + return internal.MarshalJSONWithExtraProperty(s.Traced, "type", "traced") + } + if len(s.rawJSON) > 0 { + return s.rawJSON, nil + } + return nil, fmt.Errorf("type %T does not define a non-empty union type", s) +} + +type SubmissionStatusForTestCaseVisitor interface { + VisitGraded(*TestCaseResultWithStdout) error + VisitGradedV2(*TestCaseGrade) error + VisitTraced(*TracedTestCase) error +} + +func (s *SubmissionStatusForTestCase) Accept(visitor SubmissionStatusForTestCaseVisitor) error { + if s.Graded != nil { + return visitor.VisitGraded(s.Graded) + } + if s.GradedV2 != nil { + return visitor.VisitGradedV2(s.GradedV2) + } + if s.Traced != nil { + return visitor.VisitTraced(s.Traced) + } + return fmt.Errorf("type %T does not define a non-empty union type", s) +} + +func (s *SubmissionStatusForTestCase) validate() error { + if s == nil { + return fmt.Errorf("type %T is nil", s) + } + var fields []string + if s.Graded != nil { + fields = append(fields, "graded") + } + if s.GradedV2 != nil { + fields = append(fields, "gradedV2") + } + if s.Traced != nil { + fields = append(fields, "traced") + } + if len(fields) == 0 { + if s.Type != "" { + if len(s.rawJSON) > 0 { + return nil + } + return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", s, s.Type) + } + return fmt.Errorf("type %T is empty", s) + } + if len(fields) > 1 { + return fmt.Errorf("type %T defines values for %s, but only one value is allowed", s, fields) + } + if s.Type != "" { + field := fields[0] + if s.Type != field { + return fmt.Errorf( + "type %T defines a discriminant set to %q, but it does not match the %T field; either remove or update the discriminant to match", + s, + s.Type, + s, + ) + } + } + return nil +} + +type SubmissionStatusV2 struct { + Type string + Test *TestSubmissionStatusV2 + Workspace *WorkspaceSubmissionStatusV2 + + rawJSON json.RawMessage +} + +func (s *SubmissionStatusV2) GetType() string { + if s == nil { + return "" + } + return s.Type +} + +func (s *SubmissionStatusV2) GetTest() *TestSubmissionStatusV2 { + if s == nil { + return nil + } + return s.Test +} + +func (s *SubmissionStatusV2) GetWorkspace() *WorkspaceSubmissionStatusV2 { + if s == nil { + return nil + } + return s.Workspace +} + +func (s *SubmissionStatusV2) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + s.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", s) + } + switch unmarshaler.Type { + case "test": + value := new(TestSubmissionStatusV2) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + s.Test = value + case "workspace": + value := new(WorkspaceSubmissionStatusV2) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + s.Workspace = value + } + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s SubmissionStatusV2) MarshalJSON() ([]byte, error) { + if err := s.validate(); err != nil { + return nil, err + } + if s.Test != nil { + return internal.MarshalJSONWithExtraProperty(s.Test, "type", "test") + } + if s.Workspace != nil { + return internal.MarshalJSONWithExtraProperty(s.Workspace, "type", "workspace") + } + if len(s.rawJSON) > 0 { + return s.rawJSON, nil + } + return nil, fmt.Errorf("type %T does not define a non-empty union type", s) +} + +type SubmissionStatusV2Visitor interface { + VisitTest(*TestSubmissionStatusV2) error + VisitWorkspace(*WorkspaceSubmissionStatusV2) error +} + +func (s *SubmissionStatusV2) Accept(visitor SubmissionStatusV2Visitor) error { + if s.Test != nil { + return visitor.VisitTest(s.Test) + } + if s.Workspace != nil { + return visitor.VisitWorkspace(s.Workspace) + } + return fmt.Errorf("type %T does not define a non-empty union type", s) +} + +func (s *SubmissionStatusV2) validate() error { + if s == nil { + return fmt.Errorf("type %T is nil", s) + } + var fields []string + if s.Test != nil { + fields = append(fields, "test") + } + if s.Workspace != nil { + fields = append(fields, "workspace") + } + if len(fields) == 0 { + if s.Type != "" { + if len(s.rawJSON) > 0 { + return nil + } + return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", s, s.Type) + } + return fmt.Errorf("type %T is empty", s) + } + if len(fields) > 1 { + return fmt.Errorf("type %T defines values for %s, but only one value is allowed", s, fields) + } + if s.Type != "" { + field := fields[0] + if s.Type != field { + return fmt.Errorf( + "type %T defines a discriminant set to %q, but it does not match the %T field; either remove or update the discriminant to match", + s, + s.Type, + s, + ) + } + } + return nil +} + +// Keep in sync with SubmissionType. +type SubmissionTypeEnum string + +const ( + SubmissionTypeEnumTest SubmissionTypeEnum = "TEST" +) + +func NewSubmissionTypeEnumFromString(s string) (SubmissionTypeEnum, error) { + switch s { + case "TEST": + return SubmissionTypeEnumTest, nil + } + var t SubmissionTypeEnum + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SubmissionTypeEnum) Ptr() *SubmissionTypeEnum { + return &s +} + +type SubmissionTypeState struct { + Type string + Test *TestSubmissionState + Workspace *WorkspaceSubmissionState + + rawJSON json.RawMessage +} + +func (s *SubmissionTypeState) GetType() string { + if s == nil { + return "" + } + return s.Type +} + +func (s *SubmissionTypeState) GetTest() *TestSubmissionState { + if s == nil { + return nil + } + return s.Test +} + +func (s *SubmissionTypeState) GetWorkspace() *WorkspaceSubmissionState { + if s == nil { + return nil + } + return s.Workspace +} + +func (s *SubmissionTypeState) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + s.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", s) + } + switch unmarshaler.Type { + case "test": + value := new(TestSubmissionState) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + s.Test = value + case "workspace": + value := new(WorkspaceSubmissionState) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + s.Workspace = value + } + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s SubmissionTypeState) MarshalJSON() ([]byte, error) { + if err := s.validate(); err != nil { + return nil, err + } + if s.Test != nil { + return internal.MarshalJSONWithExtraProperty(s.Test, "type", "test") + } + if s.Workspace != nil { + return internal.MarshalJSONWithExtraProperty(s.Workspace, "type", "workspace") + } + if len(s.rawJSON) > 0 { + return s.rawJSON, nil + } + return nil, fmt.Errorf("type %T does not define a non-empty union type", s) +} + +type SubmissionTypeStateVisitor interface { + VisitTest(*TestSubmissionState) error + VisitWorkspace(*WorkspaceSubmissionState) error +} + +func (s *SubmissionTypeState) Accept(visitor SubmissionTypeStateVisitor) error { + if s.Test != nil { + return visitor.VisitTest(s.Test) + } + if s.Workspace != nil { + return visitor.VisitWorkspace(s.Workspace) + } + return fmt.Errorf("type %T does not define a non-empty union type", s) +} + +func (s *SubmissionTypeState) validate() error { + if s == nil { + return fmt.Errorf("type %T is nil", s) + } + var fields []string + if s.Test != nil { + fields = append(fields, "test") + } + if s.Workspace != nil { + fields = append(fields, "workspace") + } + if len(fields) == 0 { + if s.Type != "" { + if len(s.rawJSON) > 0 { + return nil + } + return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", s, s.Type) + } + return fmt.Errorf("type %T is empty", s) + } + if len(fields) > 1 { + return fmt.Errorf("type %T defines values for %s, but only one value is allowed", s, fields) + } + if s.Type != "" { + field := fields[0] + if s.Type != field { + return fmt.Errorf( + "type %T defines a discriminant set to %q, but it does not match the %T field; either remove or update the discriminant to match", + s, + s.Type, + s, + ) + } + } + return nil +} + +var ( + submitRequestV2FieldSubmissionID = big.NewInt(1 << 0) + submitRequestV2FieldLanguage = big.NewInt(1 << 1) + submitRequestV2FieldSubmissionFiles = big.NewInt(1 << 2) + submitRequestV2FieldProblemID = big.NewInt(1 << 3) + submitRequestV2FieldProblemVersion = big.NewInt(1 << 4) + submitRequestV2FieldUserID = big.NewInt(1 << 5) +) + +type SubmitRequestV2 struct { + SubmissionID SubmissionID `json:"submissionId" url:"submissionId"` + Language common.Language `json:"language" url:"language"` + SubmissionFiles []*SubmissionFileInfo `json:"submissionFiles" url:"submissionFiles"` + ProblemID common.ProblemID `json:"problemId" url:"problemId"` + ProblemVersion *int `json:"problemVersion,omitempty" url:"problemVersion,omitempty"` + UserID *string `json:"userId,omitempty" url:"userId,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SubmitRequestV2) GetSubmissionID() SubmissionID { + if s == nil { + return uuid.Nil + } + return s.SubmissionID +} + +func (s *SubmitRequestV2) GetLanguage() common.Language { + if s == nil { + return "" + } + return s.Language +} + +func (s *SubmitRequestV2) GetSubmissionFiles() []*SubmissionFileInfo { + if s == nil { + return nil + } + return s.SubmissionFiles +} + +func (s *SubmitRequestV2) GetProblemID() common.ProblemID { + if s == nil { + return "" + } + return s.ProblemID +} + +func (s *SubmitRequestV2) GetProblemVersion() *int { + if s == nil { + return nil + } + return s.ProblemVersion +} + +func (s *SubmitRequestV2) GetUserID() *string { + if s == nil { + return nil + } + return s.UserID +} + +func (s *SubmitRequestV2) GetExtraProperties() map[string]interface{} { + if s == nil { + return nil + } + return s.extraProperties +} + +func (s *SubmitRequestV2) require(field *big.Int) { + if s.explicitFields == nil { + s.explicitFields = big.NewInt(0) + } + s.explicitFields.Or(s.explicitFields, field) +} + +// SetSubmissionID sets the SubmissionID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SubmitRequestV2) SetSubmissionID(submissionID SubmissionID) { + s.SubmissionID = submissionID + s.require(submitRequestV2FieldSubmissionID) +} + +// SetLanguage sets the Language field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SubmitRequestV2) SetLanguage(language common.Language) { + s.Language = language + s.require(submitRequestV2FieldLanguage) +} + +// SetSubmissionFiles sets the SubmissionFiles field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SubmitRequestV2) SetSubmissionFiles(submissionFiles []*SubmissionFileInfo) { + s.SubmissionFiles = submissionFiles + s.require(submitRequestV2FieldSubmissionFiles) +} + +// SetProblemID sets the ProblemID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SubmitRequestV2) SetProblemID(problemID common.ProblemID) { + s.ProblemID = problemID + s.require(submitRequestV2FieldProblemID) +} + +// SetProblemVersion sets the ProblemVersion field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SubmitRequestV2) SetProblemVersion(problemVersion *int) { + s.ProblemVersion = problemVersion + s.require(submitRequestV2FieldProblemVersion) +} + +// SetUserID sets the UserID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SubmitRequestV2) SetUserID(userID *string) { + s.UserID = userID + s.require(submitRequestV2FieldUserID) +} + +func (s *SubmitRequestV2) UnmarshalJSON(data []byte) error { + type unmarshaler SubmitRequestV2 + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SubmitRequestV2(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SubmitRequestV2) MarshalJSON() ([]byte, error) { + type embed SubmitRequestV2 + var marshaler = struct { + embed + }{ + embed: embed(*s), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, s.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (s *SubmitRequestV2) String() string { + if s == nil { + return "" + } + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +type TerminatedResponse struct { + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TerminatedResponse) GetExtraProperties() map[string]interface{} { + if t == nil { + return nil + } + return t.extraProperties +} + +func (t *TerminatedResponse) require(field *big.Int) { + if t.explicitFields == nil { + t.explicitFields = big.NewInt(0) + } + t.explicitFields.Or(t.explicitFields, field) +} + +func (t *TerminatedResponse) UnmarshalJSON(data []byte) error { + type unmarshaler TerminatedResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TerminatedResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TerminatedResponse) MarshalJSON() ([]byte, error) { + type embed TerminatedResponse + var marshaler = struct { + embed + }{ + embed: embed(*t), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, t.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (t *TerminatedResponse) String() string { + if t == nil { + return "" + } + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +type TestCaseGrade struct { + Type string + Hidden *TestCaseHiddenGrade + NonHidden *TestCaseNonHiddenGrade + + rawJSON json.RawMessage +} + +func (t *TestCaseGrade) GetType() string { + if t == nil { + return "" + } + return t.Type +} + +func (t *TestCaseGrade) GetHidden() *TestCaseHiddenGrade { + if t == nil { + return nil + } + return t.Hidden +} + +func (t *TestCaseGrade) GetNonHidden() *TestCaseNonHiddenGrade { + if t == nil { + return nil + } + return t.NonHidden +} + +func (t *TestCaseGrade) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + t.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", t) + } + switch unmarshaler.Type { + case "hidden": + value := new(TestCaseHiddenGrade) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + t.Hidden = value + case "nonHidden": + value := new(TestCaseNonHiddenGrade) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + t.NonHidden = value + } + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t TestCaseGrade) MarshalJSON() ([]byte, error) { + if err := t.validate(); err != nil { + return nil, err + } + if t.Hidden != nil { + return internal.MarshalJSONWithExtraProperty(t.Hidden, "type", "hidden") + } + if t.NonHidden != nil { + return internal.MarshalJSONWithExtraProperty(t.NonHidden, "type", "nonHidden") + } + if len(t.rawJSON) > 0 { + return t.rawJSON, nil + } + return nil, fmt.Errorf("type %T does not define a non-empty union type", t) +} + +type TestCaseGradeVisitor interface { + VisitHidden(*TestCaseHiddenGrade) error + VisitNonHidden(*TestCaseNonHiddenGrade) error +} + +func (t *TestCaseGrade) Accept(visitor TestCaseGradeVisitor) error { + if t.Hidden != nil { + return visitor.VisitHidden(t.Hidden) + } + if t.NonHidden != nil { + return visitor.VisitNonHidden(t.NonHidden) + } + return fmt.Errorf("type %T does not define a non-empty union type", t) +} + +func (t *TestCaseGrade) validate() error { + if t == nil { + return fmt.Errorf("type %T is nil", t) + } + var fields []string + if t.Hidden != nil { + fields = append(fields, "hidden") + } + if t.NonHidden != nil { + fields = append(fields, "nonHidden") + } + if len(fields) == 0 { + if t.Type != "" { + if len(t.rawJSON) > 0 { + return nil + } + return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", t, t.Type) + } + return fmt.Errorf("type %T is empty", t) + } + if len(fields) > 1 { + return fmt.Errorf("type %T defines values for %s, but only one value is allowed", t, fields) + } + if t.Type != "" { + field := fields[0] + if t.Type != field { + return fmt.Errorf( + "type %T defines a discriminant set to %q, but it does not match the %T field; either remove or update the discriminant to match", + t, + t.Type, + t, + ) + } + } + return nil +} + +var ( + testCaseHiddenGradeFieldPassed = big.NewInt(1 << 0) +) + +type TestCaseHiddenGrade struct { + Passed bool `json:"passed" url:"passed"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TestCaseHiddenGrade) GetPassed() bool { + if t == nil { + return false + } + return t.Passed +} + +func (t *TestCaseHiddenGrade) GetExtraProperties() map[string]interface{} { + if t == nil { + return nil + } + return t.extraProperties +} + +func (t *TestCaseHiddenGrade) require(field *big.Int) { + if t.explicitFields == nil { + t.explicitFields = big.NewInt(0) + } + t.explicitFields.Or(t.explicitFields, field) +} + +// SetPassed sets the Passed field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseHiddenGrade) SetPassed(passed bool) { + t.Passed = passed + t.require(testCaseHiddenGradeFieldPassed) +} + +func (t *TestCaseHiddenGrade) UnmarshalJSON(data []byte) error { + type unmarshaler TestCaseHiddenGrade + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TestCaseHiddenGrade(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TestCaseHiddenGrade) MarshalJSON() ([]byte, error) { + type embed TestCaseHiddenGrade + var marshaler = struct { + embed + }{ + embed: embed(*t), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, t.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (t *TestCaseHiddenGrade) String() string { + if t == nil { + return "" + } + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +var ( + testCaseNonHiddenGradeFieldPassed = big.NewInt(1 << 0) + testCaseNonHiddenGradeFieldActualResult = big.NewInt(1 << 1) + testCaseNonHiddenGradeFieldException = big.NewInt(1 << 2) + testCaseNonHiddenGradeFieldStdout = big.NewInt(1 << 3) +) + +type TestCaseNonHiddenGrade struct { + Passed bool `json:"passed" url:"passed"` + ActualResult *common.VariableValue `json:"actualResult,omitempty" url:"actualResult,omitempty"` + Exception *ExceptionV2 `json:"exception,omitempty" url:"exception,omitempty"` + Stdout string `json:"stdout" url:"stdout"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TestCaseNonHiddenGrade) GetPassed() bool { + if t == nil { + return false + } + return t.Passed +} + +func (t *TestCaseNonHiddenGrade) GetActualResult() *common.VariableValue { + if t == nil { + return nil + } + return t.ActualResult +} + +func (t *TestCaseNonHiddenGrade) GetException() *ExceptionV2 { + if t == nil { + return nil + } + return t.Exception +} + +func (t *TestCaseNonHiddenGrade) GetStdout() string { + if t == nil { + return "" + } + return t.Stdout +} + +func (t *TestCaseNonHiddenGrade) GetExtraProperties() map[string]interface{} { + if t == nil { + return nil + } + return t.extraProperties +} + +func (t *TestCaseNonHiddenGrade) require(field *big.Int) { + if t.explicitFields == nil { + t.explicitFields = big.NewInt(0) + } + t.explicitFields.Or(t.explicitFields, field) +} + +// SetPassed sets the Passed field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseNonHiddenGrade) SetPassed(passed bool) { + t.Passed = passed + t.require(testCaseNonHiddenGradeFieldPassed) +} + +// SetActualResult sets the ActualResult field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseNonHiddenGrade) SetActualResult(actualResult *common.VariableValue) { + t.ActualResult = actualResult + t.require(testCaseNonHiddenGradeFieldActualResult) +} + +// SetException sets the Exception field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseNonHiddenGrade) SetException(exception *ExceptionV2) { + t.Exception = exception + t.require(testCaseNonHiddenGradeFieldException) +} + +// SetStdout sets the Stdout field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseNonHiddenGrade) SetStdout(stdout string) { + t.Stdout = stdout + t.require(testCaseNonHiddenGradeFieldStdout) +} + +func (t *TestCaseNonHiddenGrade) UnmarshalJSON(data []byte) error { + type unmarshaler TestCaseNonHiddenGrade + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TestCaseNonHiddenGrade(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TestCaseNonHiddenGrade) MarshalJSON() ([]byte, error) { + type embed TestCaseNonHiddenGrade + var marshaler = struct { + embed + }{ + embed: embed(*t), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, t.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (t *TestCaseNonHiddenGrade) String() string { + if t == nil { + return "" + } + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +var ( + testCaseResultFieldExpectedResult = big.NewInt(1 << 0) + testCaseResultFieldActualResult = big.NewInt(1 << 1) + testCaseResultFieldPassed = big.NewInt(1 << 2) +) + +type TestCaseResult struct { + ExpectedResult *common.VariableValue `json:"expectedResult" url:"expectedResult"` + ActualResult *ActualResult `json:"actualResult" url:"actualResult"` + Passed bool `json:"passed" url:"passed"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TestCaseResult) GetExpectedResult() *common.VariableValue { + if t == nil { + return nil + } + return t.ExpectedResult +} + +func (t *TestCaseResult) GetActualResult() *ActualResult { + if t == nil { + return nil + } + return t.ActualResult +} + +func (t *TestCaseResult) GetPassed() bool { + if t == nil { + return false + } + return t.Passed +} + +func (t *TestCaseResult) GetExtraProperties() map[string]interface{} { + if t == nil { + return nil + } + return t.extraProperties +} + +func (t *TestCaseResult) require(field *big.Int) { + if t.explicitFields == nil { + t.explicitFields = big.NewInt(0) + } + t.explicitFields.Or(t.explicitFields, field) +} + +// SetExpectedResult sets the ExpectedResult field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseResult) SetExpectedResult(expectedResult *common.VariableValue) { + t.ExpectedResult = expectedResult + t.require(testCaseResultFieldExpectedResult) +} + +// SetActualResult sets the ActualResult field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseResult) SetActualResult(actualResult *ActualResult) { + t.ActualResult = actualResult + t.require(testCaseResultFieldActualResult) +} + +// SetPassed sets the Passed field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseResult) SetPassed(passed bool) { + t.Passed = passed + t.require(testCaseResultFieldPassed) +} + +func (t *TestCaseResult) UnmarshalJSON(data []byte) error { + type unmarshaler TestCaseResult + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TestCaseResult(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TestCaseResult) MarshalJSON() ([]byte, error) { + type embed TestCaseResult + var marshaler = struct { + embed + }{ + embed: embed(*t), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, t.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (t *TestCaseResult) String() string { + if t == nil { + return "" + } + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +var ( + testCaseResultWithStdoutFieldResult = big.NewInt(1 << 0) + testCaseResultWithStdoutFieldStdout = big.NewInt(1 << 1) +) + +type TestCaseResultWithStdout struct { + Result *TestCaseResult `json:"result" url:"result"` + Stdout string `json:"stdout" url:"stdout"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TestCaseResultWithStdout) GetResult() *TestCaseResult { + if t == nil { + return nil + } + return t.Result +} + +func (t *TestCaseResultWithStdout) GetStdout() string { + if t == nil { + return "" + } + return t.Stdout +} + +func (t *TestCaseResultWithStdout) GetExtraProperties() map[string]interface{} { + if t == nil { + return nil + } + return t.extraProperties +} + +func (t *TestCaseResultWithStdout) require(field *big.Int) { + if t.explicitFields == nil { + t.explicitFields = big.NewInt(0) + } + t.explicitFields.Or(t.explicitFields, field) +} + +// SetResult sets the Result field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseResultWithStdout) SetResult(result *TestCaseResult) { + t.Result = result + t.require(testCaseResultWithStdoutFieldResult) +} + +// SetStdout sets the Stdout field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseResultWithStdout) SetStdout(stdout string) { + t.Stdout = stdout + t.require(testCaseResultWithStdoutFieldStdout) +} + +func (t *TestCaseResultWithStdout) UnmarshalJSON(data []byte) error { + type unmarshaler TestCaseResultWithStdout + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TestCaseResultWithStdout(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TestCaseResultWithStdout) MarshalJSON() ([]byte, error) { + type embed TestCaseResultWithStdout + var marshaler = struct { + embed + }{ + embed: embed(*t), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, t.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (t *TestCaseResultWithStdout) String() string { + if t == nil { + return "" + } + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +var ( + testSubmissionStateFieldProblemID = big.NewInt(1 << 0) + testSubmissionStateFieldDefaultTestCases = big.NewInt(1 << 1) + testSubmissionStateFieldCustomTestCases = big.NewInt(1 << 2) + testSubmissionStateFieldStatus = big.NewInt(1 << 3) +) + +type TestSubmissionState struct { + ProblemID common.ProblemID `json:"problemId" url:"problemId"` + DefaultTestCases []*TestCase `json:"defaultTestCases" url:"defaultTestCases"` + CustomTestCases []*TestCase `json:"customTestCases" url:"customTestCases"` + Status *TestSubmissionStatus `json:"status" url:"status"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TestSubmissionState) GetProblemID() common.ProblemID { + if t == nil { + return "" + } + return t.ProblemID +} + +func (t *TestSubmissionState) GetDefaultTestCases() []*TestCase { + if t == nil { + return nil + } + return t.DefaultTestCases +} + +func (t *TestSubmissionState) GetCustomTestCases() []*TestCase { + if t == nil { + return nil + } + return t.CustomTestCases +} + +func (t *TestSubmissionState) GetStatus() *TestSubmissionStatus { + if t == nil { + return nil + } + return t.Status +} + +func (t *TestSubmissionState) GetExtraProperties() map[string]interface{} { + if t == nil { + return nil + } + return t.extraProperties +} + +func (t *TestSubmissionState) require(field *big.Int) { + if t.explicitFields == nil { + t.explicitFields = big.NewInt(0) + } + t.explicitFields.Or(t.explicitFields, field) +} + +// SetProblemID sets the ProblemID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestSubmissionState) SetProblemID(problemID common.ProblemID) { + t.ProblemID = problemID + t.require(testSubmissionStateFieldProblemID) +} + +// SetDefaultTestCases sets the DefaultTestCases field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestSubmissionState) SetDefaultTestCases(defaultTestCases []*TestCase) { + t.DefaultTestCases = defaultTestCases + t.require(testSubmissionStateFieldDefaultTestCases) +} + +// SetCustomTestCases sets the CustomTestCases field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestSubmissionState) SetCustomTestCases(customTestCases []*TestCase) { + t.CustomTestCases = customTestCases + t.require(testSubmissionStateFieldCustomTestCases) +} + +// SetStatus sets the Status field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestSubmissionState) SetStatus(status *TestSubmissionStatus) { + t.Status = status + t.require(testSubmissionStateFieldStatus) +} + +func (t *TestSubmissionState) UnmarshalJSON(data []byte) error { + type unmarshaler TestSubmissionState + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TestSubmissionState(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TestSubmissionState) MarshalJSON() ([]byte, error) { + type embed TestSubmissionState + var marshaler = struct { + embed + }{ + embed: embed(*t), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, t.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (t *TestSubmissionState) String() string { + if t == nil { + return "" + } + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +type TestSubmissionStatus struct { + Type string + Stopped interface{} + Errored *ErrorInfo + Running RunningSubmissionState + TestCaseIDToState map[string]*SubmissionStatusForTestCase + + rawJSON json.RawMessage +} + +func (t *TestSubmissionStatus) GetType() string { + if t == nil { + return "" + } + return t.Type +} + +func (t *TestSubmissionStatus) GetStopped() interface{} { + if t == nil { + return nil + } + return t.Stopped +} + +func (t *TestSubmissionStatus) GetErrored() *ErrorInfo { + if t == nil { + return nil + } + return t.Errored +} + +func (t *TestSubmissionStatus) GetRunning() RunningSubmissionState { + if t == nil { + return "" + } + return t.Running +} + +func (t *TestSubmissionStatus) GetTestCaseIDToState() map[string]*SubmissionStatusForTestCase { + if t == nil { + return nil + } + return t.TestCaseIDToState +} + +func (t *TestSubmissionStatus) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + t.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", t) + } + switch unmarshaler.Type { + case "stopped": + value := make(map[string]interface{}) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + t.Stopped = value + case "errored": + var valueUnmarshaler struct { + Errored *ErrorInfo `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + t.Errored = valueUnmarshaler.Errored + case "running": + var valueUnmarshaler struct { + Running RunningSubmissionState `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + t.Running = valueUnmarshaler.Running + case "testCaseIdToState": + var valueUnmarshaler struct { + TestCaseIDToState map[string]*SubmissionStatusForTestCase `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + t.TestCaseIDToState = valueUnmarshaler.TestCaseIDToState + } + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t TestSubmissionStatus) MarshalJSON() ([]byte, error) { + if err := t.validate(); err != nil { + return nil, err + } + if t.Stopped != nil { + var marshaler = struct { + Type string `json:"type"` + Stopped interface{} `json:"stopped,omitempty"` + }{ + Type: "stopped", + Stopped: t.Stopped, + } + return json.Marshal(marshaler) + } + if t.Errored != nil { + var marshaler = struct { + Type string `json:"type"` + Errored *ErrorInfo `json:"value"` + }{ + Type: "errored", + Errored: t.Errored, + } + return json.Marshal(marshaler) + } + if t.Running != "" { + var marshaler = struct { + Type string `json:"type"` + Running RunningSubmissionState `json:"value"` + }{ + Type: "running", + Running: t.Running, + } + return json.Marshal(marshaler) + } + if t.TestCaseIDToState != nil { + var marshaler = struct { + Type string `json:"type"` + TestCaseIDToState map[string]*SubmissionStatusForTestCase `json:"value"` + }{ + Type: "testCaseIdToState", + TestCaseIDToState: t.TestCaseIDToState, + } + return json.Marshal(marshaler) + } + if len(t.rawJSON) > 0 { + return t.rawJSON, nil + } + return nil, fmt.Errorf("type %T does not define a non-empty union type", t) +} + +type TestSubmissionStatusVisitor interface { + VisitStopped(interface{}) error + VisitErrored(*ErrorInfo) error + VisitRunning(RunningSubmissionState) error + VisitTestCaseIDToState(map[string]*SubmissionStatusForTestCase) error +} + +func (t *TestSubmissionStatus) Accept(visitor TestSubmissionStatusVisitor) error { + if t.Stopped != nil { + return visitor.VisitStopped(t.Stopped) + } + if t.Errored != nil { + return visitor.VisitErrored(t.Errored) + } + if t.Running != "" { + return visitor.VisitRunning(t.Running) + } + if t.TestCaseIDToState != nil { + return visitor.VisitTestCaseIDToState(t.TestCaseIDToState) + } + return fmt.Errorf("type %T does not define a non-empty union type", t) +} + +func (t *TestSubmissionStatus) validate() error { + if t == nil { + return fmt.Errorf("type %T is nil", t) + } + var fields []string + if t.Stopped != nil { + fields = append(fields, "stopped") + } + if t.Errored != nil { + fields = append(fields, "errored") + } + if t.Running != "" { + fields = append(fields, "running") + } + if t.TestCaseIDToState != nil { + fields = append(fields, "testCaseIdToState") + } + if len(fields) == 0 { + if t.Type != "" { + if len(t.rawJSON) > 0 { + return nil + } + return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", t, t.Type) + } + return fmt.Errorf("type %T is empty", t) + } + if len(fields) > 1 { + return fmt.Errorf("type %T defines values for %s, but only one value is allowed", t, fields) + } + if t.Type != "" { + field := fields[0] + if t.Type != field { + return fmt.Errorf( + "type %T defines a discriminant set to %q, but it does not match the %T field; either remove or update the discriminant to match", + t, + t.Type, + t, + ) + } + } + return nil +} + +var ( + testSubmissionStatusV2FieldUpdates = big.NewInt(1 << 0) + testSubmissionStatusV2FieldProblemID = big.NewInt(1 << 1) + testSubmissionStatusV2FieldProblemVersion = big.NewInt(1 << 2) + testSubmissionStatusV2FieldProblemInfo = big.NewInt(1 << 3) +) + +type TestSubmissionStatusV2 struct { + Updates []*TestSubmissionUpdate `json:"updates" url:"updates"` + ProblemID common.ProblemID `json:"problemId" url:"problemId"` + ProblemVersion int `json:"problemVersion" url:"problemVersion"` + ProblemInfo *v2.ProblemInfoV2 `json:"problemInfo" url:"problemInfo"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TestSubmissionStatusV2) GetUpdates() []*TestSubmissionUpdate { + if t == nil { + return nil + } + return t.Updates +} + +func (t *TestSubmissionStatusV2) GetProblemID() common.ProblemID { + if t == nil { + return "" + } + return t.ProblemID +} + +func (t *TestSubmissionStatusV2) GetProblemVersion() int { + if t == nil { + return 0 + } + return t.ProblemVersion +} + +func (t *TestSubmissionStatusV2) GetProblemInfo() *v2.ProblemInfoV2 { + if t == nil { + return nil + } + return t.ProblemInfo +} + +func (t *TestSubmissionStatusV2) GetExtraProperties() map[string]interface{} { + if t == nil { + return nil + } + return t.extraProperties +} + +func (t *TestSubmissionStatusV2) require(field *big.Int) { + if t.explicitFields == nil { + t.explicitFields = big.NewInt(0) + } + t.explicitFields.Or(t.explicitFields, field) +} + +// SetUpdates sets the Updates field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestSubmissionStatusV2) SetUpdates(updates []*TestSubmissionUpdate) { + t.Updates = updates + t.require(testSubmissionStatusV2FieldUpdates) +} + +// SetProblemID sets the ProblemID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestSubmissionStatusV2) SetProblemID(problemID common.ProblemID) { + t.ProblemID = problemID + t.require(testSubmissionStatusV2FieldProblemID) +} + +// SetProblemVersion sets the ProblemVersion field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestSubmissionStatusV2) SetProblemVersion(problemVersion int) { + t.ProblemVersion = problemVersion + t.require(testSubmissionStatusV2FieldProblemVersion) +} + +// SetProblemInfo sets the ProblemInfo field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestSubmissionStatusV2) SetProblemInfo(problemInfo *v2.ProblemInfoV2) { + t.ProblemInfo = problemInfo + t.require(testSubmissionStatusV2FieldProblemInfo) +} + +func (t *TestSubmissionStatusV2) UnmarshalJSON(data []byte) error { + type unmarshaler TestSubmissionStatusV2 + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TestSubmissionStatusV2(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TestSubmissionStatusV2) MarshalJSON() ([]byte, error) { + type embed TestSubmissionStatusV2 + var marshaler = struct { + embed + }{ + embed: embed(*t), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, t.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (t *TestSubmissionStatusV2) String() string { + if t == nil { + return "" + } + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +var ( + testSubmissionUpdateFieldUpdateTime = big.NewInt(1 << 0) + testSubmissionUpdateFieldUpdateInfo = big.NewInt(1 << 1) +) + +type TestSubmissionUpdate struct { + UpdateTime time.Time `json:"updateTime" url:"updateTime"` + UpdateInfo *TestSubmissionUpdateInfo `json:"updateInfo" url:"updateInfo"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TestSubmissionUpdate) GetUpdateTime() time.Time { + if t == nil { + return time.Time{} + } + return t.UpdateTime +} + +func (t *TestSubmissionUpdate) GetUpdateInfo() *TestSubmissionUpdateInfo { + if t == nil { + return nil + } + return t.UpdateInfo +} + +func (t *TestSubmissionUpdate) GetExtraProperties() map[string]interface{} { + if t == nil { + return nil + } + return t.extraProperties +} + +func (t *TestSubmissionUpdate) require(field *big.Int) { + if t.explicitFields == nil { + t.explicitFields = big.NewInt(0) + } + t.explicitFields.Or(t.explicitFields, field) +} + +// SetUpdateTime sets the UpdateTime field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestSubmissionUpdate) SetUpdateTime(updateTime time.Time) { + t.UpdateTime = updateTime + t.require(testSubmissionUpdateFieldUpdateTime) +} + +// SetUpdateInfo sets the UpdateInfo field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestSubmissionUpdate) SetUpdateInfo(updateInfo *TestSubmissionUpdateInfo) { + t.UpdateInfo = updateInfo + t.require(testSubmissionUpdateFieldUpdateInfo) +} + +func (t *TestSubmissionUpdate) UnmarshalJSON(data []byte) error { + type embed TestSubmissionUpdate + var unmarshaler = struct { + embed + UpdateTime *internal.DateTime `json:"updateTime"` + }{ + embed: embed(*t), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + *t = TestSubmissionUpdate(unmarshaler.embed) + t.UpdateTime = unmarshaler.UpdateTime.Time() + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TestSubmissionUpdate) MarshalJSON() ([]byte, error) { + type embed TestSubmissionUpdate + var marshaler = struct { + embed + UpdateTime *internal.DateTime `json:"updateTime"` + }{ + embed: embed(*t), + UpdateTime: internal.NewDateTime(t.UpdateTime), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, t.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (t *TestSubmissionUpdate) String() string { + if t == nil { + return "" + } + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +type TestSubmissionUpdateInfo struct { + Type string + Running RunningSubmissionState + Stopped interface{} + Errored *ErrorInfo + GradedTestCase *GradedTestCaseUpdate + RecordedTestCase *RecordedTestCaseUpdate + Finished interface{} + + rawJSON json.RawMessage +} + +func (t *TestSubmissionUpdateInfo) GetType() string { + if t == nil { + return "" + } + return t.Type +} + +func (t *TestSubmissionUpdateInfo) GetRunning() RunningSubmissionState { + if t == nil { + return "" + } + return t.Running +} + +func (t *TestSubmissionUpdateInfo) GetStopped() interface{} { + if t == nil { + return nil + } + return t.Stopped +} + +func (t *TestSubmissionUpdateInfo) GetErrored() *ErrorInfo { + if t == nil { + return nil + } + return t.Errored +} + +func (t *TestSubmissionUpdateInfo) GetGradedTestCase() *GradedTestCaseUpdate { + if t == nil { + return nil + } + return t.GradedTestCase +} + +func (t *TestSubmissionUpdateInfo) GetRecordedTestCase() *RecordedTestCaseUpdate { + if t == nil { + return nil + } + return t.RecordedTestCase +} + +func (t *TestSubmissionUpdateInfo) GetFinished() interface{} { + if t == nil { + return nil + } + return t.Finished +} + +func (t *TestSubmissionUpdateInfo) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + t.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", t) + } + switch unmarshaler.Type { + case "running": + var valueUnmarshaler struct { + Running RunningSubmissionState `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + t.Running = valueUnmarshaler.Running + case "stopped": + value := make(map[string]interface{}) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + t.Stopped = value + case "errored": + var valueUnmarshaler struct { + Errored *ErrorInfo `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + t.Errored = valueUnmarshaler.Errored + case "gradedTestCase": + value := new(GradedTestCaseUpdate) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + t.GradedTestCase = value + case "recordedTestCase": + value := new(RecordedTestCaseUpdate) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + t.RecordedTestCase = value + case "finished": + value := make(map[string]interface{}) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + t.Finished = value + } + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t TestSubmissionUpdateInfo) MarshalJSON() ([]byte, error) { + if err := t.validate(); err != nil { + return nil, err + } + if t.Running != "" { + var marshaler = struct { + Type string `json:"type"` + Running RunningSubmissionState `json:"value"` + }{ + Type: "running", + Running: t.Running, + } + return json.Marshal(marshaler) + } + if t.Stopped != nil { + var marshaler = struct { + Type string `json:"type"` + Stopped interface{} `json:"stopped,omitempty"` + }{ + Type: "stopped", + Stopped: t.Stopped, + } + return json.Marshal(marshaler) + } + if t.Errored != nil { + var marshaler = struct { + Type string `json:"type"` + Errored *ErrorInfo `json:"value"` + }{ + Type: "errored", + Errored: t.Errored, + } + return json.Marshal(marshaler) + } + if t.GradedTestCase != nil { + return internal.MarshalJSONWithExtraProperty(t.GradedTestCase, "type", "gradedTestCase") + } + if t.RecordedTestCase != nil { + return internal.MarshalJSONWithExtraProperty(t.RecordedTestCase, "type", "recordedTestCase") + } + if t.Finished != nil { + var marshaler = struct { + Type string `json:"type"` + Finished interface{} `json:"finished,omitempty"` + }{ + Type: "finished", + Finished: t.Finished, + } + return json.Marshal(marshaler) + } + if len(t.rawJSON) > 0 { + return t.rawJSON, nil + } + return nil, fmt.Errorf("type %T does not define a non-empty union type", t) +} + +type TestSubmissionUpdateInfoVisitor interface { + VisitRunning(RunningSubmissionState) error + VisitStopped(interface{}) error + VisitErrored(*ErrorInfo) error + VisitGradedTestCase(*GradedTestCaseUpdate) error + VisitRecordedTestCase(*RecordedTestCaseUpdate) error + VisitFinished(interface{}) error +} + +func (t *TestSubmissionUpdateInfo) Accept(visitor TestSubmissionUpdateInfoVisitor) error { + if t.Running != "" { + return visitor.VisitRunning(t.Running) + } + if t.Stopped != nil { + return visitor.VisitStopped(t.Stopped) + } + if t.Errored != nil { + return visitor.VisitErrored(t.Errored) + } + if t.GradedTestCase != nil { + return visitor.VisitGradedTestCase(t.GradedTestCase) + } + if t.RecordedTestCase != nil { + return visitor.VisitRecordedTestCase(t.RecordedTestCase) + } + if t.Finished != nil { + return visitor.VisitFinished(t.Finished) + } + return fmt.Errorf("type %T does not define a non-empty union type", t) +} + +func (t *TestSubmissionUpdateInfo) validate() error { + if t == nil { + return fmt.Errorf("type %T is nil", t) + } + var fields []string + if t.Running != "" { + fields = append(fields, "running") + } + if t.Stopped != nil { + fields = append(fields, "stopped") + } + if t.Errored != nil { + fields = append(fields, "errored") + } + if t.GradedTestCase != nil { + fields = append(fields, "gradedTestCase") + } + if t.RecordedTestCase != nil { + fields = append(fields, "recordedTestCase") + } + if t.Finished != nil { + fields = append(fields, "finished") + } + if len(fields) == 0 { + if t.Type != "" { + if len(t.rawJSON) > 0 { + return nil + } + return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", t, t.Type) + } + return fmt.Errorf("type %T is empty", t) + } + if len(fields) > 1 { + return fmt.Errorf("type %T defines values for %s, but only one value is allowed", t, fields) + } + if t.Type != "" { + field := fields[0] + if t.Type != field { + return fmt.Errorf( + "type %T defines a discriminant set to %q, but it does not match the %T field; either remove or update the discriminant to match", + t, + t.Type, + t, + ) + } + } + return nil +} + +var ( + traceResponseFieldSubmissionID = big.NewInt(1 << 0) + traceResponseFieldLineNumber = big.NewInt(1 << 1) + traceResponseFieldReturnValue = big.NewInt(1 << 2) + traceResponseFieldExpressionLocation = big.NewInt(1 << 3) + traceResponseFieldStack = big.NewInt(1 << 4) + traceResponseFieldStdout = big.NewInt(1 << 5) +) + +type TraceResponse struct { + SubmissionID SubmissionID `json:"submissionId" url:"submissionId"` + LineNumber int `json:"lineNumber" url:"lineNumber"` + ReturnValue *DebugVariableValue `json:"returnValue,omitempty" url:"returnValue,omitempty"` + ExpressionLocation *ExpressionLocation `json:"expressionLocation,omitempty" url:"expressionLocation,omitempty"` + Stack *StackInformation `json:"stack" url:"stack"` + Stdout *string `json:"stdout,omitempty" url:"stdout,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TraceResponse) GetSubmissionID() SubmissionID { + if t == nil { + return uuid.Nil + } + return t.SubmissionID +} + +func (t *TraceResponse) GetLineNumber() int { + if t == nil { + return 0 + } + return t.LineNumber +} + +func (t *TraceResponse) GetReturnValue() *DebugVariableValue { + if t == nil { + return nil + } + return t.ReturnValue +} + +func (t *TraceResponse) GetExpressionLocation() *ExpressionLocation { + if t == nil { + return nil + } + return t.ExpressionLocation +} + +func (t *TraceResponse) GetStack() *StackInformation { + if t == nil { + return nil + } + return t.Stack +} + +func (t *TraceResponse) GetStdout() *string { + if t == nil { + return nil + } + return t.Stdout +} + +func (t *TraceResponse) GetExtraProperties() map[string]interface{} { + if t == nil { + return nil + } + return t.extraProperties +} + +func (t *TraceResponse) require(field *big.Int) { + if t.explicitFields == nil { + t.explicitFields = big.NewInt(0) + } + t.explicitFields.Or(t.explicitFields, field) +} + +// SetSubmissionID sets the SubmissionID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TraceResponse) SetSubmissionID(submissionID SubmissionID) { + t.SubmissionID = submissionID + t.require(traceResponseFieldSubmissionID) +} + +// SetLineNumber sets the LineNumber field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TraceResponse) SetLineNumber(lineNumber int) { + t.LineNumber = lineNumber + t.require(traceResponseFieldLineNumber) +} + +// SetReturnValue sets the ReturnValue field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TraceResponse) SetReturnValue(returnValue *DebugVariableValue) { + t.ReturnValue = returnValue + t.require(traceResponseFieldReturnValue) +} + +// SetExpressionLocation sets the ExpressionLocation field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TraceResponse) SetExpressionLocation(expressionLocation *ExpressionLocation) { + t.ExpressionLocation = expressionLocation + t.require(traceResponseFieldExpressionLocation) +} + +// SetStack sets the Stack field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TraceResponse) SetStack(stack *StackInformation) { + t.Stack = stack + t.require(traceResponseFieldStack) +} + +// SetStdout sets the Stdout field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TraceResponse) SetStdout(stdout *string) { + t.Stdout = stdout + t.require(traceResponseFieldStdout) +} + +func (t *TraceResponse) UnmarshalJSON(data []byte) error { + type unmarshaler TraceResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TraceResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TraceResponse) MarshalJSON() ([]byte, error) { + type embed TraceResponse + var marshaler = struct { + embed + }{ + embed: embed(*t), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, t.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (t *TraceResponse) String() string { + if t == nil { + return "" + } + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +var ( + traceResponseV2FieldSubmissionID = big.NewInt(1 << 0) + traceResponseV2FieldLineNumber = big.NewInt(1 << 1) + traceResponseV2FieldFile = big.NewInt(1 << 2) + traceResponseV2FieldReturnValue = big.NewInt(1 << 3) + traceResponseV2FieldExpressionLocation = big.NewInt(1 << 4) + traceResponseV2FieldStack = big.NewInt(1 << 5) + traceResponseV2FieldStdout = big.NewInt(1 << 6) +) + +type TraceResponseV2 struct { + SubmissionID SubmissionID `json:"submissionId" url:"submissionId"` + LineNumber int `json:"lineNumber" url:"lineNumber"` + File *TracedFile `json:"file" url:"file"` + ReturnValue *DebugVariableValue `json:"returnValue,omitempty" url:"returnValue,omitempty"` + ExpressionLocation *ExpressionLocation `json:"expressionLocation,omitempty" url:"expressionLocation,omitempty"` + Stack *StackInformation `json:"stack" url:"stack"` + Stdout *string `json:"stdout,omitempty" url:"stdout,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TraceResponseV2) GetSubmissionID() SubmissionID { + if t == nil { + return uuid.Nil + } + return t.SubmissionID +} + +func (t *TraceResponseV2) GetLineNumber() int { + if t == nil { + return 0 + } + return t.LineNumber +} + +func (t *TraceResponseV2) GetFile() *TracedFile { + if t == nil { + return nil + } + return t.File +} + +func (t *TraceResponseV2) GetReturnValue() *DebugVariableValue { + if t == nil { + return nil + } + return t.ReturnValue +} + +func (t *TraceResponseV2) GetExpressionLocation() *ExpressionLocation { + if t == nil { + return nil + } + return t.ExpressionLocation +} + +func (t *TraceResponseV2) GetStack() *StackInformation { + if t == nil { + return nil + } + return t.Stack +} + +func (t *TraceResponseV2) GetStdout() *string { + if t == nil { + return nil + } + return t.Stdout +} + +func (t *TraceResponseV2) GetExtraProperties() map[string]interface{} { + if t == nil { + return nil + } + return t.extraProperties +} + +func (t *TraceResponseV2) require(field *big.Int) { + if t.explicitFields == nil { + t.explicitFields = big.NewInt(0) + } + t.explicitFields.Or(t.explicitFields, field) +} + +// SetSubmissionID sets the SubmissionID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TraceResponseV2) SetSubmissionID(submissionID SubmissionID) { + t.SubmissionID = submissionID + t.require(traceResponseV2FieldSubmissionID) +} + +// SetLineNumber sets the LineNumber field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TraceResponseV2) SetLineNumber(lineNumber int) { + t.LineNumber = lineNumber + t.require(traceResponseV2FieldLineNumber) +} + +// SetFile sets the File field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TraceResponseV2) SetFile(file *TracedFile) { + t.File = file + t.require(traceResponseV2FieldFile) +} + +// SetReturnValue sets the ReturnValue field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TraceResponseV2) SetReturnValue(returnValue *DebugVariableValue) { + t.ReturnValue = returnValue + t.require(traceResponseV2FieldReturnValue) +} + +// SetExpressionLocation sets the ExpressionLocation field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TraceResponseV2) SetExpressionLocation(expressionLocation *ExpressionLocation) { + t.ExpressionLocation = expressionLocation + t.require(traceResponseV2FieldExpressionLocation) +} + +// SetStack sets the Stack field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TraceResponseV2) SetStack(stack *StackInformation) { + t.Stack = stack + t.require(traceResponseV2FieldStack) +} + +// SetStdout sets the Stdout field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TraceResponseV2) SetStdout(stdout *string) { + t.Stdout = stdout + t.require(traceResponseV2FieldStdout) +} + +func (t *TraceResponseV2) UnmarshalJSON(data []byte) error { + type unmarshaler TraceResponseV2 + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TraceResponseV2(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TraceResponseV2) MarshalJSON() ([]byte, error) { + type embed TraceResponseV2 + var marshaler = struct { + embed + }{ + embed: embed(*t), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, t.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (t *TraceResponseV2) String() string { + if t == nil { + return "" + } + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +var ( + traceResponsesPageFieldOffset = big.NewInt(1 << 0) + traceResponsesPageFieldTraceResponses = big.NewInt(1 << 1) +) + +type TraceResponsesPage struct { + // If present, use this to load subsequent pages. + // The offset is the id of the next trace response to load. + Offset *int `json:"offset,omitempty" url:"offset,omitempty"` + TraceResponses []*TraceResponse `json:"traceResponses" url:"traceResponses"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TraceResponsesPage) GetOffset() *int { + if t == nil { + return nil + } + return t.Offset +} + +func (t *TraceResponsesPage) GetTraceResponses() []*TraceResponse { + if t == nil { + return nil + } + return t.TraceResponses +} + +func (t *TraceResponsesPage) GetExtraProperties() map[string]interface{} { + if t == nil { + return nil + } + return t.extraProperties +} + +func (t *TraceResponsesPage) require(field *big.Int) { + if t.explicitFields == nil { + t.explicitFields = big.NewInt(0) + } + t.explicitFields.Or(t.explicitFields, field) +} + +// SetOffset sets the Offset field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TraceResponsesPage) SetOffset(offset *int) { + t.Offset = offset + t.require(traceResponsesPageFieldOffset) +} + +// SetTraceResponses sets the TraceResponses field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TraceResponsesPage) SetTraceResponses(traceResponses []*TraceResponse) { + t.TraceResponses = traceResponses + t.require(traceResponsesPageFieldTraceResponses) +} + +func (t *TraceResponsesPage) UnmarshalJSON(data []byte) error { + type unmarshaler TraceResponsesPage + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TraceResponsesPage(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TraceResponsesPage) MarshalJSON() ([]byte, error) { + type embed TraceResponsesPage + var marshaler = struct { + embed + }{ + embed: embed(*t), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, t.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (t *TraceResponsesPage) String() string { + if t == nil { + return "" + } + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +var ( + traceResponsesPageV2FieldOffset = big.NewInt(1 << 0) + traceResponsesPageV2FieldTraceResponses = big.NewInt(1 << 1) +) + +type TraceResponsesPageV2 struct { + // If present, use this to load subsequent pages. + // The offset is the id of the next trace response to load. + Offset *int `json:"offset,omitempty" url:"offset,omitempty"` + TraceResponses []*TraceResponseV2 `json:"traceResponses" url:"traceResponses"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TraceResponsesPageV2) GetOffset() *int { + if t == nil { + return nil + } + return t.Offset +} + +func (t *TraceResponsesPageV2) GetTraceResponses() []*TraceResponseV2 { + if t == nil { + return nil + } + return t.TraceResponses +} + +func (t *TraceResponsesPageV2) GetExtraProperties() map[string]interface{} { + if t == nil { + return nil + } + return t.extraProperties +} + +func (t *TraceResponsesPageV2) require(field *big.Int) { + if t.explicitFields == nil { + t.explicitFields = big.NewInt(0) + } + t.explicitFields.Or(t.explicitFields, field) +} + +// SetOffset sets the Offset field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TraceResponsesPageV2) SetOffset(offset *int) { + t.Offset = offset + t.require(traceResponsesPageV2FieldOffset) +} + +// SetTraceResponses sets the TraceResponses field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TraceResponsesPageV2) SetTraceResponses(traceResponses []*TraceResponseV2) { + t.TraceResponses = traceResponses + t.require(traceResponsesPageV2FieldTraceResponses) +} + +func (t *TraceResponsesPageV2) UnmarshalJSON(data []byte) error { + type unmarshaler TraceResponsesPageV2 + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TraceResponsesPageV2(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TraceResponsesPageV2) MarshalJSON() ([]byte, error) { + type embed TraceResponsesPageV2 + var marshaler = struct { + embed + }{ + embed: embed(*t), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, t.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (t *TraceResponsesPageV2) String() string { + if t == nil { + return "" + } + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +var ( + tracedFileFieldFilename = big.NewInt(1 << 0) + tracedFileFieldDirectory = big.NewInt(1 << 1) +) + +type TracedFile struct { + Filename string `json:"filename" url:"filename"` + Directory string `json:"directory" url:"directory"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TracedFile) GetFilename() string { + if t == nil { + return "" + } + return t.Filename +} + +func (t *TracedFile) GetDirectory() string { + if t == nil { + return "" + } + return t.Directory +} + +func (t *TracedFile) GetExtraProperties() map[string]interface{} { + if t == nil { + return nil + } + return t.extraProperties +} + +func (t *TracedFile) require(field *big.Int) { + if t.explicitFields == nil { + t.explicitFields = big.NewInt(0) + } + t.explicitFields.Or(t.explicitFields, field) +} + +// SetFilename sets the Filename field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TracedFile) SetFilename(filename string) { + t.Filename = filename + t.require(tracedFileFieldFilename) +} + +// SetDirectory sets the Directory field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TracedFile) SetDirectory(directory string) { + t.Directory = directory + t.require(tracedFileFieldDirectory) +} + +func (t *TracedFile) UnmarshalJSON(data []byte) error { + type unmarshaler TracedFile + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TracedFile(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TracedFile) MarshalJSON() ([]byte, error) { + type embed TracedFile + var marshaler = struct { + embed + }{ + embed: embed(*t), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, t.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (t *TracedFile) String() string { + if t == nil { + return "" + } + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +var ( + tracedTestCaseFieldResult = big.NewInt(1 << 0) + tracedTestCaseFieldTraceResponsesSize = big.NewInt(1 << 1) +) + +type TracedTestCase struct { + Result *TestCaseResultWithStdout `json:"result" url:"result"` + TraceResponsesSize int `json:"traceResponsesSize" url:"traceResponsesSize"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TracedTestCase) GetResult() *TestCaseResultWithStdout { + if t == nil { + return nil + } + return t.Result +} + +func (t *TracedTestCase) GetTraceResponsesSize() int { + if t == nil { + return 0 + } + return t.TraceResponsesSize +} + +func (t *TracedTestCase) GetExtraProperties() map[string]interface{} { + if t == nil { + return nil + } + return t.extraProperties +} + +func (t *TracedTestCase) require(field *big.Int) { + if t.explicitFields == nil { + t.explicitFields = big.NewInt(0) + } + t.explicitFields.Or(t.explicitFields, field) +} + +// SetResult sets the Result field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TracedTestCase) SetResult(result *TestCaseResultWithStdout) { + t.Result = result + t.require(tracedTestCaseFieldResult) +} + +// SetTraceResponsesSize sets the TraceResponsesSize field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TracedTestCase) SetTraceResponsesSize(traceResponsesSize int) { + t.TraceResponsesSize = traceResponsesSize + t.require(tracedTestCaseFieldTraceResponsesSize) +} + +func (t *TracedTestCase) UnmarshalJSON(data []byte) error { + type unmarshaler TracedTestCase + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TracedTestCase(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TracedTestCase) MarshalJSON() ([]byte, error) { + type embed TracedTestCase + var marshaler = struct { + embed + }{ + embed: embed(*t), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, t.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (t *TracedTestCase) String() string { + if t == nil { + return "" + } + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +var ( + unexpectedLanguageErrorFieldExpectedLanguage = big.NewInt(1 << 0) + unexpectedLanguageErrorFieldActualLanguage = big.NewInt(1 << 1) +) + +type UnexpectedLanguageError struct { + ExpectedLanguage common.Language `json:"expectedLanguage" url:"expectedLanguage"` + ActualLanguage common.Language `json:"actualLanguage" url:"actualLanguage"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (u *UnexpectedLanguageError) GetExpectedLanguage() common.Language { + if u == nil { + return "" + } + return u.ExpectedLanguage +} + +func (u *UnexpectedLanguageError) GetActualLanguage() common.Language { + if u == nil { + return "" + } + return u.ActualLanguage +} + +func (u *UnexpectedLanguageError) GetExtraProperties() map[string]interface{} { + if u == nil { + return nil + } + return u.extraProperties +} + +func (u *UnexpectedLanguageError) require(field *big.Int) { + if u.explicitFields == nil { + u.explicitFields = big.NewInt(0) + } + u.explicitFields.Or(u.explicitFields, field) +} + +// SetExpectedLanguage sets the ExpectedLanguage field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (u *UnexpectedLanguageError) SetExpectedLanguage(expectedLanguage common.Language) { + u.ExpectedLanguage = expectedLanguage + u.require(unexpectedLanguageErrorFieldExpectedLanguage) +} + +// SetActualLanguage sets the ActualLanguage field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (u *UnexpectedLanguageError) SetActualLanguage(actualLanguage common.Language) { + u.ActualLanguage = actualLanguage + u.require(unexpectedLanguageErrorFieldActualLanguage) +} + +func (u *UnexpectedLanguageError) UnmarshalJSON(data []byte) error { + type unmarshaler UnexpectedLanguageError + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *u = UnexpectedLanguageError(value) + extraProperties, err := internal.ExtractExtraProperties(data, *u) + if err != nil { + return err + } + u.extraProperties = extraProperties + u.rawJSON = json.RawMessage(data) + return nil +} + +func (u *UnexpectedLanguageError) MarshalJSON() ([]byte, error) { + type embed UnexpectedLanguageError + var marshaler = struct { + embed + }{ + embed: embed(*u), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, u.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (u *UnexpectedLanguageError) String() string { + if u == nil { + return "" + } + if len(u.rawJSON) > 0 { + if value, err := internal.StringifyJSON(u.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(u); err == nil { + return value + } + return fmt.Sprintf("%#v", u) +} + +var ( + workspaceFilesFieldMainFile = big.NewInt(1 << 0) + workspaceFilesFieldReadOnlyFiles = big.NewInt(1 << 1) +) + +type WorkspaceFiles struct { + MainFile *FileInfo `json:"mainFile" url:"mainFile"` + ReadOnlyFiles []*FileInfo `json:"readOnlyFiles" url:"readOnlyFiles"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (w *WorkspaceFiles) GetMainFile() *FileInfo { + if w == nil { + return nil + } + return w.MainFile +} + +func (w *WorkspaceFiles) GetReadOnlyFiles() []*FileInfo { + if w == nil { + return nil + } + return w.ReadOnlyFiles +} + +func (w *WorkspaceFiles) GetExtraProperties() map[string]interface{} { + if w == nil { + return nil + } + return w.extraProperties +} + +func (w *WorkspaceFiles) require(field *big.Int) { + if w.explicitFields == nil { + w.explicitFields = big.NewInt(0) + } + w.explicitFields.Or(w.explicitFields, field) +} + +// SetMainFile sets the MainFile field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (w *WorkspaceFiles) SetMainFile(mainFile *FileInfo) { + w.MainFile = mainFile + w.require(workspaceFilesFieldMainFile) +} + +// SetReadOnlyFiles sets the ReadOnlyFiles field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (w *WorkspaceFiles) SetReadOnlyFiles(readOnlyFiles []*FileInfo) { + w.ReadOnlyFiles = readOnlyFiles + w.require(workspaceFilesFieldReadOnlyFiles) +} + +func (w *WorkspaceFiles) UnmarshalJSON(data []byte) error { + type unmarshaler WorkspaceFiles + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *w = WorkspaceFiles(value) + extraProperties, err := internal.ExtractExtraProperties(data, *w) + if err != nil { + return err + } + w.extraProperties = extraProperties + w.rawJSON = json.RawMessage(data) + return nil +} + +func (w *WorkspaceFiles) MarshalJSON() ([]byte, error) { + type embed WorkspaceFiles + var marshaler = struct { + embed + }{ + embed: embed(*w), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, w.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (w *WorkspaceFiles) String() string { + if w == nil { + return "" + } + if len(w.rawJSON) > 0 { + if value, err := internal.StringifyJSON(w.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(w); err == nil { + return value + } + return fmt.Sprintf("%#v", w) +} + +var ( + workspaceRanResponseFieldSubmissionID = big.NewInt(1 << 0) + workspaceRanResponseFieldRunDetails = big.NewInt(1 << 1) +) + +type WorkspaceRanResponse struct { + SubmissionID SubmissionID `json:"submissionId" url:"submissionId"` + RunDetails *WorkspaceRunDetails `json:"runDetails" url:"runDetails"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (w *WorkspaceRanResponse) GetSubmissionID() SubmissionID { + if w == nil { + return uuid.Nil + } + return w.SubmissionID +} + +func (w *WorkspaceRanResponse) GetRunDetails() *WorkspaceRunDetails { + if w == nil { + return nil + } + return w.RunDetails +} + +func (w *WorkspaceRanResponse) GetExtraProperties() map[string]interface{} { + if w == nil { + return nil + } + return w.extraProperties +} + +func (w *WorkspaceRanResponse) require(field *big.Int) { + if w.explicitFields == nil { + w.explicitFields = big.NewInt(0) + } + w.explicitFields.Or(w.explicitFields, field) +} + +// SetSubmissionID sets the SubmissionID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (w *WorkspaceRanResponse) SetSubmissionID(submissionID SubmissionID) { + w.SubmissionID = submissionID + w.require(workspaceRanResponseFieldSubmissionID) +} + +// SetRunDetails sets the RunDetails field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (w *WorkspaceRanResponse) SetRunDetails(runDetails *WorkspaceRunDetails) { + w.RunDetails = runDetails + w.require(workspaceRanResponseFieldRunDetails) +} + +func (w *WorkspaceRanResponse) UnmarshalJSON(data []byte) error { + type unmarshaler WorkspaceRanResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *w = WorkspaceRanResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *w) + if err != nil { + return err + } + w.extraProperties = extraProperties + w.rawJSON = json.RawMessage(data) + return nil +} + +func (w *WorkspaceRanResponse) MarshalJSON() ([]byte, error) { + type embed WorkspaceRanResponse + var marshaler = struct { + embed + }{ + embed: embed(*w), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, w.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (w *WorkspaceRanResponse) String() string { + if w == nil { + return "" + } + if len(w.rawJSON) > 0 { + if value, err := internal.StringifyJSON(w.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(w); err == nil { + return value + } + return fmt.Sprintf("%#v", w) +} + +var ( + workspaceRunDetailsFieldExceptionV2 = big.NewInt(1 << 0) + workspaceRunDetailsFieldException = big.NewInt(1 << 1) + workspaceRunDetailsFieldStdout = big.NewInt(1 << 2) +) + +type WorkspaceRunDetails struct { + ExceptionV2 *ExceptionV2 `json:"exceptionV2,omitempty" url:"exceptionV2,omitempty"` + Exception *ExceptionInfo `json:"exception,omitempty" url:"exception,omitempty"` + Stdout string `json:"stdout" url:"stdout"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (w *WorkspaceRunDetails) GetExceptionV2() *ExceptionV2 { + if w == nil { + return nil + } + return w.ExceptionV2 +} + +func (w *WorkspaceRunDetails) GetException() *ExceptionInfo { + if w == nil { + return nil + } + return w.Exception +} + +func (w *WorkspaceRunDetails) GetStdout() string { + if w == nil { + return "" + } + return w.Stdout +} + +func (w *WorkspaceRunDetails) GetExtraProperties() map[string]interface{} { + if w == nil { + return nil + } + return w.extraProperties +} + +func (w *WorkspaceRunDetails) require(field *big.Int) { + if w.explicitFields == nil { + w.explicitFields = big.NewInt(0) + } + w.explicitFields.Or(w.explicitFields, field) +} + +// SetExceptionV2 sets the ExceptionV2 field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (w *WorkspaceRunDetails) SetExceptionV2(exceptionV2 *ExceptionV2) { + w.ExceptionV2 = exceptionV2 + w.require(workspaceRunDetailsFieldExceptionV2) +} + +// SetException sets the Exception field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (w *WorkspaceRunDetails) SetException(exception *ExceptionInfo) { + w.Exception = exception + w.require(workspaceRunDetailsFieldException) +} + +// SetStdout sets the Stdout field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (w *WorkspaceRunDetails) SetStdout(stdout string) { + w.Stdout = stdout + w.require(workspaceRunDetailsFieldStdout) +} + +func (w *WorkspaceRunDetails) UnmarshalJSON(data []byte) error { + type unmarshaler WorkspaceRunDetails + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *w = WorkspaceRunDetails(value) + extraProperties, err := internal.ExtractExtraProperties(data, *w) + if err != nil { + return err + } + w.extraProperties = extraProperties + w.rawJSON = json.RawMessage(data) + return nil +} + +func (w *WorkspaceRunDetails) MarshalJSON() ([]byte, error) { + type embed WorkspaceRunDetails + var marshaler = struct { + embed + }{ + embed: embed(*w), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, w.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (w *WorkspaceRunDetails) String() string { + if w == nil { + return "" + } + if len(w.rawJSON) > 0 { + if value, err := internal.StringifyJSON(w.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(w); err == nil { + return value + } + return fmt.Sprintf("%#v", w) +} + +var ( + workspaceStarterFilesResponseFieldFiles = big.NewInt(1 << 0) +) + +type WorkspaceStarterFilesResponse struct { + Files map[common.Language]*WorkspaceFiles `json:"files" url:"files"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (w *WorkspaceStarterFilesResponse) GetFiles() map[common.Language]*WorkspaceFiles { + if w == nil { + return nil + } + return w.Files +} + +func (w *WorkspaceStarterFilesResponse) GetExtraProperties() map[string]interface{} { + if w == nil { + return nil + } + return w.extraProperties +} + +func (w *WorkspaceStarterFilesResponse) require(field *big.Int) { + if w.explicitFields == nil { + w.explicitFields = big.NewInt(0) + } + w.explicitFields.Or(w.explicitFields, field) +} + +// SetFiles sets the Files field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (w *WorkspaceStarterFilesResponse) SetFiles(files map[common.Language]*WorkspaceFiles) { + w.Files = files + w.require(workspaceStarterFilesResponseFieldFiles) +} + +func (w *WorkspaceStarterFilesResponse) UnmarshalJSON(data []byte) error { + type unmarshaler WorkspaceStarterFilesResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *w = WorkspaceStarterFilesResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *w) + if err != nil { + return err + } + w.extraProperties = extraProperties + w.rawJSON = json.RawMessage(data) + return nil +} + +func (w *WorkspaceStarterFilesResponse) MarshalJSON() ([]byte, error) { + type embed WorkspaceStarterFilesResponse + var marshaler = struct { + embed + }{ + embed: embed(*w), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, w.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (w *WorkspaceStarterFilesResponse) String() string { + if w == nil { + return "" + } + if len(w.rawJSON) > 0 { + if value, err := internal.StringifyJSON(w.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(w); err == nil { + return value + } + return fmt.Sprintf("%#v", w) +} + +var ( + workspaceStarterFilesResponseV2FieldFilesByLanguage = big.NewInt(1 << 0) +) + +type WorkspaceStarterFilesResponseV2 struct { + FilesByLanguage map[common.Language]*v2.Files `json:"filesByLanguage" url:"filesByLanguage"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (w *WorkspaceStarterFilesResponseV2) GetFilesByLanguage() map[common.Language]*v2.Files { + if w == nil { + return nil + } + return w.FilesByLanguage +} + +func (w *WorkspaceStarterFilesResponseV2) GetExtraProperties() map[string]interface{} { + if w == nil { + return nil + } + return w.extraProperties +} + +func (w *WorkspaceStarterFilesResponseV2) require(field *big.Int) { + if w.explicitFields == nil { + w.explicitFields = big.NewInt(0) + } + w.explicitFields.Or(w.explicitFields, field) +} + +// SetFilesByLanguage sets the FilesByLanguage field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (w *WorkspaceStarterFilesResponseV2) SetFilesByLanguage(filesByLanguage map[common.Language]*v2.Files) { + w.FilesByLanguage = filesByLanguage + w.require(workspaceStarterFilesResponseV2FieldFilesByLanguage) +} + +func (w *WorkspaceStarterFilesResponseV2) UnmarshalJSON(data []byte) error { + type unmarshaler WorkspaceStarterFilesResponseV2 + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *w = WorkspaceStarterFilesResponseV2(value) + extraProperties, err := internal.ExtractExtraProperties(data, *w) + if err != nil { + return err + } + w.extraProperties = extraProperties + w.rawJSON = json.RawMessage(data) + return nil +} + +func (w *WorkspaceStarterFilesResponseV2) MarshalJSON() ([]byte, error) { + type embed WorkspaceStarterFilesResponseV2 + var marshaler = struct { + embed + }{ + embed: embed(*w), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, w.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (w *WorkspaceStarterFilesResponseV2) String() string { + if w == nil { + return "" + } + if len(w.rawJSON) > 0 { + if value, err := internal.StringifyJSON(w.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(w); err == nil { + return value + } + return fmt.Sprintf("%#v", w) +} + +var ( + workspaceSubmissionStateFieldStatus = big.NewInt(1 << 0) +) + +type WorkspaceSubmissionState struct { + Status *WorkspaceSubmissionStatus `json:"status" url:"status"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (w *WorkspaceSubmissionState) GetStatus() *WorkspaceSubmissionStatus { + if w == nil { + return nil + } + return w.Status +} + +func (w *WorkspaceSubmissionState) GetExtraProperties() map[string]interface{} { + if w == nil { + return nil + } + return w.extraProperties +} + +func (w *WorkspaceSubmissionState) require(field *big.Int) { + if w.explicitFields == nil { + w.explicitFields = big.NewInt(0) + } + w.explicitFields.Or(w.explicitFields, field) +} + +// SetStatus sets the Status field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (w *WorkspaceSubmissionState) SetStatus(status *WorkspaceSubmissionStatus) { + w.Status = status + w.require(workspaceSubmissionStateFieldStatus) +} + +func (w *WorkspaceSubmissionState) UnmarshalJSON(data []byte) error { + type unmarshaler WorkspaceSubmissionState + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *w = WorkspaceSubmissionState(value) + extraProperties, err := internal.ExtractExtraProperties(data, *w) + if err != nil { + return err + } + w.extraProperties = extraProperties + w.rawJSON = json.RawMessage(data) + return nil +} + +func (w *WorkspaceSubmissionState) MarshalJSON() ([]byte, error) { + type embed WorkspaceSubmissionState + var marshaler = struct { + embed + }{ + embed: embed(*w), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, w.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (w *WorkspaceSubmissionState) String() string { + if w == nil { + return "" + } + if len(w.rawJSON) > 0 { + if value, err := internal.StringifyJSON(w.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(w); err == nil { + return value + } + return fmt.Sprintf("%#v", w) +} + +type WorkspaceSubmissionStatus struct { + Type string + Stopped interface{} + Errored *ErrorInfo + Running RunningSubmissionState + Ran *WorkspaceRunDetails + Traced *WorkspaceRunDetails + + rawJSON json.RawMessage +} + +func (w *WorkspaceSubmissionStatus) GetType() string { + if w == nil { + return "" + } + return w.Type +} + +func (w *WorkspaceSubmissionStatus) GetStopped() interface{} { + if w == nil { + return nil + } + return w.Stopped +} + +func (w *WorkspaceSubmissionStatus) GetErrored() *ErrorInfo { + if w == nil { + return nil + } + return w.Errored +} + +func (w *WorkspaceSubmissionStatus) GetRunning() RunningSubmissionState { + if w == nil { + return "" + } + return w.Running +} + +func (w *WorkspaceSubmissionStatus) GetRan() *WorkspaceRunDetails { + if w == nil { + return nil + } + return w.Ran +} + +func (w *WorkspaceSubmissionStatus) GetTraced() *WorkspaceRunDetails { + if w == nil { + return nil + } + return w.Traced +} + +func (w *WorkspaceSubmissionStatus) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + w.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", w) + } + switch unmarshaler.Type { + case "stopped": + value := make(map[string]interface{}) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + w.Stopped = value + case "errored": + var valueUnmarshaler struct { + Errored *ErrorInfo `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + w.Errored = valueUnmarshaler.Errored + case "running": + var valueUnmarshaler struct { + Running RunningSubmissionState `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + w.Running = valueUnmarshaler.Running + case "ran": + value := new(WorkspaceRunDetails) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + w.Ran = value + case "traced": + value := new(WorkspaceRunDetails) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + w.Traced = value + } + w.rawJSON = json.RawMessage(data) + return nil +} + +func (w WorkspaceSubmissionStatus) MarshalJSON() ([]byte, error) { + if err := w.validate(); err != nil { + return nil, err + } + if w.Stopped != nil { + var marshaler = struct { + Type string `json:"type"` + Stopped interface{} `json:"stopped,omitempty"` + }{ + Type: "stopped", + Stopped: w.Stopped, + } + return json.Marshal(marshaler) + } + if w.Errored != nil { + var marshaler = struct { + Type string `json:"type"` + Errored *ErrorInfo `json:"value"` + }{ + Type: "errored", + Errored: w.Errored, + } + return json.Marshal(marshaler) + } + if w.Running != "" { + var marshaler = struct { + Type string `json:"type"` + Running RunningSubmissionState `json:"value"` + }{ + Type: "running", + Running: w.Running, + } + return json.Marshal(marshaler) + } + if w.Ran != nil { + return internal.MarshalJSONWithExtraProperty(w.Ran, "type", "ran") + } + if w.Traced != nil { + return internal.MarshalJSONWithExtraProperty(w.Traced, "type", "traced") + } + if len(w.rawJSON) > 0 { + return w.rawJSON, nil + } + return nil, fmt.Errorf("type %T does not define a non-empty union type", w) +} + +type WorkspaceSubmissionStatusVisitor interface { + VisitStopped(interface{}) error + VisitErrored(*ErrorInfo) error + VisitRunning(RunningSubmissionState) error + VisitRan(*WorkspaceRunDetails) error + VisitTraced(*WorkspaceRunDetails) error +} + +func (w *WorkspaceSubmissionStatus) Accept(visitor WorkspaceSubmissionStatusVisitor) error { + if w.Stopped != nil { + return visitor.VisitStopped(w.Stopped) + } + if w.Errored != nil { + return visitor.VisitErrored(w.Errored) + } + if w.Running != "" { + return visitor.VisitRunning(w.Running) + } + if w.Ran != nil { + return visitor.VisitRan(w.Ran) + } + if w.Traced != nil { + return visitor.VisitTraced(w.Traced) + } + return fmt.Errorf("type %T does not define a non-empty union type", w) +} + +func (w *WorkspaceSubmissionStatus) validate() error { + if w == nil { + return fmt.Errorf("type %T is nil", w) + } + var fields []string + if w.Stopped != nil { + fields = append(fields, "stopped") + } + if w.Errored != nil { + fields = append(fields, "errored") + } + if w.Running != "" { + fields = append(fields, "running") + } + if w.Ran != nil { + fields = append(fields, "ran") + } + if w.Traced != nil { + fields = append(fields, "traced") + } + if len(fields) == 0 { + if w.Type != "" { + if len(w.rawJSON) > 0 { + return nil + } + return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", w, w.Type) + } + return fmt.Errorf("type %T is empty", w) + } + if len(fields) > 1 { + return fmt.Errorf("type %T defines values for %s, but only one value is allowed", w, fields) + } + if w.Type != "" { + field := fields[0] + if w.Type != field { + return fmt.Errorf( + "type %T defines a discriminant set to %q, but it does not match the %T field; either remove or update the discriminant to match", + w, + w.Type, + w, + ) + } + } + return nil +} + +var ( + workspaceSubmissionStatusV2FieldUpdates = big.NewInt(1 << 0) +) + +type WorkspaceSubmissionStatusV2 struct { + Updates []*WorkspaceSubmissionUpdate `json:"updates" url:"updates"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (w *WorkspaceSubmissionStatusV2) GetUpdates() []*WorkspaceSubmissionUpdate { + if w == nil { + return nil + } + return w.Updates +} + +func (w *WorkspaceSubmissionStatusV2) GetExtraProperties() map[string]interface{} { + if w == nil { + return nil + } + return w.extraProperties +} + +func (w *WorkspaceSubmissionStatusV2) require(field *big.Int) { + if w.explicitFields == nil { + w.explicitFields = big.NewInt(0) + } + w.explicitFields.Or(w.explicitFields, field) +} + +// SetUpdates sets the Updates field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (w *WorkspaceSubmissionStatusV2) SetUpdates(updates []*WorkspaceSubmissionUpdate) { + w.Updates = updates + w.require(workspaceSubmissionStatusV2FieldUpdates) +} + +func (w *WorkspaceSubmissionStatusV2) UnmarshalJSON(data []byte) error { + type unmarshaler WorkspaceSubmissionStatusV2 + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *w = WorkspaceSubmissionStatusV2(value) + extraProperties, err := internal.ExtractExtraProperties(data, *w) + if err != nil { + return err + } + w.extraProperties = extraProperties + w.rawJSON = json.RawMessage(data) + return nil +} + +func (w *WorkspaceSubmissionStatusV2) MarshalJSON() ([]byte, error) { + type embed WorkspaceSubmissionStatusV2 + var marshaler = struct { + embed + }{ + embed: embed(*w), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, w.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (w *WorkspaceSubmissionStatusV2) String() string { + if w == nil { + return "" + } + if len(w.rawJSON) > 0 { + if value, err := internal.StringifyJSON(w.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(w); err == nil { + return value + } + return fmt.Sprintf("%#v", w) +} + +var ( + workspaceSubmissionUpdateFieldUpdateTime = big.NewInt(1 << 0) + workspaceSubmissionUpdateFieldUpdateInfo = big.NewInt(1 << 1) +) + +type WorkspaceSubmissionUpdate struct { + UpdateTime time.Time `json:"updateTime" url:"updateTime"` + UpdateInfo *WorkspaceSubmissionUpdateInfo `json:"updateInfo" url:"updateInfo"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (w *WorkspaceSubmissionUpdate) GetUpdateTime() time.Time { + if w == nil { + return time.Time{} + } + return w.UpdateTime +} + +func (w *WorkspaceSubmissionUpdate) GetUpdateInfo() *WorkspaceSubmissionUpdateInfo { + if w == nil { + return nil + } + return w.UpdateInfo +} + +func (w *WorkspaceSubmissionUpdate) GetExtraProperties() map[string]interface{} { + if w == nil { + return nil + } + return w.extraProperties +} + +func (w *WorkspaceSubmissionUpdate) require(field *big.Int) { + if w.explicitFields == nil { + w.explicitFields = big.NewInt(0) + } + w.explicitFields.Or(w.explicitFields, field) +} + +// SetUpdateTime sets the UpdateTime field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (w *WorkspaceSubmissionUpdate) SetUpdateTime(updateTime time.Time) { + w.UpdateTime = updateTime + w.require(workspaceSubmissionUpdateFieldUpdateTime) +} + +// SetUpdateInfo sets the UpdateInfo field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (w *WorkspaceSubmissionUpdate) SetUpdateInfo(updateInfo *WorkspaceSubmissionUpdateInfo) { + w.UpdateInfo = updateInfo + w.require(workspaceSubmissionUpdateFieldUpdateInfo) +} + +func (w *WorkspaceSubmissionUpdate) UnmarshalJSON(data []byte) error { + type embed WorkspaceSubmissionUpdate + var unmarshaler = struct { + embed + UpdateTime *internal.DateTime `json:"updateTime"` + }{ + embed: embed(*w), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + *w = WorkspaceSubmissionUpdate(unmarshaler.embed) + w.UpdateTime = unmarshaler.UpdateTime.Time() + extraProperties, err := internal.ExtractExtraProperties(data, *w) + if err != nil { + return err + } + w.extraProperties = extraProperties + w.rawJSON = json.RawMessage(data) + return nil +} + +func (w *WorkspaceSubmissionUpdate) MarshalJSON() ([]byte, error) { + type embed WorkspaceSubmissionUpdate + var marshaler = struct { + embed + UpdateTime *internal.DateTime `json:"updateTime"` + }{ + embed: embed(*w), + UpdateTime: internal.NewDateTime(w.UpdateTime), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, w.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (w *WorkspaceSubmissionUpdate) String() string { + if w == nil { + return "" + } + if len(w.rawJSON) > 0 { + if value, err := internal.StringifyJSON(w.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(w); err == nil { + return value + } + return fmt.Sprintf("%#v", w) +} + +type WorkspaceSubmissionUpdateInfo struct { + Type string + Running RunningSubmissionState + Ran *WorkspaceRunDetails + Stopped interface{} + Traced interface{} + TracedV2 *WorkspaceTracedUpdate + Errored *ErrorInfo + Finished interface{} + + rawJSON json.RawMessage +} + +func (w *WorkspaceSubmissionUpdateInfo) GetType() string { + if w == nil { + return "" + } + return w.Type +} + +func (w *WorkspaceSubmissionUpdateInfo) GetRunning() RunningSubmissionState { + if w == nil { + return "" + } + return w.Running +} + +func (w *WorkspaceSubmissionUpdateInfo) GetRan() *WorkspaceRunDetails { + if w == nil { + return nil + } + return w.Ran +} + +func (w *WorkspaceSubmissionUpdateInfo) GetStopped() interface{} { + if w == nil { + return nil + } + return w.Stopped +} + +func (w *WorkspaceSubmissionUpdateInfo) GetTraced() interface{} { + if w == nil { + return nil + } + return w.Traced +} + +func (w *WorkspaceSubmissionUpdateInfo) GetTracedV2() *WorkspaceTracedUpdate { + if w == nil { + return nil + } + return w.TracedV2 +} + +func (w *WorkspaceSubmissionUpdateInfo) GetErrored() *ErrorInfo { + if w == nil { + return nil + } + return w.Errored +} + +func (w *WorkspaceSubmissionUpdateInfo) GetFinished() interface{} { + if w == nil { + return nil + } + return w.Finished +} + +func (w *WorkspaceSubmissionUpdateInfo) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + w.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", w) + } + switch unmarshaler.Type { + case "running": + var valueUnmarshaler struct { + Running RunningSubmissionState `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + w.Running = valueUnmarshaler.Running + case "ran": + value := new(WorkspaceRunDetails) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + w.Ran = value + case "stopped": + value := make(map[string]interface{}) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + w.Stopped = value + case "traced": + value := make(map[string]interface{}) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + w.Traced = value + case "tracedV2": + value := new(WorkspaceTracedUpdate) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + w.TracedV2 = value + case "errored": + var valueUnmarshaler struct { + Errored *ErrorInfo `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + w.Errored = valueUnmarshaler.Errored + case "finished": + value := make(map[string]interface{}) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + w.Finished = value + } + w.rawJSON = json.RawMessage(data) + return nil +} + +func (w WorkspaceSubmissionUpdateInfo) MarshalJSON() ([]byte, error) { + if err := w.validate(); err != nil { + return nil, err + } + if w.Running != "" { + var marshaler = struct { + Type string `json:"type"` + Running RunningSubmissionState `json:"value"` + }{ + Type: "running", + Running: w.Running, + } + return json.Marshal(marshaler) + } + if w.Ran != nil { + return internal.MarshalJSONWithExtraProperty(w.Ran, "type", "ran") + } + if w.Stopped != nil { + var marshaler = struct { + Type string `json:"type"` + Stopped interface{} `json:"stopped,omitempty"` + }{ + Type: "stopped", + Stopped: w.Stopped, + } + return json.Marshal(marshaler) + } + if w.Traced != nil { + var marshaler = struct { + Type string `json:"type"` + Traced interface{} `json:"traced,omitempty"` + }{ + Type: "traced", + Traced: w.Traced, + } + return json.Marshal(marshaler) + } + if w.TracedV2 != nil { + return internal.MarshalJSONWithExtraProperty(w.TracedV2, "type", "tracedV2") + } + if w.Errored != nil { + var marshaler = struct { + Type string `json:"type"` + Errored *ErrorInfo `json:"value"` + }{ + Type: "errored", + Errored: w.Errored, + } + return json.Marshal(marshaler) + } + if w.Finished != nil { + var marshaler = struct { + Type string `json:"type"` + Finished interface{} `json:"finished,omitempty"` + }{ + Type: "finished", + Finished: w.Finished, + } + return json.Marshal(marshaler) + } + if len(w.rawJSON) > 0 { + return w.rawJSON, nil + } + return nil, fmt.Errorf("type %T does not define a non-empty union type", w) +} + +type WorkspaceSubmissionUpdateInfoVisitor interface { + VisitRunning(RunningSubmissionState) error + VisitRan(*WorkspaceRunDetails) error + VisitStopped(interface{}) error + VisitTraced(interface{}) error + VisitTracedV2(*WorkspaceTracedUpdate) error + VisitErrored(*ErrorInfo) error + VisitFinished(interface{}) error +} + +func (w *WorkspaceSubmissionUpdateInfo) Accept(visitor WorkspaceSubmissionUpdateInfoVisitor) error { + if w.Running != "" { + return visitor.VisitRunning(w.Running) + } + if w.Ran != nil { + return visitor.VisitRan(w.Ran) + } + if w.Stopped != nil { + return visitor.VisitStopped(w.Stopped) + } + if w.Traced != nil { + return visitor.VisitTraced(w.Traced) + } + if w.TracedV2 != nil { + return visitor.VisitTracedV2(w.TracedV2) + } + if w.Errored != nil { + return visitor.VisitErrored(w.Errored) + } + if w.Finished != nil { + return visitor.VisitFinished(w.Finished) + } + return fmt.Errorf("type %T does not define a non-empty union type", w) +} + +func (w *WorkspaceSubmissionUpdateInfo) validate() error { + if w == nil { + return fmt.Errorf("type %T is nil", w) + } + var fields []string + if w.Running != "" { + fields = append(fields, "running") + } + if w.Ran != nil { + fields = append(fields, "ran") + } + if w.Stopped != nil { + fields = append(fields, "stopped") + } + if w.Traced != nil { + fields = append(fields, "traced") + } + if w.TracedV2 != nil { + fields = append(fields, "tracedV2") + } + if w.Errored != nil { + fields = append(fields, "errored") + } + if w.Finished != nil { + fields = append(fields, "finished") + } + if len(fields) == 0 { + if w.Type != "" { + if len(w.rawJSON) > 0 { + return nil + } + return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", w, w.Type) + } + return fmt.Errorf("type %T is empty", w) + } + if len(fields) > 1 { + return fmt.Errorf("type %T defines values for %s, but only one value is allowed", w, fields) + } + if w.Type != "" { + field := fields[0] + if w.Type != field { + return fmt.Errorf( + "type %T defines a discriminant set to %q, but it does not match the %T field; either remove or update the discriminant to match", + w, + w.Type, + w, + ) + } + } + return nil +} + +var ( + workspaceSubmitRequestFieldSubmissionID = big.NewInt(1 << 0) + workspaceSubmitRequestFieldLanguage = big.NewInt(1 << 1) + workspaceSubmitRequestFieldSubmissionFiles = big.NewInt(1 << 2) + workspaceSubmitRequestFieldUserID = big.NewInt(1 << 3) +) + +type WorkspaceSubmitRequest struct { + SubmissionID SubmissionID `json:"submissionId" url:"submissionId"` + Language common.Language `json:"language" url:"language"` + SubmissionFiles []*SubmissionFileInfo `json:"submissionFiles" url:"submissionFiles"` + UserID *string `json:"userId,omitempty" url:"userId,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (w *WorkspaceSubmitRequest) GetSubmissionID() SubmissionID { + if w == nil { + return uuid.Nil + } + return w.SubmissionID +} + +func (w *WorkspaceSubmitRequest) GetLanguage() common.Language { + if w == nil { + return "" + } + return w.Language +} + +func (w *WorkspaceSubmitRequest) GetSubmissionFiles() []*SubmissionFileInfo { + if w == nil { + return nil + } + return w.SubmissionFiles +} + +func (w *WorkspaceSubmitRequest) GetUserID() *string { + if w == nil { + return nil + } + return w.UserID +} + +func (w *WorkspaceSubmitRequest) GetExtraProperties() map[string]interface{} { + if w == nil { + return nil + } + return w.extraProperties +} + +func (w *WorkspaceSubmitRequest) require(field *big.Int) { + if w.explicitFields == nil { + w.explicitFields = big.NewInt(0) + } + w.explicitFields.Or(w.explicitFields, field) +} + +// SetSubmissionID sets the SubmissionID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (w *WorkspaceSubmitRequest) SetSubmissionID(submissionID SubmissionID) { + w.SubmissionID = submissionID + w.require(workspaceSubmitRequestFieldSubmissionID) +} + +// SetLanguage sets the Language field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (w *WorkspaceSubmitRequest) SetLanguage(language common.Language) { + w.Language = language + w.require(workspaceSubmitRequestFieldLanguage) +} + +// SetSubmissionFiles sets the SubmissionFiles field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (w *WorkspaceSubmitRequest) SetSubmissionFiles(submissionFiles []*SubmissionFileInfo) { + w.SubmissionFiles = submissionFiles + w.require(workspaceSubmitRequestFieldSubmissionFiles) +} + +// SetUserID sets the UserID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (w *WorkspaceSubmitRequest) SetUserID(userID *string) { + w.UserID = userID + w.require(workspaceSubmitRequestFieldUserID) +} + +func (w *WorkspaceSubmitRequest) UnmarshalJSON(data []byte) error { + type unmarshaler WorkspaceSubmitRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *w = WorkspaceSubmitRequest(value) + extraProperties, err := internal.ExtractExtraProperties(data, *w) + if err != nil { + return err + } + w.extraProperties = extraProperties + w.rawJSON = json.RawMessage(data) + return nil +} + +func (w *WorkspaceSubmitRequest) MarshalJSON() ([]byte, error) { + type embed WorkspaceSubmitRequest + var marshaler = struct { + embed + }{ + embed: embed(*w), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, w.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (w *WorkspaceSubmitRequest) String() string { + if w == nil { + return "" + } + if len(w.rawJSON) > 0 { + if value, err := internal.StringifyJSON(w.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(w); err == nil { + return value + } + return fmt.Sprintf("%#v", w) +} + +var ( + workspaceTracedUpdateFieldTraceResponsesSize = big.NewInt(1 << 0) +) + +type WorkspaceTracedUpdate struct { + TraceResponsesSize int `json:"traceResponsesSize" url:"traceResponsesSize"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (w *WorkspaceTracedUpdate) GetTraceResponsesSize() int { + if w == nil { + return 0 + } + return w.TraceResponsesSize +} + +func (w *WorkspaceTracedUpdate) GetExtraProperties() map[string]interface{} { + if w == nil { + return nil + } + return w.extraProperties +} + +func (w *WorkspaceTracedUpdate) require(field *big.Int) { + if w.explicitFields == nil { + w.explicitFields = big.NewInt(0) + } + w.explicitFields.Or(w.explicitFields, field) +} + +// SetTraceResponsesSize sets the TraceResponsesSize field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (w *WorkspaceTracedUpdate) SetTraceResponsesSize(traceResponsesSize int) { + w.TraceResponsesSize = traceResponsesSize + w.require(workspaceTracedUpdateFieldTraceResponsesSize) +} + +func (w *WorkspaceTracedUpdate) UnmarshalJSON(data []byte) error { + type unmarshaler WorkspaceTracedUpdate + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *w = WorkspaceTracedUpdate(value) + extraProperties, err := internal.ExtractExtraProperties(data, *w) + if err != nil { + return err + } + w.extraProperties = extraProperties + w.rawJSON = json.RawMessage(data) + return nil +} + +func (w *WorkspaceTracedUpdate) MarshalJSON() ([]byte, error) { + type embed WorkspaceTracedUpdate + var marshaler = struct { + embed + }{ + embed: embed(*w), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, w.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (w *WorkspaceTracedUpdate) String() string { + if w == nil { + return "" + } + if len(w.rawJSON) > 0 { + if value, err := internal.StringifyJSON(w.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(w); err == nil { + return value + } + return fmt.Sprintf("%#v", w) +} diff --git a/seed/go-sdk/trace/submission/client.go b/seed/go-sdk/trace/submission/client.go new file mode 100644 index 000000000000..c657f8742ed3 --- /dev/null +++ b/seed/go-sdk/trace/submission/client.go @@ -0,0 +1,101 @@ +// Code generated by Fern. DO NOT EDIT. + +package submission + +import ( + context "context" + + fern "github.com/trace/fern" + common "github.com/trace/fern/common" + core "github.com/trace/fern/core" + internal "github.com/trace/fern/internal" + option "github.com/trace/fern/option" +) + +type Client struct { + WithRawResponse *RawClient + + options *core.RequestOptions + baseURL string + caller *internal.Caller +} + +func NewClient(options *core.RequestOptions) *Client { + return &Client{ + WithRawResponse: NewRawClient(options), + options: options, + baseURL: options.BaseURL, + caller: internal.NewCaller( + &internal.CallerParams{ + Client: options.HTTPClient, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + }, + ), + } +} + +// Returns sessionId and execution server URL for session. Spins up server. +func (c *Client) CreateExecutionSession( + ctx context.Context, + language *common.Language, + opts ...option.RequestOption, +) (*fern.ExecutionSessionResponse, error) { + response, err := c.WithRawResponse.CreateExecutionSession( + ctx, + language, + opts..., + ) + if err != nil { + return nil, err + } + return response.Body, nil +} + +// Returns execution server URL for session. Returns empty if session isn't registered. +func (c *Client) GetExecutionSession( + ctx context.Context, + sessionID string, + opts ...option.RequestOption, +) (*fern.ExecutionSessionResponse, error) { + response, err := c.WithRawResponse.GetExecutionSession( + ctx, + sessionID, + opts..., + ) + if err != nil { + return nil, err + } + return response.Body, nil +} + +// Stops execution session. +func (c *Client) StopExecutionSession( + ctx context.Context, + sessionID string, + opts ...option.RequestOption, +) error { + _, err := c.WithRawResponse.StopExecutionSession( + ctx, + sessionID, + opts..., + ) + if err != nil { + return err + } + return nil +} + +func (c *Client) GetExecutionSessionsState( + ctx context.Context, + opts ...option.RequestOption, +) (*fern.GetExecutionSessionStateResponse, error) { + response, err := c.WithRawResponse.GetExecutionSessionsState( + ctx, + opts..., + ) + if err != nil { + return nil, err + } + return response.Body, nil +} diff --git a/seed/go-sdk/trace/submission/doc.go b/seed/go-sdk/trace/submission/doc.go new file mode 100644 index 000000000000..6c7a47bf5118 --- /dev/null +++ b/seed/go-sdk/trace/submission/doc.go @@ -0,0 +1,4 @@ +// Code generated by Fern. DO NOT EDIT. + +// Responsible for spinning up and spinning down execution. +package submission diff --git a/seed/go-sdk/trace/submission/raw_client.go b/seed/go-sdk/trace/submission/raw_client.go new file mode 100644 index 000000000000..868b00e2d0e3 --- /dev/null +++ b/seed/go-sdk/trace/submission/raw_client.go @@ -0,0 +1,204 @@ +// Code generated by Fern. DO NOT EDIT. + +package submission + +import ( + context "context" + http "net/http" + + fern "github.com/trace/fern" + common "github.com/trace/fern/common" + core "github.com/trace/fern/core" + internal "github.com/trace/fern/internal" + option "github.com/trace/fern/option" +) + +type RawClient struct { + baseURL string + caller *internal.Caller + options *core.RequestOptions +} + +func NewRawClient(options *core.RequestOptions) *RawClient { + return &RawClient{ + options: options, + baseURL: options.BaseURL, + caller: internal.NewCaller( + &internal.CallerParams{ + Client: options.HTTPClient, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + }, + ), + } +} + +func (r *RawClient) CreateExecutionSession( + ctx context.Context, + language *common.Language, + opts ...option.RequestOption, +) (*core.Response[*fern.ExecutionSessionResponse], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.trace.come", + ) + endpointURL := internal.EncodeURL( + baseURL+"/sessions/create-session/%v", + language, + ) + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + var response *fern.ExecutionSessionResponse + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: headers, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + Response: &response, + }, + ) + if err != nil { + return nil, err + } + return &core.Response[*fern.ExecutionSessionResponse]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: response, + }, nil +} + +func (r *RawClient) GetExecutionSession( + ctx context.Context, + sessionID string, + opts ...option.RequestOption, +) (*core.Response[*fern.ExecutionSessionResponse], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.trace.come", + ) + endpointURL := internal.EncodeURL( + baseURL+"/sessions/%v", + sessionID, + ) + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + var response *fern.ExecutionSessionResponse + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodGet, + Headers: headers, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + Response: &response, + }, + ) + if err != nil { + return nil, err + } + return &core.Response[*fern.ExecutionSessionResponse]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: response, + }, nil +} + +func (r *RawClient) StopExecutionSession( + ctx context.Context, + sessionID string, + opts ...option.RequestOption, +) (*core.Response[any], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.trace.come", + ) + endpointURL := internal.EncodeURL( + baseURL+"/sessions/stop/%v", + sessionID, + ) + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodDelete, + Headers: headers, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + }, + ) + if err != nil { + return nil, err + } + return &core.Response[any]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: nil, + }, nil +} + +func (r *RawClient) GetExecutionSessionsState( + ctx context.Context, + opts ...option.RequestOption, +) (*core.Response[*fern.GetExecutionSessionStateResponse], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.trace.come", + ) + endpointURL := baseURL + "/sessions/execution-sessions-state" + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + var response *fern.GetExecutionSessionStateResponse + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodGet, + Headers: headers, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + Response: &response, + }, + ) + if err != nil { + return nil, err + } + return &core.Response[*fern.GetExecutionSessionStateResponse]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: response, + }, nil +} diff --git a/seed/go-sdk/trace/submission_test.go b/seed/go-sdk/trace/submission_test.go new file mode 100644 index 000000000000..1896b0234845 --- /dev/null +++ b/seed/go-sdk/trace/submission_test.go @@ -0,0 +1,16717 @@ +// Code generated by Fern. DO NOT EDIT. + +package trace + +import ( + json "encoding/json" + assert "github.com/stretchr/testify/assert" + require "github.com/stretchr/testify/require" + common "github.com/trace/fern/common" + v2 "github.com/trace/fern/common/v2" + testing "testing" + time "time" +) + +func TestGettersActualResult(t *testing.T) { + t.Run("GetType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ActualResult{} + var expected string + obj.Type = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetType(), "getter should return the property value") + }) + + t.Run("GetType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ActualResult + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetType() // Should return zero value + }) + + t.Run("GetValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ActualResult{} + var expected *common.VariableValue + obj.Value = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetValue(), "getter should return the property value") + }) + + t.Run("GetValue_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ActualResult{} + obj.Value = nil + + // Act & Assert + assert.Nil(t, obj.GetValue(), "getter should return nil when property is nil") + }) + + t.Run("GetValue_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ActualResult + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetValue() // Should return zero value + }) + + t.Run("GetException", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ActualResult{} + var expected *ExceptionInfo + obj.Exception = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetException(), "getter should return the property value") + }) + + t.Run("GetException_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ActualResult{} + obj.Exception = nil + + // Act & Assert + assert.Nil(t, obj.GetException(), "getter should return nil when property is nil") + }) + + t.Run("GetException_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ActualResult + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetException() // Should return zero value + }) + + t.Run("GetExceptionV2", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ActualResult{} + var expected *ExceptionV2 + obj.ExceptionV2 = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetExceptionV2(), "getter should return the property value") + }) + + t.Run("GetExceptionV2_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ActualResult{} + obj.ExceptionV2 = nil + + // Act & Assert + assert.Nil(t, obj.GetExceptionV2(), "getter should return nil when property is nil") + }) + + t.Run("GetExceptionV2_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ActualResult + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetExceptionV2() // Should return zero value + }) + +} + +func TestSettersBuildingExecutorResponse(t *testing.T) { + t.Run("SetSubmissionID", func(t *testing.T) { + obj := &BuildingExecutorResponse{} + var fernTestValueSubmissionID SubmissionID + obj.SetSubmissionID(fernTestValueSubmissionID) + assert.Equal(t, fernTestValueSubmissionID, obj.SubmissionID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetStatus", func(t *testing.T) { + obj := &BuildingExecutorResponse{} + var fernTestValueStatus ExecutionSessionStatus + obj.SetStatus(fernTestValueStatus) + assert.Equal(t, fernTestValueStatus, obj.Status) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersBuildingExecutorResponse(t *testing.T) { + t.Run("GetSubmissionID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BuildingExecutorResponse{} + var expected SubmissionID + obj.SubmissionID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSubmissionID(), "getter should return the property value") + }) + + t.Run("GetSubmissionID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BuildingExecutorResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSubmissionID() // Should return zero value + }) + + t.Run("GetStatus", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BuildingExecutorResponse{} + var expected ExecutionSessionStatus + obj.Status = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetStatus(), "getter should return the property value") + }) + + t.Run("GetStatus_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BuildingExecutorResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetStatus() // Should return zero value + }) + +} + +func TestSettersMarkExplicitBuildingExecutorResponse(t *testing.T) { + t.Run("SetSubmissionID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BuildingExecutorResponse{} + var fernTestValueSubmissionID SubmissionID + + // Act + obj.SetSubmissionID(fernTestValueSubmissionID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetStatus_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BuildingExecutorResponse{} + var fernTestValueStatus ExecutionSessionStatus + + // Act + obj.SetStatus(fernTestValueStatus) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestGettersCodeExecutionUpdate(t *testing.T) { + t.Run("GetType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CodeExecutionUpdate{} + var expected string + obj.Type = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetType(), "getter should return the property value") + }) + + t.Run("GetType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CodeExecutionUpdate + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetType() // Should return zero value + }) + + t.Run("GetBuildingExecutor", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CodeExecutionUpdate{} + var expected *BuildingExecutorResponse + obj.BuildingExecutor = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetBuildingExecutor(), "getter should return the property value") + }) + + t.Run("GetBuildingExecutor_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CodeExecutionUpdate{} + obj.BuildingExecutor = nil + + // Act & Assert + assert.Nil(t, obj.GetBuildingExecutor(), "getter should return nil when property is nil") + }) + + t.Run("GetBuildingExecutor_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CodeExecutionUpdate + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetBuildingExecutor() // Should return zero value + }) + + t.Run("GetRunning", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CodeExecutionUpdate{} + var expected *RunningResponse + obj.Running = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetRunning(), "getter should return the property value") + }) + + t.Run("GetRunning_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CodeExecutionUpdate{} + obj.Running = nil + + // Act & Assert + assert.Nil(t, obj.GetRunning(), "getter should return nil when property is nil") + }) + + t.Run("GetRunning_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CodeExecutionUpdate + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetRunning() // Should return zero value + }) + + t.Run("GetErrored", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CodeExecutionUpdate{} + var expected *ErroredResponse + obj.Errored = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetErrored(), "getter should return the property value") + }) + + t.Run("GetErrored_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CodeExecutionUpdate{} + obj.Errored = nil + + // Act & Assert + assert.Nil(t, obj.GetErrored(), "getter should return nil when property is nil") + }) + + t.Run("GetErrored_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CodeExecutionUpdate + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetErrored() // Should return zero value + }) + + t.Run("GetStopped", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CodeExecutionUpdate{} + var expected *StoppedResponse + obj.Stopped = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetStopped(), "getter should return the property value") + }) + + t.Run("GetStopped_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CodeExecutionUpdate{} + obj.Stopped = nil + + // Act & Assert + assert.Nil(t, obj.GetStopped(), "getter should return nil when property is nil") + }) + + t.Run("GetStopped_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CodeExecutionUpdate + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetStopped() // Should return zero value + }) + + t.Run("GetGraded", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CodeExecutionUpdate{} + var expected *GradedResponse + obj.Graded = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetGraded(), "getter should return the property value") + }) + + t.Run("GetGraded_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CodeExecutionUpdate{} + obj.Graded = nil + + // Act & Assert + assert.Nil(t, obj.GetGraded(), "getter should return nil when property is nil") + }) + + t.Run("GetGraded_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CodeExecutionUpdate + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetGraded() // Should return zero value + }) + + t.Run("GetGradedV2", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CodeExecutionUpdate{} + var expected *GradedResponseV2 + obj.GradedV2 = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetGradedV2(), "getter should return the property value") + }) + + t.Run("GetGradedV2_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CodeExecutionUpdate{} + obj.GradedV2 = nil + + // Act & Assert + assert.Nil(t, obj.GetGradedV2(), "getter should return nil when property is nil") + }) + + t.Run("GetGradedV2_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CodeExecutionUpdate + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetGradedV2() // Should return zero value + }) + + t.Run("GetWorkspaceRan", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CodeExecutionUpdate{} + var expected *WorkspaceRanResponse + obj.WorkspaceRan = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetWorkspaceRan(), "getter should return the property value") + }) + + t.Run("GetWorkspaceRan_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CodeExecutionUpdate{} + obj.WorkspaceRan = nil + + // Act & Assert + assert.Nil(t, obj.GetWorkspaceRan(), "getter should return nil when property is nil") + }) + + t.Run("GetWorkspaceRan_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CodeExecutionUpdate + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetWorkspaceRan() // Should return zero value + }) + + t.Run("GetRecording", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CodeExecutionUpdate{} + var expected *RecordingResponseNotification + obj.Recording = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetRecording(), "getter should return the property value") + }) + + t.Run("GetRecording_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CodeExecutionUpdate{} + obj.Recording = nil + + // Act & Assert + assert.Nil(t, obj.GetRecording(), "getter should return nil when property is nil") + }) + + t.Run("GetRecording_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CodeExecutionUpdate + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetRecording() // Should return zero value + }) + + t.Run("GetRecorded", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CodeExecutionUpdate{} + var expected *RecordedResponseNotification + obj.Recorded = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetRecorded(), "getter should return the property value") + }) + + t.Run("GetRecorded_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CodeExecutionUpdate{} + obj.Recorded = nil + + // Act & Assert + assert.Nil(t, obj.GetRecorded(), "getter should return nil when property is nil") + }) + + t.Run("GetRecorded_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CodeExecutionUpdate + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetRecorded() // Should return zero value + }) + + t.Run("GetInvalidRequest", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CodeExecutionUpdate{} + var expected *InvalidRequestResponse + obj.InvalidRequest = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetInvalidRequest(), "getter should return the property value") + }) + + t.Run("GetInvalidRequest_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CodeExecutionUpdate{} + obj.InvalidRequest = nil + + // Act & Assert + assert.Nil(t, obj.GetInvalidRequest(), "getter should return nil when property is nil") + }) + + t.Run("GetInvalidRequest_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CodeExecutionUpdate + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetInvalidRequest() // Should return zero value + }) + + t.Run("GetFinished", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CodeExecutionUpdate{} + var expected *FinishedResponse + obj.Finished = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetFinished(), "getter should return the property value") + }) + + t.Run("GetFinished_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CodeExecutionUpdate{} + obj.Finished = nil + + // Act & Assert + assert.Nil(t, obj.GetFinished(), "getter should return nil when property is nil") + }) + + t.Run("GetFinished_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CodeExecutionUpdate + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetFinished() // Should return zero value + }) + +} + +func TestSettersCompileError(t *testing.T) { + t.Run("SetMessage", func(t *testing.T) { + obj := &CompileError{} + var fernTestValueMessage string + obj.SetMessage(fernTestValueMessage) + assert.Equal(t, fernTestValueMessage, obj.Message) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersCompileError(t *testing.T) { + t.Run("GetMessage", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CompileError{} + var expected string + obj.Message = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetMessage(), "getter should return the property value") + }) + + t.Run("GetMessage_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CompileError + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetMessage() // Should return zero value + }) + +} + +func TestSettersMarkExplicitCompileError(t *testing.T) { + t.Run("SetMessage_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CompileError{} + var fernTestValueMessage string + + // Act + obj.SetMessage(fernTestValueMessage) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersCustomTestCasesUnsupported(t *testing.T) { + t.Run("SetProblemID", func(t *testing.T) { + obj := &CustomTestCasesUnsupported{} + var fernTestValueProblemID common.ProblemID + obj.SetProblemID(fernTestValueProblemID) + assert.Equal(t, fernTestValueProblemID, obj.ProblemID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetSubmissionID", func(t *testing.T) { + obj := &CustomTestCasesUnsupported{} + var fernTestValueSubmissionID SubmissionID + obj.SetSubmissionID(fernTestValueSubmissionID) + assert.Equal(t, fernTestValueSubmissionID, obj.SubmissionID) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersCustomTestCasesUnsupported(t *testing.T) { + t.Run("GetProblemID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CustomTestCasesUnsupported{} + var expected common.ProblemID + obj.ProblemID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetProblemID(), "getter should return the property value") + }) + + t.Run("GetProblemID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CustomTestCasesUnsupported + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetProblemID() // Should return zero value + }) + + t.Run("GetSubmissionID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CustomTestCasesUnsupported{} + var expected SubmissionID + obj.SubmissionID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSubmissionID(), "getter should return the property value") + }) + + t.Run("GetSubmissionID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CustomTestCasesUnsupported + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSubmissionID() // Should return zero value + }) + +} + +func TestSettersMarkExplicitCustomTestCasesUnsupported(t *testing.T) { + t.Run("SetProblemID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CustomTestCasesUnsupported{} + var fernTestValueProblemID common.ProblemID + + // Act + obj.SetProblemID(fernTestValueProblemID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetSubmissionID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CustomTestCasesUnsupported{} + var fernTestValueSubmissionID SubmissionID + + // Act + obj.SetSubmissionID(fernTestValueSubmissionID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestGettersErrorInfo(t *testing.T) { + t.Run("GetType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ErrorInfo{} + var expected string + obj.Type = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetType(), "getter should return the property value") + }) + + t.Run("GetType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ErrorInfo + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetType() // Should return zero value + }) + + t.Run("GetCompileError", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ErrorInfo{} + var expected *CompileError + obj.CompileError = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetCompileError(), "getter should return the property value") + }) + + t.Run("GetCompileError_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ErrorInfo{} + obj.CompileError = nil + + // Act & Assert + assert.Nil(t, obj.GetCompileError(), "getter should return nil when property is nil") + }) + + t.Run("GetCompileError_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ErrorInfo + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetCompileError() // Should return zero value + }) + + t.Run("GetRuntimeError", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ErrorInfo{} + var expected *RuntimeError + obj.RuntimeError = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetRuntimeError(), "getter should return the property value") + }) + + t.Run("GetRuntimeError_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ErrorInfo{} + obj.RuntimeError = nil + + // Act & Assert + assert.Nil(t, obj.GetRuntimeError(), "getter should return nil when property is nil") + }) + + t.Run("GetRuntimeError_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ErrorInfo + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetRuntimeError() // Should return zero value + }) + + t.Run("GetInternalError", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ErrorInfo{} + var expected *InternalError + obj.InternalError = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetInternalError(), "getter should return the property value") + }) + + t.Run("GetInternalError_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ErrorInfo{} + obj.InternalError = nil + + // Act & Assert + assert.Nil(t, obj.GetInternalError(), "getter should return nil when property is nil") + }) + + t.Run("GetInternalError_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ErrorInfo + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetInternalError() // Should return zero value + }) + +} + +func TestSettersErroredResponse(t *testing.T) { + t.Run("SetSubmissionID", func(t *testing.T) { + obj := &ErroredResponse{} + var fernTestValueSubmissionID SubmissionID + obj.SetSubmissionID(fernTestValueSubmissionID) + assert.Equal(t, fernTestValueSubmissionID, obj.SubmissionID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetErrorInfo", func(t *testing.T) { + obj := &ErroredResponse{} + var fernTestValueErrorInfo *ErrorInfo + obj.SetErrorInfo(fernTestValueErrorInfo) + assert.Equal(t, fernTestValueErrorInfo, obj.ErrorInfo) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersErroredResponse(t *testing.T) { + t.Run("GetSubmissionID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ErroredResponse{} + var expected SubmissionID + obj.SubmissionID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSubmissionID(), "getter should return the property value") + }) + + t.Run("GetSubmissionID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ErroredResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSubmissionID() // Should return zero value + }) + + t.Run("GetErrorInfo", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ErroredResponse{} + var expected *ErrorInfo + obj.ErrorInfo = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetErrorInfo(), "getter should return the property value") + }) + + t.Run("GetErrorInfo_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ErroredResponse{} + obj.ErrorInfo = nil + + // Act & Assert + assert.Nil(t, obj.GetErrorInfo(), "getter should return nil when property is nil") + }) + + t.Run("GetErrorInfo_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ErroredResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetErrorInfo() // Should return zero value + }) + +} + +func TestSettersMarkExplicitErroredResponse(t *testing.T) { + t.Run("SetSubmissionID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ErroredResponse{} + var fernTestValueSubmissionID SubmissionID + + // Act + obj.SetSubmissionID(fernTestValueSubmissionID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetErrorInfo_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ErroredResponse{} + var fernTestValueErrorInfo *ErrorInfo + + // Act + obj.SetErrorInfo(fernTestValueErrorInfo) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersExceptionInfo(t *testing.T) { + t.Run("SetExceptionType", func(t *testing.T) { + obj := &ExceptionInfo{} + var fernTestValueExceptionType string + obj.SetExceptionType(fernTestValueExceptionType) + assert.Equal(t, fernTestValueExceptionType, obj.ExceptionType) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetExceptionMessage", func(t *testing.T) { + obj := &ExceptionInfo{} + var fernTestValueExceptionMessage string + obj.SetExceptionMessage(fernTestValueExceptionMessage) + assert.Equal(t, fernTestValueExceptionMessage, obj.ExceptionMessage) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetExceptionStacktrace", func(t *testing.T) { + obj := &ExceptionInfo{} + var fernTestValueExceptionStacktrace string + obj.SetExceptionStacktrace(fernTestValueExceptionStacktrace) + assert.Equal(t, fernTestValueExceptionStacktrace, obj.ExceptionStacktrace) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersExceptionInfo(t *testing.T) { + t.Run("GetExceptionType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExceptionInfo{} + var expected string + obj.ExceptionType = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetExceptionType(), "getter should return the property value") + }) + + t.Run("GetExceptionType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ExceptionInfo + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetExceptionType() // Should return zero value + }) + + t.Run("GetExceptionMessage", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExceptionInfo{} + var expected string + obj.ExceptionMessage = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetExceptionMessage(), "getter should return the property value") + }) + + t.Run("GetExceptionMessage_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ExceptionInfo + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetExceptionMessage() // Should return zero value + }) + + t.Run("GetExceptionStacktrace", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExceptionInfo{} + var expected string + obj.ExceptionStacktrace = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetExceptionStacktrace(), "getter should return the property value") + }) + + t.Run("GetExceptionStacktrace_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ExceptionInfo + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetExceptionStacktrace() // Should return zero value + }) + +} + +func TestSettersMarkExplicitExceptionInfo(t *testing.T) { + t.Run("SetExceptionType_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExceptionInfo{} + var fernTestValueExceptionType string + + // Act + obj.SetExceptionType(fernTestValueExceptionType) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetExceptionMessage_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExceptionInfo{} + var fernTestValueExceptionMessage string + + // Act + obj.SetExceptionMessage(fernTestValueExceptionMessage) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetExceptionStacktrace_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExceptionInfo{} + var fernTestValueExceptionStacktrace string + + // Act + obj.SetExceptionStacktrace(fernTestValueExceptionStacktrace) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestGettersExceptionV2(t *testing.T) { + t.Run("GetType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExceptionV2{} + var expected string + obj.Type = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetType(), "getter should return the property value") + }) + + t.Run("GetType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ExceptionV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetType() // Should return zero value + }) + + t.Run("GetGeneric", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExceptionV2{} + var expected *ExceptionInfo + obj.Generic = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetGeneric(), "getter should return the property value") + }) + + t.Run("GetGeneric_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExceptionV2{} + obj.Generic = nil + + // Act & Assert + assert.Nil(t, obj.GetGeneric(), "getter should return nil when property is nil") + }) + + t.Run("GetGeneric_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ExceptionV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetGeneric() // Should return zero value + }) + + t.Run("GetTimeout", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExceptionV2{} + var expected interface{} + obj.Timeout = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTimeout(), "getter should return the property value") + }) + + t.Run("GetTimeout_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ExceptionV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTimeout() // Should return zero value + }) + +} + +func TestSettersExecutionSessionResponse(t *testing.T) { + t.Run("SetSessionID", func(t *testing.T) { + obj := &ExecutionSessionResponse{} + var fernTestValueSessionID string + obj.SetSessionID(fernTestValueSessionID) + assert.Equal(t, fernTestValueSessionID, obj.SessionID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetExecutionSessionURL", func(t *testing.T) { + obj := &ExecutionSessionResponse{} + var fernTestValueExecutionSessionURL *string + obj.SetExecutionSessionURL(fernTestValueExecutionSessionURL) + assert.Equal(t, fernTestValueExecutionSessionURL, obj.ExecutionSessionURL) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetLanguage", func(t *testing.T) { + obj := &ExecutionSessionResponse{} + var fernTestValueLanguage common.Language + obj.SetLanguage(fernTestValueLanguage) + assert.Equal(t, fernTestValueLanguage, obj.Language) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetStatus", func(t *testing.T) { + obj := &ExecutionSessionResponse{} + var fernTestValueStatus ExecutionSessionStatus + obj.SetStatus(fernTestValueStatus) + assert.Equal(t, fernTestValueStatus, obj.Status) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersExecutionSessionResponse(t *testing.T) { + t.Run("GetSessionID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExecutionSessionResponse{} + var expected string + obj.SessionID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSessionID(), "getter should return the property value") + }) + + t.Run("GetSessionID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ExecutionSessionResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSessionID() // Should return zero value + }) + + t.Run("GetExecutionSessionURL", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExecutionSessionResponse{} + var expected *string + obj.ExecutionSessionURL = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetExecutionSessionURL(), "getter should return the property value") + }) + + t.Run("GetExecutionSessionURL_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExecutionSessionResponse{} + obj.ExecutionSessionURL = nil + + // Act & Assert + assert.Nil(t, obj.GetExecutionSessionURL(), "getter should return nil when property is nil") + }) + + t.Run("GetExecutionSessionURL_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ExecutionSessionResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetExecutionSessionURL() // Should return zero value + }) + + t.Run("GetLanguage", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExecutionSessionResponse{} + var expected common.Language + obj.Language = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetLanguage(), "getter should return the property value") + }) + + t.Run("GetLanguage_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ExecutionSessionResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetLanguage() // Should return zero value + }) + + t.Run("GetStatus", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExecutionSessionResponse{} + var expected ExecutionSessionStatus + obj.Status = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetStatus(), "getter should return the property value") + }) + + t.Run("GetStatus_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ExecutionSessionResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetStatus() // Should return zero value + }) + +} + +func TestSettersMarkExplicitExecutionSessionResponse(t *testing.T) { + t.Run("SetSessionID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExecutionSessionResponse{} + var fernTestValueSessionID string + + // Act + obj.SetSessionID(fernTestValueSessionID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetExecutionSessionURL_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExecutionSessionResponse{} + var fernTestValueExecutionSessionURL *string + + // Act + obj.SetExecutionSessionURL(fernTestValueExecutionSessionURL) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetLanguage_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExecutionSessionResponse{} + var fernTestValueLanguage common.Language + + // Act + obj.SetLanguage(fernTestValueLanguage) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetStatus_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExecutionSessionResponse{} + var fernTestValueStatus ExecutionSessionStatus + + // Act + obj.SetStatus(fernTestValueStatus) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersExecutionSessionState(t *testing.T) { + t.Run("SetLastTimeContacted", func(t *testing.T) { + obj := &ExecutionSessionState{} + var fernTestValueLastTimeContacted *string + obj.SetLastTimeContacted(fernTestValueLastTimeContacted) + assert.Equal(t, fernTestValueLastTimeContacted, obj.LastTimeContacted) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetSessionID", func(t *testing.T) { + obj := &ExecutionSessionState{} + var fernTestValueSessionID string + obj.SetSessionID(fernTestValueSessionID) + assert.Equal(t, fernTestValueSessionID, obj.SessionID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetIsWarmInstance", func(t *testing.T) { + obj := &ExecutionSessionState{} + var fernTestValueIsWarmInstance bool + obj.SetIsWarmInstance(fernTestValueIsWarmInstance) + assert.Equal(t, fernTestValueIsWarmInstance, obj.IsWarmInstance) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetAwsTaskID", func(t *testing.T) { + obj := &ExecutionSessionState{} + var fernTestValueAwsTaskID *string + obj.SetAwsTaskID(fernTestValueAwsTaskID) + assert.Equal(t, fernTestValueAwsTaskID, obj.AwsTaskID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetLanguage", func(t *testing.T) { + obj := &ExecutionSessionState{} + var fernTestValueLanguage common.Language + obj.SetLanguage(fernTestValueLanguage) + assert.Equal(t, fernTestValueLanguage, obj.Language) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetStatus", func(t *testing.T) { + obj := &ExecutionSessionState{} + var fernTestValueStatus ExecutionSessionStatus + obj.SetStatus(fernTestValueStatus) + assert.Equal(t, fernTestValueStatus, obj.Status) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersExecutionSessionState(t *testing.T) { + t.Run("GetLastTimeContacted", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExecutionSessionState{} + var expected *string + obj.LastTimeContacted = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetLastTimeContacted(), "getter should return the property value") + }) + + t.Run("GetLastTimeContacted_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExecutionSessionState{} + obj.LastTimeContacted = nil + + // Act & Assert + assert.Nil(t, obj.GetLastTimeContacted(), "getter should return nil when property is nil") + }) + + t.Run("GetLastTimeContacted_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ExecutionSessionState + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetLastTimeContacted() // Should return zero value + }) + + t.Run("GetSessionID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExecutionSessionState{} + var expected string + obj.SessionID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSessionID(), "getter should return the property value") + }) + + t.Run("GetSessionID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ExecutionSessionState + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSessionID() // Should return zero value + }) + + t.Run("GetIsWarmInstance", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExecutionSessionState{} + var expected bool + obj.IsWarmInstance = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetIsWarmInstance(), "getter should return the property value") + }) + + t.Run("GetIsWarmInstance_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ExecutionSessionState + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetIsWarmInstance() // Should return zero value + }) + + t.Run("GetAwsTaskID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExecutionSessionState{} + var expected *string + obj.AwsTaskID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetAwsTaskID(), "getter should return the property value") + }) + + t.Run("GetAwsTaskID_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExecutionSessionState{} + obj.AwsTaskID = nil + + // Act & Assert + assert.Nil(t, obj.GetAwsTaskID(), "getter should return nil when property is nil") + }) + + t.Run("GetAwsTaskID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ExecutionSessionState + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetAwsTaskID() // Should return zero value + }) + + t.Run("GetLanguage", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExecutionSessionState{} + var expected common.Language + obj.Language = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetLanguage(), "getter should return the property value") + }) + + t.Run("GetLanguage_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ExecutionSessionState + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetLanguage() // Should return zero value + }) + + t.Run("GetStatus", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExecutionSessionState{} + var expected ExecutionSessionStatus + obj.Status = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetStatus(), "getter should return the property value") + }) + + t.Run("GetStatus_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ExecutionSessionState + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetStatus() // Should return zero value + }) + +} + +func TestSettersMarkExplicitExecutionSessionState(t *testing.T) { + t.Run("SetLastTimeContacted_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExecutionSessionState{} + var fernTestValueLastTimeContacted *string + + // Act + obj.SetLastTimeContacted(fernTestValueLastTimeContacted) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetSessionID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExecutionSessionState{} + var fernTestValueSessionID string + + // Act + obj.SetSessionID(fernTestValueSessionID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetIsWarmInstance_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExecutionSessionState{} + var fernTestValueIsWarmInstance bool + + // Act + obj.SetIsWarmInstance(fernTestValueIsWarmInstance) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetAwsTaskID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExecutionSessionState{} + var fernTestValueAwsTaskID *string + + // Act + obj.SetAwsTaskID(fernTestValueAwsTaskID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetLanguage_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExecutionSessionState{} + var fernTestValueLanguage common.Language + + // Act + obj.SetLanguage(fernTestValueLanguage) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetStatus_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExecutionSessionState{} + var fernTestValueStatus ExecutionSessionStatus + + // Act + obj.SetStatus(fernTestValueStatus) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersExistingSubmissionExecuting(t *testing.T) { + t.Run("SetSubmissionID", func(t *testing.T) { + obj := &ExistingSubmissionExecuting{} + var fernTestValueSubmissionID SubmissionID + obj.SetSubmissionID(fernTestValueSubmissionID) + assert.Equal(t, fernTestValueSubmissionID, obj.SubmissionID) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersExistingSubmissionExecuting(t *testing.T) { + t.Run("GetSubmissionID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExistingSubmissionExecuting{} + var expected SubmissionID + obj.SubmissionID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSubmissionID(), "getter should return the property value") + }) + + t.Run("GetSubmissionID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ExistingSubmissionExecuting + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSubmissionID() // Should return zero value + }) + +} + +func TestSettersMarkExplicitExistingSubmissionExecuting(t *testing.T) { + t.Run("SetSubmissionID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExistingSubmissionExecuting{} + var fernTestValueSubmissionID SubmissionID + + // Act + obj.SetSubmissionID(fernTestValueSubmissionID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersExpressionLocation(t *testing.T) { + t.Run("SetStart", func(t *testing.T) { + obj := &ExpressionLocation{} + var fernTestValueStart int + obj.SetStart(fernTestValueStart) + assert.Equal(t, fernTestValueStart, obj.Start) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetOffset", func(t *testing.T) { + obj := &ExpressionLocation{} + var fernTestValueOffset int + obj.SetOffset(fernTestValueOffset) + assert.Equal(t, fernTestValueOffset, obj.Offset) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersExpressionLocation(t *testing.T) { + t.Run("GetStart", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExpressionLocation{} + var expected int + obj.Start = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetStart(), "getter should return the property value") + }) + + t.Run("GetStart_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ExpressionLocation + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetStart() // Should return zero value + }) + + t.Run("GetOffset", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExpressionLocation{} + var expected int + obj.Offset = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetOffset(), "getter should return the property value") + }) + + t.Run("GetOffset_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ExpressionLocation + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetOffset() // Should return zero value + }) + +} + +func TestSettersMarkExplicitExpressionLocation(t *testing.T) { + t.Run("SetStart_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExpressionLocation{} + var fernTestValueStart int + + // Act + obj.SetStart(fernTestValueStart) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetOffset_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExpressionLocation{} + var fernTestValueOffset int + + // Act + obj.SetOffset(fernTestValueOffset) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersFinishedResponse(t *testing.T) { + t.Run("SetSubmissionID", func(t *testing.T) { + obj := &FinishedResponse{} + var fernTestValueSubmissionID SubmissionID + obj.SetSubmissionID(fernTestValueSubmissionID) + assert.Equal(t, fernTestValueSubmissionID, obj.SubmissionID) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersFinishedResponse(t *testing.T) { + t.Run("GetSubmissionID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FinishedResponse{} + var expected SubmissionID + obj.SubmissionID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSubmissionID(), "getter should return the property value") + }) + + t.Run("GetSubmissionID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FinishedResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSubmissionID() // Should return zero value + }) + +} + +func TestSettersMarkExplicitFinishedResponse(t *testing.T) { + t.Run("SetSubmissionID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FinishedResponse{} + var fernTestValueSubmissionID SubmissionID + + // Act + obj.SetSubmissionID(fernTestValueSubmissionID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersGetExecutionSessionStateResponse(t *testing.T) { + t.Run("SetStates", func(t *testing.T) { + obj := &GetExecutionSessionStateResponse{} + var fernTestValueStates map[string]*ExecutionSessionState + obj.SetStates(fernTestValueStates) + assert.Equal(t, fernTestValueStates, obj.States) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetNumWarmingInstances", func(t *testing.T) { + obj := &GetExecutionSessionStateResponse{} + var fernTestValueNumWarmingInstances *int + obj.SetNumWarmingInstances(fernTestValueNumWarmingInstances) + assert.Equal(t, fernTestValueNumWarmingInstances, obj.NumWarmingInstances) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetWarmingSessionIDs", func(t *testing.T) { + obj := &GetExecutionSessionStateResponse{} + var fernTestValueWarmingSessionIDs []string + obj.SetWarmingSessionIDs(fernTestValueWarmingSessionIDs) + assert.Equal(t, fernTestValueWarmingSessionIDs, obj.WarmingSessionIDs) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersGetExecutionSessionStateResponse(t *testing.T) { + t.Run("GetStates", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetExecutionSessionStateResponse{} + var expected map[string]*ExecutionSessionState + obj.States = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetStates(), "getter should return the property value") + }) + + t.Run("GetStates_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetExecutionSessionStateResponse{} + obj.States = nil + + // Act & Assert + assert.Nil(t, obj.GetStates(), "getter should return nil when property is nil") + }) + + t.Run("GetStates_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetExecutionSessionStateResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetStates() // Should return zero value + }) + + t.Run("GetNumWarmingInstances", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetExecutionSessionStateResponse{} + var expected *int + obj.NumWarmingInstances = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetNumWarmingInstances(), "getter should return the property value") + }) + + t.Run("GetNumWarmingInstances_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetExecutionSessionStateResponse{} + obj.NumWarmingInstances = nil + + // Act & Assert + assert.Nil(t, obj.GetNumWarmingInstances(), "getter should return nil when property is nil") + }) + + t.Run("GetNumWarmingInstances_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetExecutionSessionStateResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetNumWarmingInstances() // Should return zero value + }) + + t.Run("GetWarmingSessionIDs", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetExecutionSessionStateResponse{} + var expected []string + obj.WarmingSessionIDs = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetWarmingSessionIDs(), "getter should return the property value") + }) + + t.Run("GetWarmingSessionIDs_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetExecutionSessionStateResponse{} + obj.WarmingSessionIDs = nil + + // Act & Assert + assert.Nil(t, obj.GetWarmingSessionIDs(), "getter should return nil when property is nil") + }) + + t.Run("GetWarmingSessionIDs_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetExecutionSessionStateResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetWarmingSessionIDs() // Should return zero value + }) + +} + +func TestSettersMarkExplicitGetExecutionSessionStateResponse(t *testing.T) { + t.Run("SetStates_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetExecutionSessionStateResponse{} + var fernTestValueStates map[string]*ExecutionSessionState + + // Act + obj.SetStates(fernTestValueStates) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetNumWarmingInstances_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetExecutionSessionStateResponse{} + var fernTestValueNumWarmingInstances *int + + // Act + obj.SetNumWarmingInstances(fernTestValueNumWarmingInstances) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetWarmingSessionIDs_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetExecutionSessionStateResponse{} + var fernTestValueWarmingSessionIDs []string + + // Act + obj.SetWarmingSessionIDs(fernTestValueWarmingSessionIDs) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersGetSubmissionStateResponse(t *testing.T) { + t.Run("SetTimeSubmitted", func(t *testing.T) { + obj := &GetSubmissionStateResponse{} + var fernTestValueTimeSubmitted *time.Time + obj.SetTimeSubmitted(fernTestValueTimeSubmitted) + assert.Equal(t, fernTestValueTimeSubmitted, obj.TimeSubmitted) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetSubmission", func(t *testing.T) { + obj := &GetSubmissionStateResponse{} + var fernTestValueSubmission string + obj.SetSubmission(fernTestValueSubmission) + assert.Equal(t, fernTestValueSubmission, obj.Submission) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetLanguage", func(t *testing.T) { + obj := &GetSubmissionStateResponse{} + var fernTestValueLanguage common.Language + obj.SetLanguage(fernTestValueLanguage) + assert.Equal(t, fernTestValueLanguage, obj.Language) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetSubmissionTypeState", func(t *testing.T) { + obj := &GetSubmissionStateResponse{} + var fernTestValueSubmissionTypeState *SubmissionTypeState + obj.SetSubmissionTypeState(fernTestValueSubmissionTypeState) + assert.Equal(t, fernTestValueSubmissionTypeState, obj.SubmissionTypeState) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersGetSubmissionStateResponse(t *testing.T) { + t.Run("GetTimeSubmitted", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetSubmissionStateResponse{} + var expected *time.Time + obj.TimeSubmitted = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTimeSubmitted(), "getter should return the property value") + }) + + t.Run("GetTimeSubmitted_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetSubmissionStateResponse{} + obj.TimeSubmitted = nil + + // Act & Assert + assert.Nil(t, obj.GetTimeSubmitted(), "getter should return nil when property is nil") + }) + + t.Run("GetTimeSubmitted_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetSubmissionStateResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTimeSubmitted() // Should return zero value + }) + + t.Run("GetSubmission", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetSubmissionStateResponse{} + var expected string + obj.Submission = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSubmission(), "getter should return the property value") + }) + + t.Run("GetSubmission_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetSubmissionStateResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSubmission() // Should return zero value + }) + + t.Run("GetLanguage", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetSubmissionStateResponse{} + var expected common.Language + obj.Language = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetLanguage(), "getter should return the property value") + }) + + t.Run("GetLanguage_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetSubmissionStateResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetLanguage() // Should return zero value + }) + + t.Run("GetSubmissionTypeState", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetSubmissionStateResponse{} + var expected *SubmissionTypeState + obj.SubmissionTypeState = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSubmissionTypeState(), "getter should return the property value") + }) + + t.Run("GetSubmissionTypeState_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetSubmissionStateResponse{} + obj.SubmissionTypeState = nil + + // Act & Assert + assert.Nil(t, obj.GetSubmissionTypeState(), "getter should return nil when property is nil") + }) + + t.Run("GetSubmissionTypeState_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetSubmissionStateResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSubmissionTypeState() // Should return zero value + }) + +} + +func TestSettersMarkExplicitGetSubmissionStateResponse(t *testing.T) { + t.Run("SetTimeSubmitted_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetSubmissionStateResponse{} + var fernTestValueTimeSubmitted *time.Time + + // Act + obj.SetTimeSubmitted(fernTestValueTimeSubmitted) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetSubmission_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetSubmissionStateResponse{} + var fernTestValueSubmission string + + // Act + obj.SetSubmission(fernTestValueSubmission) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetLanguage_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetSubmissionStateResponse{} + var fernTestValueLanguage common.Language + + // Act + obj.SetLanguage(fernTestValueLanguage) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetSubmissionTypeState_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetSubmissionStateResponse{} + var fernTestValueSubmissionTypeState *SubmissionTypeState + + // Act + obj.SetSubmissionTypeState(fernTestValueSubmissionTypeState) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersGetTraceResponsesPageRequest(t *testing.T) { + t.Run("SetOffset", func(t *testing.T) { + obj := &GetTraceResponsesPageRequest{} + var fernTestValueOffset *int + obj.SetOffset(fernTestValueOffset) + assert.Equal(t, fernTestValueOffset, obj.Offset) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersGetTraceResponsesPageRequest(t *testing.T) { + t.Run("GetOffset", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetTraceResponsesPageRequest{} + var expected *int + obj.Offset = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetOffset(), "getter should return the property value") + }) + + t.Run("GetOffset_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetTraceResponsesPageRequest{} + obj.Offset = nil + + // Act & Assert + assert.Nil(t, obj.GetOffset(), "getter should return nil when property is nil") + }) + + t.Run("GetOffset_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetTraceResponsesPageRequest + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetOffset() // Should return zero value + }) + +} + +func TestSettersMarkExplicitGetTraceResponsesPageRequest(t *testing.T) { + t.Run("SetOffset_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetTraceResponsesPageRequest{} + var fernTestValueOffset *int + + // Act + obj.SetOffset(fernTestValueOffset) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersGradedResponse(t *testing.T) { + t.Run("SetSubmissionID", func(t *testing.T) { + obj := &GradedResponse{} + var fernTestValueSubmissionID SubmissionID + obj.SetSubmissionID(fernTestValueSubmissionID) + assert.Equal(t, fernTestValueSubmissionID, obj.SubmissionID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetTestCases", func(t *testing.T) { + obj := &GradedResponse{} + var fernTestValueTestCases map[string]*TestCaseResultWithStdout + obj.SetTestCases(fernTestValueTestCases) + assert.Equal(t, fernTestValueTestCases, obj.TestCases) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersGradedResponse(t *testing.T) { + t.Run("GetSubmissionID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GradedResponse{} + var expected SubmissionID + obj.SubmissionID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSubmissionID(), "getter should return the property value") + }) + + t.Run("GetSubmissionID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GradedResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSubmissionID() // Should return zero value + }) + + t.Run("GetTestCases", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GradedResponse{} + var expected map[string]*TestCaseResultWithStdout + obj.TestCases = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTestCases(), "getter should return the property value") + }) + + t.Run("GetTestCases_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GradedResponse{} + obj.TestCases = nil + + // Act & Assert + assert.Nil(t, obj.GetTestCases(), "getter should return nil when property is nil") + }) + + t.Run("GetTestCases_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GradedResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTestCases() // Should return zero value + }) + +} + +func TestSettersMarkExplicitGradedResponse(t *testing.T) { + t.Run("SetSubmissionID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GradedResponse{} + var fernTestValueSubmissionID SubmissionID + + // Act + obj.SetSubmissionID(fernTestValueSubmissionID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetTestCases_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GradedResponse{} + var fernTestValueTestCases map[string]*TestCaseResultWithStdout + + // Act + obj.SetTestCases(fernTestValueTestCases) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersGradedResponseV2(t *testing.T) { + t.Run("SetSubmissionID", func(t *testing.T) { + obj := &GradedResponseV2{} + var fernTestValueSubmissionID SubmissionID + obj.SetSubmissionID(fernTestValueSubmissionID) + assert.Equal(t, fernTestValueSubmissionID, obj.SubmissionID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetTestCases", func(t *testing.T) { + obj := &GradedResponseV2{} + var fernTestValueTestCases map[v2.TestCaseID]*TestCaseGrade + obj.SetTestCases(fernTestValueTestCases) + assert.Equal(t, fernTestValueTestCases, obj.TestCases) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersGradedResponseV2(t *testing.T) { + t.Run("GetSubmissionID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GradedResponseV2{} + var expected SubmissionID + obj.SubmissionID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSubmissionID(), "getter should return the property value") + }) + + t.Run("GetSubmissionID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GradedResponseV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSubmissionID() // Should return zero value + }) + + t.Run("GetTestCases", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GradedResponseV2{} + var expected map[v2.TestCaseID]*TestCaseGrade + obj.TestCases = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTestCases(), "getter should return the property value") + }) + + t.Run("GetTestCases_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GradedResponseV2{} + obj.TestCases = nil + + // Act & Assert + assert.Nil(t, obj.GetTestCases(), "getter should return nil when property is nil") + }) + + t.Run("GetTestCases_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GradedResponseV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTestCases() // Should return zero value + }) + +} + +func TestSettersMarkExplicitGradedResponseV2(t *testing.T) { + t.Run("SetSubmissionID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GradedResponseV2{} + var fernTestValueSubmissionID SubmissionID + + // Act + obj.SetSubmissionID(fernTestValueSubmissionID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetTestCases_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GradedResponseV2{} + var fernTestValueTestCases map[v2.TestCaseID]*TestCaseGrade + + // Act + obj.SetTestCases(fernTestValueTestCases) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersGradedTestCaseUpdate(t *testing.T) { + t.Run("SetTestCaseID", func(t *testing.T) { + obj := &GradedTestCaseUpdate{} + var fernTestValueTestCaseID v2.TestCaseID + obj.SetTestCaseID(fernTestValueTestCaseID) + assert.Equal(t, fernTestValueTestCaseID, obj.TestCaseID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetGrade", func(t *testing.T) { + obj := &GradedTestCaseUpdate{} + var fernTestValueGrade *TestCaseGrade + obj.SetGrade(fernTestValueGrade) + assert.Equal(t, fernTestValueGrade, obj.Grade) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersGradedTestCaseUpdate(t *testing.T) { + t.Run("GetTestCaseID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GradedTestCaseUpdate{} + var expected v2.TestCaseID + obj.TestCaseID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTestCaseID(), "getter should return the property value") + }) + + t.Run("GetTestCaseID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GradedTestCaseUpdate + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTestCaseID() // Should return zero value + }) + + t.Run("GetGrade", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GradedTestCaseUpdate{} + var expected *TestCaseGrade + obj.Grade = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetGrade(), "getter should return the property value") + }) + + t.Run("GetGrade_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GradedTestCaseUpdate{} + obj.Grade = nil + + // Act & Assert + assert.Nil(t, obj.GetGrade(), "getter should return nil when property is nil") + }) + + t.Run("GetGrade_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GradedTestCaseUpdate + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetGrade() // Should return zero value + }) + +} + +func TestSettersMarkExplicitGradedTestCaseUpdate(t *testing.T) { + t.Run("SetTestCaseID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GradedTestCaseUpdate{} + var fernTestValueTestCaseID v2.TestCaseID + + // Act + obj.SetTestCaseID(fernTestValueTestCaseID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetGrade_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GradedTestCaseUpdate{} + var fernTestValueGrade *TestCaseGrade + + // Act + obj.SetGrade(fernTestValueGrade) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersInitializeProblemRequest(t *testing.T) { + t.Run("SetProblemID", func(t *testing.T) { + obj := &InitializeProblemRequest{} + var fernTestValueProblemID common.ProblemID + obj.SetProblemID(fernTestValueProblemID) + assert.Equal(t, fernTestValueProblemID, obj.ProblemID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetProblemVersion", func(t *testing.T) { + obj := &InitializeProblemRequest{} + var fernTestValueProblemVersion *int + obj.SetProblemVersion(fernTestValueProblemVersion) + assert.Equal(t, fernTestValueProblemVersion, obj.ProblemVersion) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersInitializeProblemRequest(t *testing.T) { + t.Run("GetProblemID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &InitializeProblemRequest{} + var expected common.ProblemID + obj.ProblemID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetProblemID(), "getter should return the property value") + }) + + t.Run("GetProblemID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *InitializeProblemRequest + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetProblemID() // Should return zero value + }) + + t.Run("GetProblemVersion", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &InitializeProblemRequest{} + var expected *int + obj.ProblemVersion = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetProblemVersion(), "getter should return the property value") + }) + + t.Run("GetProblemVersion_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &InitializeProblemRequest{} + obj.ProblemVersion = nil + + // Act & Assert + assert.Nil(t, obj.GetProblemVersion(), "getter should return nil when property is nil") + }) + + t.Run("GetProblemVersion_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *InitializeProblemRequest + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetProblemVersion() // Should return zero value + }) + +} + +func TestSettersMarkExplicitInitializeProblemRequest(t *testing.T) { + t.Run("SetProblemID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &InitializeProblemRequest{} + var fernTestValueProblemID common.ProblemID + + // Act + obj.SetProblemID(fernTestValueProblemID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetProblemVersion_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &InitializeProblemRequest{} + var fernTestValueProblemVersion *int + + // Act + obj.SetProblemVersion(fernTestValueProblemVersion) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersInternalError(t *testing.T) { + t.Run("SetExceptionInfo", func(t *testing.T) { + obj := &InternalError{} + var fernTestValueExceptionInfo *ExceptionInfo + obj.SetExceptionInfo(fernTestValueExceptionInfo) + assert.Equal(t, fernTestValueExceptionInfo, obj.ExceptionInfo) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersInternalError(t *testing.T) { + t.Run("GetExceptionInfo", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &InternalError{} + var expected *ExceptionInfo + obj.ExceptionInfo = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetExceptionInfo(), "getter should return the property value") + }) + + t.Run("GetExceptionInfo_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &InternalError{} + obj.ExceptionInfo = nil + + // Act & Assert + assert.Nil(t, obj.GetExceptionInfo(), "getter should return nil when property is nil") + }) + + t.Run("GetExceptionInfo_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *InternalError + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetExceptionInfo() // Should return zero value + }) + +} + +func TestSettersMarkExplicitInternalError(t *testing.T) { + t.Run("SetExceptionInfo_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &InternalError{} + var fernTestValueExceptionInfo *ExceptionInfo + + // Act + obj.SetExceptionInfo(fernTestValueExceptionInfo) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestGettersInvalidRequestCause(t *testing.T) { + t.Run("GetType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &InvalidRequestCause{} + var expected string + obj.Type = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetType(), "getter should return the property value") + }) + + t.Run("GetType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *InvalidRequestCause + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetType() // Should return zero value + }) + + t.Run("GetSubmissionIDNotFound", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &InvalidRequestCause{} + var expected *SubmissionIDNotFound + obj.SubmissionIDNotFound = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSubmissionIDNotFound(), "getter should return the property value") + }) + + t.Run("GetSubmissionIDNotFound_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &InvalidRequestCause{} + obj.SubmissionIDNotFound = nil + + // Act & Assert + assert.Nil(t, obj.GetSubmissionIDNotFound(), "getter should return nil when property is nil") + }) + + t.Run("GetSubmissionIDNotFound_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *InvalidRequestCause + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSubmissionIDNotFound() // Should return zero value + }) + + t.Run("GetCustomTestCasesUnsupported", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &InvalidRequestCause{} + var expected *CustomTestCasesUnsupported + obj.CustomTestCasesUnsupported = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetCustomTestCasesUnsupported(), "getter should return the property value") + }) + + t.Run("GetCustomTestCasesUnsupported_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &InvalidRequestCause{} + obj.CustomTestCasesUnsupported = nil + + // Act & Assert + assert.Nil(t, obj.GetCustomTestCasesUnsupported(), "getter should return nil when property is nil") + }) + + t.Run("GetCustomTestCasesUnsupported_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *InvalidRequestCause + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetCustomTestCasesUnsupported() // Should return zero value + }) + + t.Run("GetUnexpectedLanguage", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &InvalidRequestCause{} + var expected *UnexpectedLanguageError + obj.UnexpectedLanguage = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetUnexpectedLanguage(), "getter should return the property value") + }) + + t.Run("GetUnexpectedLanguage_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &InvalidRequestCause{} + obj.UnexpectedLanguage = nil + + // Act & Assert + assert.Nil(t, obj.GetUnexpectedLanguage(), "getter should return nil when property is nil") + }) + + t.Run("GetUnexpectedLanguage_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *InvalidRequestCause + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetUnexpectedLanguage() // Should return zero value + }) + +} + +func TestSettersInvalidRequestResponse(t *testing.T) { + t.Run("SetRequest", func(t *testing.T) { + obj := &InvalidRequestResponse{} + var fernTestValueRequest *SubmissionRequest + obj.SetRequest(fernTestValueRequest) + assert.Equal(t, fernTestValueRequest, obj.Request) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetCause", func(t *testing.T) { + obj := &InvalidRequestResponse{} + var fernTestValueCause *InvalidRequestCause + obj.SetCause(fernTestValueCause) + assert.Equal(t, fernTestValueCause, obj.Cause) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersInvalidRequestResponse(t *testing.T) { + t.Run("GetRequest", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &InvalidRequestResponse{} + var expected *SubmissionRequest + obj.Request = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetRequest(), "getter should return the property value") + }) + + t.Run("GetRequest_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &InvalidRequestResponse{} + obj.Request = nil + + // Act & Assert + assert.Nil(t, obj.GetRequest(), "getter should return nil when property is nil") + }) + + t.Run("GetRequest_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *InvalidRequestResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetRequest() // Should return zero value + }) + + t.Run("GetCause", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &InvalidRequestResponse{} + var expected *InvalidRequestCause + obj.Cause = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetCause(), "getter should return the property value") + }) + + t.Run("GetCause_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &InvalidRequestResponse{} + obj.Cause = nil + + // Act & Assert + assert.Nil(t, obj.GetCause(), "getter should return nil when property is nil") + }) + + t.Run("GetCause_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *InvalidRequestResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetCause() // Should return zero value + }) + +} + +func TestSettersMarkExplicitInvalidRequestResponse(t *testing.T) { + t.Run("SetRequest_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &InvalidRequestResponse{} + var fernTestValueRequest *SubmissionRequest + + // Act + obj.SetRequest(fernTestValueRequest) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetCause_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &InvalidRequestResponse{} + var fernTestValueCause *InvalidRequestCause + + // Act + obj.SetCause(fernTestValueCause) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersLightweightStackframeInformation(t *testing.T) { + t.Run("SetNumStackFrames", func(t *testing.T) { + obj := &LightweightStackframeInformation{} + var fernTestValueNumStackFrames int + obj.SetNumStackFrames(fernTestValueNumStackFrames) + assert.Equal(t, fernTestValueNumStackFrames, obj.NumStackFrames) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetTopStackFrameMethodName", func(t *testing.T) { + obj := &LightweightStackframeInformation{} + var fernTestValueTopStackFrameMethodName string + obj.SetTopStackFrameMethodName(fernTestValueTopStackFrameMethodName) + assert.Equal(t, fernTestValueTopStackFrameMethodName, obj.TopStackFrameMethodName) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersLightweightStackframeInformation(t *testing.T) { + t.Run("GetNumStackFrames", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &LightweightStackframeInformation{} + var expected int + obj.NumStackFrames = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetNumStackFrames(), "getter should return the property value") + }) + + t.Run("GetNumStackFrames_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *LightweightStackframeInformation + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetNumStackFrames() // Should return zero value + }) + + t.Run("GetTopStackFrameMethodName", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &LightweightStackframeInformation{} + var expected string + obj.TopStackFrameMethodName = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTopStackFrameMethodName(), "getter should return the property value") + }) + + t.Run("GetTopStackFrameMethodName_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *LightweightStackframeInformation + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTopStackFrameMethodName() // Should return zero value + }) + +} + +func TestSettersMarkExplicitLightweightStackframeInformation(t *testing.T) { + t.Run("SetNumStackFrames_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &LightweightStackframeInformation{} + var fernTestValueNumStackFrames int + + // Act + obj.SetNumStackFrames(fernTestValueNumStackFrames) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetTopStackFrameMethodName_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &LightweightStackframeInformation{} + var fernTestValueTopStackFrameMethodName string + + // Act + obj.SetTopStackFrameMethodName(fernTestValueTopStackFrameMethodName) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersRecordedResponseNotification(t *testing.T) { + t.Run("SetSubmissionID", func(t *testing.T) { + obj := &RecordedResponseNotification{} + var fernTestValueSubmissionID SubmissionID + obj.SetSubmissionID(fernTestValueSubmissionID) + assert.Equal(t, fernTestValueSubmissionID, obj.SubmissionID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetTraceResponsesSize", func(t *testing.T) { + obj := &RecordedResponseNotification{} + var fernTestValueTraceResponsesSize int + obj.SetTraceResponsesSize(fernTestValueTraceResponsesSize) + assert.Equal(t, fernTestValueTraceResponsesSize, obj.TraceResponsesSize) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetTestCaseID", func(t *testing.T) { + obj := &RecordedResponseNotification{} + var fernTestValueTestCaseID *string + obj.SetTestCaseID(fernTestValueTestCaseID) + assert.Equal(t, fernTestValueTestCaseID, obj.TestCaseID) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersRecordedResponseNotification(t *testing.T) { + t.Run("GetSubmissionID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &RecordedResponseNotification{} + var expected SubmissionID + obj.SubmissionID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSubmissionID(), "getter should return the property value") + }) + + t.Run("GetSubmissionID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *RecordedResponseNotification + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSubmissionID() // Should return zero value + }) + + t.Run("GetTraceResponsesSize", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &RecordedResponseNotification{} + var expected int + obj.TraceResponsesSize = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTraceResponsesSize(), "getter should return the property value") + }) + + t.Run("GetTraceResponsesSize_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *RecordedResponseNotification + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTraceResponsesSize() // Should return zero value + }) + + t.Run("GetTestCaseID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &RecordedResponseNotification{} + var expected *string + obj.TestCaseID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTestCaseID(), "getter should return the property value") + }) + + t.Run("GetTestCaseID_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &RecordedResponseNotification{} + obj.TestCaseID = nil + + // Act & Assert + assert.Nil(t, obj.GetTestCaseID(), "getter should return nil when property is nil") + }) + + t.Run("GetTestCaseID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *RecordedResponseNotification + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTestCaseID() // Should return zero value + }) + +} + +func TestSettersMarkExplicitRecordedResponseNotification(t *testing.T) { + t.Run("SetSubmissionID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &RecordedResponseNotification{} + var fernTestValueSubmissionID SubmissionID + + // Act + obj.SetSubmissionID(fernTestValueSubmissionID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetTraceResponsesSize_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &RecordedResponseNotification{} + var fernTestValueTraceResponsesSize int + + // Act + obj.SetTraceResponsesSize(fernTestValueTraceResponsesSize) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetTestCaseID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &RecordedResponseNotification{} + var fernTestValueTestCaseID *string + + // Act + obj.SetTestCaseID(fernTestValueTestCaseID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersRecordedTestCaseUpdate(t *testing.T) { + t.Run("SetTestCaseID", func(t *testing.T) { + obj := &RecordedTestCaseUpdate{} + var fernTestValueTestCaseID v2.TestCaseID + obj.SetTestCaseID(fernTestValueTestCaseID) + assert.Equal(t, fernTestValueTestCaseID, obj.TestCaseID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetTraceResponsesSize", func(t *testing.T) { + obj := &RecordedTestCaseUpdate{} + var fernTestValueTraceResponsesSize int + obj.SetTraceResponsesSize(fernTestValueTraceResponsesSize) + assert.Equal(t, fernTestValueTraceResponsesSize, obj.TraceResponsesSize) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersRecordedTestCaseUpdate(t *testing.T) { + t.Run("GetTestCaseID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &RecordedTestCaseUpdate{} + var expected v2.TestCaseID + obj.TestCaseID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTestCaseID(), "getter should return the property value") + }) + + t.Run("GetTestCaseID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *RecordedTestCaseUpdate + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTestCaseID() // Should return zero value + }) + + t.Run("GetTraceResponsesSize", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &RecordedTestCaseUpdate{} + var expected int + obj.TraceResponsesSize = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTraceResponsesSize(), "getter should return the property value") + }) + + t.Run("GetTraceResponsesSize_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *RecordedTestCaseUpdate + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTraceResponsesSize() // Should return zero value + }) + +} + +func TestSettersMarkExplicitRecordedTestCaseUpdate(t *testing.T) { + t.Run("SetTestCaseID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &RecordedTestCaseUpdate{} + var fernTestValueTestCaseID v2.TestCaseID + + // Act + obj.SetTestCaseID(fernTestValueTestCaseID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetTraceResponsesSize_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &RecordedTestCaseUpdate{} + var fernTestValueTraceResponsesSize int + + // Act + obj.SetTraceResponsesSize(fernTestValueTraceResponsesSize) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersRecordingResponseNotification(t *testing.T) { + t.Run("SetSubmissionID", func(t *testing.T) { + obj := &RecordingResponseNotification{} + var fernTestValueSubmissionID SubmissionID + obj.SetSubmissionID(fernTestValueSubmissionID) + assert.Equal(t, fernTestValueSubmissionID, obj.SubmissionID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetTestCaseID", func(t *testing.T) { + obj := &RecordingResponseNotification{} + var fernTestValueTestCaseID *string + obj.SetTestCaseID(fernTestValueTestCaseID) + assert.Equal(t, fernTestValueTestCaseID, obj.TestCaseID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetLineNumber", func(t *testing.T) { + obj := &RecordingResponseNotification{} + var fernTestValueLineNumber int + obj.SetLineNumber(fernTestValueLineNumber) + assert.Equal(t, fernTestValueLineNumber, obj.LineNumber) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetLightweightStackInfo", func(t *testing.T) { + obj := &RecordingResponseNotification{} + var fernTestValueLightweightStackInfo *LightweightStackframeInformation + obj.SetLightweightStackInfo(fernTestValueLightweightStackInfo) + assert.Equal(t, fernTestValueLightweightStackInfo, obj.LightweightStackInfo) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetTracedFile", func(t *testing.T) { + obj := &RecordingResponseNotification{} + var fernTestValueTracedFile *TracedFile + obj.SetTracedFile(fernTestValueTracedFile) + assert.Equal(t, fernTestValueTracedFile, obj.TracedFile) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersRecordingResponseNotification(t *testing.T) { + t.Run("GetSubmissionID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &RecordingResponseNotification{} + var expected SubmissionID + obj.SubmissionID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSubmissionID(), "getter should return the property value") + }) + + t.Run("GetSubmissionID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *RecordingResponseNotification + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSubmissionID() // Should return zero value + }) + + t.Run("GetTestCaseID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &RecordingResponseNotification{} + var expected *string + obj.TestCaseID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTestCaseID(), "getter should return the property value") + }) + + t.Run("GetTestCaseID_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &RecordingResponseNotification{} + obj.TestCaseID = nil + + // Act & Assert + assert.Nil(t, obj.GetTestCaseID(), "getter should return nil when property is nil") + }) + + t.Run("GetTestCaseID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *RecordingResponseNotification + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTestCaseID() // Should return zero value + }) + + t.Run("GetLineNumber", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &RecordingResponseNotification{} + var expected int + obj.LineNumber = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetLineNumber(), "getter should return the property value") + }) + + t.Run("GetLineNumber_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *RecordingResponseNotification + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetLineNumber() // Should return zero value + }) + + t.Run("GetLightweightStackInfo", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &RecordingResponseNotification{} + var expected *LightweightStackframeInformation + obj.LightweightStackInfo = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetLightweightStackInfo(), "getter should return the property value") + }) + + t.Run("GetLightweightStackInfo_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &RecordingResponseNotification{} + obj.LightweightStackInfo = nil + + // Act & Assert + assert.Nil(t, obj.GetLightweightStackInfo(), "getter should return nil when property is nil") + }) + + t.Run("GetLightweightStackInfo_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *RecordingResponseNotification + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetLightweightStackInfo() // Should return zero value + }) + + t.Run("GetTracedFile", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &RecordingResponseNotification{} + var expected *TracedFile + obj.TracedFile = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTracedFile(), "getter should return the property value") + }) + + t.Run("GetTracedFile_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &RecordingResponseNotification{} + obj.TracedFile = nil + + // Act & Assert + assert.Nil(t, obj.GetTracedFile(), "getter should return nil when property is nil") + }) + + t.Run("GetTracedFile_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *RecordingResponseNotification + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTracedFile() // Should return zero value + }) + +} + +func TestSettersMarkExplicitRecordingResponseNotification(t *testing.T) { + t.Run("SetSubmissionID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &RecordingResponseNotification{} + var fernTestValueSubmissionID SubmissionID + + // Act + obj.SetSubmissionID(fernTestValueSubmissionID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetTestCaseID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &RecordingResponseNotification{} + var fernTestValueTestCaseID *string + + // Act + obj.SetTestCaseID(fernTestValueTestCaseID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetLineNumber_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &RecordingResponseNotification{} + var fernTestValueLineNumber int + + // Act + obj.SetLineNumber(fernTestValueLineNumber) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetLightweightStackInfo_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &RecordingResponseNotification{} + var fernTestValueLightweightStackInfo *LightweightStackframeInformation + + // Act + obj.SetLightweightStackInfo(fernTestValueLightweightStackInfo) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetTracedFile_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &RecordingResponseNotification{} + var fernTestValueTracedFile *TracedFile + + // Act + obj.SetTracedFile(fernTestValueTracedFile) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersRunningResponse(t *testing.T) { + t.Run("SetSubmissionID", func(t *testing.T) { + obj := &RunningResponse{} + var fernTestValueSubmissionID SubmissionID + obj.SetSubmissionID(fernTestValueSubmissionID) + assert.Equal(t, fernTestValueSubmissionID, obj.SubmissionID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetState", func(t *testing.T) { + obj := &RunningResponse{} + var fernTestValueState RunningSubmissionState + obj.SetState(fernTestValueState) + assert.Equal(t, fernTestValueState, obj.State) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersRunningResponse(t *testing.T) { + t.Run("GetSubmissionID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &RunningResponse{} + var expected SubmissionID + obj.SubmissionID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSubmissionID(), "getter should return the property value") + }) + + t.Run("GetSubmissionID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *RunningResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSubmissionID() // Should return zero value + }) + + t.Run("GetState", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &RunningResponse{} + var expected RunningSubmissionState + obj.State = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetState(), "getter should return the property value") + }) + + t.Run("GetState_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *RunningResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetState() // Should return zero value + }) + +} + +func TestSettersMarkExplicitRunningResponse(t *testing.T) { + t.Run("SetSubmissionID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &RunningResponse{} + var fernTestValueSubmissionID SubmissionID + + // Act + obj.SetSubmissionID(fernTestValueSubmissionID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetState_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &RunningResponse{} + var fernTestValueState RunningSubmissionState + + // Act + obj.SetState(fernTestValueState) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersRuntimeError(t *testing.T) { + t.Run("SetMessage", func(t *testing.T) { + obj := &RuntimeError{} + var fernTestValueMessage string + obj.SetMessage(fernTestValueMessage) + assert.Equal(t, fernTestValueMessage, obj.Message) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersRuntimeError(t *testing.T) { + t.Run("GetMessage", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &RuntimeError{} + var expected string + obj.Message = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetMessage(), "getter should return the property value") + }) + + t.Run("GetMessage_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *RuntimeError + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetMessage() // Should return zero value + }) + +} + +func TestSettersMarkExplicitRuntimeError(t *testing.T) { + t.Run("SetMessage_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &RuntimeError{} + var fernTestValueMessage string + + // Act + obj.SetMessage(fernTestValueMessage) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersScope(t *testing.T) { + t.Run("SetVariables", func(t *testing.T) { + obj := &Scope{} + var fernTestValueVariables map[string]*DebugVariableValue + obj.SetVariables(fernTestValueVariables) + assert.Equal(t, fernTestValueVariables, obj.Variables) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersScope(t *testing.T) { + t.Run("GetVariables", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Scope{} + var expected map[string]*DebugVariableValue + obj.Variables = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetVariables(), "getter should return the property value") + }) + + t.Run("GetVariables_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Scope{} + obj.Variables = nil + + // Act & Assert + assert.Nil(t, obj.GetVariables(), "getter should return nil when property is nil") + }) + + t.Run("GetVariables_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *Scope + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetVariables() // Should return zero value + }) + +} + +func TestSettersMarkExplicitScope(t *testing.T) { + t.Run("SetVariables_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Scope{} + var fernTestValueVariables map[string]*DebugVariableValue + + // Act + obj.SetVariables(fernTestValueVariables) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersStackFrame(t *testing.T) { + t.Run("SetMethodName", func(t *testing.T) { + obj := &StackFrame{} + var fernTestValueMethodName string + obj.SetMethodName(fernTestValueMethodName) + assert.Equal(t, fernTestValueMethodName, obj.MethodName) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetLineNumber", func(t *testing.T) { + obj := &StackFrame{} + var fernTestValueLineNumber int + obj.SetLineNumber(fernTestValueLineNumber) + assert.Equal(t, fernTestValueLineNumber, obj.LineNumber) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetScopes", func(t *testing.T) { + obj := &StackFrame{} + var fernTestValueScopes []*Scope + obj.SetScopes(fernTestValueScopes) + assert.Equal(t, fernTestValueScopes, obj.Scopes) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersStackFrame(t *testing.T) { + t.Run("GetMethodName", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StackFrame{} + var expected string + obj.MethodName = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetMethodName(), "getter should return the property value") + }) + + t.Run("GetMethodName_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *StackFrame + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetMethodName() // Should return zero value + }) + + t.Run("GetLineNumber", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StackFrame{} + var expected int + obj.LineNumber = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetLineNumber(), "getter should return the property value") + }) + + t.Run("GetLineNumber_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *StackFrame + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetLineNumber() // Should return zero value + }) + + t.Run("GetScopes", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StackFrame{} + var expected []*Scope + obj.Scopes = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetScopes(), "getter should return the property value") + }) + + t.Run("GetScopes_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StackFrame{} + obj.Scopes = nil + + // Act & Assert + assert.Nil(t, obj.GetScopes(), "getter should return nil when property is nil") + }) + + t.Run("GetScopes_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *StackFrame + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetScopes() // Should return zero value + }) + +} + +func TestSettersMarkExplicitStackFrame(t *testing.T) { + t.Run("SetMethodName_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StackFrame{} + var fernTestValueMethodName string + + // Act + obj.SetMethodName(fernTestValueMethodName) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetLineNumber_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StackFrame{} + var fernTestValueLineNumber int + + // Act + obj.SetLineNumber(fernTestValueLineNumber) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetScopes_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StackFrame{} + var fernTestValueScopes []*Scope + + // Act + obj.SetScopes(fernTestValueScopes) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersStackInformation(t *testing.T) { + t.Run("SetNumStackFrames", func(t *testing.T) { + obj := &StackInformation{} + var fernTestValueNumStackFrames int + obj.SetNumStackFrames(fernTestValueNumStackFrames) + assert.Equal(t, fernTestValueNumStackFrames, obj.NumStackFrames) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetTopStackFrame", func(t *testing.T) { + obj := &StackInformation{} + var fernTestValueTopStackFrame *StackFrame + obj.SetTopStackFrame(fernTestValueTopStackFrame) + assert.Equal(t, fernTestValueTopStackFrame, obj.TopStackFrame) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersStackInformation(t *testing.T) { + t.Run("GetNumStackFrames", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StackInformation{} + var expected int + obj.NumStackFrames = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetNumStackFrames(), "getter should return the property value") + }) + + t.Run("GetNumStackFrames_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *StackInformation + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetNumStackFrames() // Should return zero value + }) + + t.Run("GetTopStackFrame", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StackInformation{} + var expected *StackFrame + obj.TopStackFrame = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTopStackFrame(), "getter should return the property value") + }) + + t.Run("GetTopStackFrame_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StackInformation{} + obj.TopStackFrame = nil + + // Act & Assert + assert.Nil(t, obj.GetTopStackFrame(), "getter should return nil when property is nil") + }) + + t.Run("GetTopStackFrame_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *StackInformation + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTopStackFrame() // Should return zero value + }) + +} + +func TestSettersMarkExplicitStackInformation(t *testing.T) { + t.Run("SetNumStackFrames_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StackInformation{} + var fernTestValueNumStackFrames int + + // Act + obj.SetNumStackFrames(fernTestValueNumStackFrames) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetTopStackFrame_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StackInformation{} + var fernTestValueTopStackFrame *StackFrame + + // Act + obj.SetTopStackFrame(fernTestValueTopStackFrame) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersStderrResponse(t *testing.T) { + t.Run("SetSubmissionID", func(t *testing.T) { + obj := &StderrResponse{} + var fernTestValueSubmissionID SubmissionID + obj.SetSubmissionID(fernTestValueSubmissionID) + assert.Equal(t, fernTestValueSubmissionID, obj.SubmissionID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetStderr", func(t *testing.T) { + obj := &StderrResponse{} + var fernTestValueStderr string + obj.SetStderr(fernTestValueStderr) + assert.Equal(t, fernTestValueStderr, obj.Stderr) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersStderrResponse(t *testing.T) { + t.Run("GetSubmissionID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StderrResponse{} + var expected SubmissionID + obj.SubmissionID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSubmissionID(), "getter should return the property value") + }) + + t.Run("GetSubmissionID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *StderrResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSubmissionID() // Should return zero value + }) + + t.Run("GetStderr", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StderrResponse{} + var expected string + obj.Stderr = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetStderr(), "getter should return the property value") + }) + + t.Run("GetStderr_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *StderrResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetStderr() // Should return zero value + }) + +} + +func TestSettersMarkExplicitStderrResponse(t *testing.T) { + t.Run("SetSubmissionID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StderrResponse{} + var fernTestValueSubmissionID SubmissionID + + // Act + obj.SetSubmissionID(fernTestValueSubmissionID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetStderr_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StderrResponse{} + var fernTestValueStderr string + + // Act + obj.SetStderr(fernTestValueStderr) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersStdoutResponse(t *testing.T) { + t.Run("SetSubmissionID", func(t *testing.T) { + obj := &StdoutResponse{} + var fernTestValueSubmissionID SubmissionID + obj.SetSubmissionID(fernTestValueSubmissionID) + assert.Equal(t, fernTestValueSubmissionID, obj.SubmissionID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetStdout", func(t *testing.T) { + obj := &StdoutResponse{} + var fernTestValueStdout string + obj.SetStdout(fernTestValueStdout) + assert.Equal(t, fernTestValueStdout, obj.Stdout) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersStdoutResponse(t *testing.T) { + t.Run("GetSubmissionID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StdoutResponse{} + var expected SubmissionID + obj.SubmissionID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSubmissionID(), "getter should return the property value") + }) + + t.Run("GetSubmissionID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *StdoutResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSubmissionID() // Should return zero value + }) + + t.Run("GetStdout", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StdoutResponse{} + var expected string + obj.Stdout = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetStdout(), "getter should return the property value") + }) + + t.Run("GetStdout_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *StdoutResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetStdout() // Should return zero value + }) + +} + +func TestSettersMarkExplicitStdoutResponse(t *testing.T) { + t.Run("SetSubmissionID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StdoutResponse{} + var fernTestValueSubmissionID SubmissionID + + // Act + obj.SetSubmissionID(fernTestValueSubmissionID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetStdout_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StdoutResponse{} + var fernTestValueStdout string + + // Act + obj.SetStdout(fernTestValueStdout) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersStopRequest(t *testing.T) { + t.Run("SetSubmissionID", func(t *testing.T) { + obj := &StopRequest{} + var fernTestValueSubmissionID SubmissionID + obj.SetSubmissionID(fernTestValueSubmissionID) + assert.Equal(t, fernTestValueSubmissionID, obj.SubmissionID) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersStopRequest(t *testing.T) { + t.Run("GetSubmissionID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StopRequest{} + var expected SubmissionID + obj.SubmissionID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSubmissionID(), "getter should return the property value") + }) + + t.Run("GetSubmissionID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *StopRequest + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSubmissionID() // Should return zero value + }) + +} + +func TestSettersMarkExplicitStopRequest(t *testing.T) { + t.Run("SetSubmissionID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StopRequest{} + var fernTestValueSubmissionID SubmissionID + + // Act + obj.SetSubmissionID(fernTestValueSubmissionID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersStoppedResponse(t *testing.T) { + t.Run("SetSubmissionID", func(t *testing.T) { + obj := &StoppedResponse{} + var fernTestValueSubmissionID SubmissionID + obj.SetSubmissionID(fernTestValueSubmissionID) + assert.Equal(t, fernTestValueSubmissionID, obj.SubmissionID) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersStoppedResponse(t *testing.T) { + t.Run("GetSubmissionID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StoppedResponse{} + var expected SubmissionID + obj.SubmissionID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSubmissionID(), "getter should return the property value") + }) + + t.Run("GetSubmissionID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *StoppedResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSubmissionID() // Should return zero value + }) + +} + +func TestSettersMarkExplicitStoppedResponse(t *testing.T) { + t.Run("SetSubmissionID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StoppedResponse{} + var fernTestValueSubmissionID SubmissionID + + // Act + obj.SetSubmissionID(fernTestValueSubmissionID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersSubmissionFileInfo(t *testing.T) { + t.Run("SetDirectory", func(t *testing.T) { + obj := &SubmissionFileInfo{} + var fernTestValueDirectory string + obj.SetDirectory(fernTestValueDirectory) + assert.Equal(t, fernTestValueDirectory, obj.Directory) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetFilename", func(t *testing.T) { + obj := &SubmissionFileInfo{} + var fernTestValueFilename string + obj.SetFilename(fernTestValueFilename) + assert.Equal(t, fernTestValueFilename, obj.Filename) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetContents", func(t *testing.T) { + obj := &SubmissionFileInfo{} + var fernTestValueContents string + obj.SetContents(fernTestValueContents) + assert.Equal(t, fernTestValueContents, obj.Contents) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersSubmissionFileInfo(t *testing.T) { + t.Run("GetDirectory", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionFileInfo{} + var expected string + obj.Directory = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetDirectory(), "getter should return the property value") + }) + + t.Run("GetDirectory_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmissionFileInfo + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetDirectory() // Should return zero value + }) + + t.Run("GetFilename", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionFileInfo{} + var expected string + obj.Filename = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetFilename(), "getter should return the property value") + }) + + t.Run("GetFilename_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmissionFileInfo + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetFilename() // Should return zero value + }) + + t.Run("GetContents", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionFileInfo{} + var expected string + obj.Contents = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetContents(), "getter should return the property value") + }) + + t.Run("GetContents_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmissionFileInfo + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetContents() // Should return zero value + }) + +} + +func TestSettersMarkExplicitSubmissionFileInfo(t *testing.T) { + t.Run("SetDirectory_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionFileInfo{} + var fernTestValueDirectory string + + // Act + obj.SetDirectory(fernTestValueDirectory) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetFilename_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionFileInfo{} + var fernTestValueFilename string + + // Act + obj.SetFilename(fernTestValueFilename) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetContents_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionFileInfo{} + var fernTestValueContents string + + // Act + obj.SetContents(fernTestValueContents) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersSubmissionIDNotFound(t *testing.T) { + t.Run("SetMissingSubmissionID", func(t *testing.T) { + obj := &SubmissionIDNotFound{} + var fernTestValueMissingSubmissionID SubmissionID + obj.SetMissingSubmissionID(fernTestValueMissingSubmissionID) + assert.Equal(t, fernTestValueMissingSubmissionID, obj.MissingSubmissionID) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersSubmissionIDNotFound(t *testing.T) { + t.Run("GetMissingSubmissionID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionIDNotFound{} + var expected SubmissionID + obj.MissingSubmissionID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetMissingSubmissionID(), "getter should return the property value") + }) + + t.Run("GetMissingSubmissionID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmissionIDNotFound + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetMissingSubmissionID() // Should return zero value + }) + +} + +func TestSettersMarkExplicitSubmissionIDNotFound(t *testing.T) { + t.Run("SetMissingSubmissionID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionIDNotFound{} + var fernTestValueMissingSubmissionID SubmissionID + + // Act + obj.SetMissingSubmissionID(fernTestValueMissingSubmissionID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestGettersSubmissionRequest(t *testing.T) { + t.Run("GetType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionRequest{} + var expected string + obj.Type = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetType(), "getter should return the property value") + }) + + t.Run("GetType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmissionRequest + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetType() // Should return zero value + }) + + t.Run("GetInitializeProblemRequest", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionRequest{} + var expected *InitializeProblemRequest + obj.InitializeProblemRequest = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetInitializeProblemRequest(), "getter should return the property value") + }) + + t.Run("GetInitializeProblemRequest_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionRequest{} + obj.InitializeProblemRequest = nil + + // Act & Assert + assert.Nil(t, obj.GetInitializeProblemRequest(), "getter should return nil when property is nil") + }) + + t.Run("GetInitializeProblemRequest_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmissionRequest + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetInitializeProblemRequest() // Should return zero value + }) + + t.Run("GetInitializeWorkspaceRequest", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionRequest{} + var expected interface{} + obj.InitializeWorkspaceRequest = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetInitializeWorkspaceRequest(), "getter should return the property value") + }) + + t.Run("GetInitializeWorkspaceRequest_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmissionRequest + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetInitializeWorkspaceRequest() // Should return zero value + }) + + t.Run("GetSubmitV2", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionRequest{} + var expected *SubmitRequestV2 + obj.SubmitV2 = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSubmitV2(), "getter should return the property value") + }) + + t.Run("GetSubmitV2_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionRequest{} + obj.SubmitV2 = nil + + // Act & Assert + assert.Nil(t, obj.GetSubmitV2(), "getter should return nil when property is nil") + }) + + t.Run("GetSubmitV2_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmissionRequest + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSubmitV2() // Should return zero value + }) + + t.Run("GetWorkspaceSubmit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionRequest{} + var expected *WorkspaceSubmitRequest + obj.WorkspaceSubmit = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetWorkspaceSubmit(), "getter should return the property value") + }) + + t.Run("GetWorkspaceSubmit_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionRequest{} + obj.WorkspaceSubmit = nil + + // Act & Assert + assert.Nil(t, obj.GetWorkspaceSubmit(), "getter should return nil when property is nil") + }) + + t.Run("GetWorkspaceSubmit_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmissionRequest + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetWorkspaceSubmit() // Should return zero value + }) + + t.Run("GetStop", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionRequest{} + var expected *StopRequest + obj.Stop = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetStop(), "getter should return the property value") + }) + + t.Run("GetStop_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionRequest{} + obj.Stop = nil + + // Act & Assert + assert.Nil(t, obj.GetStop(), "getter should return nil when property is nil") + }) + + t.Run("GetStop_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmissionRequest + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetStop() // Should return zero value + }) + +} + +func TestGettersSubmissionResponse(t *testing.T) { + t.Run("GetType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionResponse{} + var expected string + obj.Type = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetType(), "getter should return the property value") + }) + + t.Run("GetType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmissionResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetType() // Should return zero value + }) + + t.Run("GetServerInitialized", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionResponse{} + var expected interface{} + obj.ServerInitialized = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetServerInitialized(), "getter should return the property value") + }) + + t.Run("GetServerInitialized_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmissionResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetServerInitialized() // Should return zero value + }) + + t.Run("GetProblemInitialized", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionResponse{} + var expected common.ProblemID + obj.ProblemInitialized = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetProblemInitialized(), "getter should return the property value") + }) + + t.Run("GetProblemInitialized_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmissionResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetProblemInitialized() // Should return zero value + }) + + t.Run("GetWorkspaceInitialized", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionResponse{} + var expected interface{} + obj.WorkspaceInitialized = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetWorkspaceInitialized(), "getter should return the property value") + }) + + t.Run("GetWorkspaceInitialized_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmissionResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetWorkspaceInitialized() // Should return zero value + }) + + t.Run("GetServerErrored", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionResponse{} + var expected *ExceptionInfo + obj.ServerErrored = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetServerErrored(), "getter should return the property value") + }) + + t.Run("GetServerErrored_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionResponse{} + obj.ServerErrored = nil + + // Act & Assert + assert.Nil(t, obj.GetServerErrored(), "getter should return nil when property is nil") + }) + + t.Run("GetServerErrored_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmissionResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetServerErrored() // Should return zero value + }) + + t.Run("GetCodeExecutionUpdate", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionResponse{} + var expected *CodeExecutionUpdate + obj.CodeExecutionUpdate = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetCodeExecutionUpdate(), "getter should return the property value") + }) + + t.Run("GetCodeExecutionUpdate_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionResponse{} + obj.CodeExecutionUpdate = nil + + // Act & Assert + assert.Nil(t, obj.GetCodeExecutionUpdate(), "getter should return nil when property is nil") + }) + + t.Run("GetCodeExecutionUpdate_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmissionResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetCodeExecutionUpdate() // Should return zero value + }) + + t.Run("GetTerminated", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionResponse{} + var expected *TerminatedResponse + obj.Terminated = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTerminated(), "getter should return the property value") + }) + + t.Run("GetTerminated_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionResponse{} + obj.Terminated = nil + + // Act & Assert + assert.Nil(t, obj.GetTerminated(), "getter should return nil when property is nil") + }) + + t.Run("GetTerminated_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmissionResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTerminated() // Should return zero value + }) + +} + +func TestGettersSubmissionStatusForTestCase(t *testing.T) { + t.Run("GetType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionStatusForTestCase{} + var expected string + obj.Type = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetType(), "getter should return the property value") + }) + + t.Run("GetType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmissionStatusForTestCase + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetType() // Should return zero value + }) + + t.Run("GetGraded", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionStatusForTestCase{} + var expected *TestCaseResultWithStdout + obj.Graded = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetGraded(), "getter should return the property value") + }) + + t.Run("GetGraded_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionStatusForTestCase{} + obj.Graded = nil + + // Act & Assert + assert.Nil(t, obj.GetGraded(), "getter should return nil when property is nil") + }) + + t.Run("GetGraded_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmissionStatusForTestCase + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetGraded() // Should return zero value + }) + + t.Run("GetGradedV2", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionStatusForTestCase{} + var expected *TestCaseGrade + obj.GradedV2 = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetGradedV2(), "getter should return the property value") + }) + + t.Run("GetGradedV2_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionStatusForTestCase{} + obj.GradedV2 = nil + + // Act & Assert + assert.Nil(t, obj.GetGradedV2(), "getter should return nil when property is nil") + }) + + t.Run("GetGradedV2_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmissionStatusForTestCase + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetGradedV2() // Should return zero value + }) + + t.Run("GetTraced", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionStatusForTestCase{} + var expected *TracedTestCase + obj.Traced = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTraced(), "getter should return the property value") + }) + + t.Run("GetTraced_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionStatusForTestCase{} + obj.Traced = nil + + // Act & Assert + assert.Nil(t, obj.GetTraced(), "getter should return nil when property is nil") + }) + + t.Run("GetTraced_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmissionStatusForTestCase + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTraced() // Should return zero value + }) + +} + +func TestGettersSubmissionStatusV2(t *testing.T) { + t.Run("GetType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionStatusV2{} + var expected string + obj.Type = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetType(), "getter should return the property value") + }) + + t.Run("GetType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmissionStatusV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetType() // Should return zero value + }) + + t.Run("GetTest", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionStatusV2{} + var expected *TestSubmissionStatusV2 + obj.Test = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTest(), "getter should return the property value") + }) + + t.Run("GetTest_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionStatusV2{} + obj.Test = nil + + // Act & Assert + assert.Nil(t, obj.GetTest(), "getter should return nil when property is nil") + }) + + t.Run("GetTest_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmissionStatusV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTest() // Should return zero value + }) + + t.Run("GetWorkspace", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionStatusV2{} + var expected *WorkspaceSubmissionStatusV2 + obj.Workspace = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetWorkspace(), "getter should return the property value") + }) + + t.Run("GetWorkspace_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionStatusV2{} + obj.Workspace = nil + + // Act & Assert + assert.Nil(t, obj.GetWorkspace(), "getter should return nil when property is nil") + }) + + t.Run("GetWorkspace_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmissionStatusV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetWorkspace() // Should return zero value + }) + +} + +func TestGettersSubmissionTypeState(t *testing.T) { + t.Run("GetType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionTypeState{} + var expected string + obj.Type = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetType(), "getter should return the property value") + }) + + t.Run("GetType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmissionTypeState + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetType() // Should return zero value + }) + + t.Run("GetTest", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionTypeState{} + var expected *TestSubmissionState + obj.Test = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTest(), "getter should return the property value") + }) + + t.Run("GetTest_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionTypeState{} + obj.Test = nil + + // Act & Assert + assert.Nil(t, obj.GetTest(), "getter should return nil when property is nil") + }) + + t.Run("GetTest_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmissionTypeState + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTest() // Should return zero value + }) + + t.Run("GetWorkspace", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionTypeState{} + var expected *WorkspaceSubmissionState + obj.Workspace = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetWorkspace(), "getter should return the property value") + }) + + t.Run("GetWorkspace_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionTypeState{} + obj.Workspace = nil + + // Act & Assert + assert.Nil(t, obj.GetWorkspace(), "getter should return nil when property is nil") + }) + + t.Run("GetWorkspace_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmissionTypeState + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetWorkspace() // Should return zero value + }) + +} + +func TestSettersSubmitRequestV2(t *testing.T) { + t.Run("SetSubmissionID", func(t *testing.T) { + obj := &SubmitRequestV2{} + var fernTestValueSubmissionID SubmissionID + obj.SetSubmissionID(fernTestValueSubmissionID) + assert.Equal(t, fernTestValueSubmissionID, obj.SubmissionID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetLanguage", func(t *testing.T) { + obj := &SubmitRequestV2{} + var fernTestValueLanguage common.Language + obj.SetLanguage(fernTestValueLanguage) + assert.Equal(t, fernTestValueLanguage, obj.Language) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetSubmissionFiles", func(t *testing.T) { + obj := &SubmitRequestV2{} + var fernTestValueSubmissionFiles []*SubmissionFileInfo + obj.SetSubmissionFiles(fernTestValueSubmissionFiles) + assert.Equal(t, fernTestValueSubmissionFiles, obj.SubmissionFiles) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetProblemID", func(t *testing.T) { + obj := &SubmitRequestV2{} + var fernTestValueProblemID common.ProblemID + obj.SetProblemID(fernTestValueProblemID) + assert.Equal(t, fernTestValueProblemID, obj.ProblemID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetProblemVersion", func(t *testing.T) { + obj := &SubmitRequestV2{} + var fernTestValueProblemVersion *int + obj.SetProblemVersion(fernTestValueProblemVersion) + assert.Equal(t, fernTestValueProblemVersion, obj.ProblemVersion) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetUserID", func(t *testing.T) { + obj := &SubmitRequestV2{} + var fernTestValueUserID *string + obj.SetUserID(fernTestValueUserID) + assert.Equal(t, fernTestValueUserID, obj.UserID) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersSubmitRequestV2(t *testing.T) { + t.Run("GetSubmissionID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmitRequestV2{} + var expected SubmissionID + obj.SubmissionID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSubmissionID(), "getter should return the property value") + }) + + t.Run("GetSubmissionID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmitRequestV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSubmissionID() // Should return zero value + }) + + t.Run("GetLanguage", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmitRequestV2{} + var expected common.Language + obj.Language = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetLanguage(), "getter should return the property value") + }) + + t.Run("GetLanguage_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmitRequestV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetLanguage() // Should return zero value + }) + + t.Run("GetSubmissionFiles", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmitRequestV2{} + var expected []*SubmissionFileInfo + obj.SubmissionFiles = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSubmissionFiles(), "getter should return the property value") + }) + + t.Run("GetSubmissionFiles_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmitRequestV2{} + obj.SubmissionFiles = nil + + // Act & Assert + assert.Nil(t, obj.GetSubmissionFiles(), "getter should return nil when property is nil") + }) + + t.Run("GetSubmissionFiles_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmitRequestV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSubmissionFiles() // Should return zero value + }) + + t.Run("GetProblemID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmitRequestV2{} + var expected common.ProblemID + obj.ProblemID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetProblemID(), "getter should return the property value") + }) + + t.Run("GetProblemID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmitRequestV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetProblemID() // Should return zero value + }) + + t.Run("GetProblemVersion", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmitRequestV2{} + var expected *int + obj.ProblemVersion = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetProblemVersion(), "getter should return the property value") + }) + + t.Run("GetProblemVersion_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmitRequestV2{} + obj.ProblemVersion = nil + + // Act & Assert + assert.Nil(t, obj.GetProblemVersion(), "getter should return nil when property is nil") + }) + + t.Run("GetProblemVersion_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmitRequestV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetProblemVersion() // Should return zero value + }) + + t.Run("GetUserID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmitRequestV2{} + var expected *string + obj.UserID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetUserID(), "getter should return the property value") + }) + + t.Run("GetUserID_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmitRequestV2{} + obj.UserID = nil + + // Act & Assert + assert.Nil(t, obj.GetUserID(), "getter should return nil when property is nil") + }) + + t.Run("GetUserID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmitRequestV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetUserID() // Should return zero value + }) + +} + +func TestSettersMarkExplicitSubmitRequestV2(t *testing.T) { + t.Run("SetSubmissionID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmitRequestV2{} + var fernTestValueSubmissionID SubmissionID + + // Act + obj.SetSubmissionID(fernTestValueSubmissionID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetLanguage_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmitRequestV2{} + var fernTestValueLanguage common.Language + + // Act + obj.SetLanguage(fernTestValueLanguage) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetSubmissionFiles_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmitRequestV2{} + var fernTestValueSubmissionFiles []*SubmissionFileInfo + + // Act + obj.SetSubmissionFiles(fernTestValueSubmissionFiles) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetProblemID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmitRequestV2{} + var fernTestValueProblemID common.ProblemID + + // Act + obj.SetProblemID(fernTestValueProblemID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetProblemVersion_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmitRequestV2{} + var fernTestValueProblemVersion *int + + // Act + obj.SetProblemVersion(fernTestValueProblemVersion) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetUserID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmitRequestV2{} + var fernTestValueUserID *string + + // Act + obj.SetUserID(fernTestValueUserID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestGettersTestCaseGrade(t *testing.T) { + t.Run("GetType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseGrade{} + var expected string + obj.Type = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetType(), "getter should return the property value") + }) + + t.Run("GetType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseGrade + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetType() // Should return zero value + }) + + t.Run("GetHidden", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseGrade{} + var expected *TestCaseHiddenGrade + obj.Hidden = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetHidden(), "getter should return the property value") + }) + + t.Run("GetHidden_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseGrade{} + obj.Hidden = nil + + // Act & Assert + assert.Nil(t, obj.GetHidden(), "getter should return nil when property is nil") + }) + + t.Run("GetHidden_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseGrade + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetHidden() // Should return zero value + }) + + t.Run("GetNonHidden", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseGrade{} + var expected *TestCaseNonHiddenGrade + obj.NonHidden = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetNonHidden(), "getter should return the property value") + }) + + t.Run("GetNonHidden_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseGrade{} + obj.NonHidden = nil + + // Act & Assert + assert.Nil(t, obj.GetNonHidden(), "getter should return nil when property is nil") + }) + + t.Run("GetNonHidden_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseGrade + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetNonHidden() // Should return zero value + }) + +} + +func TestSettersTestCaseHiddenGrade(t *testing.T) { + t.Run("SetPassed", func(t *testing.T) { + obj := &TestCaseHiddenGrade{} + var fernTestValuePassed bool + obj.SetPassed(fernTestValuePassed) + assert.Equal(t, fernTestValuePassed, obj.Passed) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersTestCaseHiddenGrade(t *testing.T) { + t.Run("GetPassed", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseHiddenGrade{} + var expected bool + obj.Passed = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetPassed(), "getter should return the property value") + }) + + t.Run("GetPassed_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseHiddenGrade + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetPassed() // Should return zero value + }) + +} + +func TestSettersMarkExplicitTestCaseHiddenGrade(t *testing.T) { + t.Run("SetPassed_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseHiddenGrade{} + var fernTestValuePassed bool + + // Act + obj.SetPassed(fernTestValuePassed) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersTestCaseNonHiddenGrade(t *testing.T) { + t.Run("SetPassed", func(t *testing.T) { + obj := &TestCaseNonHiddenGrade{} + var fernTestValuePassed bool + obj.SetPassed(fernTestValuePassed) + assert.Equal(t, fernTestValuePassed, obj.Passed) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetActualResult", func(t *testing.T) { + obj := &TestCaseNonHiddenGrade{} + var fernTestValueActualResult *common.VariableValue + obj.SetActualResult(fernTestValueActualResult) + assert.Equal(t, fernTestValueActualResult, obj.ActualResult) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetException", func(t *testing.T) { + obj := &TestCaseNonHiddenGrade{} + var fernTestValueException *ExceptionV2 + obj.SetException(fernTestValueException) + assert.Equal(t, fernTestValueException, obj.Exception) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetStdout", func(t *testing.T) { + obj := &TestCaseNonHiddenGrade{} + var fernTestValueStdout string + obj.SetStdout(fernTestValueStdout) + assert.Equal(t, fernTestValueStdout, obj.Stdout) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersTestCaseNonHiddenGrade(t *testing.T) { + t.Run("GetPassed", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseNonHiddenGrade{} + var expected bool + obj.Passed = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetPassed(), "getter should return the property value") + }) + + t.Run("GetPassed_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseNonHiddenGrade + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetPassed() // Should return zero value + }) + + t.Run("GetActualResult", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseNonHiddenGrade{} + var expected *common.VariableValue + obj.ActualResult = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetActualResult(), "getter should return the property value") + }) + + t.Run("GetActualResult_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseNonHiddenGrade{} + obj.ActualResult = nil + + // Act & Assert + assert.Nil(t, obj.GetActualResult(), "getter should return nil when property is nil") + }) + + t.Run("GetActualResult_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseNonHiddenGrade + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetActualResult() // Should return zero value + }) + + t.Run("GetException", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseNonHiddenGrade{} + var expected *ExceptionV2 + obj.Exception = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetException(), "getter should return the property value") + }) + + t.Run("GetException_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseNonHiddenGrade{} + obj.Exception = nil + + // Act & Assert + assert.Nil(t, obj.GetException(), "getter should return nil when property is nil") + }) + + t.Run("GetException_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseNonHiddenGrade + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetException() // Should return zero value + }) + + t.Run("GetStdout", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseNonHiddenGrade{} + var expected string + obj.Stdout = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetStdout(), "getter should return the property value") + }) + + t.Run("GetStdout_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseNonHiddenGrade + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetStdout() // Should return zero value + }) + +} + +func TestSettersMarkExplicitTestCaseNonHiddenGrade(t *testing.T) { + t.Run("SetPassed_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseNonHiddenGrade{} + var fernTestValuePassed bool + + // Act + obj.SetPassed(fernTestValuePassed) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetActualResult_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseNonHiddenGrade{} + var fernTestValueActualResult *common.VariableValue + + // Act + obj.SetActualResult(fernTestValueActualResult) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetException_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseNonHiddenGrade{} + var fernTestValueException *ExceptionV2 + + // Act + obj.SetException(fernTestValueException) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetStdout_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseNonHiddenGrade{} + var fernTestValueStdout string + + // Act + obj.SetStdout(fernTestValueStdout) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersTestCaseResult(t *testing.T) { + t.Run("SetExpectedResult", func(t *testing.T) { + obj := &TestCaseResult{} + var fernTestValueExpectedResult *common.VariableValue + obj.SetExpectedResult(fernTestValueExpectedResult) + assert.Equal(t, fernTestValueExpectedResult, obj.ExpectedResult) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetActualResult", func(t *testing.T) { + obj := &TestCaseResult{} + var fernTestValueActualResult *ActualResult + obj.SetActualResult(fernTestValueActualResult) + assert.Equal(t, fernTestValueActualResult, obj.ActualResult) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetPassed", func(t *testing.T) { + obj := &TestCaseResult{} + var fernTestValuePassed bool + obj.SetPassed(fernTestValuePassed) + assert.Equal(t, fernTestValuePassed, obj.Passed) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersTestCaseResult(t *testing.T) { + t.Run("GetExpectedResult", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseResult{} + var expected *common.VariableValue + obj.ExpectedResult = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetExpectedResult(), "getter should return the property value") + }) + + t.Run("GetExpectedResult_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseResult{} + obj.ExpectedResult = nil + + // Act & Assert + assert.Nil(t, obj.GetExpectedResult(), "getter should return nil when property is nil") + }) + + t.Run("GetExpectedResult_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseResult + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetExpectedResult() // Should return zero value + }) + + t.Run("GetActualResult", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseResult{} + var expected *ActualResult + obj.ActualResult = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetActualResult(), "getter should return the property value") + }) + + t.Run("GetActualResult_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseResult{} + obj.ActualResult = nil + + // Act & Assert + assert.Nil(t, obj.GetActualResult(), "getter should return nil when property is nil") + }) + + t.Run("GetActualResult_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseResult + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetActualResult() // Should return zero value + }) + + t.Run("GetPassed", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseResult{} + var expected bool + obj.Passed = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetPassed(), "getter should return the property value") + }) + + t.Run("GetPassed_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseResult + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetPassed() // Should return zero value + }) + +} + +func TestSettersMarkExplicitTestCaseResult(t *testing.T) { + t.Run("SetExpectedResult_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseResult{} + var fernTestValueExpectedResult *common.VariableValue + + // Act + obj.SetExpectedResult(fernTestValueExpectedResult) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetActualResult_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseResult{} + var fernTestValueActualResult *ActualResult + + // Act + obj.SetActualResult(fernTestValueActualResult) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetPassed_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseResult{} + var fernTestValuePassed bool + + // Act + obj.SetPassed(fernTestValuePassed) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersTestCaseResultWithStdout(t *testing.T) { + t.Run("SetResult", func(t *testing.T) { + obj := &TestCaseResultWithStdout{} + var fernTestValueResult *TestCaseResult + obj.SetResult(fernTestValueResult) + assert.Equal(t, fernTestValueResult, obj.Result) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetStdout", func(t *testing.T) { + obj := &TestCaseResultWithStdout{} + var fernTestValueStdout string + obj.SetStdout(fernTestValueStdout) + assert.Equal(t, fernTestValueStdout, obj.Stdout) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersTestCaseResultWithStdout(t *testing.T) { + t.Run("GetResult", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseResultWithStdout{} + var expected *TestCaseResult + obj.Result = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetResult(), "getter should return the property value") + }) + + t.Run("GetResult_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseResultWithStdout{} + obj.Result = nil + + // Act & Assert + assert.Nil(t, obj.GetResult(), "getter should return nil when property is nil") + }) + + t.Run("GetResult_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseResultWithStdout + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetResult() // Should return zero value + }) + + t.Run("GetStdout", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseResultWithStdout{} + var expected string + obj.Stdout = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetStdout(), "getter should return the property value") + }) + + t.Run("GetStdout_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseResultWithStdout + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetStdout() // Should return zero value + }) + +} + +func TestSettersMarkExplicitTestCaseResultWithStdout(t *testing.T) { + t.Run("SetResult_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseResultWithStdout{} + var fernTestValueResult *TestCaseResult + + // Act + obj.SetResult(fernTestValueResult) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetStdout_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseResultWithStdout{} + var fernTestValueStdout string + + // Act + obj.SetStdout(fernTestValueStdout) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersTestSubmissionState(t *testing.T) { + t.Run("SetProblemID", func(t *testing.T) { + obj := &TestSubmissionState{} + var fernTestValueProblemID common.ProblemID + obj.SetProblemID(fernTestValueProblemID) + assert.Equal(t, fernTestValueProblemID, obj.ProblemID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetDefaultTestCases", func(t *testing.T) { + obj := &TestSubmissionState{} + var fernTestValueDefaultTestCases []*TestCase + obj.SetDefaultTestCases(fernTestValueDefaultTestCases) + assert.Equal(t, fernTestValueDefaultTestCases, obj.DefaultTestCases) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetCustomTestCases", func(t *testing.T) { + obj := &TestSubmissionState{} + var fernTestValueCustomTestCases []*TestCase + obj.SetCustomTestCases(fernTestValueCustomTestCases) + assert.Equal(t, fernTestValueCustomTestCases, obj.CustomTestCases) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetStatus", func(t *testing.T) { + obj := &TestSubmissionState{} + var fernTestValueStatus *TestSubmissionStatus + obj.SetStatus(fernTestValueStatus) + assert.Equal(t, fernTestValueStatus, obj.Status) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersTestSubmissionState(t *testing.T) { + t.Run("GetProblemID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionState{} + var expected common.ProblemID + obj.ProblemID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetProblemID(), "getter should return the property value") + }) + + t.Run("GetProblemID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestSubmissionState + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetProblemID() // Should return zero value + }) + + t.Run("GetDefaultTestCases", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionState{} + var expected []*TestCase + obj.DefaultTestCases = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetDefaultTestCases(), "getter should return the property value") + }) + + t.Run("GetDefaultTestCases_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionState{} + obj.DefaultTestCases = nil + + // Act & Assert + assert.Nil(t, obj.GetDefaultTestCases(), "getter should return nil when property is nil") + }) + + t.Run("GetDefaultTestCases_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestSubmissionState + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetDefaultTestCases() // Should return zero value + }) + + t.Run("GetCustomTestCases", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionState{} + var expected []*TestCase + obj.CustomTestCases = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetCustomTestCases(), "getter should return the property value") + }) + + t.Run("GetCustomTestCases_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionState{} + obj.CustomTestCases = nil + + // Act & Assert + assert.Nil(t, obj.GetCustomTestCases(), "getter should return nil when property is nil") + }) + + t.Run("GetCustomTestCases_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestSubmissionState + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetCustomTestCases() // Should return zero value + }) + + t.Run("GetStatus", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionState{} + var expected *TestSubmissionStatus + obj.Status = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetStatus(), "getter should return the property value") + }) + + t.Run("GetStatus_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionState{} + obj.Status = nil + + // Act & Assert + assert.Nil(t, obj.GetStatus(), "getter should return nil when property is nil") + }) + + t.Run("GetStatus_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestSubmissionState + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetStatus() // Should return zero value + }) + +} + +func TestSettersMarkExplicitTestSubmissionState(t *testing.T) { + t.Run("SetProblemID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionState{} + var fernTestValueProblemID common.ProblemID + + // Act + obj.SetProblemID(fernTestValueProblemID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetDefaultTestCases_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionState{} + var fernTestValueDefaultTestCases []*TestCase + + // Act + obj.SetDefaultTestCases(fernTestValueDefaultTestCases) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetCustomTestCases_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionState{} + var fernTestValueCustomTestCases []*TestCase + + // Act + obj.SetCustomTestCases(fernTestValueCustomTestCases) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetStatus_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionState{} + var fernTestValueStatus *TestSubmissionStatus + + // Act + obj.SetStatus(fernTestValueStatus) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestGettersTestSubmissionStatus(t *testing.T) { + t.Run("GetType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionStatus{} + var expected string + obj.Type = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetType(), "getter should return the property value") + }) + + t.Run("GetType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestSubmissionStatus + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetType() // Should return zero value + }) + + t.Run("GetStopped", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionStatus{} + var expected interface{} + obj.Stopped = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetStopped(), "getter should return the property value") + }) + + t.Run("GetStopped_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestSubmissionStatus + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetStopped() // Should return zero value + }) + + t.Run("GetErrored", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionStatus{} + var expected *ErrorInfo + obj.Errored = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetErrored(), "getter should return the property value") + }) + + t.Run("GetErrored_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionStatus{} + obj.Errored = nil + + // Act & Assert + assert.Nil(t, obj.GetErrored(), "getter should return nil when property is nil") + }) + + t.Run("GetErrored_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestSubmissionStatus + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetErrored() // Should return zero value + }) + + t.Run("GetRunning", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionStatus{} + var expected RunningSubmissionState + obj.Running = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetRunning(), "getter should return the property value") + }) + + t.Run("GetRunning_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestSubmissionStatus + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetRunning() // Should return zero value + }) + + t.Run("GetTestCaseIDToState", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionStatus{} + var expected map[string]*SubmissionStatusForTestCase + obj.TestCaseIDToState = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTestCaseIDToState(), "getter should return the property value") + }) + + t.Run("GetTestCaseIDToState_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionStatus{} + obj.TestCaseIDToState = nil + + // Act & Assert + assert.Nil(t, obj.GetTestCaseIDToState(), "getter should return nil when property is nil") + }) + + t.Run("GetTestCaseIDToState_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestSubmissionStatus + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTestCaseIDToState() // Should return zero value + }) + +} + +func TestSettersTestSubmissionStatusV2(t *testing.T) { + t.Run("SetUpdates", func(t *testing.T) { + obj := &TestSubmissionStatusV2{} + var fernTestValueUpdates []*TestSubmissionUpdate + obj.SetUpdates(fernTestValueUpdates) + assert.Equal(t, fernTestValueUpdates, obj.Updates) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetProblemID", func(t *testing.T) { + obj := &TestSubmissionStatusV2{} + var fernTestValueProblemID common.ProblemID + obj.SetProblemID(fernTestValueProblemID) + assert.Equal(t, fernTestValueProblemID, obj.ProblemID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetProblemVersion", func(t *testing.T) { + obj := &TestSubmissionStatusV2{} + var fernTestValueProblemVersion int + obj.SetProblemVersion(fernTestValueProblemVersion) + assert.Equal(t, fernTestValueProblemVersion, obj.ProblemVersion) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetProblemInfo", func(t *testing.T) { + obj := &TestSubmissionStatusV2{} + var fernTestValueProblemInfo *v2.ProblemInfoV2 + obj.SetProblemInfo(fernTestValueProblemInfo) + assert.Equal(t, fernTestValueProblemInfo, obj.ProblemInfo) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersTestSubmissionStatusV2(t *testing.T) { + t.Run("GetUpdates", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionStatusV2{} + var expected []*TestSubmissionUpdate + obj.Updates = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetUpdates(), "getter should return the property value") + }) + + t.Run("GetUpdates_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionStatusV2{} + obj.Updates = nil + + // Act & Assert + assert.Nil(t, obj.GetUpdates(), "getter should return nil when property is nil") + }) + + t.Run("GetUpdates_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestSubmissionStatusV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetUpdates() // Should return zero value + }) + + t.Run("GetProblemID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionStatusV2{} + var expected common.ProblemID + obj.ProblemID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetProblemID(), "getter should return the property value") + }) + + t.Run("GetProblemID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestSubmissionStatusV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetProblemID() // Should return zero value + }) + + t.Run("GetProblemVersion", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionStatusV2{} + var expected int + obj.ProblemVersion = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetProblemVersion(), "getter should return the property value") + }) + + t.Run("GetProblemVersion_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestSubmissionStatusV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetProblemVersion() // Should return zero value + }) + + t.Run("GetProblemInfo", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionStatusV2{} + var expected *v2.ProblemInfoV2 + obj.ProblemInfo = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetProblemInfo(), "getter should return the property value") + }) + + t.Run("GetProblemInfo_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionStatusV2{} + obj.ProblemInfo = nil + + // Act & Assert + assert.Nil(t, obj.GetProblemInfo(), "getter should return nil when property is nil") + }) + + t.Run("GetProblemInfo_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestSubmissionStatusV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetProblemInfo() // Should return zero value + }) + +} + +func TestSettersMarkExplicitTestSubmissionStatusV2(t *testing.T) { + t.Run("SetUpdates_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionStatusV2{} + var fernTestValueUpdates []*TestSubmissionUpdate + + // Act + obj.SetUpdates(fernTestValueUpdates) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetProblemID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionStatusV2{} + var fernTestValueProblemID common.ProblemID + + // Act + obj.SetProblemID(fernTestValueProblemID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetProblemVersion_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionStatusV2{} + var fernTestValueProblemVersion int + + // Act + obj.SetProblemVersion(fernTestValueProblemVersion) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetProblemInfo_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionStatusV2{} + var fernTestValueProblemInfo *v2.ProblemInfoV2 + + // Act + obj.SetProblemInfo(fernTestValueProblemInfo) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersTestSubmissionUpdate(t *testing.T) { + t.Run("SetUpdateTime", func(t *testing.T) { + obj := &TestSubmissionUpdate{} + var fernTestValueUpdateTime time.Time + obj.SetUpdateTime(fernTestValueUpdateTime) + assert.Equal(t, fernTestValueUpdateTime, obj.UpdateTime) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetUpdateInfo", func(t *testing.T) { + obj := &TestSubmissionUpdate{} + var fernTestValueUpdateInfo *TestSubmissionUpdateInfo + obj.SetUpdateInfo(fernTestValueUpdateInfo) + assert.Equal(t, fernTestValueUpdateInfo, obj.UpdateInfo) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersTestSubmissionUpdate(t *testing.T) { + t.Run("GetUpdateTime", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionUpdate{} + var expected time.Time + obj.UpdateTime = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetUpdateTime(), "getter should return the property value") + }) + + t.Run("GetUpdateTime_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestSubmissionUpdate + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetUpdateTime() // Should return zero value + }) + + t.Run("GetUpdateInfo", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionUpdate{} + var expected *TestSubmissionUpdateInfo + obj.UpdateInfo = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetUpdateInfo(), "getter should return the property value") + }) + + t.Run("GetUpdateInfo_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionUpdate{} + obj.UpdateInfo = nil + + // Act & Assert + assert.Nil(t, obj.GetUpdateInfo(), "getter should return nil when property is nil") + }) + + t.Run("GetUpdateInfo_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestSubmissionUpdate + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetUpdateInfo() // Should return zero value + }) + +} + +func TestSettersMarkExplicitTestSubmissionUpdate(t *testing.T) { + t.Run("SetUpdateTime_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionUpdate{} + var fernTestValueUpdateTime time.Time + + // Act + obj.SetUpdateTime(fernTestValueUpdateTime) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetUpdateInfo_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionUpdate{} + var fernTestValueUpdateInfo *TestSubmissionUpdateInfo + + // Act + obj.SetUpdateInfo(fernTestValueUpdateInfo) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestGettersTestSubmissionUpdateInfo(t *testing.T) { + t.Run("GetType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionUpdateInfo{} + var expected string + obj.Type = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetType(), "getter should return the property value") + }) + + t.Run("GetType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestSubmissionUpdateInfo + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetType() // Should return zero value + }) + + t.Run("GetRunning", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionUpdateInfo{} + var expected RunningSubmissionState + obj.Running = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetRunning(), "getter should return the property value") + }) + + t.Run("GetRunning_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestSubmissionUpdateInfo + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetRunning() // Should return zero value + }) + + t.Run("GetStopped", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionUpdateInfo{} + var expected interface{} + obj.Stopped = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetStopped(), "getter should return the property value") + }) + + t.Run("GetStopped_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestSubmissionUpdateInfo + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetStopped() // Should return zero value + }) + + t.Run("GetErrored", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionUpdateInfo{} + var expected *ErrorInfo + obj.Errored = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetErrored(), "getter should return the property value") + }) + + t.Run("GetErrored_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionUpdateInfo{} + obj.Errored = nil + + // Act & Assert + assert.Nil(t, obj.GetErrored(), "getter should return nil when property is nil") + }) + + t.Run("GetErrored_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestSubmissionUpdateInfo + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetErrored() // Should return zero value + }) + + t.Run("GetGradedTestCase", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionUpdateInfo{} + var expected *GradedTestCaseUpdate + obj.GradedTestCase = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetGradedTestCase(), "getter should return the property value") + }) + + t.Run("GetGradedTestCase_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionUpdateInfo{} + obj.GradedTestCase = nil + + // Act & Assert + assert.Nil(t, obj.GetGradedTestCase(), "getter should return nil when property is nil") + }) + + t.Run("GetGradedTestCase_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestSubmissionUpdateInfo + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetGradedTestCase() // Should return zero value + }) + + t.Run("GetRecordedTestCase", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionUpdateInfo{} + var expected *RecordedTestCaseUpdate + obj.RecordedTestCase = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetRecordedTestCase(), "getter should return the property value") + }) + + t.Run("GetRecordedTestCase_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionUpdateInfo{} + obj.RecordedTestCase = nil + + // Act & Assert + assert.Nil(t, obj.GetRecordedTestCase(), "getter should return nil when property is nil") + }) + + t.Run("GetRecordedTestCase_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestSubmissionUpdateInfo + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetRecordedTestCase() // Should return zero value + }) + + t.Run("GetFinished", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionUpdateInfo{} + var expected interface{} + obj.Finished = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetFinished(), "getter should return the property value") + }) + + t.Run("GetFinished_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestSubmissionUpdateInfo + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetFinished() // Should return zero value + }) + +} + +func TestSettersTraceResponse(t *testing.T) { + t.Run("SetSubmissionID", func(t *testing.T) { + obj := &TraceResponse{} + var fernTestValueSubmissionID SubmissionID + obj.SetSubmissionID(fernTestValueSubmissionID) + assert.Equal(t, fernTestValueSubmissionID, obj.SubmissionID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetLineNumber", func(t *testing.T) { + obj := &TraceResponse{} + var fernTestValueLineNumber int + obj.SetLineNumber(fernTestValueLineNumber) + assert.Equal(t, fernTestValueLineNumber, obj.LineNumber) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetReturnValue", func(t *testing.T) { + obj := &TraceResponse{} + var fernTestValueReturnValue *DebugVariableValue + obj.SetReturnValue(fernTestValueReturnValue) + assert.Equal(t, fernTestValueReturnValue, obj.ReturnValue) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetExpressionLocation", func(t *testing.T) { + obj := &TraceResponse{} + var fernTestValueExpressionLocation *ExpressionLocation + obj.SetExpressionLocation(fernTestValueExpressionLocation) + assert.Equal(t, fernTestValueExpressionLocation, obj.ExpressionLocation) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetStack", func(t *testing.T) { + obj := &TraceResponse{} + var fernTestValueStack *StackInformation + obj.SetStack(fernTestValueStack) + assert.Equal(t, fernTestValueStack, obj.Stack) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetStdout", func(t *testing.T) { + obj := &TraceResponse{} + var fernTestValueStdout *string + obj.SetStdout(fernTestValueStdout) + assert.Equal(t, fernTestValueStdout, obj.Stdout) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersTraceResponse(t *testing.T) { + t.Run("GetSubmissionID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponse{} + var expected SubmissionID + obj.SubmissionID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSubmissionID(), "getter should return the property value") + }) + + t.Run("GetSubmissionID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TraceResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSubmissionID() // Should return zero value + }) + + t.Run("GetLineNumber", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponse{} + var expected int + obj.LineNumber = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetLineNumber(), "getter should return the property value") + }) + + t.Run("GetLineNumber_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TraceResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetLineNumber() // Should return zero value + }) + + t.Run("GetReturnValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponse{} + var expected *DebugVariableValue + obj.ReturnValue = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetReturnValue(), "getter should return the property value") + }) + + t.Run("GetReturnValue_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponse{} + obj.ReturnValue = nil + + // Act & Assert + assert.Nil(t, obj.GetReturnValue(), "getter should return nil when property is nil") + }) + + t.Run("GetReturnValue_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TraceResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetReturnValue() // Should return zero value + }) + + t.Run("GetExpressionLocation", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponse{} + var expected *ExpressionLocation + obj.ExpressionLocation = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetExpressionLocation(), "getter should return the property value") + }) + + t.Run("GetExpressionLocation_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponse{} + obj.ExpressionLocation = nil + + // Act & Assert + assert.Nil(t, obj.GetExpressionLocation(), "getter should return nil when property is nil") + }) + + t.Run("GetExpressionLocation_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TraceResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetExpressionLocation() // Should return zero value + }) + + t.Run("GetStack", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponse{} + var expected *StackInformation + obj.Stack = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetStack(), "getter should return the property value") + }) + + t.Run("GetStack_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponse{} + obj.Stack = nil + + // Act & Assert + assert.Nil(t, obj.GetStack(), "getter should return nil when property is nil") + }) + + t.Run("GetStack_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TraceResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetStack() // Should return zero value + }) + + t.Run("GetStdout", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponse{} + var expected *string + obj.Stdout = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetStdout(), "getter should return the property value") + }) + + t.Run("GetStdout_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponse{} + obj.Stdout = nil + + // Act & Assert + assert.Nil(t, obj.GetStdout(), "getter should return nil when property is nil") + }) + + t.Run("GetStdout_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TraceResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetStdout() // Should return zero value + }) + +} + +func TestSettersMarkExplicitTraceResponse(t *testing.T) { + t.Run("SetSubmissionID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponse{} + var fernTestValueSubmissionID SubmissionID + + // Act + obj.SetSubmissionID(fernTestValueSubmissionID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetLineNumber_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponse{} + var fernTestValueLineNumber int + + // Act + obj.SetLineNumber(fernTestValueLineNumber) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetReturnValue_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponse{} + var fernTestValueReturnValue *DebugVariableValue + + // Act + obj.SetReturnValue(fernTestValueReturnValue) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetExpressionLocation_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponse{} + var fernTestValueExpressionLocation *ExpressionLocation + + // Act + obj.SetExpressionLocation(fernTestValueExpressionLocation) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetStack_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponse{} + var fernTestValueStack *StackInformation + + // Act + obj.SetStack(fernTestValueStack) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetStdout_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponse{} + var fernTestValueStdout *string + + // Act + obj.SetStdout(fernTestValueStdout) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersTraceResponseV2(t *testing.T) { + t.Run("SetSubmissionID", func(t *testing.T) { + obj := &TraceResponseV2{} + var fernTestValueSubmissionID SubmissionID + obj.SetSubmissionID(fernTestValueSubmissionID) + assert.Equal(t, fernTestValueSubmissionID, obj.SubmissionID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetLineNumber", func(t *testing.T) { + obj := &TraceResponseV2{} + var fernTestValueLineNumber int + obj.SetLineNumber(fernTestValueLineNumber) + assert.Equal(t, fernTestValueLineNumber, obj.LineNumber) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetFile", func(t *testing.T) { + obj := &TraceResponseV2{} + var fernTestValueFile *TracedFile + obj.SetFile(fernTestValueFile) + assert.Equal(t, fernTestValueFile, obj.File) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetReturnValue", func(t *testing.T) { + obj := &TraceResponseV2{} + var fernTestValueReturnValue *DebugVariableValue + obj.SetReturnValue(fernTestValueReturnValue) + assert.Equal(t, fernTestValueReturnValue, obj.ReturnValue) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetExpressionLocation", func(t *testing.T) { + obj := &TraceResponseV2{} + var fernTestValueExpressionLocation *ExpressionLocation + obj.SetExpressionLocation(fernTestValueExpressionLocation) + assert.Equal(t, fernTestValueExpressionLocation, obj.ExpressionLocation) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetStack", func(t *testing.T) { + obj := &TraceResponseV2{} + var fernTestValueStack *StackInformation + obj.SetStack(fernTestValueStack) + assert.Equal(t, fernTestValueStack, obj.Stack) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetStdout", func(t *testing.T) { + obj := &TraceResponseV2{} + var fernTestValueStdout *string + obj.SetStdout(fernTestValueStdout) + assert.Equal(t, fernTestValueStdout, obj.Stdout) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersTraceResponseV2(t *testing.T) { + t.Run("GetSubmissionID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponseV2{} + var expected SubmissionID + obj.SubmissionID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSubmissionID(), "getter should return the property value") + }) + + t.Run("GetSubmissionID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TraceResponseV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSubmissionID() // Should return zero value + }) + + t.Run("GetLineNumber", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponseV2{} + var expected int + obj.LineNumber = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetLineNumber(), "getter should return the property value") + }) + + t.Run("GetLineNumber_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TraceResponseV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetLineNumber() // Should return zero value + }) + + t.Run("GetFile", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponseV2{} + var expected *TracedFile + obj.File = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetFile(), "getter should return the property value") + }) + + t.Run("GetFile_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponseV2{} + obj.File = nil + + // Act & Assert + assert.Nil(t, obj.GetFile(), "getter should return nil when property is nil") + }) + + t.Run("GetFile_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TraceResponseV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetFile() // Should return zero value + }) + + t.Run("GetReturnValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponseV2{} + var expected *DebugVariableValue + obj.ReturnValue = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetReturnValue(), "getter should return the property value") + }) + + t.Run("GetReturnValue_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponseV2{} + obj.ReturnValue = nil + + // Act & Assert + assert.Nil(t, obj.GetReturnValue(), "getter should return nil when property is nil") + }) + + t.Run("GetReturnValue_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TraceResponseV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetReturnValue() // Should return zero value + }) + + t.Run("GetExpressionLocation", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponseV2{} + var expected *ExpressionLocation + obj.ExpressionLocation = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetExpressionLocation(), "getter should return the property value") + }) + + t.Run("GetExpressionLocation_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponseV2{} + obj.ExpressionLocation = nil + + // Act & Assert + assert.Nil(t, obj.GetExpressionLocation(), "getter should return nil when property is nil") + }) + + t.Run("GetExpressionLocation_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TraceResponseV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetExpressionLocation() // Should return zero value + }) + + t.Run("GetStack", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponseV2{} + var expected *StackInformation + obj.Stack = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetStack(), "getter should return the property value") + }) + + t.Run("GetStack_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponseV2{} + obj.Stack = nil + + // Act & Assert + assert.Nil(t, obj.GetStack(), "getter should return nil when property is nil") + }) + + t.Run("GetStack_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TraceResponseV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetStack() // Should return zero value + }) + + t.Run("GetStdout", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponseV2{} + var expected *string + obj.Stdout = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetStdout(), "getter should return the property value") + }) + + t.Run("GetStdout_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponseV2{} + obj.Stdout = nil + + // Act & Assert + assert.Nil(t, obj.GetStdout(), "getter should return nil when property is nil") + }) + + t.Run("GetStdout_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TraceResponseV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetStdout() // Should return zero value + }) + +} + +func TestSettersMarkExplicitTraceResponseV2(t *testing.T) { + t.Run("SetSubmissionID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponseV2{} + var fernTestValueSubmissionID SubmissionID + + // Act + obj.SetSubmissionID(fernTestValueSubmissionID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetLineNumber_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponseV2{} + var fernTestValueLineNumber int + + // Act + obj.SetLineNumber(fernTestValueLineNumber) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetFile_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponseV2{} + var fernTestValueFile *TracedFile + + // Act + obj.SetFile(fernTestValueFile) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetReturnValue_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponseV2{} + var fernTestValueReturnValue *DebugVariableValue + + // Act + obj.SetReturnValue(fernTestValueReturnValue) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetExpressionLocation_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponseV2{} + var fernTestValueExpressionLocation *ExpressionLocation + + // Act + obj.SetExpressionLocation(fernTestValueExpressionLocation) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetStack_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponseV2{} + var fernTestValueStack *StackInformation + + // Act + obj.SetStack(fernTestValueStack) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetStdout_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponseV2{} + var fernTestValueStdout *string + + // Act + obj.SetStdout(fernTestValueStdout) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersTraceResponsesPage(t *testing.T) { + t.Run("SetOffset", func(t *testing.T) { + obj := &TraceResponsesPage{} + var fernTestValueOffset *int + obj.SetOffset(fernTestValueOffset) + assert.Equal(t, fernTestValueOffset, obj.Offset) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetTraceResponses", func(t *testing.T) { + obj := &TraceResponsesPage{} + var fernTestValueTraceResponses []*TraceResponse + obj.SetTraceResponses(fernTestValueTraceResponses) + assert.Equal(t, fernTestValueTraceResponses, obj.TraceResponses) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersTraceResponsesPage(t *testing.T) { + t.Run("GetOffset", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponsesPage{} + var expected *int + obj.Offset = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetOffset(), "getter should return the property value") + }) + + t.Run("GetOffset_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponsesPage{} + obj.Offset = nil + + // Act & Assert + assert.Nil(t, obj.GetOffset(), "getter should return nil when property is nil") + }) + + t.Run("GetOffset_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TraceResponsesPage + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetOffset() // Should return zero value + }) + + t.Run("GetTraceResponses", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponsesPage{} + var expected []*TraceResponse + obj.TraceResponses = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTraceResponses(), "getter should return the property value") + }) + + t.Run("GetTraceResponses_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponsesPage{} + obj.TraceResponses = nil + + // Act & Assert + assert.Nil(t, obj.GetTraceResponses(), "getter should return nil when property is nil") + }) + + t.Run("GetTraceResponses_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TraceResponsesPage + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTraceResponses() // Should return zero value + }) + +} + +func TestSettersMarkExplicitTraceResponsesPage(t *testing.T) { + t.Run("SetOffset_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponsesPage{} + var fernTestValueOffset *int + + // Act + obj.SetOffset(fernTestValueOffset) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetTraceResponses_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponsesPage{} + var fernTestValueTraceResponses []*TraceResponse + + // Act + obj.SetTraceResponses(fernTestValueTraceResponses) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersTraceResponsesPageV2(t *testing.T) { + t.Run("SetOffset", func(t *testing.T) { + obj := &TraceResponsesPageV2{} + var fernTestValueOffset *int + obj.SetOffset(fernTestValueOffset) + assert.Equal(t, fernTestValueOffset, obj.Offset) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetTraceResponses", func(t *testing.T) { + obj := &TraceResponsesPageV2{} + var fernTestValueTraceResponses []*TraceResponseV2 + obj.SetTraceResponses(fernTestValueTraceResponses) + assert.Equal(t, fernTestValueTraceResponses, obj.TraceResponses) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersTraceResponsesPageV2(t *testing.T) { + t.Run("GetOffset", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponsesPageV2{} + var expected *int + obj.Offset = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetOffset(), "getter should return the property value") + }) + + t.Run("GetOffset_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponsesPageV2{} + obj.Offset = nil + + // Act & Assert + assert.Nil(t, obj.GetOffset(), "getter should return nil when property is nil") + }) + + t.Run("GetOffset_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TraceResponsesPageV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetOffset() // Should return zero value + }) + + t.Run("GetTraceResponses", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponsesPageV2{} + var expected []*TraceResponseV2 + obj.TraceResponses = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTraceResponses(), "getter should return the property value") + }) + + t.Run("GetTraceResponses_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponsesPageV2{} + obj.TraceResponses = nil + + // Act & Assert + assert.Nil(t, obj.GetTraceResponses(), "getter should return nil when property is nil") + }) + + t.Run("GetTraceResponses_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TraceResponsesPageV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTraceResponses() // Should return zero value + }) + +} + +func TestSettersMarkExplicitTraceResponsesPageV2(t *testing.T) { + t.Run("SetOffset_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponsesPageV2{} + var fernTestValueOffset *int + + // Act + obj.SetOffset(fernTestValueOffset) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetTraceResponses_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponsesPageV2{} + var fernTestValueTraceResponses []*TraceResponseV2 + + // Act + obj.SetTraceResponses(fernTestValueTraceResponses) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersTracedFile(t *testing.T) { + t.Run("SetFilename", func(t *testing.T) { + obj := &TracedFile{} + var fernTestValueFilename string + obj.SetFilename(fernTestValueFilename) + assert.Equal(t, fernTestValueFilename, obj.Filename) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetDirectory", func(t *testing.T) { + obj := &TracedFile{} + var fernTestValueDirectory string + obj.SetDirectory(fernTestValueDirectory) + assert.Equal(t, fernTestValueDirectory, obj.Directory) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersTracedFile(t *testing.T) { + t.Run("GetFilename", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TracedFile{} + var expected string + obj.Filename = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetFilename(), "getter should return the property value") + }) + + t.Run("GetFilename_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TracedFile + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetFilename() // Should return zero value + }) + + t.Run("GetDirectory", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TracedFile{} + var expected string + obj.Directory = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetDirectory(), "getter should return the property value") + }) + + t.Run("GetDirectory_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TracedFile + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetDirectory() // Should return zero value + }) + +} + +func TestSettersMarkExplicitTracedFile(t *testing.T) { + t.Run("SetFilename_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TracedFile{} + var fernTestValueFilename string + + // Act + obj.SetFilename(fernTestValueFilename) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetDirectory_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TracedFile{} + var fernTestValueDirectory string + + // Act + obj.SetDirectory(fernTestValueDirectory) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersTracedTestCase(t *testing.T) { + t.Run("SetResult", func(t *testing.T) { + obj := &TracedTestCase{} + var fernTestValueResult *TestCaseResultWithStdout + obj.SetResult(fernTestValueResult) + assert.Equal(t, fernTestValueResult, obj.Result) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetTraceResponsesSize", func(t *testing.T) { + obj := &TracedTestCase{} + var fernTestValueTraceResponsesSize int + obj.SetTraceResponsesSize(fernTestValueTraceResponsesSize) + assert.Equal(t, fernTestValueTraceResponsesSize, obj.TraceResponsesSize) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersTracedTestCase(t *testing.T) { + t.Run("GetResult", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TracedTestCase{} + var expected *TestCaseResultWithStdout + obj.Result = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetResult(), "getter should return the property value") + }) + + t.Run("GetResult_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TracedTestCase{} + obj.Result = nil + + // Act & Assert + assert.Nil(t, obj.GetResult(), "getter should return nil when property is nil") + }) + + t.Run("GetResult_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TracedTestCase + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetResult() // Should return zero value + }) + + t.Run("GetTraceResponsesSize", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TracedTestCase{} + var expected int + obj.TraceResponsesSize = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTraceResponsesSize(), "getter should return the property value") + }) + + t.Run("GetTraceResponsesSize_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TracedTestCase + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTraceResponsesSize() // Should return zero value + }) + +} + +func TestSettersMarkExplicitTracedTestCase(t *testing.T) { + t.Run("SetResult_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TracedTestCase{} + var fernTestValueResult *TestCaseResultWithStdout + + // Act + obj.SetResult(fernTestValueResult) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetTraceResponsesSize_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TracedTestCase{} + var fernTestValueTraceResponsesSize int + + // Act + obj.SetTraceResponsesSize(fernTestValueTraceResponsesSize) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersUnexpectedLanguageError(t *testing.T) { + t.Run("SetExpectedLanguage", func(t *testing.T) { + obj := &UnexpectedLanguageError{} + var fernTestValueExpectedLanguage common.Language + obj.SetExpectedLanguage(fernTestValueExpectedLanguage) + assert.Equal(t, fernTestValueExpectedLanguage, obj.ExpectedLanguage) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetActualLanguage", func(t *testing.T) { + obj := &UnexpectedLanguageError{} + var fernTestValueActualLanguage common.Language + obj.SetActualLanguage(fernTestValueActualLanguage) + assert.Equal(t, fernTestValueActualLanguage, obj.ActualLanguage) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersUnexpectedLanguageError(t *testing.T) { + t.Run("GetExpectedLanguage", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &UnexpectedLanguageError{} + var expected common.Language + obj.ExpectedLanguage = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetExpectedLanguage(), "getter should return the property value") + }) + + t.Run("GetExpectedLanguage_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *UnexpectedLanguageError + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetExpectedLanguage() // Should return zero value + }) + + t.Run("GetActualLanguage", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &UnexpectedLanguageError{} + var expected common.Language + obj.ActualLanguage = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetActualLanguage(), "getter should return the property value") + }) + + t.Run("GetActualLanguage_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *UnexpectedLanguageError + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetActualLanguage() // Should return zero value + }) + +} + +func TestSettersMarkExplicitUnexpectedLanguageError(t *testing.T) { + t.Run("SetExpectedLanguage_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &UnexpectedLanguageError{} + var fernTestValueExpectedLanguage common.Language + + // Act + obj.SetExpectedLanguage(fernTestValueExpectedLanguage) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetActualLanguage_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &UnexpectedLanguageError{} + var fernTestValueActualLanguage common.Language + + // Act + obj.SetActualLanguage(fernTestValueActualLanguage) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersWorkspaceFiles(t *testing.T) { + t.Run("SetMainFile", func(t *testing.T) { + obj := &WorkspaceFiles{} + var fernTestValueMainFile *FileInfo + obj.SetMainFile(fernTestValueMainFile) + assert.Equal(t, fernTestValueMainFile, obj.MainFile) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetReadOnlyFiles", func(t *testing.T) { + obj := &WorkspaceFiles{} + var fernTestValueReadOnlyFiles []*FileInfo + obj.SetReadOnlyFiles(fernTestValueReadOnlyFiles) + assert.Equal(t, fernTestValueReadOnlyFiles, obj.ReadOnlyFiles) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersWorkspaceFiles(t *testing.T) { + t.Run("GetMainFile", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceFiles{} + var expected *FileInfo + obj.MainFile = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetMainFile(), "getter should return the property value") + }) + + t.Run("GetMainFile_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceFiles{} + obj.MainFile = nil + + // Act & Assert + assert.Nil(t, obj.GetMainFile(), "getter should return nil when property is nil") + }) + + t.Run("GetMainFile_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceFiles + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetMainFile() // Should return zero value + }) + + t.Run("GetReadOnlyFiles", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceFiles{} + var expected []*FileInfo + obj.ReadOnlyFiles = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetReadOnlyFiles(), "getter should return the property value") + }) + + t.Run("GetReadOnlyFiles_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceFiles{} + obj.ReadOnlyFiles = nil + + // Act & Assert + assert.Nil(t, obj.GetReadOnlyFiles(), "getter should return nil when property is nil") + }) + + t.Run("GetReadOnlyFiles_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceFiles + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetReadOnlyFiles() // Should return zero value + }) + +} + +func TestSettersMarkExplicitWorkspaceFiles(t *testing.T) { + t.Run("SetMainFile_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceFiles{} + var fernTestValueMainFile *FileInfo + + // Act + obj.SetMainFile(fernTestValueMainFile) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetReadOnlyFiles_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceFiles{} + var fernTestValueReadOnlyFiles []*FileInfo + + // Act + obj.SetReadOnlyFiles(fernTestValueReadOnlyFiles) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersWorkspaceRanResponse(t *testing.T) { + t.Run("SetSubmissionID", func(t *testing.T) { + obj := &WorkspaceRanResponse{} + var fernTestValueSubmissionID SubmissionID + obj.SetSubmissionID(fernTestValueSubmissionID) + assert.Equal(t, fernTestValueSubmissionID, obj.SubmissionID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetRunDetails", func(t *testing.T) { + obj := &WorkspaceRanResponse{} + var fernTestValueRunDetails *WorkspaceRunDetails + obj.SetRunDetails(fernTestValueRunDetails) + assert.Equal(t, fernTestValueRunDetails, obj.RunDetails) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersWorkspaceRanResponse(t *testing.T) { + t.Run("GetSubmissionID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceRanResponse{} + var expected SubmissionID + obj.SubmissionID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSubmissionID(), "getter should return the property value") + }) + + t.Run("GetSubmissionID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceRanResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSubmissionID() // Should return zero value + }) + + t.Run("GetRunDetails", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceRanResponse{} + var expected *WorkspaceRunDetails + obj.RunDetails = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetRunDetails(), "getter should return the property value") + }) + + t.Run("GetRunDetails_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceRanResponse{} + obj.RunDetails = nil + + // Act & Assert + assert.Nil(t, obj.GetRunDetails(), "getter should return nil when property is nil") + }) + + t.Run("GetRunDetails_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceRanResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetRunDetails() // Should return zero value + }) + +} + +func TestSettersMarkExplicitWorkspaceRanResponse(t *testing.T) { + t.Run("SetSubmissionID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceRanResponse{} + var fernTestValueSubmissionID SubmissionID + + // Act + obj.SetSubmissionID(fernTestValueSubmissionID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetRunDetails_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceRanResponse{} + var fernTestValueRunDetails *WorkspaceRunDetails + + // Act + obj.SetRunDetails(fernTestValueRunDetails) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersWorkspaceRunDetails(t *testing.T) { + t.Run("SetExceptionV2", func(t *testing.T) { + obj := &WorkspaceRunDetails{} + var fernTestValueExceptionV2 *ExceptionV2 + obj.SetExceptionV2(fernTestValueExceptionV2) + assert.Equal(t, fernTestValueExceptionV2, obj.ExceptionV2) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetException", func(t *testing.T) { + obj := &WorkspaceRunDetails{} + var fernTestValueException *ExceptionInfo + obj.SetException(fernTestValueException) + assert.Equal(t, fernTestValueException, obj.Exception) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetStdout", func(t *testing.T) { + obj := &WorkspaceRunDetails{} + var fernTestValueStdout string + obj.SetStdout(fernTestValueStdout) + assert.Equal(t, fernTestValueStdout, obj.Stdout) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersWorkspaceRunDetails(t *testing.T) { + t.Run("GetExceptionV2", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceRunDetails{} + var expected *ExceptionV2 + obj.ExceptionV2 = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetExceptionV2(), "getter should return the property value") + }) + + t.Run("GetExceptionV2_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceRunDetails{} + obj.ExceptionV2 = nil + + // Act & Assert + assert.Nil(t, obj.GetExceptionV2(), "getter should return nil when property is nil") + }) + + t.Run("GetExceptionV2_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceRunDetails + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetExceptionV2() // Should return zero value + }) + + t.Run("GetException", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceRunDetails{} + var expected *ExceptionInfo + obj.Exception = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetException(), "getter should return the property value") + }) + + t.Run("GetException_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceRunDetails{} + obj.Exception = nil + + // Act & Assert + assert.Nil(t, obj.GetException(), "getter should return nil when property is nil") + }) + + t.Run("GetException_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceRunDetails + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetException() // Should return zero value + }) + + t.Run("GetStdout", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceRunDetails{} + var expected string + obj.Stdout = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetStdout(), "getter should return the property value") + }) + + t.Run("GetStdout_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceRunDetails + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetStdout() // Should return zero value + }) + +} + +func TestSettersMarkExplicitWorkspaceRunDetails(t *testing.T) { + t.Run("SetExceptionV2_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceRunDetails{} + var fernTestValueExceptionV2 *ExceptionV2 + + // Act + obj.SetExceptionV2(fernTestValueExceptionV2) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetException_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceRunDetails{} + var fernTestValueException *ExceptionInfo + + // Act + obj.SetException(fernTestValueException) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetStdout_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceRunDetails{} + var fernTestValueStdout string + + // Act + obj.SetStdout(fernTestValueStdout) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersWorkspaceStarterFilesResponse(t *testing.T) { + t.Run("SetFiles", func(t *testing.T) { + obj := &WorkspaceStarterFilesResponse{} + var fernTestValueFiles map[common.Language]*WorkspaceFiles + obj.SetFiles(fernTestValueFiles) + assert.Equal(t, fernTestValueFiles, obj.Files) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersWorkspaceStarterFilesResponse(t *testing.T) { + t.Run("GetFiles", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceStarterFilesResponse{} + var expected map[common.Language]*WorkspaceFiles + obj.Files = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetFiles(), "getter should return the property value") + }) + + t.Run("GetFiles_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceStarterFilesResponse{} + obj.Files = nil + + // Act & Assert + assert.Nil(t, obj.GetFiles(), "getter should return nil when property is nil") + }) + + t.Run("GetFiles_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceStarterFilesResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetFiles() // Should return zero value + }) + +} + +func TestSettersMarkExplicitWorkspaceStarterFilesResponse(t *testing.T) { + t.Run("SetFiles_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceStarterFilesResponse{} + var fernTestValueFiles map[common.Language]*WorkspaceFiles + + // Act + obj.SetFiles(fernTestValueFiles) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersWorkspaceStarterFilesResponseV2(t *testing.T) { + t.Run("SetFilesByLanguage", func(t *testing.T) { + obj := &WorkspaceStarterFilesResponseV2{} + var fernTestValueFilesByLanguage map[common.Language]*v2.Files + obj.SetFilesByLanguage(fernTestValueFilesByLanguage) + assert.Equal(t, fernTestValueFilesByLanguage, obj.FilesByLanguage) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersWorkspaceStarterFilesResponseV2(t *testing.T) { + t.Run("GetFilesByLanguage", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceStarterFilesResponseV2{} + var expected map[common.Language]*v2.Files + obj.FilesByLanguage = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetFilesByLanguage(), "getter should return the property value") + }) + + t.Run("GetFilesByLanguage_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceStarterFilesResponseV2{} + obj.FilesByLanguage = nil + + // Act & Assert + assert.Nil(t, obj.GetFilesByLanguage(), "getter should return nil when property is nil") + }) + + t.Run("GetFilesByLanguage_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceStarterFilesResponseV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetFilesByLanguage() // Should return zero value + }) + +} + +func TestSettersMarkExplicitWorkspaceStarterFilesResponseV2(t *testing.T) { + t.Run("SetFilesByLanguage_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceStarterFilesResponseV2{} + var fernTestValueFilesByLanguage map[common.Language]*v2.Files + + // Act + obj.SetFilesByLanguage(fernTestValueFilesByLanguage) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersWorkspaceSubmissionState(t *testing.T) { + t.Run("SetStatus", func(t *testing.T) { + obj := &WorkspaceSubmissionState{} + var fernTestValueStatus *WorkspaceSubmissionStatus + obj.SetStatus(fernTestValueStatus) + assert.Equal(t, fernTestValueStatus, obj.Status) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersWorkspaceSubmissionState(t *testing.T) { + t.Run("GetStatus", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmissionState{} + var expected *WorkspaceSubmissionStatus + obj.Status = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetStatus(), "getter should return the property value") + }) + + t.Run("GetStatus_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmissionState{} + obj.Status = nil + + // Act & Assert + assert.Nil(t, obj.GetStatus(), "getter should return nil when property is nil") + }) + + t.Run("GetStatus_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceSubmissionState + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetStatus() // Should return zero value + }) + +} + +func TestSettersMarkExplicitWorkspaceSubmissionState(t *testing.T) { + t.Run("SetStatus_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmissionState{} + var fernTestValueStatus *WorkspaceSubmissionStatus + + // Act + obj.SetStatus(fernTestValueStatus) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestGettersWorkspaceSubmissionStatus(t *testing.T) { + t.Run("GetType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmissionStatus{} + var expected string + obj.Type = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetType(), "getter should return the property value") + }) + + t.Run("GetType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceSubmissionStatus + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetType() // Should return zero value + }) + + t.Run("GetStopped", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmissionStatus{} + var expected interface{} + obj.Stopped = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetStopped(), "getter should return the property value") + }) + + t.Run("GetStopped_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceSubmissionStatus + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetStopped() // Should return zero value + }) + + t.Run("GetErrored", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmissionStatus{} + var expected *ErrorInfo + obj.Errored = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetErrored(), "getter should return the property value") + }) + + t.Run("GetErrored_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmissionStatus{} + obj.Errored = nil + + // Act & Assert + assert.Nil(t, obj.GetErrored(), "getter should return nil when property is nil") + }) + + t.Run("GetErrored_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceSubmissionStatus + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetErrored() // Should return zero value + }) + + t.Run("GetRunning", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmissionStatus{} + var expected RunningSubmissionState + obj.Running = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetRunning(), "getter should return the property value") + }) + + t.Run("GetRunning_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceSubmissionStatus + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetRunning() // Should return zero value + }) + + t.Run("GetRan", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmissionStatus{} + var expected *WorkspaceRunDetails + obj.Ran = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetRan(), "getter should return the property value") + }) + + t.Run("GetRan_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmissionStatus{} + obj.Ran = nil + + // Act & Assert + assert.Nil(t, obj.GetRan(), "getter should return nil when property is nil") + }) + + t.Run("GetRan_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceSubmissionStatus + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetRan() // Should return zero value + }) + + t.Run("GetTraced", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmissionStatus{} + var expected *WorkspaceRunDetails + obj.Traced = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTraced(), "getter should return the property value") + }) + + t.Run("GetTraced_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmissionStatus{} + obj.Traced = nil + + // Act & Assert + assert.Nil(t, obj.GetTraced(), "getter should return nil when property is nil") + }) + + t.Run("GetTraced_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceSubmissionStatus + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTraced() // Should return zero value + }) + +} + +func TestSettersWorkspaceSubmissionStatusV2(t *testing.T) { + t.Run("SetUpdates", func(t *testing.T) { + obj := &WorkspaceSubmissionStatusV2{} + var fernTestValueUpdates []*WorkspaceSubmissionUpdate + obj.SetUpdates(fernTestValueUpdates) + assert.Equal(t, fernTestValueUpdates, obj.Updates) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersWorkspaceSubmissionStatusV2(t *testing.T) { + t.Run("GetUpdates", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmissionStatusV2{} + var expected []*WorkspaceSubmissionUpdate + obj.Updates = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetUpdates(), "getter should return the property value") + }) + + t.Run("GetUpdates_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmissionStatusV2{} + obj.Updates = nil + + // Act & Assert + assert.Nil(t, obj.GetUpdates(), "getter should return nil when property is nil") + }) + + t.Run("GetUpdates_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceSubmissionStatusV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetUpdates() // Should return zero value + }) + +} + +func TestSettersMarkExplicitWorkspaceSubmissionStatusV2(t *testing.T) { + t.Run("SetUpdates_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmissionStatusV2{} + var fernTestValueUpdates []*WorkspaceSubmissionUpdate + + // Act + obj.SetUpdates(fernTestValueUpdates) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersWorkspaceSubmissionUpdate(t *testing.T) { + t.Run("SetUpdateTime", func(t *testing.T) { + obj := &WorkspaceSubmissionUpdate{} + var fernTestValueUpdateTime time.Time + obj.SetUpdateTime(fernTestValueUpdateTime) + assert.Equal(t, fernTestValueUpdateTime, obj.UpdateTime) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetUpdateInfo", func(t *testing.T) { + obj := &WorkspaceSubmissionUpdate{} + var fernTestValueUpdateInfo *WorkspaceSubmissionUpdateInfo + obj.SetUpdateInfo(fernTestValueUpdateInfo) + assert.Equal(t, fernTestValueUpdateInfo, obj.UpdateInfo) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersWorkspaceSubmissionUpdate(t *testing.T) { + t.Run("GetUpdateTime", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmissionUpdate{} + var expected time.Time + obj.UpdateTime = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetUpdateTime(), "getter should return the property value") + }) + + t.Run("GetUpdateTime_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceSubmissionUpdate + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetUpdateTime() // Should return zero value + }) + + t.Run("GetUpdateInfo", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmissionUpdate{} + var expected *WorkspaceSubmissionUpdateInfo + obj.UpdateInfo = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetUpdateInfo(), "getter should return the property value") + }) + + t.Run("GetUpdateInfo_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmissionUpdate{} + obj.UpdateInfo = nil + + // Act & Assert + assert.Nil(t, obj.GetUpdateInfo(), "getter should return nil when property is nil") + }) + + t.Run("GetUpdateInfo_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceSubmissionUpdate + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetUpdateInfo() // Should return zero value + }) + +} + +func TestSettersMarkExplicitWorkspaceSubmissionUpdate(t *testing.T) { + t.Run("SetUpdateTime_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmissionUpdate{} + var fernTestValueUpdateTime time.Time + + // Act + obj.SetUpdateTime(fernTestValueUpdateTime) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetUpdateInfo_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmissionUpdate{} + var fernTestValueUpdateInfo *WorkspaceSubmissionUpdateInfo + + // Act + obj.SetUpdateInfo(fernTestValueUpdateInfo) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestGettersWorkspaceSubmissionUpdateInfo(t *testing.T) { + t.Run("GetType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmissionUpdateInfo{} + var expected string + obj.Type = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetType(), "getter should return the property value") + }) + + t.Run("GetType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceSubmissionUpdateInfo + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetType() // Should return zero value + }) + + t.Run("GetRunning", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmissionUpdateInfo{} + var expected RunningSubmissionState + obj.Running = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetRunning(), "getter should return the property value") + }) + + t.Run("GetRunning_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceSubmissionUpdateInfo + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetRunning() // Should return zero value + }) + + t.Run("GetRan", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmissionUpdateInfo{} + var expected *WorkspaceRunDetails + obj.Ran = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetRan(), "getter should return the property value") + }) + + t.Run("GetRan_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmissionUpdateInfo{} + obj.Ran = nil + + // Act & Assert + assert.Nil(t, obj.GetRan(), "getter should return nil when property is nil") + }) + + t.Run("GetRan_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceSubmissionUpdateInfo + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetRan() // Should return zero value + }) + + t.Run("GetStopped", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmissionUpdateInfo{} + var expected interface{} + obj.Stopped = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetStopped(), "getter should return the property value") + }) + + t.Run("GetStopped_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceSubmissionUpdateInfo + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetStopped() // Should return zero value + }) + + t.Run("GetTraced", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmissionUpdateInfo{} + var expected interface{} + obj.Traced = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTraced(), "getter should return the property value") + }) + + t.Run("GetTraced_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceSubmissionUpdateInfo + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTraced() // Should return zero value + }) + + t.Run("GetTracedV2", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmissionUpdateInfo{} + var expected *WorkspaceTracedUpdate + obj.TracedV2 = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTracedV2(), "getter should return the property value") + }) + + t.Run("GetTracedV2_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmissionUpdateInfo{} + obj.TracedV2 = nil + + // Act & Assert + assert.Nil(t, obj.GetTracedV2(), "getter should return nil when property is nil") + }) + + t.Run("GetTracedV2_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceSubmissionUpdateInfo + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTracedV2() // Should return zero value + }) + + t.Run("GetErrored", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmissionUpdateInfo{} + var expected *ErrorInfo + obj.Errored = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetErrored(), "getter should return the property value") + }) + + t.Run("GetErrored_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmissionUpdateInfo{} + obj.Errored = nil + + // Act & Assert + assert.Nil(t, obj.GetErrored(), "getter should return nil when property is nil") + }) + + t.Run("GetErrored_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceSubmissionUpdateInfo + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetErrored() // Should return zero value + }) + + t.Run("GetFinished", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmissionUpdateInfo{} + var expected interface{} + obj.Finished = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetFinished(), "getter should return the property value") + }) + + t.Run("GetFinished_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceSubmissionUpdateInfo + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetFinished() // Should return zero value + }) + +} + +func TestSettersWorkspaceSubmitRequest(t *testing.T) { + t.Run("SetSubmissionID", func(t *testing.T) { + obj := &WorkspaceSubmitRequest{} + var fernTestValueSubmissionID SubmissionID + obj.SetSubmissionID(fernTestValueSubmissionID) + assert.Equal(t, fernTestValueSubmissionID, obj.SubmissionID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetLanguage", func(t *testing.T) { + obj := &WorkspaceSubmitRequest{} + var fernTestValueLanguage common.Language + obj.SetLanguage(fernTestValueLanguage) + assert.Equal(t, fernTestValueLanguage, obj.Language) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetSubmissionFiles", func(t *testing.T) { + obj := &WorkspaceSubmitRequest{} + var fernTestValueSubmissionFiles []*SubmissionFileInfo + obj.SetSubmissionFiles(fernTestValueSubmissionFiles) + assert.Equal(t, fernTestValueSubmissionFiles, obj.SubmissionFiles) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetUserID", func(t *testing.T) { + obj := &WorkspaceSubmitRequest{} + var fernTestValueUserID *string + obj.SetUserID(fernTestValueUserID) + assert.Equal(t, fernTestValueUserID, obj.UserID) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersWorkspaceSubmitRequest(t *testing.T) { + t.Run("GetSubmissionID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmitRequest{} + var expected SubmissionID + obj.SubmissionID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSubmissionID(), "getter should return the property value") + }) + + t.Run("GetSubmissionID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceSubmitRequest + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSubmissionID() // Should return zero value + }) + + t.Run("GetLanguage", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmitRequest{} + var expected common.Language + obj.Language = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetLanguage(), "getter should return the property value") + }) + + t.Run("GetLanguage_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceSubmitRequest + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetLanguage() // Should return zero value + }) + + t.Run("GetSubmissionFiles", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmitRequest{} + var expected []*SubmissionFileInfo + obj.SubmissionFiles = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSubmissionFiles(), "getter should return the property value") + }) + + t.Run("GetSubmissionFiles_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmitRequest{} + obj.SubmissionFiles = nil + + // Act & Assert + assert.Nil(t, obj.GetSubmissionFiles(), "getter should return nil when property is nil") + }) + + t.Run("GetSubmissionFiles_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceSubmitRequest + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSubmissionFiles() // Should return zero value + }) + + t.Run("GetUserID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmitRequest{} + var expected *string + obj.UserID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetUserID(), "getter should return the property value") + }) + + t.Run("GetUserID_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmitRequest{} + obj.UserID = nil + + // Act & Assert + assert.Nil(t, obj.GetUserID(), "getter should return nil when property is nil") + }) + + t.Run("GetUserID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceSubmitRequest + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetUserID() // Should return zero value + }) + +} + +func TestSettersMarkExplicitWorkspaceSubmitRequest(t *testing.T) { + t.Run("SetSubmissionID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmitRequest{} + var fernTestValueSubmissionID SubmissionID + + // Act + obj.SetSubmissionID(fernTestValueSubmissionID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetLanguage_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmitRequest{} + var fernTestValueLanguage common.Language + + // Act + obj.SetLanguage(fernTestValueLanguage) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetSubmissionFiles_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmitRequest{} + var fernTestValueSubmissionFiles []*SubmissionFileInfo + + // Act + obj.SetSubmissionFiles(fernTestValueSubmissionFiles) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetUserID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmitRequest{} + var fernTestValueUserID *string + + // Act + obj.SetUserID(fernTestValueUserID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersWorkspaceTracedUpdate(t *testing.T) { + t.Run("SetTraceResponsesSize", func(t *testing.T) { + obj := &WorkspaceTracedUpdate{} + var fernTestValueTraceResponsesSize int + obj.SetTraceResponsesSize(fernTestValueTraceResponsesSize) + assert.Equal(t, fernTestValueTraceResponsesSize, obj.TraceResponsesSize) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersWorkspaceTracedUpdate(t *testing.T) { + t.Run("GetTraceResponsesSize", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceTracedUpdate{} + var expected int + obj.TraceResponsesSize = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTraceResponsesSize(), "getter should return the property value") + }) + + t.Run("GetTraceResponsesSize_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceTracedUpdate + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTraceResponsesSize() // Should return zero value + }) + +} + +func TestSettersMarkExplicitWorkspaceTracedUpdate(t *testing.T) { + t.Run("SetTraceResponsesSize_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceTracedUpdate{} + var fernTestValueTraceResponsesSize int + + // Act + obj.SetTraceResponsesSize(fernTestValueTraceResponsesSize) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestJSONMarshalingBuildingExecutorResponse(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BuildingExecutorResponse{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled BuildingExecutorResponse + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj BuildingExecutorResponse + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj BuildingExecutorResponse + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingCompileError(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CompileError{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled CompileError + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj CompileError + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj CompileError + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingCustomTestCasesUnsupported(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CustomTestCasesUnsupported{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled CustomTestCasesUnsupported + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj CustomTestCasesUnsupported + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj CustomTestCasesUnsupported + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingErroredResponse(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ErroredResponse{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled ErroredResponse + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj ErroredResponse + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj ErroredResponse + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingExceptionInfo(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExceptionInfo{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled ExceptionInfo + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj ExceptionInfo + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj ExceptionInfo + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingExecutionSessionResponse(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExecutionSessionResponse{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled ExecutionSessionResponse + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj ExecutionSessionResponse + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj ExecutionSessionResponse + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingExecutionSessionState(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExecutionSessionState{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled ExecutionSessionState + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj ExecutionSessionState + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj ExecutionSessionState + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingExistingSubmissionExecuting(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExistingSubmissionExecuting{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled ExistingSubmissionExecuting + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj ExistingSubmissionExecuting + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj ExistingSubmissionExecuting + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingExpressionLocation(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ExpressionLocation{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled ExpressionLocation + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj ExpressionLocation + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj ExpressionLocation + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingFinishedResponse(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FinishedResponse{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled FinishedResponse + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj FinishedResponse + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj FinishedResponse + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingGetExecutionSessionStateResponse(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetExecutionSessionStateResponse{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled GetExecutionSessionStateResponse + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj GetExecutionSessionStateResponse + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj GetExecutionSessionStateResponse + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingGetSubmissionStateResponse(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetSubmissionStateResponse{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled GetSubmissionStateResponse + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj GetSubmissionStateResponse + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj GetSubmissionStateResponse + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingGetTraceResponsesPageRequest(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetTraceResponsesPageRequest{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled GetTraceResponsesPageRequest + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj GetTraceResponsesPageRequest + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj GetTraceResponsesPageRequest + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingGradedResponse(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GradedResponse{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled GradedResponse + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj GradedResponse + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj GradedResponse + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingGradedResponseV2(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GradedResponseV2{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled GradedResponseV2 + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj GradedResponseV2 + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj GradedResponseV2 + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingGradedTestCaseUpdate(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GradedTestCaseUpdate{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled GradedTestCaseUpdate + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj GradedTestCaseUpdate + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj GradedTestCaseUpdate + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingInitializeProblemRequest(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &InitializeProblemRequest{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled InitializeProblemRequest + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj InitializeProblemRequest + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj InitializeProblemRequest + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingInternalError(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &InternalError{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled InternalError + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj InternalError + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj InternalError + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingInvalidRequestResponse(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &InvalidRequestResponse{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled InvalidRequestResponse + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj InvalidRequestResponse + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj InvalidRequestResponse + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingLightweightStackframeInformation(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &LightweightStackframeInformation{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled LightweightStackframeInformation + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj LightweightStackframeInformation + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj LightweightStackframeInformation + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingRecordedResponseNotification(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &RecordedResponseNotification{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled RecordedResponseNotification + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj RecordedResponseNotification + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj RecordedResponseNotification + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingRecordedTestCaseUpdate(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &RecordedTestCaseUpdate{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled RecordedTestCaseUpdate + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj RecordedTestCaseUpdate + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj RecordedTestCaseUpdate + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingRecordingResponseNotification(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &RecordingResponseNotification{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled RecordingResponseNotification + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj RecordingResponseNotification + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj RecordingResponseNotification + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingRunningResponse(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &RunningResponse{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled RunningResponse + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj RunningResponse + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj RunningResponse + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingRuntimeError(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &RuntimeError{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled RuntimeError + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj RuntimeError + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj RuntimeError + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingScope(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Scope{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled Scope + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj Scope + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj Scope + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingStackFrame(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StackFrame{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled StackFrame + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj StackFrame + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj StackFrame + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingStackInformation(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StackInformation{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled StackInformation + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj StackInformation + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj StackInformation + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingStderrResponse(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StderrResponse{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled StderrResponse + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj StderrResponse + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj StderrResponse + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingStdoutResponse(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StdoutResponse{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled StdoutResponse + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj StdoutResponse + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj StdoutResponse + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingStopRequest(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StopRequest{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled StopRequest + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj StopRequest + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj StopRequest + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingStoppedResponse(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &StoppedResponse{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled StoppedResponse + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj StoppedResponse + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj StoppedResponse + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingSubmissionFileInfo(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionFileInfo{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled SubmissionFileInfo + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj SubmissionFileInfo + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj SubmissionFileInfo + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingSubmissionIDNotFound(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmissionIDNotFound{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled SubmissionIDNotFound + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj SubmissionIDNotFound + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj SubmissionIDNotFound + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingSubmitRequestV2(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &SubmitRequestV2{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled SubmitRequestV2 + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj SubmitRequestV2 + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj SubmitRequestV2 + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingTerminatedResponse(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TerminatedResponse{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled TerminatedResponse + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj TerminatedResponse + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj TerminatedResponse + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingTestCaseHiddenGrade(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseHiddenGrade{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled TestCaseHiddenGrade + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj TestCaseHiddenGrade + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj TestCaseHiddenGrade + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingTestCaseNonHiddenGrade(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseNonHiddenGrade{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled TestCaseNonHiddenGrade + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj TestCaseNonHiddenGrade + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj TestCaseNonHiddenGrade + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingTestCaseResult(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseResult{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled TestCaseResult + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj TestCaseResult + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj TestCaseResult + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingTestCaseResultWithStdout(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseResultWithStdout{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled TestCaseResultWithStdout + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj TestCaseResultWithStdout + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj TestCaseResultWithStdout + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingTestSubmissionState(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionState{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled TestSubmissionState + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj TestSubmissionState + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj TestSubmissionState + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingTestSubmissionStatusV2(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionStatusV2{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled TestSubmissionStatusV2 + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj TestSubmissionStatusV2 + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj TestSubmissionStatusV2 + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingTestSubmissionUpdate(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestSubmissionUpdate{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled TestSubmissionUpdate + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj TestSubmissionUpdate + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj TestSubmissionUpdate + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingTraceResponse(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponse{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled TraceResponse + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj TraceResponse + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj TraceResponse + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingTraceResponseV2(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponseV2{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled TraceResponseV2 + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj TraceResponseV2 + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj TraceResponseV2 + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingTraceResponsesPage(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponsesPage{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled TraceResponsesPage + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj TraceResponsesPage + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj TraceResponsesPage + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingTraceResponsesPageV2(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TraceResponsesPageV2{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled TraceResponsesPageV2 + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj TraceResponsesPageV2 + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj TraceResponsesPageV2 + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingTracedFile(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TracedFile{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled TracedFile + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj TracedFile + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj TracedFile + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingTracedTestCase(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TracedTestCase{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled TracedTestCase + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj TracedTestCase + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj TracedTestCase + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingUnexpectedLanguageError(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &UnexpectedLanguageError{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled UnexpectedLanguageError + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj UnexpectedLanguageError + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj UnexpectedLanguageError + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingWorkspaceFiles(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceFiles{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled WorkspaceFiles + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj WorkspaceFiles + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj WorkspaceFiles + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingWorkspaceRanResponse(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceRanResponse{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled WorkspaceRanResponse + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj WorkspaceRanResponse + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj WorkspaceRanResponse + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingWorkspaceRunDetails(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceRunDetails{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled WorkspaceRunDetails + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj WorkspaceRunDetails + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj WorkspaceRunDetails + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingWorkspaceStarterFilesResponse(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceStarterFilesResponse{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled WorkspaceStarterFilesResponse + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj WorkspaceStarterFilesResponse + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj WorkspaceStarterFilesResponse + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingWorkspaceStarterFilesResponseV2(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceStarterFilesResponseV2{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled WorkspaceStarterFilesResponseV2 + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj WorkspaceStarterFilesResponseV2 + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj WorkspaceStarterFilesResponseV2 + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingWorkspaceSubmissionState(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmissionState{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled WorkspaceSubmissionState + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj WorkspaceSubmissionState + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj WorkspaceSubmissionState + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingWorkspaceSubmissionStatusV2(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmissionStatusV2{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled WorkspaceSubmissionStatusV2 + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj WorkspaceSubmissionStatusV2 + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj WorkspaceSubmissionStatusV2 + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingWorkspaceSubmissionUpdate(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmissionUpdate{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled WorkspaceSubmissionUpdate + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj WorkspaceSubmissionUpdate + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj WorkspaceSubmissionUpdate + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingWorkspaceSubmitRequest(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceSubmitRequest{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled WorkspaceSubmitRequest + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj WorkspaceSubmitRequest + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj WorkspaceSubmitRequest + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingWorkspaceTracedUpdate(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &WorkspaceTracedUpdate{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled WorkspaceTracedUpdate + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj WorkspaceTracedUpdate + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj WorkspaceTracedUpdate + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestStringBuildingExecutorResponse(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &BuildingExecutorResponse{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BuildingExecutorResponse + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringCompileError(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &CompileError{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CompileError + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringCustomTestCasesUnsupported(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &CustomTestCasesUnsupported{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CustomTestCasesUnsupported + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringErroredResponse(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &ErroredResponse{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ErroredResponse + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringExceptionInfo(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &ExceptionInfo{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ExceptionInfo + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringExecutionSessionResponse(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &ExecutionSessionResponse{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ExecutionSessionResponse + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringExecutionSessionState(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &ExecutionSessionState{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ExecutionSessionState + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringExistingSubmissionExecuting(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &ExistingSubmissionExecuting{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ExistingSubmissionExecuting + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringExpressionLocation(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &ExpressionLocation{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ExpressionLocation + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringFinishedResponse(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &FinishedResponse{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FinishedResponse + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringGetExecutionSessionStateResponse(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &GetExecutionSessionStateResponse{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetExecutionSessionStateResponse + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringGetSubmissionStateResponse(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &GetSubmissionStateResponse{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetSubmissionStateResponse + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringGetTraceResponsesPageRequest(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &GetTraceResponsesPageRequest{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetTraceResponsesPageRequest + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringGradedResponse(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &GradedResponse{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GradedResponse + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringGradedResponseV2(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &GradedResponseV2{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GradedResponseV2 + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringGradedTestCaseUpdate(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &GradedTestCaseUpdate{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GradedTestCaseUpdate + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringInitializeProblemRequest(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &InitializeProblemRequest{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *InitializeProblemRequest + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringInternalError(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &InternalError{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *InternalError + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringInvalidRequestResponse(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &InvalidRequestResponse{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *InvalidRequestResponse + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringLightweightStackframeInformation(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &LightweightStackframeInformation{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *LightweightStackframeInformation + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringRecordedResponseNotification(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &RecordedResponseNotification{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *RecordedResponseNotification + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringRecordedTestCaseUpdate(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &RecordedTestCaseUpdate{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *RecordedTestCaseUpdate + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringRecordingResponseNotification(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &RecordingResponseNotification{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *RecordingResponseNotification + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringRunningResponse(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &RunningResponse{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *RunningResponse + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringRuntimeError(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &RuntimeError{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *RuntimeError + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringScope(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &Scope{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *Scope + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringStackFrame(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &StackFrame{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *StackFrame + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringStackInformation(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &StackInformation{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *StackInformation + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringStderrResponse(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &StderrResponse{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *StderrResponse + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringStdoutResponse(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &StdoutResponse{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *StdoutResponse + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringStopRequest(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &StopRequest{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *StopRequest + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringStoppedResponse(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &StoppedResponse{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *StoppedResponse + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringSubmissionFileInfo(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &SubmissionFileInfo{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmissionFileInfo + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringSubmissionIDNotFound(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &SubmissionIDNotFound{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmissionIDNotFound + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringSubmitRequestV2(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &SubmitRequestV2{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmitRequestV2 + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringTerminatedResponse(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &TerminatedResponse{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TerminatedResponse + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringTestCaseHiddenGrade(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &TestCaseHiddenGrade{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseHiddenGrade + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringTestCaseNonHiddenGrade(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &TestCaseNonHiddenGrade{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseNonHiddenGrade + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringTestCaseResult(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &TestCaseResult{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseResult + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringTestCaseResultWithStdout(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &TestCaseResultWithStdout{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseResultWithStdout + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringTestSubmissionState(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &TestSubmissionState{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestSubmissionState + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringTestSubmissionStatusV2(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &TestSubmissionStatusV2{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestSubmissionStatusV2 + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringTestSubmissionUpdate(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &TestSubmissionUpdate{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestSubmissionUpdate + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringTraceResponse(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &TraceResponse{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TraceResponse + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringTraceResponseV2(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &TraceResponseV2{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TraceResponseV2 + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringTraceResponsesPage(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &TraceResponsesPage{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TraceResponsesPage + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringTraceResponsesPageV2(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &TraceResponsesPageV2{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TraceResponsesPageV2 + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringTracedFile(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &TracedFile{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TracedFile + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringTracedTestCase(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &TracedTestCase{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TracedTestCase + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringUnexpectedLanguageError(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &UnexpectedLanguageError{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *UnexpectedLanguageError + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringWorkspaceFiles(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &WorkspaceFiles{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceFiles + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringWorkspaceRanResponse(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &WorkspaceRanResponse{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceRanResponse + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringWorkspaceRunDetails(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &WorkspaceRunDetails{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceRunDetails + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringWorkspaceStarterFilesResponse(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &WorkspaceStarterFilesResponse{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceStarterFilesResponse + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringWorkspaceStarterFilesResponseV2(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &WorkspaceStarterFilesResponseV2{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceStarterFilesResponseV2 + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringWorkspaceSubmissionState(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &WorkspaceSubmissionState{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceSubmissionState + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringWorkspaceSubmissionStatusV2(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &WorkspaceSubmissionStatusV2{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceSubmissionStatusV2 + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringWorkspaceSubmissionUpdate(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &WorkspaceSubmissionUpdate{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceSubmissionUpdate + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringWorkspaceSubmitRequest(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &WorkspaceSubmitRequest{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceSubmitRequest + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringWorkspaceTracedUpdate(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &WorkspaceTracedUpdate{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceTracedUpdate + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestEnumExecutionSessionStatus(t *testing.T) { + t.Run("NewFromString_CREATING_CONTAINER", func(t *testing.T) { + t.Parallel() + val, err := NewExecutionSessionStatusFromString("CREATING_CONTAINER") + assert.NoError(t, err, "valid enum value should not return error") + assert.Equal(t, ExecutionSessionStatus("CREATING_CONTAINER"), val, "enum value should match expected wire value") + }) + + t.Run("NewFromString_PROVISIONING_CONTAINER", func(t *testing.T) { + t.Parallel() + val, err := NewExecutionSessionStatusFromString("PROVISIONING_CONTAINER") + assert.NoError(t, err, "valid enum value should not return error") + assert.Equal(t, ExecutionSessionStatus("PROVISIONING_CONTAINER"), val, "enum value should match expected wire value") + }) + + t.Run("NewFromString_PENDING_CONTAINER", func(t *testing.T) { + t.Parallel() + val, err := NewExecutionSessionStatusFromString("PENDING_CONTAINER") + assert.NoError(t, err, "valid enum value should not return error") + assert.Equal(t, ExecutionSessionStatus("PENDING_CONTAINER"), val, "enum value should match expected wire value") + }) + + t.Run("NewFromString_RUNNING_CONTAINER", func(t *testing.T) { + t.Parallel() + val, err := NewExecutionSessionStatusFromString("RUNNING_CONTAINER") + assert.NoError(t, err, "valid enum value should not return error") + assert.Equal(t, ExecutionSessionStatus("RUNNING_CONTAINER"), val, "enum value should match expected wire value") + }) + + t.Run("NewFromString_LIVE_CONTAINER", func(t *testing.T) { + t.Parallel() + val, err := NewExecutionSessionStatusFromString("LIVE_CONTAINER") + assert.NoError(t, err, "valid enum value should not return error") + assert.Equal(t, ExecutionSessionStatus("LIVE_CONTAINER"), val, "enum value should match expected wire value") + }) + + t.Run("NewFromString_FAILED_TO_LAUNCH", func(t *testing.T) { + t.Parallel() + val, err := NewExecutionSessionStatusFromString("FAILED_TO_LAUNCH") + assert.NoError(t, err, "valid enum value should not return error") + assert.Equal(t, ExecutionSessionStatus("FAILED_TO_LAUNCH"), val, "enum value should match expected wire value") + }) + + t.Run("NewFromString_Invalid", func(t *testing.T) { + _, err := NewExecutionSessionStatusFromString("invalid_value_that_does_not_exist") + assert.Error(t, err) + }) + + t.Run("Ptr", func(t *testing.T) { + val, err := NewExecutionSessionStatusFromString("CREATING_CONTAINER") + assert.NoError(t, err) + ptr := val.Ptr() + assert.NotNil(t, ptr) + assert.Equal(t, val, *ptr) + }) +} + +func TestEnumRunningSubmissionState(t *testing.T) { + t.Run("NewFromString_QUEUEING_SUBMISSION", func(t *testing.T) { + t.Parallel() + val, err := NewRunningSubmissionStateFromString("QUEUEING_SUBMISSION") + assert.NoError(t, err, "valid enum value should not return error") + assert.Equal(t, RunningSubmissionState("QUEUEING_SUBMISSION"), val, "enum value should match expected wire value") + }) + + t.Run("NewFromString_KILLING_HISTORICAL_SUBMISSIONS", func(t *testing.T) { + t.Parallel() + val, err := NewRunningSubmissionStateFromString("KILLING_HISTORICAL_SUBMISSIONS") + assert.NoError(t, err, "valid enum value should not return error") + assert.Equal(t, RunningSubmissionState("KILLING_HISTORICAL_SUBMISSIONS"), val, "enum value should match expected wire value") + }) + + t.Run("NewFromString_WRITING_SUBMISSION_TO_FILE", func(t *testing.T) { + t.Parallel() + val, err := NewRunningSubmissionStateFromString("WRITING_SUBMISSION_TO_FILE") + assert.NoError(t, err, "valid enum value should not return error") + assert.Equal(t, RunningSubmissionState("WRITING_SUBMISSION_TO_FILE"), val, "enum value should match expected wire value") + }) + + t.Run("NewFromString_COMPILING_SUBMISSION", func(t *testing.T) { + t.Parallel() + val, err := NewRunningSubmissionStateFromString("COMPILING_SUBMISSION") + assert.NoError(t, err, "valid enum value should not return error") + assert.Equal(t, RunningSubmissionState("COMPILING_SUBMISSION"), val, "enum value should match expected wire value") + }) + + t.Run("NewFromString_RUNNING_SUBMISSION", func(t *testing.T) { + t.Parallel() + val, err := NewRunningSubmissionStateFromString("RUNNING_SUBMISSION") + assert.NoError(t, err, "valid enum value should not return error") + assert.Equal(t, RunningSubmissionState("RUNNING_SUBMISSION"), val, "enum value should match expected wire value") + }) + + t.Run("NewFromString_Invalid", func(t *testing.T) { + _, err := NewRunningSubmissionStateFromString("invalid_value_that_does_not_exist") + assert.Error(t, err) + }) + + t.Run("Ptr", func(t *testing.T) { + val, err := NewRunningSubmissionStateFromString("QUEUEING_SUBMISSION") + assert.NoError(t, err) + ptr := val.Ptr() + assert.NotNil(t, ptr) + assert.Equal(t, val, *ptr) + }) +} + +func TestEnumSubmissionTypeEnum(t *testing.T) { + t.Run("NewFromString_TEST", func(t *testing.T) { + t.Parallel() + val, err := NewSubmissionTypeEnumFromString("TEST") + assert.NoError(t, err, "valid enum value should not return error") + assert.Equal(t, SubmissionTypeEnum("TEST"), val, "enum value should match expected wire value") + }) + + t.Run("NewFromString_Invalid", func(t *testing.T) { + _, err := NewSubmissionTypeEnumFromString("invalid_value_that_does_not_exist") + assert.Error(t, err) + }) + + t.Run("Ptr", func(t *testing.T) { + val, err := NewSubmissionTypeEnumFromString("TEST") + assert.NoError(t, err) + ptr := val.Ptr() + assert.NotNil(t, ptr) + assert.Equal(t, val, *ptr) + }) +} + +func TestExtraPropertiesBuildingExecutorResponse(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &BuildingExecutorResponse{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BuildingExecutorResponse + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesCompileError(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &CompileError{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CompileError + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesCustomTestCasesUnsupported(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &CustomTestCasesUnsupported{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CustomTestCasesUnsupported + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesErroredResponse(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &ErroredResponse{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ErroredResponse + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesExceptionInfo(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &ExceptionInfo{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ExceptionInfo + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesExecutionSessionResponse(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &ExecutionSessionResponse{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ExecutionSessionResponse + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesExecutionSessionState(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &ExecutionSessionState{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ExecutionSessionState + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesExistingSubmissionExecuting(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &ExistingSubmissionExecuting{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ExistingSubmissionExecuting + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesExpressionLocation(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &ExpressionLocation{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ExpressionLocation + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesFinishedResponse(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &FinishedResponse{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FinishedResponse + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesGetExecutionSessionStateResponse(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &GetExecutionSessionStateResponse{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetExecutionSessionStateResponse + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesGetSubmissionStateResponse(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &GetSubmissionStateResponse{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetSubmissionStateResponse + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesGetTraceResponsesPageRequest(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &GetTraceResponsesPageRequest{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetTraceResponsesPageRequest + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesGradedResponse(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &GradedResponse{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GradedResponse + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesGradedResponseV2(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &GradedResponseV2{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GradedResponseV2 + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesGradedTestCaseUpdate(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &GradedTestCaseUpdate{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GradedTestCaseUpdate + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesInitializeProblemRequest(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &InitializeProblemRequest{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *InitializeProblemRequest + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesInternalError(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &InternalError{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *InternalError + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesInvalidRequestResponse(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &InvalidRequestResponse{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *InvalidRequestResponse + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesLightweightStackframeInformation(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &LightweightStackframeInformation{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *LightweightStackframeInformation + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesRecordedResponseNotification(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &RecordedResponseNotification{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *RecordedResponseNotification + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesRecordedTestCaseUpdate(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &RecordedTestCaseUpdate{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *RecordedTestCaseUpdate + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesRecordingResponseNotification(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &RecordingResponseNotification{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *RecordingResponseNotification + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesRunningResponse(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &RunningResponse{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *RunningResponse + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesRuntimeError(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &RuntimeError{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *RuntimeError + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesScope(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &Scope{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *Scope + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesStackFrame(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &StackFrame{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *StackFrame + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesStackInformation(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &StackInformation{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *StackInformation + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesStderrResponse(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &StderrResponse{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *StderrResponse + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesStdoutResponse(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &StdoutResponse{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *StdoutResponse + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesStopRequest(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &StopRequest{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *StopRequest + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesStoppedResponse(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &StoppedResponse{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *StoppedResponse + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesSubmissionFileInfo(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &SubmissionFileInfo{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmissionFileInfo + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesSubmissionIDNotFound(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &SubmissionIDNotFound{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmissionIDNotFound + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesSubmitRequestV2(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &SubmitRequestV2{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *SubmitRequestV2 + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesTerminatedResponse(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &TerminatedResponse{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TerminatedResponse + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesTestCaseHiddenGrade(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &TestCaseHiddenGrade{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseHiddenGrade + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesTestCaseNonHiddenGrade(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &TestCaseNonHiddenGrade{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseNonHiddenGrade + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesTestCaseResult(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &TestCaseResult{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseResult + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesTestCaseResultWithStdout(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &TestCaseResultWithStdout{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseResultWithStdout + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesTestSubmissionState(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &TestSubmissionState{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestSubmissionState + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesTestSubmissionStatusV2(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &TestSubmissionStatusV2{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestSubmissionStatusV2 + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesTestSubmissionUpdate(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &TestSubmissionUpdate{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestSubmissionUpdate + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesTraceResponse(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &TraceResponse{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TraceResponse + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesTraceResponseV2(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &TraceResponseV2{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TraceResponseV2 + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesTraceResponsesPage(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &TraceResponsesPage{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TraceResponsesPage + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesTraceResponsesPageV2(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &TraceResponsesPageV2{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TraceResponsesPageV2 + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesTracedFile(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &TracedFile{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TracedFile + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesTracedTestCase(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &TracedTestCase{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TracedTestCase + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesUnexpectedLanguageError(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &UnexpectedLanguageError{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *UnexpectedLanguageError + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesWorkspaceFiles(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &WorkspaceFiles{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceFiles + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesWorkspaceRanResponse(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &WorkspaceRanResponse{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceRanResponse + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesWorkspaceRunDetails(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &WorkspaceRunDetails{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceRunDetails + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesWorkspaceStarterFilesResponse(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &WorkspaceStarterFilesResponse{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceStarterFilesResponse + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesWorkspaceStarterFilesResponseV2(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &WorkspaceStarterFilesResponseV2{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceStarterFilesResponseV2 + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesWorkspaceSubmissionState(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &WorkspaceSubmissionState{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceSubmissionState + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesWorkspaceSubmissionStatusV2(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &WorkspaceSubmissionStatusV2{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceSubmissionStatusV2 + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesWorkspaceSubmissionUpdate(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &WorkspaceSubmissionUpdate{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceSubmissionUpdate + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesWorkspaceSubmitRequest(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &WorkspaceSubmitRequest{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceSubmitRequest + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesWorkspaceTracedUpdate(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &WorkspaceTracedUpdate{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *WorkspaceTracedUpdate + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} diff --git a/seed/go-sdk/trace/sysprop/client.go b/seed/go-sdk/trace/sysprop/client.go new file mode 100644 index 000000000000..81886575c05a --- /dev/null +++ b/seed/go-sdk/trace/sysprop/client.go @@ -0,0 +1,67 @@ +// Code generated by Fern. DO NOT EDIT. + +package sysprop + +import ( + context "context" + + common "github.com/trace/fern/common" + core "github.com/trace/fern/core" + internal "github.com/trace/fern/internal" + option "github.com/trace/fern/option" +) + +type Client struct { + WithRawResponse *RawClient + + options *core.RequestOptions + baseURL string + caller *internal.Caller +} + +func NewClient(options *core.RequestOptions) *Client { + return &Client{ + WithRawResponse: NewRawClient(options), + options: options, + baseURL: options.BaseURL, + caller: internal.NewCaller( + &internal.CallerParams{ + Client: options.HTTPClient, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + }, + ), + } +} + +func (c *Client) SetNumWarmInstances( + ctx context.Context, + language *common.Language, + numWarmInstances int, + opts ...option.RequestOption, +) error { + _, err := c.WithRawResponse.SetNumWarmInstances( + ctx, + language, + numWarmInstances, + opts..., + ) + if err != nil { + return err + } + return nil +} + +func (c *Client) GetNumWarmInstances( + ctx context.Context, + opts ...option.RequestOption, +) (map[*common.Language]int, error) { + response, err := c.WithRawResponse.GetNumWarmInstances( + ctx, + opts..., + ) + if err != nil { + return nil, err + } + return response.Body, nil +} diff --git a/seed/go-sdk/trace/sysprop/raw_client.go b/seed/go-sdk/trace/sysprop/raw_client.go new file mode 100644 index 000000000000..5e045708e855 --- /dev/null +++ b/seed/go-sdk/trace/sysprop/raw_client.go @@ -0,0 +1,117 @@ +// Code generated by Fern. DO NOT EDIT. + +package sysprop + +import ( + context "context" + http "net/http" + + common "github.com/trace/fern/common" + core "github.com/trace/fern/core" + internal "github.com/trace/fern/internal" + option "github.com/trace/fern/option" +) + +type RawClient struct { + baseURL string + caller *internal.Caller + options *core.RequestOptions +} + +func NewRawClient(options *core.RequestOptions) *RawClient { + return &RawClient{ + options: options, + baseURL: options.BaseURL, + caller: internal.NewCaller( + &internal.CallerParams{ + Client: options.HTTPClient, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + }, + ), + } +} + +func (r *RawClient) SetNumWarmInstances( + ctx context.Context, + language *common.Language, + numWarmInstances int, + opts ...option.RequestOption, +) (*core.Response[any], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.trace.come", + ) + endpointURL := internal.EncodeURL( + baseURL+"/sysprop/num-warm-instances/%v/%v", + language, + numWarmInstances, + ) + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodPut, + Headers: headers, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + }, + ) + if err != nil { + return nil, err + } + return &core.Response[any]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: nil, + }, nil +} + +func (r *RawClient) GetNumWarmInstances( + ctx context.Context, + opts ...option.RequestOption, +) (*core.Response[map[*common.Language]int], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.trace.come", + ) + endpointURL := baseURL + "/sysprop/num-warm-instances" + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + var response map[*common.Language]int + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodGet, + Headers: headers, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + Response: &response, + }, + ) + if err != nil { + return nil, err + } + return &core.Response[map[*common.Language]int]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: response, + }, nil +} diff --git a/seed/go-sdk/trace/v2/client/client.go b/seed/go-sdk/trace/v2/client/client.go new file mode 100644 index 000000000000..9d5d0daf06a9 --- /dev/null +++ b/seed/go-sdk/trace/v2/client/client.go @@ -0,0 +1,54 @@ +// Code generated by Fern. DO NOT EDIT. + +package client + +import ( + context "context" + + core "github.com/trace/fern/core" + internal "github.com/trace/fern/internal" + option "github.com/trace/fern/option" + problem "github.com/trace/fern/v2/problem" + client "github.com/trace/fern/v2/v3/client" +) + +type Client struct { + WithRawResponse *RawClient + Problem *problem.Client + V3 *client.Client + + options *core.RequestOptions + baseURL string + caller *internal.Caller +} + +func NewClient(options *core.RequestOptions) *Client { + return &Client{ + Problem: problem.NewClient(options), + V3: client.NewClient(options), + WithRawResponse: NewRawClient(options), + options: options, + baseURL: options.BaseURL, + caller: internal.NewCaller( + &internal.CallerParams{ + Client: options.HTTPClient, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + }, + ), + } +} + +func (c *Client) Test( + ctx context.Context, + opts ...option.RequestOption, +) error { + _, err := c.WithRawResponse.Test( + ctx, + opts..., + ) + if err != nil { + return err + } + return nil +} diff --git a/seed/go-sdk/trace/v2/client/raw_client.go b/seed/go-sdk/trace/v2/client/raw_client.go new file mode 100644 index 000000000000..bf0ac18c178f --- /dev/null +++ b/seed/go-sdk/trace/v2/client/raw_client.go @@ -0,0 +1,70 @@ +// Code generated by Fern. DO NOT EDIT. + +package client + +import ( + context "context" + http "net/http" + + core "github.com/trace/fern/core" + internal "github.com/trace/fern/internal" + option "github.com/trace/fern/option" +) + +type RawClient struct { + baseURL string + caller *internal.Caller + options *core.RequestOptions +} + +func NewRawClient(options *core.RequestOptions) *RawClient { + return &RawClient{ + options: options, + baseURL: options.BaseURL, + caller: internal.NewCaller( + &internal.CallerParams{ + Client: options.HTTPClient, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + }, + ), + } +} + +func (r *RawClient) Test( + ctx context.Context, + opts ...option.RequestOption, +) (*core.Response[any], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.trace.come", + ) + endpointURL := baseURL + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodGet, + Headers: headers, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + }, + ) + if err != nil { + return nil, err + } + return &core.Response[any]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: nil, + }, nil +} diff --git a/seed/go-sdk/trace/v2/error_codes.go b/seed/go-sdk/trace/v2/error_codes.go new file mode 100644 index 000000000000..76e71534fc56 --- /dev/null +++ b/seed/go-sdk/trace/v2/error_codes.go @@ -0,0 +1,9 @@ +// Code generated by Fern. DO NOT EDIT. + +package v2 + +import ( + internal "github.com/trace/fern/internal" +) + +var ErrorCodes internal.ErrorCodes = internal.ErrorCodes{} diff --git a/seed/go-sdk/trace/v2/problem.go b/seed/go-sdk/trace/v2/problem.go new file mode 100644 index 000000000000..d2e4e34786ae --- /dev/null +++ b/seed/go-sdk/trace/v2/problem.go @@ -0,0 +1,1295 @@ +// Code generated by Fern. DO NOT EDIT. + +package v2 + +import ( + json "encoding/json" + fmt "fmt" + common "github.com/trace/fern/common" + v2 "github.com/trace/fern/common/v2" + internal "github.com/trace/fern/internal" + big "math/big" +) + +var ( + createProblemRequestV2FieldProblemName = big.NewInt(1 << 0) + createProblemRequestV2FieldProblemDescription = big.NewInt(1 << 1) + createProblemRequestV2FieldCustomFiles = big.NewInt(1 << 2) + createProblemRequestV2FieldCustomTestCaseTemplates = big.NewInt(1 << 3) + createProblemRequestV2FieldTestcases = big.NewInt(1 << 4) + createProblemRequestV2FieldSupportedLanguages = big.NewInt(1 << 5) + createProblemRequestV2FieldIsPublic = big.NewInt(1 << 6) +) + +type CreateProblemRequestV2 struct { + ProblemName string `json:"problemName" url:"problemName"` + ProblemDescription *common.ProblemDescription `json:"problemDescription" url:"problemDescription"` + CustomFiles *v2.CustomFiles `json:"customFiles" url:"customFiles"` + CustomTestCaseTemplates []*v2.TestCaseTemplate `json:"customTestCaseTemplates" url:"customTestCaseTemplates"` + Testcases []*v2.TestCaseV2 `json:"testcases" url:"testcases"` + SupportedLanguages []common.Language `json:"supportedLanguages" url:"supportedLanguages"` + IsPublic bool `json:"isPublic" url:"isPublic"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (c *CreateProblemRequestV2) GetProblemName() string { + if c == nil { + return "" + } + return c.ProblemName +} + +func (c *CreateProblemRequestV2) GetProblemDescription() *common.ProblemDescription { + if c == nil { + return nil + } + return c.ProblemDescription +} + +func (c *CreateProblemRequestV2) GetCustomFiles() *v2.CustomFiles { + if c == nil { + return nil + } + return c.CustomFiles +} + +func (c *CreateProblemRequestV2) GetCustomTestCaseTemplates() []*v2.TestCaseTemplate { + if c == nil { + return nil + } + return c.CustomTestCaseTemplates +} + +func (c *CreateProblemRequestV2) GetTestcases() []*v2.TestCaseV2 { + if c == nil { + return nil + } + return c.Testcases +} + +func (c *CreateProblemRequestV2) GetSupportedLanguages() []common.Language { + if c == nil { + return nil + } + return c.SupportedLanguages +} + +func (c *CreateProblemRequestV2) GetIsPublic() bool { + if c == nil { + return false + } + return c.IsPublic +} + +func (c *CreateProblemRequestV2) GetExtraProperties() map[string]interface{} { + if c == nil { + return nil + } + return c.extraProperties +} + +func (c *CreateProblemRequestV2) require(field *big.Int) { + if c.explicitFields == nil { + c.explicitFields = big.NewInt(0) + } + c.explicitFields.Or(c.explicitFields, field) +} + +// SetProblemName sets the ProblemName field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CreateProblemRequestV2) SetProblemName(problemName string) { + c.ProblemName = problemName + c.require(createProblemRequestV2FieldProblemName) +} + +// SetProblemDescription sets the ProblemDescription field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CreateProblemRequestV2) SetProblemDescription(problemDescription *common.ProblemDescription) { + c.ProblemDescription = problemDescription + c.require(createProblemRequestV2FieldProblemDescription) +} + +// SetCustomFiles sets the CustomFiles field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CreateProblemRequestV2) SetCustomFiles(customFiles *v2.CustomFiles) { + c.CustomFiles = customFiles + c.require(createProblemRequestV2FieldCustomFiles) +} + +// SetCustomTestCaseTemplates sets the CustomTestCaseTemplates field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CreateProblemRequestV2) SetCustomTestCaseTemplates(customTestCaseTemplates []*v2.TestCaseTemplate) { + c.CustomTestCaseTemplates = customTestCaseTemplates + c.require(createProblemRequestV2FieldCustomTestCaseTemplates) +} + +// SetTestcases sets the Testcases field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CreateProblemRequestV2) SetTestcases(testcases []*v2.TestCaseV2) { + c.Testcases = testcases + c.require(createProblemRequestV2FieldTestcases) +} + +// SetSupportedLanguages sets the SupportedLanguages field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CreateProblemRequestV2) SetSupportedLanguages(supportedLanguages []common.Language) { + c.SupportedLanguages = supportedLanguages + c.require(createProblemRequestV2FieldSupportedLanguages) +} + +// SetIsPublic sets the IsPublic field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CreateProblemRequestV2) SetIsPublic(isPublic bool) { + c.IsPublic = isPublic + c.require(createProblemRequestV2FieldIsPublic) +} + +func (c *CreateProblemRequestV2) UnmarshalJSON(data []byte) error { + type unmarshaler CreateProblemRequestV2 + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CreateProblemRequestV2(value) + extraProperties, err := internal.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + c.rawJSON = json.RawMessage(data) + return nil +} + +func (c *CreateProblemRequestV2) MarshalJSON() ([]byte, error) { + type embed CreateProblemRequestV2 + var marshaler = struct { + embed + }{ + embed: embed(*c), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, c.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (c *CreateProblemRequestV2) String() string { + if c == nil { + return "" + } + if len(c.rawJSON) > 0 { + if value, err := internal.StringifyJSON(c.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +var ( + defaultProvidedFileFieldFile = big.NewInt(1 << 0) + defaultProvidedFileFieldRelatedTypes = big.NewInt(1 << 1) +) + +type DefaultProvidedFile struct { + File *v2.FileInfoV2 `json:"file" url:"file"` + RelatedTypes []*common.VariableType `json:"relatedTypes" url:"relatedTypes"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (d *DefaultProvidedFile) GetFile() *v2.FileInfoV2 { + if d == nil { + return nil + } + return d.File +} + +func (d *DefaultProvidedFile) GetRelatedTypes() []*common.VariableType { + if d == nil { + return nil + } + return d.RelatedTypes +} + +func (d *DefaultProvidedFile) GetExtraProperties() map[string]interface{} { + if d == nil { + return nil + } + return d.extraProperties +} + +func (d *DefaultProvidedFile) require(field *big.Int) { + if d.explicitFields == nil { + d.explicitFields = big.NewInt(0) + } + d.explicitFields.Or(d.explicitFields, field) +} + +// SetFile sets the File field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (d *DefaultProvidedFile) SetFile(file *v2.FileInfoV2) { + d.File = file + d.require(defaultProvidedFileFieldFile) +} + +// SetRelatedTypes sets the RelatedTypes field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (d *DefaultProvidedFile) SetRelatedTypes(relatedTypes []*common.VariableType) { + d.RelatedTypes = relatedTypes + d.require(defaultProvidedFileFieldRelatedTypes) +} + +func (d *DefaultProvidedFile) UnmarshalJSON(data []byte) error { + type unmarshaler DefaultProvidedFile + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DefaultProvidedFile(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) + return nil +} + +func (d *DefaultProvidedFile) MarshalJSON() ([]byte, error) { + type embed DefaultProvidedFile + var marshaler = struct { + embed + }{ + embed: embed(*d), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, d.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (d *DefaultProvidedFile) String() string { + if d == nil { + return "" + } + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +type FunctionSignature struct { + Type string + Void *VoidFunctionSignature + NonVoid *v2.NonVoidFunctionSignature + // Useful when specifying custom grading for a testcase where actualResult is defined. + VoidThatTakesActualResult *VoidFunctionSignatureThatTakesActualResult + + rawJSON json.RawMessage +} + +func (f *FunctionSignature) GetType() string { + if f == nil { + return "" + } + return f.Type +} + +func (f *FunctionSignature) GetVoid() *VoidFunctionSignature { + if f == nil { + return nil + } + return f.Void +} + +func (f *FunctionSignature) GetNonVoid() *v2.NonVoidFunctionSignature { + if f == nil { + return nil + } + return f.NonVoid +} + +func (f *FunctionSignature) GetVoidThatTakesActualResult() *VoidFunctionSignatureThatTakesActualResult { + if f == nil { + return nil + } + return f.VoidThatTakesActualResult +} + +func (f *FunctionSignature) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + f.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", f) + } + switch unmarshaler.Type { + case "void": + value := new(VoidFunctionSignature) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + f.Void = value + case "nonVoid": + value := new(v2.NonVoidFunctionSignature) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + f.NonVoid = value + case "voidThatTakesActualResult": + value := new(VoidFunctionSignatureThatTakesActualResult) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + f.VoidThatTakesActualResult = value + } + f.rawJSON = json.RawMessage(data) + return nil +} + +func (f FunctionSignature) MarshalJSON() ([]byte, error) { + if err := f.validate(); err != nil { + return nil, err + } + if f.Void != nil { + return internal.MarshalJSONWithExtraProperty(f.Void, "type", "void") + } + if f.NonVoid != nil { + return internal.MarshalJSONWithExtraProperty(f.NonVoid, "type", "nonVoid") + } + if f.VoidThatTakesActualResult != nil { + return internal.MarshalJSONWithExtraProperty(f.VoidThatTakesActualResult, "type", "voidThatTakesActualResult") + } + if len(f.rawJSON) > 0 { + return f.rawJSON, nil + } + return nil, fmt.Errorf("type %T does not define a non-empty union type", f) +} + +type FunctionSignatureVisitor interface { + VisitVoid(*VoidFunctionSignature) error + VisitNonVoid(*v2.NonVoidFunctionSignature) error + VisitVoidThatTakesActualResult(*VoidFunctionSignatureThatTakesActualResult) error +} + +func (f *FunctionSignature) Accept(visitor FunctionSignatureVisitor) error { + if f.Void != nil { + return visitor.VisitVoid(f.Void) + } + if f.NonVoid != nil { + return visitor.VisitNonVoid(f.NonVoid) + } + if f.VoidThatTakesActualResult != nil { + return visitor.VisitVoidThatTakesActualResult(f.VoidThatTakesActualResult) + } + return fmt.Errorf("type %T does not define a non-empty union type", f) +} + +func (f *FunctionSignature) validate() error { + if f == nil { + return fmt.Errorf("type %T is nil", f) + } + var fields []string + if f.Void != nil { + fields = append(fields, "void") + } + if f.NonVoid != nil { + fields = append(fields, "nonVoid") + } + if f.VoidThatTakesActualResult != nil { + fields = append(fields, "voidThatTakesActualResult") + } + if len(fields) == 0 { + if f.Type != "" { + if len(f.rawJSON) > 0 { + return nil + } + return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", f, f.Type) + } + return fmt.Errorf("type %T is empty", f) + } + if len(fields) > 1 { + return fmt.Errorf("type %T defines values for %s, but only one value is allowed", f, fields) + } + if f.Type != "" { + field := fields[0] + if f.Type != field { + return fmt.Errorf( + "type %T defines a discriminant set to %q, but it does not match the %T field; either remove or update the discriminant to match", + f, + f.Type, + f, + ) + } + } + return nil +} + +var ( + getBasicSolutionFileRequestFieldMethodName = big.NewInt(1 << 0) + getBasicSolutionFileRequestFieldSignature = big.NewInt(1 << 1) +) + +type GetBasicSolutionFileRequest struct { + MethodName string `json:"methodName" url:"methodName"` + Signature *v2.NonVoidFunctionSignature `json:"signature" url:"signature"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (g *GetBasicSolutionFileRequest) GetMethodName() string { + if g == nil { + return "" + } + return g.MethodName +} + +func (g *GetBasicSolutionFileRequest) GetSignature() *v2.NonVoidFunctionSignature { + if g == nil { + return nil + } + return g.Signature +} + +func (g *GetBasicSolutionFileRequest) GetExtraProperties() map[string]interface{} { + if g == nil { + return nil + } + return g.extraProperties +} + +func (g *GetBasicSolutionFileRequest) require(field *big.Int) { + if g.explicitFields == nil { + g.explicitFields = big.NewInt(0) + } + g.explicitFields.Or(g.explicitFields, field) +} + +// SetMethodName sets the MethodName field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetBasicSolutionFileRequest) SetMethodName(methodName string) { + g.MethodName = methodName + g.require(getBasicSolutionFileRequestFieldMethodName) +} + +// SetSignature sets the Signature field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetBasicSolutionFileRequest) SetSignature(signature *v2.NonVoidFunctionSignature) { + g.Signature = signature + g.require(getBasicSolutionFileRequestFieldSignature) +} + +func (g *GetBasicSolutionFileRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetBasicSolutionFileRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetBasicSolutionFileRequest(value) + extraProperties, err := internal.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + g.rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetBasicSolutionFileRequest) MarshalJSON() ([]byte, error) { + type embed GetBasicSolutionFileRequest + var marshaler = struct { + embed + }{ + embed: embed(*g), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, g.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (g *GetBasicSolutionFileRequest) String() string { + if g == nil { + return "" + } + if len(g.rawJSON) > 0 { + if value, err := internal.StringifyJSON(g.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +var ( + getBasicSolutionFileResponseFieldSolutionFileByLanguage = big.NewInt(1 << 0) +) + +type GetBasicSolutionFileResponse struct { + SolutionFileByLanguage map[common.Language]*v2.FileInfoV2 `json:"solutionFileByLanguage" url:"solutionFileByLanguage"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (g *GetBasicSolutionFileResponse) GetSolutionFileByLanguage() map[common.Language]*v2.FileInfoV2 { + if g == nil { + return nil + } + return g.SolutionFileByLanguage +} + +func (g *GetBasicSolutionFileResponse) GetExtraProperties() map[string]interface{} { + if g == nil { + return nil + } + return g.extraProperties +} + +func (g *GetBasicSolutionFileResponse) require(field *big.Int) { + if g.explicitFields == nil { + g.explicitFields = big.NewInt(0) + } + g.explicitFields.Or(g.explicitFields, field) +} + +// SetSolutionFileByLanguage sets the SolutionFileByLanguage field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetBasicSolutionFileResponse) SetSolutionFileByLanguage(solutionFileByLanguage map[common.Language]*v2.FileInfoV2) { + g.SolutionFileByLanguage = solutionFileByLanguage + g.require(getBasicSolutionFileResponseFieldSolutionFileByLanguage) +} + +func (g *GetBasicSolutionFileResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetBasicSolutionFileResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetBasicSolutionFileResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + g.rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetBasicSolutionFileResponse) MarshalJSON() ([]byte, error) { + type embed GetBasicSolutionFileResponse + var marshaler = struct { + embed + }{ + embed: embed(*g), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, g.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (g *GetBasicSolutionFileResponse) String() string { + if g == nil { + return "" + } + if len(g.rawJSON) > 0 { + if value, err := internal.StringifyJSON(g.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +var ( + getFunctionSignatureRequestFieldFunctionSignature = big.NewInt(1 << 0) +) + +type GetFunctionSignatureRequest struct { + FunctionSignature *FunctionSignature `json:"functionSignature" url:"functionSignature"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (g *GetFunctionSignatureRequest) GetFunctionSignature() *FunctionSignature { + if g == nil { + return nil + } + return g.FunctionSignature +} + +func (g *GetFunctionSignatureRequest) GetExtraProperties() map[string]interface{} { + if g == nil { + return nil + } + return g.extraProperties +} + +func (g *GetFunctionSignatureRequest) require(field *big.Int) { + if g.explicitFields == nil { + g.explicitFields = big.NewInt(0) + } + g.explicitFields.Or(g.explicitFields, field) +} + +// SetFunctionSignature sets the FunctionSignature field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetFunctionSignatureRequest) SetFunctionSignature(functionSignature *FunctionSignature) { + g.FunctionSignature = functionSignature + g.require(getFunctionSignatureRequestFieldFunctionSignature) +} + +func (g *GetFunctionSignatureRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetFunctionSignatureRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetFunctionSignatureRequest(value) + extraProperties, err := internal.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + g.rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetFunctionSignatureRequest) MarshalJSON() ([]byte, error) { + type embed GetFunctionSignatureRequest + var marshaler = struct { + embed + }{ + embed: embed(*g), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, g.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (g *GetFunctionSignatureRequest) String() string { + if g == nil { + return "" + } + if len(g.rawJSON) > 0 { + if value, err := internal.StringifyJSON(g.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +var ( + getFunctionSignatureResponseFieldFunctionByLanguage = big.NewInt(1 << 0) +) + +type GetFunctionSignatureResponse struct { + FunctionByLanguage map[common.Language]string `json:"functionByLanguage" url:"functionByLanguage"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (g *GetFunctionSignatureResponse) GetFunctionByLanguage() map[common.Language]string { + if g == nil { + return nil + } + return g.FunctionByLanguage +} + +func (g *GetFunctionSignatureResponse) GetExtraProperties() map[string]interface{} { + if g == nil { + return nil + } + return g.extraProperties +} + +func (g *GetFunctionSignatureResponse) require(field *big.Int) { + if g.explicitFields == nil { + g.explicitFields = big.NewInt(0) + } + g.explicitFields.Or(g.explicitFields, field) +} + +// SetFunctionByLanguage sets the FunctionByLanguage field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetFunctionSignatureResponse) SetFunctionByLanguage(functionByLanguage map[common.Language]string) { + g.FunctionByLanguage = functionByLanguage + g.require(getFunctionSignatureResponseFieldFunctionByLanguage) +} + +func (g *GetFunctionSignatureResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetFunctionSignatureResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetFunctionSignatureResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + g.rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetFunctionSignatureResponse) MarshalJSON() ([]byte, error) { + type embed GetFunctionSignatureResponse + var marshaler = struct { + embed + }{ + embed: embed(*g), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, g.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (g *GetFunctionSignatureResponse) String() string { + if g == nil { + return "" + } + if len(g.rawJSON) > 0 { + if value, err := internal.StringifyJSON(g.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +var ( + getGeneratedTestCaseFileRequestFieldTemplate = big.NewInt(1 << 0) + getGeneratedTestCaseFileRequestFieldTestCase = big.NewInt(1 << 1) +) + +type GetGeneratedTestCaseFileRequest struct { + Template *v2.TestCaseTemplate `json:"template,omitempty" url:"template,omitempty"` + TestCase *v2.TestCaseV2 `json:"testCase" url:"testCase"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (g *GetGeneratedTestCaseFileRequest) GetTemplate() *v2.TestCaseTemplate { + if g == nil { + return nil + } + return g.Template +} + +func (g *GetGeneratedTestCaseFileRequest) GetTestCase() *v2.TestCaseV2 { + if g == nil { + return nil + } + return g.TestCase +} + +func (g *GetGeneratedTestCaseFileRequest) GetExtraProperties() map[string]interface{} { + if g == nil { + return nil + } + return g.extraProperties +} + +func (g *GetGeneratedTestCaseFileRequest) require(field *big.Int) { + if g.explicitFields == nil { + g.explicitFields = big.NewInt(0) + } + g.explicitFields.Or(g.explicitFields, field) +} + +// SetTemplate sets the Template field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetGeneratedTestCaseFileRequest) SetTemplate(template *v2.TestCaseTemplate) { + g.Template = template + g.require(getGeneratedTestCaseFileRequestFieldTemplate) +} + +// SetTestCase sets the TestCase field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetGeneratedTestCaseFileRequest) SetTestCase(testCase *v2.TestCaseV2) { + g.TestCase = testCase + g.require(getGeneratedTestCaseFileRequestFieldTestCase) +} + +func (g *GetGeneratedTestCaseFileRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetGeneratedTestCaseFileRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetGeneratedTestCaseFileRequest(value) + extraProperties, err := internal.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + g.rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetGeneratedTestCaseFileRequest) MarshalJSON() ([]byte, error) { + type embed GetGeneratedTestCaseFileRequest + var marshaler = struct { + embed + }{ + embed: embed(*g), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, g.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (g *GetGeneratedTestCaseFileRequest) String() string { + if g == nil { + return "" + } + if len(g.rawJSON) > 0 { + if value, err := internal.StringifyJSON(g.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +var ( + getGeneratedTestCaseTemplateFileRequestFieldTemplate = big.NewInt(1 << 0) +) + +type GetGeneratedTestCaseTemplateFileRequest struct { + Template *v2.TestCaseTemplate `json:"template" url:"template"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (g *GetGeneratedTestCaseTemplateFileRequest) GetTemplate() *v2.TestCaseTemplate { + if g == nil { + return nil + } + return g.Template +} + +func (g *GetGeneratedTestCaseTemplateFileRequest) GetExtraProperties() map[string]interface{} { + if g == nil { + return nil + } + return g.extraProperties +} + +func (g *GetGeneratedTestCaseTemplateFileRequest) require(field *big.Int) { + if g.explicitFields == nil { + g.explicitFields = big.NewInt(0) + } + g.explicitFields.Or(g.explicitFields, field) +} + +// SetTemplate sets the Template field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetGeneratedTestCaseTemplateFileRequest) SetTemplate(template *v2.TestCaseTemplate) { + g.Template = template + g.require(getGeneratedTestCaseTemplateFileRequestFieldTemplate) +} + +func (g *GetGeneratedTestCaseTemplateFileRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetGeneratedTestCaseTemplateFileRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetGeneratedTestCaseTemplateFileRequest(value) + extraProperties, err := internal.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + g.rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetGeneratedTestCaseTemplateFileRequest) MarshalJSON() ([]byte, error) { + type embed GetGeneratedTestCaseTemplateFileRequest + var marshaler = struct { + embed + }{ + embed: embed(*g), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, g.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (g *GetGeneratedTestCaseTemplateFileRequest) String() string { + if g == nil { + return "" + } + if len(g.rawJSON) > 0 { + if value, err := internal.StringifyJSON(g.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +var ( + lightweightProblemInfoV2FieldProblemID = big.NewInt(1 << 0) + lightweightProblemInfoV2FieldProblemName = big.NewInt(1 << 1) + lightweightProblemInfoV2FieldProblemVersion = big.NewInt(1 << 2) + lightweightProblemInfoV2FieldVariableTypes = big.NewInt(1 << 3) +) + +type LightweightProblemInfoV2 struct { + ProblemID common.ProblemID `json:"problemId" url:"problemId"` + ProblemName string `json:"problemName" url:"problemName"` + ProblemVersion int `json:"problemVersion" url:"problemVersion"` + VariableTypes []*common.VariableType `json:"variableTypes" url:"variableTypes"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (l *LightweightProblemInfoV2) GetProblemID() common.ProblemID { + if l == nil { + return "" + } + return l.ProblemID +} + +func (l *LightweightProblemInfoV2) GetProblemName() string { + if l == nil { + return "" + } + return l.ProblemName +} + +func (l *LightweightProblemInfoV2) GetProblemVersion() int { + if l == nil { + return 0 + } + return l.ProblemVersion +} + +func (l *LightweightProblemInfoV2) GetVariableTypes() []*common.VariableType { + if l == nil { + return nil + } + return l.VariableTypes +} + +func (l *LightweightProblemInfoV2) GetExtraProperties() map[string]interface{} { + if l == nil { + return nil + } + return l.extraProperties +} + +func (l *LightweightProblemInfoV2) require(field *big.Int) { + if l.explicitFields == nil { + l.explicitFields = big.NewInt(0) + } + l.explicitFields.Or(l.explicitFields, field) +} + +// SetProblemID sets the ProblemID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LightweightProblemInfoV2) SetProblemID(problemID common.ProblemID) { + l.ProblemID = problemID + l.require(lightweightProblemInfoV2FieldProblemID) +} + +// SetProblemName sets the ProblemName field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LightweightProblemInfoV2) SetProblemName(problemName string) { + l.ProblemName = problemName + l.require(lightweightProblemInfoV2FieldProblemName) +} + +// SetProblemVersion sets the ProblemVersion field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LightweightProblemInfoV2) SetProblemVersion(problemVersion int) { + l.ProblemVersion = problemVersion + l.require(lightweightProblemInfoV2FieldProblemVersion) +} + +// SetVariableTypes sets the VariableTypes field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LightweightProblemInfoV2) SetVariableTypes(variableTypes []*common.VariableType) { + l.VariableTypes = variableTypes + l.require(lightweightProblemInfoV2FieldVariableTypes) +} + +func (l *LightweightProblemInfoV2) UnmarshalJSON(data []byte) error { + type unmarshaler LightweightProblemInfoV2 + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *l = LightweightProblemInfoV2(value) + extraProperties, err := internal.ExtractExtraProperties(data, *l) + if err != nil { + return err + } + l.extraProperties = extraProperties + l.rawJSON = json.RawMessage(data) + return nil +} + +func (l *LightweightProblemInfoV2) MarshalJSON() ([]byte, error) { + type embed LightweightProblemInfoV2 + var marshaler = struct { + embed + }{ + embed: embed(*l), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, l.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (l *LightweightProblemInfoV2) String() string { + if l == nil { + return "" + } + if len(l.rawJSON) > 0 { + if value, err := internal.StringifyJSON(l.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(l); err == nil { + return value + } + return fmt.Sprintf("%#v", l) +} + +var ( + voidFunctionSignatureFieldParameters = big.NewInt(1 << 0) +) + +type VoidFunctionSignature struct { + Parameters []*v2.Parameter `json:"parameters" url:"parameters"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (v *VoidFunctionSignature) GetParameters() []*v2.Parameter { + if v == nil { + return nil + } + return v.Parameters +} + +func (v *VoidFunctionSignature) GetExtraProperties() map[string]interface{} { + if v == nil { + return nil + } + return v.extraProperties +} + +func (v *VoidFunctionSignature) require(field *big.Int) { + if v.explicitFields == nil { + v.explicitFields = big.NewInt(0) + } + v.explicitFields.Or(v.explicitFields, field) +} + +// SetParameters sets the Parameters field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (v *VoidFunctionSignature) SetParameters(parameters []*v2.Parameter) { + v.Parameters = parameters + v.require(voidFunctionSignatureFieldParameters) +} + +func (v *VoidFunctionSignature) UnmarshalJSON(data []byte) error { + type unmarshaler VoidFunctionSignature + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *v = VoidFunctionSignature(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err + } + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil +} + +func (v *VoidFunctionSignature) MarshalJSON() ([]byte, error) { + type embed VoidFunctionSignature + var marshaler = struct { + embed + }{ + embed: embed(*v), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, v.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (v *VoidFunctionSignature) String() string { + if v == nil { + return "" + } + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(v); err == nil { + return value + } + return fmt.Sprintf("%#v", v) +} + +var ( + voidFunctionSignatureThatTakesActualResultFieldParameters = big.NewInt(1 << 0) + voidFunctionSignatureThatTakesActualResultFieldActualResultType = big.NewInt(1 << 1) +) + +type VoidFunctionSignatureThatTakesActualResult struct { + Parameters []*v2.Parameter `json:"parameters" url:"parameters"` + ActualResultType *common.VariableType `json:"actualResultType" url:"actualResultType"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (v *VoidFunctionSignatureThatTakesActualResult) GetParameters() []*v2.Parameter { + if v == nil { + return nil + } + return v.Parameters +} + +func (v *VoidFunctionSignatureThatTakesActualResult) GetActualResultType() *common.VariableType { + if v == nil { + return nil + } + return v.ActualResultType +} + +func (v *VoidFunctionSignatureThatTakesActualResult) GetExtraProperties() map[string]interface{} { + if v == nil { + return nil + } + return v.extraProperties +} + +func (v *VoidFunctionSignatureThatTakesActualResult) require(field *big.Int) { + if v.explicitFields == nil { + v.explicitFields = big.NewInt(0) + } + v.explicitFields.Or(v.explicitFields, field) +} + +// SetParameters sets the Parameters field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (v *VoidFunctionSignatureThatTakesActualResult) SetParameters(parameters []*v2.Parameter) { + v.Parameters = parameters + v.require(voidFunctionSignatureThatTakesActualResultFieldParameters) +} + +// SetActualResultType sets the ActualResultType field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (v *VoidFunctionSignatureThatTakesActualResult) SetActualResultType(actualResultType *common.VariableType) { + v.ActualResultType = actualResultType + v.require(voidFunctionSignatureThatTakesActualResultFieldActualResultType) +} + +func (v *VoidFunctionSignatureThatTakesActualResult) UnmarshalJSON(data []byte) error { + type unmarshaler VoidFunctionSignatureThatTakesActualResult + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *v = VoidFunctionSignatureThatTakesActualResult(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err + } + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil +} + +func (v *VoidFunctionSignatureThatTakesActualResult) MarshalJSON() ([]byte, error) { + type embed VoidFunctionSignatureThatTakesActualResult + var marshaler = struct { + embed + }{ + embed: embed(*v), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, v.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (v *VoidFunctionSignatureThatTakesActualResult) String() string { + if v == nil { + return "" + } + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(v); err == nil { + return value + } + return fmt.Sprintf("%#v", v) +} diff --git a/seed/go-sdk/trace/v2/problem/client.go b/seed/go-sdk/trace/v2/problem/client.go new file mode 100644 index 000000000000..5cd53af995a8 --- /dev/null +++ b/seed/go-sdk/trace/v2/problem/client.go @@ -0,0 +1,103 @@ +// Code generated by Fern. DO NOT EDIT. + +package problem + +import ( + context "context" + + common "github.com/trace/fern/common" + commonv2 "github.com/trace/fern/common/v2" + core "github.com/trace/fern/core" + internal "github.com/trace/fern/internal" + option "github.com/trace/fern/option" + v2 "github.com/trace/fern/v2" +) + +type Client struct { + WithRawResponse *RawClient + + options *core.RequestOptions + baseURL string + caller *internal.Caller +} + +func NewClient(options *core.RequestOptions) *Client { + return &Client{ + WithRawResponse: NewRawClient(options), + options: options, + baseURL: options.BaseURL, + caller: internal.NewCaller( + &internal.CallerParams{ + Client: options.HTTPClient, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + }, + ), + } +} + +// Returns lightweight versions of all problems +func (c *Client) GetLightweightProblems( + ctx context.Context, + opts ...option.RequestOption, +) ([]*v2.LightweightProblemInfoV2, error) { + response, err := c.WithRawResponse.GetLightweightProblems( + ctx, + opts..., + ) + if err != nil { + return nil, err + } + return response.Body, nil +} + +// Returns latest versions of all problems +func (c *Client) GetProblems( + ctx context.Context, + opts ...option.RequestOption, +) ([]*commonv2.ProblemInfoV2, error) { + response, err := c.WithRawResponse.GetProblems( + ctx, + opts..., + ) + if err != nil { + return nil, err + } + return response.Body, nil +} + +// Returns latest version of a problem +func (c *Client) GetLatestProblem( + ctx context.Context, + problemID common.ProblemID, + opts ...option.RequestOption, +) (*commonv2.ProblemInfoV2, error) { + response, err := c.WithRawResponse.GetLatestProblem( + ctx, + problemID, + opts..., + ) + if err != nil { + return nil, err + } + return response.Body, nil +} + +// Returns requested version of a problem +func (c *Client) GetProblemVersion( + ctx context.Context, + problemID common.ProblemID, + problemVersion int, + opts ...option.RequestOption, +) (*commonv2.ProblemInfoV2, error) { + response, err := c.WithRawResponse.GetProblemVersion( + ctx, + problemID, + problemVersion, + opts..., + ) + if err != nil { + return nil, err + } + return response.Body, nil +} diff --git a/seed/go-sdk/trace/v2/problem/raw_client.go b/seed/go-sdk/trace/v2/problem/raw_client.go new file mode 100644 index 000000000000..62410c94ee1d --- /dev/null +++ b/seed/go-sdk/trace/v2/problem/raw_client.go @@ -0,0 +1,205 @@ +// Code generated by Fern. DO NOT EDIT. + +package problem + +import ( + context "context" + http "net/http" + + common "github.com/trace/fern/common" + commonv2 "github.com/trace/fern/common/v2" + core "github.com/trace/fern/core" + internal "github.com/trace/fern/internal" + option "github.com/trace/fern/option" + v2 "github.com/trace/fern/v2" +) + +type RawClient struct { + baseURL string + caller *internal.Caller + options *core.RequestOptions +} + +func NewRawClient(options *core.RequestOptions) *RawClient { + return &RawClient{ + options: options, + baseURL: options.BaseURL, + caller: internal.NewCaller( + &internal.CallerParams{ + Client: options.HTTPClient, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + }, + ), + } +} + +func (r *RawClient) GetLightweightProblems( + ctx context.Context, + opts ...option.RequestOption, +) (*core.Response[[]*v2.LightweightProblemInfoV2], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.trace.come", + ) + endpointURL := baseURL + "/problems-v2/lightweight-problem-info" + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + var response []*v2.LightweightProblemInfoV2 + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodGet, + Headers: headers, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + Response: &response, + }, + ) + if err != nil { + return nil, err + } + return &core.Response[[]*v2.LightweightProblemInfoV2]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: response, + }, nil +} + +func (r *RawClient) GetProblems( + ctx context.Context, + opts ...option.RequestOption, +) (*core.Response[[]*commonv2.ProblemInfoV2], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.trace.come", + ) + endpointURL := baseURL + "/problems-v2/problem-info" + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + var response []*commonv2.ProblemInfoV2 + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodGet, + Headers: headers, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + Response: &response, + }, + ) + if err != nil { + return nil, err + } + return &core.Response[[]*commonv2.ProblemInfoV2]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: response, + }, nil +} + +func (r *RawClient) GetLatestProblem( + ctx context.Context, + problemID common.ProblemID, + opts ...option.RequestOption, +) (*core.Response[*commonv2.ProblemInfoV2], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.trace.come", + ) + endpointURL := internal.EncodeURL( + baseURL+"/problems-v2/problem-info/%v", + problemID, + ) + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + var response *commonv2.ProblemInfoV2 + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodGet, + Headers: headers, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + Response: &response, + }, + ) + if err != nil { + return nil, err + } + return &core.Response[*commonv2.ProblemInfoV2]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: response, + }, nil +} + +func (r *RawClient) GetProblemVersion( + ctx context.Context, + problemID common.ProblemID, + problemVersion int, + opts ...option.RequestOption, +) (*core.Response[*commonv2.ProblemInfoV2], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.trace.come", + ) + endpointURL := internal.EncodeURL( + baseURL+"/problems-v2/problem-info/%v/version/%v", + problemID, + problemVersion, + ) + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + var response *commonv2.ProblemInfoV2 + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodGet, + Headers: headers, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + Response: &response, + }, + ) + if err != nil { + return nil, err + } + return &core.Response[*commonv2.ProblemInfoV2]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: response, + }, nil +} diff --git a/seed/go-sdk/trace/v2/problem_test.go b/seed/go-sdk/trace/v2/problem_test.go new file mode 100644 index 000000000000..e9a72c1ac78d --- /dev/null +++ b/seed/go-sdk/trace/v2/problem_test.go @@ -0,0 +1,2696 @@ +// Code generated by Fern. DO NOT EDIT. + +package v2 + +import ( + json "encoding/json" + assert "github.com/stretchr/testify/assert" + require "github.com/stretchr/testify/require" + common "github.com/trace/fern/common" + v2 "github.com/trace/fern/common/v2" + testing "testing" +) + +func TestSettersCreateProblemRequestV2(t *testing.T) { + t.Run("SetProblemName", func(t *testing.T) { + obj := &CreateProblemRequestV2{} + var fernTestValueProblemName string + obj.SetProblemName(fernTestValueProblemName) + assert.Equal(t, fernTestValueProblemName, obj.ProblemName) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetProblemDescription", func(t *testing.T) { + obj := &CreateProblemRequestV2{} + var fernTestValueProblemDescription *common.ProblemDescription + obj.SetProblemDescription(fernTestValueProblemDescription) + assert.Equal(t, fernTestValueProblemDescription, obj.ProblemDescription) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetCustomFiles", func(t *testing.T) { + obj := &CreateProblemRequestV2{} + var fernTestValueCustomFiles *v2.CustomFiles + obj.SetCustomFiles(fernTestValueCustomFiles) + assert.Equal(t, fernTestValueCustomFiles, obj.CustomFiles) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetCustomTestCaseTemplates", func(t *testing.T) { + obj := &CreateProblemRequestV2{} + var fernTestValueCustomTestCaseTemplates []*v2.TestCaseTemplate + obj.SetCustomTestCaseTemplates(fernTestValueCustomTestCaseTemplates) + assert.Equal(t, fernTestValueCustomTestCaseTemplates, obj.CustomTestCaseTemplates) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetTestcases", func(t *testing.T) { + obj := &CreateProblemRequestV2{} + var fernTestValueTestcases []*v2.TestCaseV2 + obj.SetTestcases(fernTestValueTestcases) + assert.Equal(t, fernTestValueTestcases, obj.Testcases) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetSupportedLanguages", func(t *testing.T) { + obj := &CreateProblemRequestV2{} + var fernTestValueSupportedLanguages []common.Language + obj.SetSupportedLanguages(fernTestValueSupportedLanguages) + assert.Equal(t, fernTestValueSupportedLanguages, obj.SupportedLanguages) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetIsPublic", func(t *testing.T) { + obj := &CreateProblemRequestV2{} + var fernTestValueIsPublic bool + obj.SetIsPublic(fernTestValueIsPublic) + assert.Equal(t, fernTestValueIsPublic, obj.IsPublic) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersCreateProblemRequestV2(t *testing.T) { + t.Run("GetProblemName", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + var expected string + obj.ProblemName = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetProblemName(), "getter should return the property value") + }) + + t.Run("GetProblemName_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CreateProblemRequestV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetProblemName() // Should return zero value + }) + + t.Run("GetProblemDescription", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + var expected *common.ProblemDescription + obj.ProblemDescription = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetProblemDescription(), "getter should return the property value") + }) + + t.Run("GetProblemDescription_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + obj.ProblemDescription = nil + + // Act & Assert + assert.Nil(t, obj.GetProblemDescription(), "getter should return nil when property is nil") + }) + + t.Run("GetProblemDescription_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CreateProblemRequestV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetProblemDescription() // Should return zero value + }) + + t.Run("GetCustomFiles", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + var expected *v2.CustomFiles + obj.CustomFiles = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetCustomFiles(), "getter should return the property value") + }) + + t.Run("GetCustomFiles_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + obj.CustomFiles = nil + + // Act & Assert + assert.Nil(t, obj.GetCustomFiles(), "getter should return nil when property is nil") + }) + + t.Run("GetCustomFiles_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CreateProblemRequestV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetCustomFiles() // Should return zero value + }) + + t.Run("GetCustomTestCaseTemplates", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + var expected []*v2.TestCaseTemplate + obj.CustomTestCaseTemplates = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetCustomTestCaseTemplates(), "getter should return the property value") + }) + + t.Run("GetCustomTestCaseTemplates_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + obj.CustomTestCaseTemplates = nil + + // Act & Assert + assert.Nil(t, obj.GetCustomTestCaseTemplates(), "getter should return nil when property is nil") + }) + + t.Run("GetCustomTestCaseTemplates_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CreateProblemRequestV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetCustomTestCaseTemplates() // Should return zero value + }) + + t.Run("GetTestcases", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + var expected []*v2.TestCaseV2 + obj.Testcases = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTestcases(), "getter should return the property value") + }) + + t.Run("GetTestcases_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + obj.Testcases = nil + + // Act & Assert + assert.Nil(t, obj.GetTestcases(), "getter should return nil when property is nil") + }) + + t.Run("GetTestcases_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CreateProblemRequestV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTestcases() // Should return zero value + }) + + t.Run("GetSupportedLanguages", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + var expected []common.Language + obj.SupportedLanguages = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSupportedLanguages(), "getter should return the property value") + }) + + t.Run("GetSupportedLanguages_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + obj.SupportedLanguages = nil + + // Act & Assert + assert.Nil(t, obj.GetSupportedLanguages(), "getter should return nil when property is nil") + }) + + t.Run("GetSupportedLanguages_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CreateProblemRequestV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSupportedLanguages() // Should return zero value + }) + + t.Run("GetIsPublic", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + var expected bool + obj.IsPublic = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetIsPublic(), "getter should return the property value") + }) + + t.Run("GetIsPublic_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CreateProblemRequestV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetIsPublic() // Should return zero value + }) + +} + +func TestSettersMarkExplicitCreateProblemRequestV2(t *testing.T) { + t.Run("SetProblemName_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + var fernTestValueProblemName string + + // Act + obj.SetProblemName(fernTestValueProblemName) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetProblemDescription_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + var fernTestValueProblemDescription *common.ProblemDescription + + // Act + obj.SetProblemDescription(fernTestValueProblemDescription) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetCustomFiles_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + var fernTestValueCustomFiles *v2.CustomFiles + + // Act + obj.SetCustomFiles(fernTestValueCustomFiles) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetCustomTestCaseTemplates_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + var fernTestValueCustomTestCaseTemplates []*v2.TestCaseTemplate + + // Act + obj.SetCustomTestCaseTemplates(fernTestValueCustomTestCaseTemplates) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetTestcases_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + var fernTestValueTestcases []*v2.TestCaseV2 + + // Act + obj.SetTestcases(fernTestValueTestcases) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetSupportedLanguages_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + var fernTestValueSupportedLanguages []common.Language + + // Act + obj.SetSupportedLanguages(fernTestValueSupportedLanguages) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetIsPublic_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + var fernTestValueIsPublic bool + + // Act + obj.SetIsPublic(fernTestValueIsPublic) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersDefaultProvidedFile(t *testing.T) { + t.Run("SetFile", func(t *testing.T) { + obj := &DefaultProvidedFile{} + var fernTestValueFile *v2.FileInfoV2 + obj.SetFile(fernTestValueFile) + assert.Equal(t, fernTestValueFile, obj.File) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetRelatedTypes", func(t *testing.T) { + obj := &DefaultProvidedFile{} + var fernTestValueRelatedTypes []*common.VariableType + obj.SetRelatedTypes(fernTestValueRelatedTypes) + assert.Equal(t, fernTestValueRelatedTypes, obj.RelatedTypes) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersDefaultProvidedFile(t *testing.T) { + t.Run("GetFile", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DefaultProvidedFile{} + var expected *v2.FileInfoV2 + obj.File = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetFile(), "getter should return the property value") + }) + + t.Run("GetFile_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DefaultProvidedFile{} + obj.File = nil + + // Act & Assert + assert.Nil(t, obj.GetFile(), "getter should return nil when property is nil") + }) + + t.Run("GetFile_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DefaultProvidedFile + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetFile() // Should return zero value + }) + + t.Run("GetRelatedTypes", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DefaultProvidedFile{} + var expected []*common.VariableType + obj.RelatedTypes = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetRelatedTypes(), "getter should return the property value") + }) + + t.Run("GetRelatedTypes_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DefaultProvidedFile{} + obj.RelatedTypes = nil + + // Act & Assert + assert.Nil(t, obj.GetRelatedTypes(), "getter should return nil when property is nil") + }) + + t.Run("GetRelatedTypes_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DefaultProvidedFile + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetRelatedTypes() // Should return zero value + }) + +} + +func TestSettersMarkExplicitDefaultProvidedFile(t *testing.T) { + t.Run("SetFile_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DefaultProvidedFile{} + var fernTestValueFile *v2.FileInfoV2 + + // Act + obj.SetFile(fernTestValueFile) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetRelatedTypes_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DefaultProvidedFile{} + var fernTestValueRelatedTypes []*common.VariableType + + // Act + obj.SetRelatedTypes(fernTestValueRelatedTypes) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestGettersFunctionSignature(t *testing.T) { + t.Run("GetType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FunctionSignature{} + var expected string + obj.Type = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetType(), "getter should return the property value") + }) + + t.Run("GetType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FunctionSignature + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetType() // Should return zero value + }) + + t.Run("GetVoid", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FunctionSignature{} + var expected *VoidFunctionSignature + obj.Void = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetVoid(), "getter should return the property value") + }) + + t.Run("GetVoid_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FunctionSignature{} + obj.Void = nil + + // Act & Assert + assert.Nil(t, obj.GetVoid(), "getter should return nil when property is nil") + }) + + t.Run("GetVoid_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FunctionSignature + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetVoid() // Should return zero value + }) + + t.Run("GetNonVoid", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FunctionSignature{} + var expected *v2.NonVoidFunctionSignature + obj.NonVoid = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetNonVoid(), "getter should return the property value") + }) + + t.Run("GetNonVoid_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FunctionSignature{} + obj.NonVoid = nil + + // Act & Assert + assert.Nil(t, obj.GetNonVoid(), "getter should return nil when property is nil") + }) + + t.Run("GetNonVoid_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FunctionSignature + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetNonVoid() // Should return zero value + }) + + t.Run("GetVoidThatTakesActualResult", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FunctionSignature{} + var expected *VoidFunctionSignatureThatTakesActualResult + obj.VoidThatTakesActualResult = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetVoidThatTakesActualResult(), "getter should return the property value") + }) + + t.Run("GetVoidThatTakesActualResult_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FunctionSignature{} + obj.VoidThatTakesActualResult = nil + + // Act & Assert + assert.Nil(t, obj.GetVoidThatTakesActualResult(), "getter should return nil when property is nil") + }) + + t.Run("GetVoidThatTakesActualResult_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FunctionSignature + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetVoidThatTakesActualResult() // Should return zero value + }) + +} + +func TestSettersGetBasicSolutionFileRequest(t *testing.T) { + t.Run("SetMethodName", func(t *testing.T) { + obj := &GetBasicSolutionFileRequest{} + var fernTestValueMethodName string + obj.SetMethodName(fernTestValueMethodName) + assert.Equal(t, fernTestValueMethodName, obj.MethodName) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetSignature", func(t *testing.T) { + obj := &GetBasicSolutionFileRequest{} + var fernTestValueSignature *v2.NonVoidFunctionSignature + obj.SetSignature(fernTestValueSignature) + assert.Equal(t, fernTestValueSignature, obj.Signature) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersGetBasicSolutionFileRequest(t *testing.T) { + t.Run("GetMethodName", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetBasicSolutionFileRequest{} + var expected string + obj.MethodName = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetMethodName(), "getter should return the property value") + }) + + t.Run("GetMethodName_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetBasicSolutionFileRequest + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetMethodName() // Should return zero value + }) + + t.Run("GetSignature", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetBasicSolutionFileRequest{} + var expected *v2.NonVoidFunctionSignature + obj.Signature = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSignature(), "getter should return the property value") + }) + + t.Run("GetSignature_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetBasicSolutionFileRequest{} + obj.Signature = nil + + // Act & Assert + assert.Nil(t, obj.GetSignature(), "getter should return nil when property is nil") + }) + + t.Run("GetSignature_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetBasicSolutionFileRequest + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSignature() // Should return zero value + }) + +} + +func TestSettersMarkExplicitGetBasicSolutionFileRequest(t *testing.T) { + t.Run("SetMethodName_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetBasicSolutionFileRequest{} + var fernTestValueMethodName string + + // Act + obj.SetMethodName(fernTestValueMethodName) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetSignature_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetBasicSolutionFileRequest{} + var fernTestValueSignature *v2.NonVoidFunctionSignature + + // Act + obj.SetSignature(fernTestValueSignature) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersGetBasicSolutionFileResponse(t *testing.T) { + t.Run("SetSolutionFileByLanguage", func(t *testing.T) { + obj := &GetBasicSolutionFileResponse{} + var fernTestValueSolutionFileByLanguage map[common.Language]*v2.FileInfoV2 + obj.SetSolutionFileByLanguage(fernTestValueSolutionFileByLanguage) + assert.Equal(t, fernTestValueSolutionFileByLanguage, obj.SolutionFileByLanguage) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersGetBasicSolutionFileResponse(t *testing.T) { + t.Run("GetSolutionFileByLanguage", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetBasicSolutionFileResponse{} + var expected map[common.Language]*v2.FileInfoV2 + obj.SolutionFileByLanguage = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSolutionFileByLanguage(), "getter should return the property value") + }) + + t.Run("GetSolutionFileByLanguage_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetBasicSolutionFileResponse{} + obj.SolutionFileByLanguage = nil + + // Act & Assert + assert.Nil(t, obj.GetSolutionFileByLanguage(), "getter should return nil when property is nil") + }) + + t.Run("GetSolutionFileByLanguage_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetBasicSolutionFileResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSolutionFileByLanguage() // Should return zero value + }) + +} + +func TestSettersMarkExplicitGetBasicSolutionFileResponse(t *testing.T) { + t.Run("SetSolutionFileByLanguage_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetBasicSolutionFileResponse{} + var fernTestValueSolutionFileByLanguage map[common.Language]*v2.FileInfoV2 + + // Act + obj.SetSolutionFileByLanguage(fernTestValueSolutionFileByLanguage) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersGetFunctionSignatureRequest(t *testing.T) { + t.Run("SetFunctionSignature", func(t *testing.T) { + obj := &GetFunctionSignatureRequest{} + var fernTestValueFunctionSignature *FunctionSignature + obj.SetFunctionSignature(fernTestValueFunctionSignature) + assert.Equal(t, fernTestValueFunctionSignature, obj.FunctionSignature) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersGetFunctionSignatureRequest(t *testing.T) { + t.Run("GetFunctionSignature", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetFunctionSignatureRequest{} + var expected *FunctionSignature + obj.FunctionSignature = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetFunctionSignature(), "getter should return the property value") + }) + + t.Run("GetFunctionSignature_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetFunctionSignatureRequest{} + obj.FunctionSignature = nil + + // Act & Assert + assert.Nil(t, obj.GetFunctionSignature(), "getter should return nil when property is nil") + }) + + t.Run("GetFunctionSignature_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetFunctionSignatureRequest + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetFunctionSignature() // Should return zero value + }) + +} + +func TestSettersMarkExplicitGetFunctionSignatureRequest(t *testing.T) { + t.Run("SetFunctionSignature_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetFunctionSignatureRequest{} + var fernTestValueFunctionSignature *FunctionSignature + + // Act + obj.SetFunctionSignature(fernTestValueFunctionSignature) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersGetFunctionSignatureResponse(t *testing.T) { + t.Run("SetFunctionByLanguage", func(t *testing.T) { + obj := &GetFunctionSignatureResponse{} + var fernTestValueFunctionByLanguage map[common.Language]string + obj.SetFunctionByLanguage(fernTestValueFunctionByLanguage) + assert.Equal(t, fernTestValueFunctionByLanguage, obj.FunctionByLanguage) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersGetFunctionSignatureResponse(t *testing.T) { + t.Run("GetFunctionByLanguage", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetFunctionSignatureResponse{} + var expected map[common.Language]string + obj.FunctionByLanguage = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetFunctionByLanguage(), "getter should return the property value") + }) + + t.Run("GetFunctionByLanguage_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetFunctionSignatureResponse{} + obj.FunctionByLanguage = nil + + // Act & Assert + assert.Nil(t, obj.GetFunctionByLanguage(), "getter should return nil when property is nil") + }) + + t.Run("GetFunctionByLanguage_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetFunctionSignatureResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetFunctionByLanguage() // Should return zero value + }) + +} + +func TestSettersMarkExplicitGetFunctionSignatureResponse(t *testing.T) { + t.Run("SetFunctionByLanguage_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetFunctionSignatureResponse{} + var fernTestValueFunctionByLanguage map[common.Language]string + + // Act + obj.SetFunctionByLanguage(fernTestValueFunctionByLanguage) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersGetGeneratedTestCaseFileRequest(t *testing.T) { + t.Run("SetTemplate", func(t *testing.T) { + obj := &GetGeneratedTestCaseFileRequest{} + var fernTestValueTemplate *v2.TestCaseTemplate + obj.SetTemplate(fernTestValueTemplate) + assert.Equal(t, fernTestValueTemplate, obj.Template) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetTestCase", func(t *testing.T) { + obj := &GetGeneratedTestCaseFileRequest{} + var fernTestValueTestCase *v2.TestCaseV2 + obj.SetTestCase(fernTestValueTestCase) + assert.Equal(t, fernTestValueTestCase, obj.TestCase) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersGetGeneratedTestCaseFileRequest(t *testing.T) { + t.Run("GetTemplate", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetGeneratedTestCaseFileRequest{} + var expected *v2.TestCaseTemplate + obj.Template = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTemplate(), "getter should return the property value") + }) + + t.Run("GetTemplate_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetGeneratedTestCaseFileRequest{} + obj.Template = nil + + // Act & Assert + assert.Nil(t, obj.GetTemplate(), "getter should return nil when property is nil") + }) + + t.Run("GetTemplate_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetGeneratedTestCaseFileRequest + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTemplate() // Should return zero value + }) + + t.Run("GetTestCase", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetGeneratedTestCaseFileRequest{} + var expected *v2.TestCaseV2 + obj.TestCase = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTestCase(), "getter should return the property value") + }) + + t.Run("GetTestCase_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetGeneratedTestCaseFileRequest{} + obj.TestCase = nil + + // Act & Assert + assert.Nil(t, obj.GetTestCase(), "getter should return nil when property is nil") + }) + + t.Run("GetTestCase_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetGeneratedTestCaseFileRequest + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTestCase() // Should return zero value + }) + +} + +func TestSettersMarkExplicitGetGeneratedTestCaseFileRequest(t *testing.T) { + t.Run("SetTemplate_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetGeneratedTestCaseFileRequest{} + var fernTestValueTemplate *v2.TestCaseTemplate + + // Act + obj.SetTemplate(fernTestValueTemplate) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetTestCase_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetGeneratedTestCaseFileRequest{} + var fernTestValueTestCase *v2.TestCaseV2 + + // Act + obj.SetTestCase(fernTestValueTestCase) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersGetGeneratedTestCaseTemplateFileRequest(t *testing.T) { + t.Run("SetTemplate", func(t *testing.T) { + obj := &GetGeneratedTestCaseTemplateFileRequest{} + var fernTestValueTemplate *v2.TestCaseTemplate + obj.SetTemplate(fernTestValueTemplate) + assert.Equal(t, fernTestValueTemplate, obj.Template) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersGetGeneratedTestCaseTemplateFileRequest(t *testing.T) { + t.Run("GetTemplate", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetGeneratedTestCaseTemplateFileRequest{} + var expected *v2.TestCaseTemplate + obj.Template = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTemplate(), "getter should return the property value") + }) + + t.Run("GetTemplate_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetGeneratedTestCaseTemplateFileRequest{} + obj.Template = nil + + // Act & Assert + assert.Nil(t, obj.GetTemplate(), "getter should return nil when property is nil") + }) + + t.Run("GetTemplate_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetGeneratedTestCaseTemplateFileRequest + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTemplate() // Should return zero value + }) + +} + +func TestSettersMarkExplicitGetGeneratedTestCaseTemplateFileRequest(t *testing.T) { + t.Run("SetTemplate_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetGeneratedTestCaseTemplateFileRequest{} + var fernTestValueTemplate *v2.TestCaseTemplate + + // Act + obj.SetTemplate(fernTestValueTemplate) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersLightweightProblemInfoV2(t *testing.T) { + t.Run("SetProblemID", func(t *testing.T) { + obj := &LightweightProblemInfoV2{} + var fernTestValueProblemID common.ProblemID + obj.SetProblemID(fernTestValueProblemID) + assert.Equal(t, fernTestValueProblemID, obj.ProblemID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetProblemName", func(t *testing.T) { + obj := &LightweightProblemInfoV2{} + var fernTestValueProblemName string + obj.SetProblemName(fernTestValueProblemName) + assert.Equal(t, fernTestValueProblemName, obj.ProblemName) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetProblemVersion", func(t *testing.T) { + obj := &LightweightProblemInfoV2{} + var fernTestValueProblemVersion int + obj.SetProblemVersion(fernTestValueProblemVersion) + assert.Equal(t, fernTestValueProblemVersion, obj.ProblemVersion) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetVariableTypes", func(t *testing.T) { + obj := &LightweightProblemInfoV2{} + var fernTestValueVariableTypes []*common.VariableType + obj.SetVariableTypes(fernTestValueVariableTypes) + assert.Equal(t, fernTestValueVariableTypes, obj.VariableTypes) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersLightweightProblemInfoV2(t *testing.T) { + t.Run("GetProblemID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &LightweightProblemInfoV2{} + var expected common.ProblemID + obj.ProblemID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetProblemID(), "getter should return the property value") + }) + + t.Run("GetProblemID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *LightweightProblemInfoV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetProblemID() // Should return zero value + }) + + t.Run("GetProblemName", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &LightweightProblemInfoV2{} + var expected string + obj.ProblemName = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetProblemName(), "getter should return the property value") + }) + + t.Run("GetProblemName_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *LightweightProblemInfoV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetProblemName() // Should return zero value + }) + + t.Run("GetProblemVersion", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &LightweightProblemInfoV2{} + var expected int + obj.ProblemVersion = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetProblemVersion(), "getter should return the property value") + }) + + t.Run("GetProblemVersion_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *LightweightProblemInfoV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetProblemVersion() // Should return zero value + }) + + t.Run("GetVariableTypes", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &LightweightProblemInfoV2{} + var expected []*common.VariableType + obj.VariableTypes = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetVariableTypes(), "getter should return the property value") + }) + + t.Run("GetVariableTypes_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &LightweightProblemInfoV2{} + obj.VariableTypes = nil + + // Act & Assert + assert.Nil(t, obj.GetVariableTypes(), "getter should return nil when property is nil") + }) + + t.Run("GetVariableTypes_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *LightweightProblemInfoV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetVariableTypes() // Should return zero value + }) + +} + +func TestSettersMarkExplicitLightweightProblemInfoV2(t *testing.T) { + t.Run("SetProblemID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &LightweightProblemInfoV2{} + var fernTestValueProblemID common.ProblemID + + // Act + obj.SetProblemID(fernTestValueProblemID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetProblemName_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &LightweightProblemInfoV2{} + var fernTestValueProblemName string + + // Act + obj.SetProblemName(fernTestValueProblemName) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetProblemVersion_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &LightweightProblemInfoV2{} + var fernTestValueProblemVersion int + + // Act + obj.SetProblemVersion(fernTestValueProblemVersion) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetVariableTypes_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &LightweightProblemInfoV2{} + var fernTestValueVariableTypes []*common.VariableType + + // Act + obj.SetVariableTypes(fernTestValueVariableTypes) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersVoidFunctionSignature(t *testing.T) { + t.Run("SetParameters", func(t *testing.T) { + obj := &VoidFunctionSignature{} + var fernTestValueParameters []*v2.Parameter + obj.SetParameters(fernTestValueParameters) + assert.Equal(t, fernTestValueParameters, obj.Parameters) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersVoidFunctionSignature(t *testing.T) { + t.Run("GetParameters", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionSignature{} + var expected []*v2.Parameter + obj.Parameters = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetParameters(), "getter should return the property value") + }) + + t.Run("GetParameters_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionSignature{} + obj.Parameters = nil + + // Act & Assert + assert.Nil(t, obj.GetParameters(), "getter should return nil when property is nil") + }) + + t.Run("GetParameters_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VoidFunctionSignature + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetParameters() // Should return zero value + }) + +} + +func TestSettersMarkExplicitVoidFunctionSignature(t *testing.T) { + t.Run("SetParameters_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionSignature{} + var fernTestValueParameters []*v2.Parameter + + // Act + obj.SetParameters(fernTestValueParameters) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersVoidFunctionSignatureThatTakesActualResult(t *testing.T) { + t.Run("SetParameters", func(t *testing.T) { + obj := &VoidFunctionSignatureThatTakesActualResult{} + var fernTestValueParameters []*v2.Parameter + obj.SetParameters(fernTestValueParameters) + assert.Equal(t, fernTestValueParameters, obj.Parameters) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetActualResultType", func(t *testing.T) { + obj := &VoidFunctionSignatureThatTakesActualResult{} + var fernTestValueActualResultType *common.VariableType + obj.SetActualResultType(fernTestValueActualResultType) + assert.Equal(t, fernTestValueActualResultType, obj.ActualResultType) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersVoidFunctionSignatureThatTakesActualResult(t *testing.T) { + t.Run("GetParameters", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionSignatureThatTakesActualResult{} + var expected []*v2.Parameter + obj.Parameters = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetParameters(), "getter should return the property value") + }) + + t.Run("GetParameters_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionSignatureThatTakesActualResult{} + obj.Parameters = nil + + // Act & Assert + assert.Nil(t, obj.GetParameters(), "getter should return nil when property is nil") + }) + + t.Run("GetParameters_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VoidFunctionSignatureThatTakesActualResult + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetParameters() // Should return zero value + }) + + t.Run("GetActualResultType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionSignatureThatTakesActualResult{} + var expected *common.VariableType + obj.ActualResultType = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetActualResultType(), "getter should return the property value") + }) + + t.Run("GetActualResultType_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionSignatureThatTakesActualResult{} + obj.ActualResultType = nil + + // Act & Assert + assert.Nil(t, obj.GetActualResultType(), "getter should return nil when property is nil") + }) + + t.Run("GetActualResultType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VoidFunctionSignatureThatTakesActualResult + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetActualResultType() // Should return zero value + }) + +} + +func TestSettersMarkExplicitVoidFunctionSignatureThatTakesActualResult(t *testing.T) { + t.Run("SetParameters_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionSignatureThatTakesActualResult{} + var fernTestValueParameters []*v2.Parameter + + // Act + obj.SetParameters(fernTestValueParameters) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetActualResultType_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionSignatureThatTakesActualResult{} + var fernTestValueActualResultType *common.VariableType + + // Act + obj.SetActualResultType(fernTestValueActualResultType) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestJSONMarshalingCreateProblemRequestV2(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled CreateProblemRequestV2 + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj CreateProblemRequestV2 + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj CreateProblemRequestV2 + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingDefaultProvidedFile(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DefaultProvidedFile{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled DefaultProvidedFile + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj DefaultProvidedFile + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj DefaultProvidedFile + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingGetBasicSolutionFileRequest(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetBasicSolutionFileRequest{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled GetBasicSolutionFileRequest + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj GetBasicSolutionFileRequest + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj GetBasicSolutionFileRequest + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingGetBasicSolutionFileResponse(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetBasicSolutionFileResponse{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled GetBasicSolutionFileResponse + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj GetBasicSolutionFileResponse + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj GetBasicSolutionFileResponse + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingGetFunctionSignatureRequest(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetFunctionSignatureRequest{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled GetFunctionSignatureRequest + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj GetFunctionSignatureRequest + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj GetFunctionSignatureRequest + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingGetFunctionSignatureResponse(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetFunctionSignatureResponse{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled GetFunctionSignatureResponse + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj GetFunctionSignatureResponse + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj GetFunctionSignatureResponse + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingGetGeneratedTestCaseFileRequest(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetGeneratedTestCaseFileRequest{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled GetGeneratedTestCaseFileRequest + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj GetGeneratedTestCaseFileRequest + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj GetGeneratedTestCaseFileRequest + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingGetGeneratedTestCaseTemplateFileRequest(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetGeneratedTestCaseTemplateFileRequest{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled GetGeneratedTestCaseTemplateFileRequest + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj GetGeneratedTestCaseTemplateFileRequest + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj GetGeneratedTestCaseTemplateFileRequest + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingLightweightProblemInfoV2(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &LightweightProblemInfoV2{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled LightweightProblemInfoV2 + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj LightweightProblemInfoV2 + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj LightweightProblemInfoV2 + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingVoidFunctionSignature(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionSignature{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled VoidFunctionSignature + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj VoidFunctionSignature + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj VoidFunctionSignature + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingVoidFunctionSignatureThatTakesActualResult(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionSignatureThatTakesActualResult{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled VoidFunctionSignatureThatTakesActualResult + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj VoidFunctionSignatureThatTakesActualResult + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj VoidFunctionSignatureThatTakesActualResult + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestStringCreateProblemRequestV2(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &CreateProblemRequestV2{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CreateProblemRequestV2 + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringDefaultProvidedFile(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &DefaultProvidedFile{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DefaultProvidedFile + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringGetBasicSolutionFileRequest(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &GetBasicSolutionFileRequest{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetBasicSolutionFileRequest + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringGetBasicSolutionFileResponse(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &GetBasicSolutionFileResponse{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetBasicSolutionFileResponse + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringGetFunctionSignatureRequest(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &GetFunctionSignatureRequest{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetFunctionSignatureRequest + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringGetFunctionSignatureResponse(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &GetFunctionSignatureResponse{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetFunctionSignatureResponse + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringGetGeneratedTestCaseFileRequest(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &GetGeneratedTestCaseFileRequest{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetGeneratedTestCaseFileRequest + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringGetGeneratedTestCaseTemplateFileRequest(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &GetGeneratedTestCaseTemplateFileRequest{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetGeneratedTestCaseTemplateFileRequest + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringLightweightProblemInfoV2(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &LightweightProblemInfoV2{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *LightweightProblemInfoV2 + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringVoidFunctionSignature(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &VoidFunctionSignature{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VoidFunctionSignature + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringVoidFunctionSignatureThatTakesActualResult(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &VoidFunctionSignatureThatTakesActualResult{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VoidFunctionSignatureThatTakesActualResult + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestExtraPropertiesCreateProblemRequestV2(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &CreateProblemRequestV2{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CreateProblemRequestV2 + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesDefaultProvidedFile(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &DefaultProvidedFile{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DefaultProvidedFile + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesGetBasicSolutionFileRequest(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &GetBasicSolutionFileRequest{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetBasicSolutionFileRequest + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesGetBasicSolutionFileResponse(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &GetBasicSolutionFileResponse{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetBasicSolutionFileResponse + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesGetFunctionSignatureRequest(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &GetFunctionSignatureRequest{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetFunctionSignatureRequest + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesGetFunctionSignatureResponse(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &GetFunctionSignatureResponse{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetFunctionSignatureResponse + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesGetGeneratedTestCaseFileRequest(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &GetGeneratedTestCaseFileRequest{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetGeneratedTestCaseFileRequest + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesGetGeneratedTestCaseTemplateFileRequest(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &GetGeneratedTestCaseTemplateFileRequest{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetGeneratedTestCaseTemplateFileRequest + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesLightweightProblemInfoV2(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &LightweightProblemInfoV2{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *LightweightProblemInfoV2 + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesVoidFunctionSignature(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &VoidFunctionSignature{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VoidFunctionSignature + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesVoidFunctionSignatureThatTakesActualResult(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &VoidFunctionSignatureThatTakesActualResult{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VoidFunctionSignatureThatTakesActualResult + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} diff --git a/seed/go-sdk/trace/v2/v3/client/client.go b/seed/go-sdk/trace/v2/v3/client/client.go new file mode 100644 index 000000000000..821760b6f7d4 --- /dev/null +++ b/seed/go-sdk/trace/v2/v3/client/client.go @@ -0,0 +1,32 @@ +// Code generated by Fern. DO NOT EDIT. + +package client + +import ( + core "github.com/trace/fern/core" + internal "github.com/trace/fern/internal" + problem "github.com/trace/fern/v2/v3/problem" +) + +type Client struct { + Problem *problem.Client + + options *core.RequestOptions + baseURL string + caller *internal.Caller +} + +func NewClient(options *core.RequestOptions) *Client { + return &Client{ + Problem: problem.NewClient(options), + options: options, + baseURL: options.BaseURL, + caller: internal.NewCaller( + &internal.CallerParams{ + Client: options.HTTPClient, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + }, + ), + } +} diff --git a/seed/go-sdk/trace/v2/v3/error_codes.go b/seed/go-sdk/trace/v2/v3/error_codes.go new file mode 100644 index 000000000000..f7165fa2bdd2 --- /dev/null +++ b/seed/go-sdk/trace/v2/v3/error_codes.go @@ -0,0 +1,9 @@ +// Code generated by Fern. DO NOT EDIT. + +package v3 + +import ( + internal "github.com/trace/fern/internal" +) + +var ErrorCodes internal.ErrorCodes = internal.ErrorCodes{} diff --git a/seed/go-sdk/trace/v2/v3/problem.go b/seed/go-sdk/trace/v2/v3/problem.go new file mode 100644 index 000000000000..ca7fcbb3f3d7 --- /dev/null +++ b/seed/go-sdk/trace/v2/v3/problem.go @@ -0,0 +1,4307 @@ +// Code generated by Fern. DO NOT EDIT. + +package v3 + +import ( + json "encoding/json" + fmt "fmt" + common "github.com/trace/fern/common" + internal "github.com/trace/fern/internal" + big "math/big" +) + +type AssertCorrectnessCheck struct { + Type string + DeepEquality *DeepEqualityCorrectnessCheck + Custom *VoidFunctionDefinitionThatTakesActualResult + + rawJSON json.RawMessage +} + +func (a *AssertCorrectnessCheck) GetType() string { + if a == nil { + return "" + } + return a.Type +} + +func (a *AssertCorrectnessCheck) GetDeepEquality() *DeepEqualityCorrectnessCheck { + if a == nil { + return nil + } + return a.DeepEquality +} + +func (a *AssertCorrectnessCheck) GetCustom() *VoidFunctionDefinitionThatTakesActualResult { + if a == nil { + return nil + } + return a.Custom +} + +func (a *AssertCorrectnessCheck) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + a.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", a) + } + switch unmarshaler.Type { + case "deepEquality": + value := new(DeepEqualityCorrectnessCheck) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + a.DeepEquality = value + case "custom": + value := new(VoidFunctionDefinitionThatTakesActualResult) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + a.Custom = value + } + a.rawJSON = json.RawMessage(data) + return nil +} + +func (a AssertCorrectnessCheck) MarshalJSON() ([]byte, error) { + if err := a.validate(); err != nil { + return nil, err + } + if a.DeepEquality != nil { + return internal.MarshalJSONWithExtraProperty(a.DeepEquality, "type", "deepEquality") + } + if a.Custom != nil { + return internal.MarshalJSONWithExtraProperty(a.Custom, "type", "custom") + } + if len(a.rawJSON) > 0 { + return a.rawJSON, nil + } + return nil, fmt.Errorf("type %T does not define a non-empty union type", a) +} + +type AssertCorrectnessCheckVisitor interface { + VisitDeepEquality(*DeepEqualityCorrectnessCheck) error + VisitCustom(*VoidFunctionDefinitionThatTakesActualResult) error +} + +func (a *AssertCorrectnessCheck) Accept(visitor AssertCorrectnessCheckVisitor) error { + if a.DeepEquality != nil { + return visitor.VisitDeepEquality(a.DeepEquality) + } + if a.Custom != nil { + return visitor.VisitCustom(a.Custom) + } + return fmt.Errorf("type %T does not define a non-empty union type", a) +} + +func (a *AssertCorrectnessCheck) validate() error { + if a == nil { + return fmt.Errorf("type %T is nil", a) + } + var fields []string + if a.DeepEquality != nil { + fields = append(fields, "deepEquality") + } + if a.Custom != nil { + fields = append(fields, "custom") + } + if len(fields) == 0 { + if a.Type != "" { + if len(a.rawJSON) > 0 { + return nil + } + return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", a, a.Type) + } + return fmt.Errorf("type %T is empty", a) + } + if len(fields) > 1 { + return fmt.Errorf("type %T defines values for %s, but only one value is allowed", a, fields) + } + if a.Type != "" { + field := fields[0] + if a.Type != field { + return fmt.Errorf( + "type %T defines a discriminant set to %q, but it does not match the %T field; either remove or update the discriminant to match", + a, + a.Type, + a, + ) + } + } + return nil +} + +var ( + basicCustomFilesFieldMethodName = big.NewInt(1 << 0) + basicCustomFilesFieldSignature = big.NewInt(1 << 1) + basicCustomFilesFieldAdditionalFiles = big.NewInt(1 << 2) + basicCustomFilesFieldBasicTestCaseTemplate = big.NewInt(1 << 3) +) + +type BasicCustomFiles struct { + MethodName string `json:"methodName" url:"methodName"` + Signature *NonVoidFunctionSignature `json:"signature" url:"signature"` + AdditionalFiles map[common.Language]*Files `json:"additionalFiles" url:"additionalFiles"` + BasicTestCaseTemplate *BasicTestCaseTemplate `json:"basicTestCaseTemplate" url:"basicTestCaseTemplate"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (b *BasicCustomFiles) GetMethodName() string { + if b == nil { + return "" + } + return b.MethodName +} + +func (b *BasicCustomFiles) GetSignature() *NonVoidFunctionSignature { + if b == nil { + return nil + } + return b.Signature +} + +func (b *BasicCustomFiles) GetAdditionalFiles() map[common.Language]*Files { + if b == nil { + return nil + } + return b.AdditionalFiles +} + +func (b *BasicCustomFiles) GetBasicTestCaseTemplate() *BasicTestCaseTemplate { + if b == nil { + return nil + } + return b.BasicTestCaseTemplate +} + +func (b *BasicCustomFiles) GetExtraProperties() map[string]interface{} { + if b == nil { + return nil + } + return b.extraProperties +} + +func (b *BasicCustomFiles) require(field *big.Int) { + if b.explicitFields == nil { + b.explicitFields = big.NewInt(0) + } + b.explicitFields.Or(b.explicitFields, field) +} + +// SetMethodName sets the MethodName field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BasicCustomFiles) SetMethodName(methodName string) { + b.MethodName = methodName + b.require(basicCustomFilesFieldMethodName) +} + +// SetSignature sets the Signature field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BasicCustomFiles) SetSignature(signature *NonVoidFunctionSignature) { + b.Signature = signature + b.require(basicCustomFilesFieldSignature) +} + +// SetAdditionalFiles sets the AdditionalFiles field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BasicCustomFiles) SetAdditionalFiles(additionalFiles map[common.Language]*Files) { + b.AdditionalFiles = additionalFiles + b.require(basicCustomFilesFieldAdditionalFiles) +} + +// SetBasicTestCaseTemplate sets the BasicTestCaseTemplate field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BasicCustomFiles) SetBasicTestCaseTemplate(basicTestCaseTemplate *BasicTestCaseTemplate) { + b.BasicTestCaseTemplate = basicTestCaseTemplate + b.require(basicCustomFilesFieldBasicTestCaseTemplate) +} + +func (b *BasicCustomFiles) UnmarshalJSON(data []byte) error { + type unmarshaler BasicCustomFiles + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *b = BasicCustomFiles(value) + extraProperties, err := internal.ExtractExtraProperties(data, *b) + if err != nil { + return err + } + b.extraProperties = extraProperties + b.rawJSON = json.RawMessage(data) + return nil +} + +func (b *BasicCustomFiles) MarshalJSON() ([]byte, error) { + type embed BasicCustomFiles + var marshaler = struct { + embed + }{ + embed: embed(*b), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, b.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (b *BasicCustomFiles) String() string { + if b == nil { + return "" + } + if len(b.rawJSON) > 0 { + if value, err := internal.StringifyJSON(b.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(b); err == nil { + return value + } + return fmt.Sprintf("%#v", b) +} + +var ( + basicTestCaseTemplateFieldTemplateID = big.NewInt(1 << 0) + basicTestCaseTemplateFieldName = big.NewInt(1 << 1) + basicTestCaseTemplateFieldDescription = big.NewInt(1 << 2) + basicTestCaseTemplateFieldExpectedValueParameterID = big.NewInt(1 << 3) +) + +type BasicTestCaseTemplate struct { + TemplateID TestCaseTemplateID `json:"templateId" url:"templateId"` + Name string `json:"name" url:"name"` + Description *TestCaseImplementationDescription `json:"description" url:"description"` + ExpectedValueParameterID ParameterID `json:"expectedValueParameterId" url:"expectedValueParameterId"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (b *BasicTestCaseTemplate) GetTemplateID() TestCaseTemplateID { + if b == nil { + return "" + } + return b.TemplateID +} + +func (b *BasicTestCaseTemplate) GetName() string { + if b == nil { + return "" + } + return b.Name +} + +func (b *BasicTestCaseTemplate) GetDescription() *TestCaseImplementationDescription { + if b == nil { + return nil + } + return b.Description +} + +func (b *BasicTestCaseTemplate) GetExpectedValueParameterID() ParameterID { + if b == nil { + return "" + } + return b.ExpectedValueParameterID +} + +func (b *BasicTestCaseTemplate) GetExtraProperties() map[string]interface{} { + if b == nil { + return nil + } + return b.extraProperties +} + +func (b *BasicTestCaseTemplate) require(field *big.Int) { + if b.explicitFields == nil { + b.explicitFields = big.NewInt(0) + } + b.explicitFields.Or(b.explicitFields, field) +} + +// SetTemplateID sets the TemplateID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BasicTestCaseTemplate) SetTemplateID(templateID TestCaseTemplateID) { + b.TemplateID = templateID + b.require(basicTestCaseTemplateFieldTemplateID) +} + +// SetName sets the Name field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BasicTestCaseTemplate) SetName(name string) { + b.Name = name + b.require(basicTestCaseTemplateFieldName) +} + +// SetDescription sets the Description field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BasicTestCaseTemplate) SetDescription(description *TestCaseImplementationDescription) { + b.Description = description + b.require(basicTestCaseTemplateFieldDescription) +} + +// SetExpectedValueParameterID sets the ExpectedValueParameterID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BasicTestCaseTemplate) SetExpectedValueParameterID(expectedValueParameterID ParameterID) { + b.ExpectedValueParameterID = expectedValueParameterID + b.require(basicTestCaseTemplateFieldExpectedValueParameterID) +} + +func (b *BasicTestCaseTemplate) UnmarshalJSON(data []byte) error { + type unmarshaler BasicTestCaseTemplate + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *b = BasicTestCaseTemplate(value) + extraProperties, err := internal.ExtractExtraProperties(data, *b) + if err != nil { + return err + } + b.extraProperties = extraProperties + b.rawJSON = json.RawMessage(data) + return nil +} + +func (b *BasicTestCaseTemplate) MarshalJSON() ([]byte, error) { + type embed BasicTestCaseTemplate + var marshaler = struct { + embed + }{ + embed: embed(*b), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, b.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (b *BasicTestCaseTemplate) String() string { + if b == nil { + return "" + } + if len(b.rawJSON) > 0 { + if value, err := internal.StringifyJSON(b.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(b); err == nil { + return value + } + return fmt.Sprintf("%#v", b) +} + +var ( + createProblemRequestV2FieldProblemName = big.NewInt(1 << 0) + createProblemRequestV2FieldProblemDescription = big.NewInt(1 << 1) + createProblemRequestV2FieldCustomFiles = big.NewInt(1 << 2) + createProblemRequestV2FieldCustomTestCaseTemplates = big.NewInt(1 << 3) + createProblemRequestV2FieldTestcases = big.NewInt(1 << 4) + createProblemRequestV2FieldSupportedLanguages = big.NewInt(1 << 5) + createProblemRequestV2FieldIsPublic = big.NewInt(1 << 6) +) + +type CreateProblemRequestV2 struct { + ProblemName string `json:"problemName" url:"problemName"` + ProblemDescription *common.ProblemDescription `json:"problemDescription" url:"problemDescription"` + CustomFiles *CustomFiles `json:"customFiles" url:"customFiles"` + CustomTestCaseTemplates []*TestCaseTemplate `json:"customTestCaseTemplates" url:"customTestCaseTemplates"` + Testcases []*TestCaseV2 `json:"testcases" url:"testcases"` + SupportedLanguages []common.Language `json:"supportedLanguages" url:"supportedLanguages"` + IsPublic bool `json:"isPublic" url:"isPublic"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (c *CreateProblemRequestV2) GetProblemName() string { + if c == nil { + return "" + } + return c.ProblemName +} + +func (c *CreateProblemRequestV2) GetProblemDescription() *common.ProblemDescription { + if c == nil { + return nil + } + return c.ProblemDescription +} + +func (c *CreateProblemRequestV2) GetCustomFiles() *CustomFiles { + if c == nil { + return nil + } + return c.CustomFiles +} + +func (c *CreateProblemRequestV2) GetCustomTestCaseTemplates() []*TestCaseTemplate { + if c == nil { + return nil + } + return c.CustomTestCaseTemplates +} + +func (c *CreateProblemRequestV2) GetTestcases() []*TestCaseV2 { + if c == nil { + return nil + } + return c.Testcases +} + +func (c *CreateProblemRequestV2) GetSupportedLanguages() []common.Language { + if c == nil { + return nil + } + return c.SupportedLanguages +} + +func (c *CreateProblemRequestV2) GetIsPublic() bool { + if c == nil { + return false + } + return c.IsPublic +} + +func (c *CreateProblemRequestV2) GetExtraProperties() map[string]interface{} { + if c == nil { + return nil + } + return c.extraProperties +} + +func (c *CreateProblemRequestV2) require(field *big.Int) { + if c.explicitFields == nil { + c.explicitFields = big.NewInt(0) + } + c.explicitFields.Or(c.explicitFields, field) +} + +// SetProblemName sets the ProblemName field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CreateProblemRequestV2) SetProblemName(problemName string) { + c.ProblemName = problemName + c.require(createProblemRequestV2FieldProblemName) +} + +// SetProblemDescription sets the ProblemDescription field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CreateProblemRequestV2) SetProblemDescription(problemDescription *common.ProblemDescription) { + c.ProblemDescription = problemDescription + c.require(createProblemRequestV2FieldProblemDescription) +} + +// SetCustomFiles sets the CustomFiles field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CreateProblemRequestV2) SetCustomFiles(customFiles *CustomFiles) { + c.CustomFiles = customFiles + c.require(createProblemRequestV2FieldCustomFiles) +} + +// SetCustomTestCaseTemplates sets the CustomTestCaseTemplates field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CreateProblemRequestV2) SetCustomTestCaseTemplates(customTestCaseTemplates []*TestCaseTemplate) { + c.CustomTestCaseTemplates = customTestCaseTemplates + c.require(createProblemRequestV2FieldCustomTestCaseTemplates) +} + +// SetTestcases sets the Testcases field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CreateProblemRequestV2) SetTestcases(testcases []*TestCaseV2) { + c.Testcases = testcases + c.require(createProblemRequestV2FieldTestcases) +} + +// SetSupportedLanguages sets the SupportedLanguages field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CreateProblemRequestV2) SetSupportedLanguages(supportedLanguages []common.Language) { + c.SupportedLanguages = supportedLanguages + c.require(createProblemRequestV2FieldSupportedLanguages) +} + +// SetIsPublic sets the IsPublic field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CreateProblemRequestV2) SetIsPublic(isPublic bool) { + c.IsPublic = isPublic + c.require(createProblemRequestV2FieldIsPublic) +} + +func (c *CreateProblemRequestV2) UnmarshalJSON(data []byte) error { + type unmarshaler CreateProblemRequestV2 + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CreateProblemRequestV2(value) + extraProperties, err := internal.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + c.rawJSON = json.RawMessage(data) + return nil +} + +func (c *CreateProblemRequestV2) MarshalJSON() ([]byte, error) { + type embed CreateProblemRequestV2 + var marshaler = struct { + embed + }{ + embed: embed(*c), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, c.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (c *CreateProblemRequestV2) String() string { + if c == nil { + return "" + } + if len(c.rawJSON) > 0 { + if value, err := internal.StringifyJSON(c.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +type CustomFiles struct { + Type string + Basic *BasicCustomFiles + Custom map[common.Language]*Files + + rawJSON json.RawMessage +} + +func (c *CustomFiles) GetType() string { + if c == nil { + return "" + } + return c.Type +} + +func (c *CustomFiles) GetBasic() *BasicCustomFiles { + if c == nil { + return nil + } + return c.Basic +} + +func (c *CustomFiles) GetCustom() map[common.Language]*Files { + if c == nil { + return nil + } + return c.Custom +} + +func (c *CustomFiles) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + c.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", c) + } + switch unmarshaler.Type { + case "basic": + value := new(BasicCustomFiles) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + c.Basic = value + case "custom": + var valueUnmarshaler struct { + Custom map[common.Language]*Files `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + c.Custom = valueUnmarshaler.Custom + } + c.rawJSON = json.RawMessage(data) + return nil +} + +func (c CustomFiles) MarshalJSON() ([]byte, error) { + if err := c.validate(); err != nil { + return nil, err + } + if c.Basic != nil { + return internal.MarshalJSONWithExtraProperty(c.Basic, "type", "basic") + } + if c.Custom != nil { + var marshaler = struct { + Type string `json:"type"` + Custom map[common.Language]*Files `json:"value"` + }{ + Type: "custom", + Custom: c.Custom, + } + return json.Marshal(marshaler) + } + if len(c.rawJSON) > 0 { + return c.rawJSON, nil + } + return nil, fmt.Errorf("type %T does not define a non-empty union type", c) +} + +type CustomFilesVisitor interface { + VisitBasic(*BasicCustomFiles) error + VisitCustom(map[common.Language]*Files) error +} + +func (c *CustomFiles) Accept(visitor CustomFilesVisitor) error { + if c.Basic != nil { + return visitor.VisitBasic(c.Basic) + } + if c.Custom != nil { + return visitor.VisitCustom(c.Custom) + } + return fmt.Errorf("type %T does not define a non-empty union type", c) +} + +func (c *CustomFiles) validate() error { + if c == nil { + return fmt.Errorf("type %T is nil", c) + } + var fields []string + if c.Basic != nil { + fields = append(fields, "basic") + } + if c.Custom != nil { + fields = append(fields, "custom") + } + if len(fields) == 0 { + if c.Type != "" { + if len(c.rawJSON) > 0 { + return nil + } + return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", c, c.Type) + } + return fmt.Errorf("type %T is empty", c) + } + if len(fields) > 1 { + return fmt.Errorf("type %T defines values for %s, but only one value is allowed", c, fields) + } + if c.Type != "" { + field := fields[0] + if c.Type != field { + return fmt.Errorf( + "type %T defines a discriminant set to %q, but it does not match the %T field; either remove or update the discriminant to match", + c, + c.Type, + c, + ) + } + } + return nil +} + +var ( + deepEqualityCorrectnessCheckFieldExpectedValueParameterID = big.NewInt(1 << 0) +) + +type DeepEqualityCorrectnessCheck struct { + ExpectedValueParameterID ParameterID `json:"expectedValueParameterId" url:"expectedValueParameterId"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (d *DeepEqualityCorrectnessCheck) GetExpectedValueParameterID() ParameterID { + if d == nil { + return "" + } + return d.ExpectedValueParameterID +} + +func (d *DeepEqualityCorrectnessCheck) GetExtraProperties() map[string]interface{} { + if d == nil { + return nil + } + return d.extraProperties +} + +func (d *DeepEqualityCorrectnessCheck) require(field *big.Int) { + if d.explicitFields == nil { + d.explicitFields = big.NewInt(0) + } + d.explicitFields.Or(d.explicitFields, field) +} + +// SetExpectedValueParameterID sets the ExpectedValueParameterID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (d *DeepEqualityCorrectnessCheck) SetExpectedValueParameterID(expectedValueParameterID ParameterID) { + d.ExpectedValueParameterID = expectedValueParameterID + d.require(deepEqualityCorrectnessCheckFieldExpectedValueParameterID) +} + +func (d *DeepEqualityCorrectnessCheck) UnmarshalJSON(data []byte) error { + type unmarshaler DeepEqualityCorrectnessCheck + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeepEqualityCorrectnessCheck(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) + return nil +} + +func (d *DeepEqualityCorrectnessCheck) MarshalJSON() ([]byte, error) { + type embed DeepEqualityCorrectnessCheck + var marshaler = struct { + embed + }{ + embed: embed(*d), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, d.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (d *DeepEqualityCorrectnessCheck) String() string { + if d == nil { + return "" + } + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +var ( + defaultProvidedFileFieldFile = big.NewInt(1 << 0) + defaultProvidedFileFieldRelatedTypes = big.NewInt(1 << 1) +) + +type DefaultProvidedFile struct { + File *FileInfoV2 `json:"file" url:"file"` + RelatedTypes []*common.VariableType `json:"relatedTypes" url:"relatedTypes"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (d *DefaultProvidedFile) GetFile() *FileInfoV2 { + if d == nil { + return nil + } + return d.File +} + +func (d *DefaultProvidedFile) GetRelatedTypes() []*common.VariableType { + if d == nil { + return nil + } + return d.RelatedTypes +} + +func (d *DefaultProvidedFile) GetExtraProperties() map[string]interface{} { + if d == nil { + return nil + } + return d.extraProperties +} + +func (d *DefaultProvidedFile) require(field *big.Int) { + if d.explicitFields == nil { + d.explicitFields = big.NewInt(0) + } + d.explicitFields.Or(d.explicitFields, field) +} + +// SetFile sets the File field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (d *DefaultProvidedFile) SetFile(file *FileInfoV2) { + d.File = file + d.require(defaultProvidedFileFieldFile) +} + +// SetRelatedTypes sets the RelatedTypes field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (d *DefaultProvidedFile) SetRelatedTypes(relatedTypes []*common.VariableType) { + d.RelatedTypes = relatedTypes + d.require(defaultProvidedFileFieldRelatedTypes) +} + +func (d *DefaultProvidedFile) UnmarshalJSON(data []byte) error { + type unmarshaler DefaultProvidedFile + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DefaultProvidedFile(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) + return nil +} + +func (d *DefaultProvidedFile) MarshalJSON() ([]byte, error) { + type embed DefaultProvidedFile + var marshaler = struct { + embed + }{ + embed: embed(*d), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, d.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (d *DefaultProvidedFile) String() string { + if d == nil { + return "" + } + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +var ( + fileInfoV2FieldFilename = big.NewInt(1 << 0) + fileInfoV2FieldDirectory = big.NewInt(1 << 1) + fileInfoV2FieldContents = big.NewInt(1 << 2) + fileInfoV2FieldEditable = big.NewInt(1 << 3) +) + +type FileInfoV2 struct { + Filename string `json:"filename" url:"filename"` + Directory string `json:"directory" url:"directory"` + Contents string `json:"contents" url:"contents"` + Editable bool `json:"editable" url:"editable"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (f *FileInfoV2) GetFilename() string { + if f == nil { + return "" + } + return f.Filename +} + +func (f *FileInfoV2) GetDirectory() string { + if f == nil { + return "" + } + return f.Directory +} + +func (f *FileInfoV2) GetContents() string { + if f == nil { + return "" + } + return f.Contents +} + +func (f *FileInfoV2) GetEditable() bool { + if f == nil { + return false + } + return f.Editable +} + +func (f *FileInfoV2) GetExtraProperties() map[string]interface{} { + if f == nil { + return nil + } + return f.extraProperties +} + +func (f *FileInfoV2) require(field *big.Int) { + if f.explicitFields == nil { + f.explicitFields = big.NewInt(0) + } + f.explicitFields.Or(f.explicitFields, field) +} + +// SetFilename sets the Filename field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (f *FileInfoV2) SetFilename(filename string) { + f.Filename = filename + f.require(fileInfoV2FieldFilename) +} + +// SetDirectory sets the Directory field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (f *FileInfoV2) SetDirectory(directory string) { + f.Directory = directory + f.require(fileInfoV2FieldDirectory) +} + +// SetContents sets the Contents field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (f *FileInfoV2) SetContents(contents string) { + f.Contents = contents + f.require(fileInfoV2FieldContents) +} + +// SetEditable sets the Editable field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (f *FileInfoV2) SetEditable(editable bool) { + f.Editable = editable + f.require(fileInfoV2FieldEditable) +} + +func (f *FileInfoV2) UnmarshalJSON(data []byte) error { + type unmarshaler FileInfoV2 + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *f = FileInfoV2(value) + extraProperties, err := internal.ExtractExtraProperties(data, *f) + if err != nil { + return err + } + f.extraProperties = extraProperties + f.rawJSON = json.RawMessage(data) + return nil +} + +func (f *FileInfoV2) MarshalJSON() ([]byte, error) { + type embed FileInfoV2 + var marshaler = struct { + embed + }{ + embed: embed(*f), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, f.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (f *FileInfoV2) String() string { + if f == nil { + return "" + } + if len(f.rawJSON) > 0 { + if value, err := internal.StringifyJSON(f.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(f); err == nil { + return value + } + return fmt.Sprintf("%#v", f) +} + +var ( + filesFieldFiles = big.NewInt(1 << 0) +) + +type Files struct { + Files []*FileInfoV2 `json:"files" url:"files"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (f *Files) GetFiles() []*FileInfoV2 { + if f == nil { + return nil + } + return f.Files +} + +func (f *Files) GetExtraProperties() map[string]interface{} { + if f == nil { + return nil + } + return f.extraProperties +} + +func (f *Files) require(field *big.Int) { + if f.explicitFields == nil { + f.explicitFields = big.NewInt(0) + } + f.explicitFields.Or(f.explicitFields, field) +} + +// SetFiles sets the Files field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (f *Files) SetFiles(files []*FileInfoV2) { + f.Files = files + f.require(filesFieldFiles) +} + +func (f *Files) UnmarshalJSON(data []byte) error { + type unmarshaler Files + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *f = Files(value) + extraProperties, err := internal.ExtractExtraProperties(data, *f) + if err != nil { + return err + } + f.extraProperties = extraProperties + f.rawJSON = json.RawMessage(data) + return nil +} + +func (f *Files) MarshalJSON() ([]byte, error) { + type embed Files + var marshaler = struct { + embed + }{ + embed: embed(*f), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, f.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (f *Files) String() string { + if f == nil { + return "" + } + if len(f.rawJSON) > 0 { + if value, err := internal.StringifyJSON(f.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(f); err == nil { + return value + } + return fmt.Sprintf("%#v", f) +} + +var ( + functionImplementationFieldImpl = big.NewInt(1 << 0) + functionImplementationFieldImports = big.NewInt(1 << 1) +) + +type FunctionImplementation struct { + Impl string `json:"impl" url:"impl"` + Imports *string `json:"imports,omitempty" url:"imports,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (f *FunctionImplementation) GetImpl() string { + if f == nil { + return "" + } + return f.Impl +} + +func (f *FunctionImplementation) GetImports() *string { + if f == nil { + return nil + } + return f.Imports +} + +func (f *FunctionImplementation) GetExtraProperties() map[string]interface{} { + if f == nil { + return nil + } + return f.extraProperties +} + +func (f *FunctionImplementation) require(field *big.Int) { + if f.explicitFields == nil { + f.explicitFields = big.NewInt(0) + } + f.explicitFields.Or(f.explicitFields, field) +} + +// SetImpl sets the Impl field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (f *FunctionImplementation) SetImpl(impl string) { + f.Impl = impl + f.require(functionImplementationFieldImpl) +} + +// SetImports sets the Imports field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (f *FunctionImplementation) SetImports(imports *string) { + f.Imports = imports + f.require(functionImplementationFieldImports) +} + +func (f *FunctionImplementation) UnmarshalJSON(data []byte) error { + type unmarshaler FunctionImplementation + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *f = FunctionImplementation(value) + extraProperties, err := internal.ExtractExtraProperties(data, *f) + if err != nil { + return err + } + f.extraProperties = extraProperties + f.rawJSON = json.RawMessage(data) + return nil +} + +func (f *FunctionImplementation) MarshalJSON() ([]byte, error) { + type embed FunctionImplementation + var marshaler = struct { + embed + }{ + embed: embed(*f), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, f.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (f *FunctionImplementation) String() string { + if f == nil { + return "" + } + if len(f.rawJSON) > 0 { + if value, err := internal.StringifyJSON(f.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(f); err == nil { + return value + } + return fmt.Sprintf("%#v", f) +} + +var ( + functionImplementationForMultipleLanguagesFieldCodeByLanguage = big.NewInt(1 << 0) +) + +type FunctionImplementationForMultipleLanguages struct { + CodeByLanguage map[common.Language]*FunctionImplementation `json:"codeByLanguage" url:"codeByLanguage"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (f *FunctionImplementationForMultipleLanguages) GetCodeByLanguage() map[common.Language]*FunctionImplementation { + if f == nil { + return nil + } + return f.CodeByLanguage +} + +func (f *FunctionImplementationForMultipleLanguages) GetExtraProperties() map[string]interface{} { + if f == nil { + return nil + } + return f.extraProperties +} + +func (f *FunctionImplementationForMultipleLanguages) require(field *big.Int) { + if f.explicitFields == nil { + f.explicitFields = big.NewInt(0) + } + f.explicitFields.Or(f.explicitFields, field) +} + +// SetCodeByLanguage sets the CodeByLanguage field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (f *FunctionImplementationForMultipleLanguages) SetCodeByLanguage(codeByLanguage map[common.Language]*FunctionImplementation) { + f.CodeByLanguage = codeByLanguage + f.require(functionImplementationForMultipleLanguagesFieldCodeByLanguage) +} + +func (f *FunctionImplementationForMultipleLanguages) UnmarshalJSON(data []byte) error { + type unmarshaler FunctionImplementationForMultipleLanguages + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *f = FunctionImplementationForMultipleLanguages(value) + extraProperties, err := internal.ExtractExtraProperties(data, *f) + if err != nil { + return err + } + f.extraProperties = extraProperties + f.rawJSON = json.RawMessage(data) + return nil +} + +func (f *FunctionImplementationForMultipleLanguages) MarshalJSON() ([]byte, error) { + type embed FunctionImplementationForMultipleLanguages + var marshaler = struct { + embed + }{ + embed: embed(*f), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, f.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (f *FunctionImplementationForMultipleLanguages) String() string { + if f == nil { + return "" + } + if len(f.rawJSON) > 0 { + if value, err := internal.StringifyJSON(f.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(f); err == nil { + return value + } + return fmt.Sprintf("%#v", f) +} + +type FunctionSignature struct { + Type string + Void *VoidFunctionSignature + NonVoid *NonVoidFunctionSignature + // Useful when specifying custom grading for a testcase where actualResult is defined. + VoidThatTakesActualResult *VoidFunctionSignatureThatTakesActualResult + + rawJSON json.RawMessage +} + +func (f *FunctionSignature) GetType() string { + if f == nil { + return "" + } + return f.Type +} + +func (f *FunctionSignature) GetVoid() *VoidFunctionSignature { + if f == nil { + return nil + } + return f.Void +} + +func (f *FunctionSignature) GetNonVoid() *NonVoidFunctionSignature { + if f == nil { + return nil + } + return f.NonVoid +} + +func (f *FunctionSignature) GetVoidThatTakesActualResult() *VoidFunctionSignatureThatTakesActualResult { + if f == nil { + return nil + } + return f.VoidThatTakesActualResult +} + +func (f *FunctionSignature) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + f.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", f) + } + switch unmarshaler.Type { + case "void": + value := new(VoidFunctionSignature) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + f.Void = value + case "nonVoid": + value := new(NonVoidFunctionSignature) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + f.NonVoid = value + case "voidThatTakesActualResult": + value := new(VoidFunctionSignatureThatTakesActualResult) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + f.VoidThatTakesActualResult = value + } + f.rawJSON = json.RawMessage(data) + return nil +} + +func (f FunctionSignature) MarshalJSON() ([]byte, error) { + if err := f.validate(); err != nil { + return nil, err + } + if f.Void != nil { + return internal.MarshalJSONWithExtraProperty(f.Void, "type", "void") + } + if f.NonVoid != nil { + return internal.MarshalJSONWithExtraProperty(f.NonVoid, "type", "nonVoid") + } + if f.VoidThatTakesActualResult != nil { + return internal.MarshalJSONWithExtraProperty(f.VoidThatTakesActualResult, "type", "voidThatTakesActualResult") + } + if len(f.rawJSON) > 0 { + return f.rawJSON, nil + } + return nil, fmt.Errorf("type %T does not define a non-empty union type", f) +} + +type FunctionSignatureVisitor interface { + VisitVoid(*VoidFunctionSignature) error + VisitNonVoid(*NonVoidFunctionSignature) error + VisitVoidThatTakesActualResult(*VoidFunctionSignatureThatTakesActualResult) error +} + +func (f *FunctionSignature) Accept(visitor FunctionSignatureVisitor) error { + if f.Void != nil { + return visitor.VisitVoid(f.Void) + } + if f.NonVoid != nil { + return visitor.VisitNonVoid(f.NonVoid) + } + if f.VoidThatTakesActualResult != nil { + return visitor.VisitVoidThatTakesActualResult(f.VoidThatTakesActualResult) + } + return fmt.Errorf("type %T does not define a non-empty union type", f) +} + +func (f *FunctionSignature) validate() error { + if f == nil { + return fmt.Errorf("type %T is nil", f) + } + var fields []string + if f.Void != nil { + fields = append(fields, "void") + } + if f.NonVoid != nil { + fields = append(fields, "nonVoid") + } + if f.VoidThatTakesActualResult != nil { + fields = append(fields, "voidThatTakesActualResult") + } + if len(fields) == 0 { + if f.Type != "" { + if len(f.rawJSON) > 0 { + return nil + } + return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", f, f.Type) + } + return fmt.Errorf("type %T is empty", f) + } + if len(fields) > 1 { + return fmt.Errorf("type %T defines values for %s, but only one value is allowed", f, fields) + } + if f.Type != "" { + field := fields[0] + if f.Type != field { + return fmt.Errorf( + "type %T defines a discriminant set to %q, but it does not match the %T field; either remove or update the discriminant to match", + f, + f.Type, + f, + ) + } + } + return nil +} + +var ( + generatedFilesFieldGeneratedTestCaseFiles = big.NewInt(1 << 0) + generatedFilesFieldGeneratedTemplateFiles = big.NewInt(1 << 1) + generatedFilesFieldOther = big.NewInt(1 << 2) +) + +type GeneratedFiles struct { + GeneratedTestCaseFiles map[common.Language]*Files `json:"generatedTestCaseFiles" url:"generatedTestCaseFiles"` + GeneratedTemplateFiles map[common.Language]*Files `json:"generatedTemplateFiles" url:"generatedTemplateFiles"` + Other map[common.Language]*Files `json:"other" url:"other"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (g *GeneratedFiles) GetGeneratedTestCaseFiles() map[common.Language]*Files { + if g == nil { + return nil + } + return g.GeneratedTestCaseFiles +} + +func (g *GeneratedFiles) GetGeneratedTemplateFiles() map[common.Language]*Files { + if g == nil { + return nil + } + return g.GeneratedTemplateFiles +} + +func (g *GeneratedFiles) GetOther() map[common.Language]*Files { + if g == nil { + return nil + } + return g.Other +} + +func (g *GeneratedFiles) GetExtraProperties() map[string]interface{} { + if g == nil { + return nil + } + return g.extraProperties +} + +func (g *GeneratedFiles) require(field *big.Int) { + if g.explicitFields == nil { + g.explicitFields = big.NewInt(0) + } + g.explicitFields.Or(g.explicitFields, field) +} + +// SetGeneratedTestCaseFiles sets the GeneratedTestCaseFiles field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GeneratedFiles) SetGeneratedTestCaseFiles(generatedTestCaseFiles map[common.Language]*Files) { + g.GeneratedTestCaseFiles = generatedTestCaseFiles + g.require(generatedFilesFieldGeneratedTestCaseFiles) +} + +// SetGeneratedTemplateFiles sets the GeneratedTemplateFiles field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GeneratedFiles) SetGeneratedTemplateFiles(generatedTemplateFiles map[common.Language]*Files) { + g.GeneratedTemplateFiles = generatedTemplateFiles + g.require(generatedFilesFieldGeneratedTemplateFiles) +} + +// SetOther sets the Other field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GeneratedFiles) SetOther(other map[common.Language]*Files) { + g.Other = other + g.require(generatedFilesFieldOther) +} + +func (g *GeneratedFiles) UnmarshalJSON(data []byte) error { + type unmarshaler GeneratedFiles + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GeneratedFiles(value) + extraProperties, err := internal.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + g.rawJSON = json.RawMessage(data) + return nil +} + +func (g *GeneratedFiles) MarshalJSON() ([]byte, error) { + type embed GeneratedFiles + var marshaler = struct { + embed + }{ + embed: embed(*g), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, g.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (g *GeneratedFiles) String() string { + if g == nil { + return "" + } + if len(g.rawJSON) > 0 { + if value, err := internal.StringifyJSON(g.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +var ( + getBasicSolutionFileRequestFieldMethodName = big.NewInt(1 << 0) + getBasicSolutionFileRequestFieldSignature = big.NewInt(1 << 1) +) + +type GetBasicSolutionFileRequest struct { + MethodName string `json:"methodName" url:"methodName"` + Signature *NonVoidFunctionSignature `json:"signature" url:"signature"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (g *GetBasicSolutionFileRequest) GetMethodName() string { + if g == nil { + return "" + } + return g.MethodName +} + +func (g *GetBasicSolutionFileRequest) GetSignature() *NonVoidFunctionSignature { + if g == nil { + return nil + } + return g.Signature +} + +func (g *GetBasicSolutionFileRequest) GetExtraProperties() map[string]interface{} { + if g == nil { + return nil + } + return g.extraProperties +} + +func (g *GetBasicSolutionFileRequest) require(field *big.Int) { + if g.explicitFields == nil { + g.explicitFields = big.NewInt(0) + } + g.explicitFields.Or(g.explicitFields, field) +} + +// SetMethodName sets the MethodName field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetBasicSolutionFileRequest) SetMethodName(methodName string) { + g.MethodName = methodName + g.require(getBasicSolutionFileRequestFieldMethodName) +} + +// SetSignature sets the Signature field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetBasicSolutionFileRequest) SetSignature(signature *NonVoidFunctionSignature) { + g.Signature = signature + g.require(getBasicSolutionFileRequestFieldSignature) +} + +func (g *GetBasicSolutionFileRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetBasicSolutionFileRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetBasicSolutionFileRequest(value) + extraProperties, err := internal.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + g.rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetBasicSolutionFileRequest) MarshalJSON() ([]byte, error) { + type embed GetBasicSolutionFileRequest + var marshaler = struct { + embed + }{ + embed: embed(*g), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, g.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (g *GetBasicSolutionFileRequest) String() string { + if g == nil { + return "" + } + if len(g.rawJSON) > 0 { + if value, err := internal.StringifyJSON(g.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +var ( + getBasicSolutionFileResponseFieldSolutionFileByLanguage = big.NewInt(1 << 0) +) + +type GetBasicSolutionFileResponse struct { + SolutionFileByLanguage map[common.Language]*FileInfoV2 `json:"solutionFileByLanguage" url:"solutionFileByLanguage"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (g *GetBasicSolutionFileResponse) GetSolutionFileByLanguage() map[common.Language]*FileInfoV2 { + if g == nil { + return nil + } + return g.SolutionFileByLanguage +} + +func (g *GetBasicSolutionFileResponse) GetExtraProperties() map[string]interface{} { + if g == nil { + return nil + } + return g.extraProperties +} + +func (g *GetBasicSolutionFileResponse) require(field *big.Int) { + if g.explicitFields == nil { + g.explicitFields = big.NewInt(0) + } + g.explicitFields.Or(g.explicitFields, field) +} + +// SetSolutionFileByLanguage sets the SolutionFileByLanguage field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetBasicSolutionFileResponse) SetSolutionFileByLanguage(solutionFileByLanguage map[common.Language]*FileInfoV2) { + g.SolutionFileByLanguage = solutionFileByLanguage + g.require(getBasicSolutionFileResponseFieldSolutionFileByLanguage) +} + +func (g *GetBasicSolutionFileResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetBasicSolutionFileResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetBasicSolutionFileResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + g.rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetBasicSolutionFileResponse) MarshalJSON() ([]byte, error) { + type embed GetBasicSolutionFileResponse + var marshaler = struct { + embed + }{ + embed: embed(*g), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, g.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (g *GetBasicSolutionFileResponse) String() string { + if g == nil { + return "" + } + if len(g.rawJSON) > 0 { + if value, err := internal.StringifyJSON(g.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +var ( + getFunctionSignatureRequestFieldFunctionSignature = big.NewInt(1 << 0) +) + +type GetFunctionSignatureRequest struct { + FunctionSignature *FunctionSignature `json:"functionSignature" url:"functionSignature"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (g *GetFunctionSignatureRequest) GetFunctionSignature() *FunctionSignature { + if g == nil { + return nil + } + return g.FunctionSignature +} + +func (g *GetFunctionSignatureRequest) GetExtraProperties() map[string]interface{} { + if g == nil { + return nil + } + return g.extraProperties +} + +func (g *GetFunctionSignatureRequest) require(field *big.Int) { + if g.explicitFields == nil { + g.explicitFields = big.NewInt(0) + } + g.explicitFields.Or(g.explicitFields, field) +} + +// SetFunctionSignature sets the FunctionSignature field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetFunctionSignatureRequest) SetFunctionSignature(functionSignature *FunctionSignature) { + g.FunctionSignature = functionSignature + g.require(getFunctionSignatureRequestFieldFunctionSignature) +} + +func (g *GetFunctionSignatureRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetFunctionSignatureRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetFunctionSignatureRequest(value) + extraProperties, err := internal.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + g.rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetFunctionSignatureRequest) MarshalJSON() ([]byte, error) { + type embed GetFunctionSignatureRequest + var marshaler = struct { + embed + }{ + embed: embed(*g), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, g.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (g *GetFunctionSignatureRequest) String() string { + if g == nil { + return "" + } + if len(g.rawJSON) > 0 { + if value, err := internal.StringifyJSON(g.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +var ( + getFunctionSignatureResponseFieldFunctionByLanguage = big.NewInt(1 << 0) +) + +type GetFunctionSignatureResponse struct { + FunctionByLanguage map[common.Language]string `json:"functionByLanguage" url:"functionByLanguage"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (g *GetFunctionSignatureResponse) GetFunctionByLanguage() map[common.Language]string { + if g == nil { + return nil + } + return g.FunctionByLanguage +} + +func (g *GetFunctionSignatureResponse) GetExtraProperties() map[string]interface{} { + if g == nil { + return nil + } + return g.extraProperties +} + +func (g *GetFunctionSignatureResponse) require(field *big.Int) { + if g.explicitFields == nil { + g.explicitFields = big.NewInt(0) + } + g.explicitFields.Or(g.explicitFields, field) +} + +// SetFunctionByLanguage sets the FunctionByLanguage field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetFunctionSignatureResponse) SetFunctionByLanguage(functionByLanguage map[common.Language]string) { + g.FunctionByLanguage = functionByLanguage + g.require(getFunctionSignatureResponseFieldFunctionByLanguage) +} + +func (g *GetFunctionSignatureResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetFunctionSignatureResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetFunctionSignatureResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + g.rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetFunctionSignatureResponse) MarshalJSON() ([]byte, error) { + type embed GetFunctionSignatureResponse + var marshaler = struct { + embed + }{ + embed: embed(*g), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, g.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (g *GetFunctionSignatureResponse) String() string { + if g == nil { + return "" + } + if len(g.rawJSON) > 0 { + if value, err := internal.StringifyJSON(g.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +var ( + getGeneratedTestCaseFileRequestFieldTemplate = big.NewInt(1 << 0) + getGeneratedTestCaseFileRequestFieldTestCase = big.NewInt(1 << 1) +) + +type GetGeneratedTestCaseFileRequest struct { + Template *TestCaseTemplate `json:"template,omitempty" url:"template,omitempty"` + TestCase *TestCaseV2 `json:"testCase" url:"testCase"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (g *GetGeneratedTestCaseFileRequest) GetTemplate() *TestCaseTemplate { + if g == nil { + return nil + } + return g.Template +} + +func (g *GetGeneratedTestCaseFileRequest) GetTestCase() *TestCaseV2 { + if g == nil { + return nil + } + return g.TestCase +} + +func (g *GetGeneratedTestCaseFileRequest) GetExtraProperties() map[string]interface{} { + if g == nil { + return nil + } + return g.extraProperties +} + +func (g *GetGeneratedTestCaseFileRequest) require(field *big.Int) { + if g.explicitFields == nil { + g.explicitFields = big.NewInt(0) + } + g.explicitFields.Or(g.explicitFields, field) +} + +// SetTemplate sets the Template field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetGeneratedTestCaseFileRequest) SetTemplate(template *TestCaseTemplate) { + g.Template = template + g.require(getGeneratedTestCaseFileRequestFieldTemplate) +} + +// SetTestCase sets the TestCase field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetGeneratedTestCaseFileRequest) SetTestCase(testCase *TestCaseV2) { + g.TestCase = testCase + g.require(getGeneratedTestCaseFileRequestFieldTestCase) +} + +func (g *GetGeneratedTestCaseFileRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetGeneratedTestCaseFileRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetGeneratedTestCaseFileRequest(value) + extraProperties, err := internal.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + g.rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetGeneratedTestCaseFileRequest) MarshalJSON() ([]byte, error) { + type embed GetGeneratedTestCaseFileRequest + var marshaler = struct { + embed + }{ + embed: embed(*g), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, g.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (g *GetGeneratedTestCaseFileRequest) String() string { + if g == nil { + return "" + } + if len(g.rawJSON) > 0 { + if value, err := internal.StringifyJSON(g.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +var ( + getGeneratedTestCaseTemplateFileRequestFieldTemplate = big.NewInt(1 << 0) +) + +type GetGeneratedTestCaseTemplateFileRequest struct { + Template *TestCaseTemplate `json:"template" url:"template"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (g *GetGeneratedTestCaseTemplateFileRequest) GetTemplate() *TestCaseTemplate { + if g == nil { + return nil + } + return g.Template +} + +func (g *GetGeneratedTestCaseTemplateFileRequest) GetExtraProperties() map[string]interface{} { + if g == nil { + return nil + } + return g.extraProperties +} + +func (g *GetGeneratedTestCaseTemplateFileRequest) require(field *big.Int) { + if g.explicitFields == nil { + g.explicitFields = big.NewInt(0) + } + g.explicitFields.Or(g.explicitFields, field) +} + +// SetTemplate sets the Template field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetGeneratedTestCaseTemplateFileRequest) SetTemplate(template *TestCaseTemplate) { + g.Template = template + g.require(getGeneratedTestCaseTemplateFileRequestFieldTemplate) +} + +func (g *GetGeneratedTestCaseTemplateFileRequest) UnmarshalJSON(data []byte) error { + type unmarshaler GetGeneratedTestCaseTemplateFileRequest + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetGeneratedTestCaseTemplateFileRequest(value) + extraProperties, err := internal.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + g.rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetGeneratedTestCaseTemplateFileRequest) MarshalJSON() ([]byte, error) { + type embed GetGeneratedTestCaseTemplateFileRequest + var marshaler = struct { + embed + }{ + embed: embed(*g), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, g.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (g *GetGeneratedTestCaseTemplateFileRequest) String() string { + if g == nil { + return "" + } + if len(g.rawJSON) > 0 { + if value, err := internal.StringifyJSON(g.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +var ( + lightweightProblemInfoV2FieldProblemID = big.NewInt(1 << 0) + lightweightProblemInfoV2FieldProblemName = big.NewInt(1 << 1) + lightweightProblemInfoV2FieldProblemVersion = big.NewInt(1 << 2) + lightweightProblemInfoV2FieldVariableTypes = big.NewInt(1 << 3) +) + +type LightweightProblemInfoV2 struct { + ProblemID common.ProblemID `json:"problemId" url:"problemId"` + ProblemName string `json:"problemName" url:"problemName"` + ProblemVersion int `json:"problemVersion" url:"problemVersion"` + VariableTypes []*common.VariableType `json:"variableTypes" url:"variableTypes"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (l *LightweightProblemInfoV2) GetProblemID() common.ProblemID { + if l == nil { + return "" + } + return l.ProblemID +} + +func (l *LightweightProblemInfoV2) GetProblemName() string { + if l == nil { + return "" + } + return l.ProblemName +} + +func (l *LightweightProblemInfoV2) GetProblemVersion() int { + if l == nil { + return 0 + } + return l.ProblemVersion +} + +func (l *LightweightProblemInfoV2) GetVariableTypes() []*common.VariableType { + if l == nil { + return nil + } + return l.VariableTypes +} + +func (l *LightweightProblemInfoV2) GetExtraProperties() map[string]interface{} { + if l == nil { + return nil + } + return l.extraProperties +} + +func (l *LightweightProblemInfoV2) require(field *big.Int) { + if l.explicitFields == nil { + l.explicitFields = big.NewInt(0) + } + l.explicitFields.Or(l.explicitFields, field) +} + +// SetProblemID sets the ProblemID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LightweightProblemInfoV2) SetProblemID(problemID common.ProblemID) { + l.ProblemID = problemID + l.require(lightweightProblemInfoV2FieldProblemID) +} + +// SetProblemName sets the ProblemName field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LightweightProblemInfoV2) SetProblemName(problemName string) { + l.ProblemName = problemName + l.require(lightweightProblemInfoV2FieldProblemName) +} + +// SetProblemVersion sets the ProblemVersion field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LightweightProblemInfoV2) SetProblemVersion(problemVersion int) { + l.ProblemVersion = problemVersion + l.require(lightweightProblemInfoV2FieldProblemVersion) +} + +// SetVariableTypes sets the VariableTypes field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LightweightProblemInfoV2) SetVariableTypes(variableTypes []*common.VariableType) { + l.VariableTypes = variableTypes + l.require(lightweightProblemInfoV2FieldVariableTypes) +} + +func (l *LightweightProblemInfoV2) UnmarshalJSON(data []byte) error { + type unmarshaler LightweightProblemInfoV2 + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *l = LightweightProblemInfoV2(value) + extraProperties, err := internal.ExtractExtraProperties(data, *l) + if err != nil { + return err + } + l.extraProperties = extraProperties + l.rawJSON = json.RawMessage(data) + return nil +} + +func (l *LightweightProblemInfoV2) MarshalJSON() ([]byte, error) { + type embed LightweightProblemInfoV2 + var marshaler = struct { + embed + }{ + embed: embed(*l), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, l.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (l *LightweightProblemInfoV2) String() string { + if l == nil { + return "" + } + if len(l.rawJSON) > 0 { + if value, err := internal.StringifyJSON(l.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(l); err == nil { + return value + } + return fmt.Sprintf("%#v", l) +} + +var ( + nonVoidFunctionDefinitionFieldSignature = big.NewInt(1 << 0) + nonVoidFunctionDefinitionFieldCode = big.NewInt(1 << 1) +) + +type NonVoidFunctionDefinition struct { + Signature *NonVoidFunctionSignature `json:"signature" url:"signature"` + Code *FunctionImplementationForMultipleLanguages `json:"code" url:"code"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (n *NonVoidFunctionDefinition) GetSignature() *NonVoidFunctionSignature { + if n == nil { + return nil + } + return n.Signature +} + +func (n *NonVoidFunctionDefinition) GetCode() *FunctionImplementationForMultipleLanguages { + if n == nil { + return nil + } + return n.Code +} + +func (n *NonVoidFunctionDefinition) GetExtraProperties() map[string]interface{} { + if n == nil { + return nil + } + return n.extraProperties +} + +func (n *NonVoidFunctionDefinition) require(field *big.Int) { + if n.explicitFields == nil { + n.explicitFields = big.NewInt(0) + } + n.explicitFields.Or(n.explicitFields, field) +} + +// SetSignature sets the Signature field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (n *NonVoidFunctionDefinition) SetSignature(signature *NonVoidFunctionSignature) { + n.Signature = signature + n.require(nonVoidFunctionDefinitionFieldSignature) +} + +// SetCode sets the Code field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (n *NonVoidFunctionDefinition) SetCode(code *FunctionImplementationForMultipleLanguages) { + n.Code = code + n.require(nonVoidFunctionDefinitionFieldCode) +} + +func (n *NonVoidFunctionDefinition) UnmarshalJSON(data []byte) error { + type unmarshaler NonVoidFunctionDefinition + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *n = NonVoidFunctionDefinition(value) + extraProperties, err := internal.ExtractExtraProperties(data, *n) + if err != nil { + return err + } + n.extraProperties = extraProperties + n.rawJSON = json.RawMessage(data) + return nil +} + +func (n *NonVoidFunctionDefinition) MarshalJSON() ([]byte, error) { + type embed NonVoidFunctionDefinition + var marshaler = struct { + embed + }{ + embed: embed(*n), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, n.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (n *NonVoidFunctionDefinition) String() string { + if n == nil { + return "" + } + if len(n.rawJSON) > 0 { + if value, err := internal.StringifyJSON(n.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(n); err == nil { + return value + } + return fmt.Sprintf("%#v", n) +} + +var ( + nonVoidFunctionSignatureFieldParameters = big.NewInt(1 << 0) + nonVoidFunctionSignatureFieldReturnType = big.NewInt(1 << 1) +) + +type NonVoidFunctionSignature struct { + Parameters []*Parameter `json:"parameters" url:"parameters"` + ReturnType *common.VariableType `json:"returnType" url:"returnType"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (n *NonVoidFunctionSignature) GetParameters() []*Parameter { + if n == nil { + return nil + } + return n.Parameters +} + +func (n *NonVoidFunctionSignature) GetReturnType() *common.VariableType { + if n == nil { + return nil + } + return n.ReturnType +} + +func (n *NonVoidFunctionSignature) GetExtraProperties() map[string]interface{} { + if n == nil { + return nil + } + return n.extraProperties +} + +func (n *NonVoidFunctionSignature) require(field *big.Int) { + if n.explicitFields == nil { + n.explicitFields = big.NewInt(0) + } + n.explicitFields.Or(n.explicitFields, field) +} + +// SetParameters sets the Parameters field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (n *NonVoidFunctionSignature) SetParameters(parameters []*Parameter) { + n.Parameters = parameters + n.require(nonVoidFunctionSignatureFieldParameters) +} + +// SetReturnType sets the ReturnType field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (n *NonVoidFunctionSignature) SetReturnType(returnType *common.VariableType) { + n.ReturnType = returnType + n.require(nonVoidFunctionSignatureFieldReturnType) +} + +func (n *NonVoidFunctionSignature) UnmarshalJSON(data []byte) error { + type unmarshaler NonVoidFunctionSignature + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *n = NonVoidFunctionSignature(value) + extraProperties, err := internal.ExtractExtraProperties(data, *n) + if err != nil { + return err + } + n.extraProperties = extraProperties + n.rawJSON = json.RawMessage(data) + return nil +} + +func (n *NonVoidFunctionSignature) MarshalJSON() ([]byte, error) { + type embed NonVoidFunctionSignature + var marshaler = struct { + embed + }{ + embed: embed(*n), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, n.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (n *NonVoidFunctionSignature) String() string { + if n == nil { + return "" + } + if len(n.rawJSON) > 0 { + if value, err := internal.StringifyJSON(n.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(n); err == nil { + return value + } + return fmt.Sprintf("%#v", n) +} + +var ( + parameterFieldParameterID = big.NewInt(1 << 0) + parameterFieldName = big.NewInt(1 << 1) + parameterFieldVariableType = big.NewInt(1 << 2) +) + +type Parameter struct { + ParameterID ParameterID `json:"parameterId" url:"parameterId"` + Name string `json:"name" url:"name"` + VariableType *common.VariableType `json:"variableType" url:"variableType"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (p *Parameter) GetParameterID() ParameterID { + if p == nil { + return "" + } + return p.ParameterID +} + +func (p *Parameter) GetName() string { + if p == nil { + return "" + } + return p.Name +} + +func (p *Parameter) GetVariableType() *common.VariableType { + if p == nil { + return nil + } + return p.VariableType +} + +func (p *Parameter) GetExtraProperties() map[string]interface{} { + if p == nil { + return nil + } + return p.extraProperties +} + +func (p *Parameter) require(field *big.Int) { + if p.explicitFields == nil { + p.explicitFields = big.NewInt(0) + } + p.explicitFields.Or(p.explicitFields, field) +} + +// SetParameterID sets the ParameterID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *Parameter) SetParameterID(parameterID ParameterID) { + p.ParameterID = parameterID + p.require(parameterFieldParameterID) +} + +// SetName sets the Name field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *Parameter) SetName(name string) { + p.Name = name + p.require(parameterFieldName) +} + +// SetVariableType sets the VariableType field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *Parameter) SetVariableType(variableType *common.VariableType) { + p.VariableType = variableType + p.require(parameterFieldVariableType) +} + +func (p *Parameter) UnmarshalJSON(data []byte) error { + type unmarshaler Parameter + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *p = Parameter(value) + extraProperties, err := internal.ExtractExtraProperties(data, *p) + if err != nil { + return err + } + p.extraProperties = extraProperties + p.rawJSON = json.RawMessage(data) + return nil +} + +func (p *Parameter) MarshalJSON() ([]byte, error) { + type embed Parameter + var marshaler = struct { + embed + }{ + embed: embed(*p), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, p.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (p *Parameter) String() string { + if p == nil { + return "" + } + if len(p.rawJSON) > 0 { + if value, err := internal.StringifyJSON(p.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(p); err == nil { + return value + } + return fmt.Sprintf("%#v", p) +} + +type ParameterID = string + +var ( + problemInfoV2FieldProblemID = big.NewInt(1 << 0) + problemInfoV2FieldProblemDescription = big.NewInt(1 << 1) + problemInfoV2FieldProblemName = big.NewInt(1 << 2) + problemInfoV2FieldProblemVersion = big.NewInt(1 << 3) + problemInfoV2FieldSupportedLanguages = big.NewInt(1 << 4) + problemInfoV2FieldCustomFiles = big.NewInt(1 << 5) + problemInfoV2FieldGeneratedFiles = big.NewInt(1 << 6) + problemInfoV2FieldCustomTestCaseTemplates = big.NewInt(1 << 7) + problemInfoV2FieldTestcases = big.NewInt(1 << 8) + problemInfoV2FieldIsPublic = big.NewInt(1 << 9) +) + +type ProblemInfoV2 struct { + ProblemID common.ProblemID `json:"problemId" url:"problemId"` + ProblemDescription *common.ProblemDescription `json:"problemDescription" url:"problemDescription"` + ProblemName string `json:"problemName" url:"problemName"` + ProblemVersion int `json:"problemVersion" url:"problemVersion"` + SupportedLanguages []common.Language `json:"supportedLanguages" url:"supportedLanguages"` + CustomFiles *CustomFiles `json:"customFiles" url:"customFiles"` + GeneratedFiles *GeneratedFiles `json:"generatedFiles" url:"generatedFiles"` + CustomTestCaseTemplates []*TestCaseTemplate `json:"customTestCaseTemplates" url:"customTestCaseTemplates"` + Testcases []*TestCaseV2 `json:"testcases" url:"testcases"` + IsPublic bool `json:"isPublic" url:"isPublic"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (p *ProblemInfoV2) GetProblemID() common.ProblemID { + if p == nil { + return "" + } + return p.ProblemID +} + +func (p *ProblemInfoV2) GetProblemDescription() *common.ProblemDescription { + if p == nil { + return nil + } + return p.ProblemDescription +} + +func (p *ProblemInfoV2) GetProblemName() string { + if p == nil { + return "" + } + return p.ProblemName +} + +func (p *ProblemInfoV2) GetProblemVersion() int { + if p == nil { + return 0 + } + return p.ProblemVersion +} + +func (p *ProblemInfoV2) GetSupportedLanguages() []common.Language { + if p == nil { + return nil + } + return p.SupportedLanguages +} + +func (p *ProblemInfoV2) GetCustomFiles() *CustomFiles { + if p == nil { + return nil + } + return p.CustomFiles +} + +func (p *ProblemInfoV2) GetGeneratedFiles() *GeneratedFiles { + if p == nil { + return nil + } + return p.GeneratedFiles +} + +func (p *ProblemInfoV2) GetCustomTestCaseTemplates() []*TestCaseTemplate { + if p == nil { + return nil + } + return p.CustomTestCaseTemplates +} + +func (p *ProblemInfoV2) GetTestcases() []*TestCaseV2 { + if p == nil { + return nil + } + return p.Testcases +} + +func (p *ProblemInfoV2) GetIsPublic() bool { + if p == nil { + return false + } + return p.IsPublic +} + +func (p *ProblemInfoV2) GetExtraProperties() map[string]interface{} { + if p == nil { + return nil + } + return p.extraProperties +} + +func (p *ProblemInfoV2) require(field *big.Int) { + if p.explicitFields == nil { + p.explicitFields = big.NewInt(0) + } + p.explicitFields.Or(p.explicitFields, field) +} + +// SetProblemID sets the ProblemID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ProblemInfoV2) SetProblemID(problemID common.ProblemID) { + p.ProblemID = problemID + p.require(problemInfoV2FieldProblemID) +} + +// SetProblemDescription sets the ProblemDescription field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ProblemInfoV2) SetProblemDescription(problemDescription *common.ProblemDescription) { + p.ProblemDescription = problemDescription + p.require(problemInfoV2FieldProblemDescription) +} + +// SetProblemName sets the ProblemName field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ProblemInfoV2) SetProblemName(problemName string) { + p.ProblemName = problemName + p.require(problemInfoV2FieldProblemName) +} + +// SetProblemVersion sets the ProblemVersion field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ProblemInfoV2) SetProblemVersion(problemVersion int) { + p.ProblemVersion = problemVersion + p.require(problemInfoV2FieldProblemVersion) +} + +// SetSupportedLanguages sets the SupportedLanguages field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ProblemInfoV2) SetSupportedLanguages(supportedLanguages []common.Language) { + p.SupportedLanguages = supportedLanguages + p.require(problemInfoV2FieldSupportedLanguages) +} + +// SetCustomFiles sets the CustomFiles field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ProblemInfoV2) SetCustomFiles(customFiles *CustomFiles) { + p.CustomFiles = customFiles + p.require(problemInfoV2FieldCustomFiles) +} + +// SetGeneratedFiles sets the GeneratedFiles field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ProblemInfoV2) SetGeneratedFiles(generatedFiles *GeneratedFiles) { + p.GeneratedFiles = generatedFiles + p.require(problemInfoV2FieldGeneratedFiles) +} + +// SetCustomTestCaseTemplates sets the CustomTestCaseTemplates field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ProblemInfoV2) SetCustomTestCaseTemplates(customTestCaseTemplates []*TestCaseTemplate) { + p.CustomTestCaseTemplates = customTestCaseTemplates + p.require(problemInfoV2FieldCustomTestCaseTemplates) +} + +// SetTestcases sets the Testcases field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ProblemInfoV2) SetTestcases(testcases []*TestCaseV2) { + p.Testcases = testcases + p.require(problemInfoV2FieldTestcases) +} + +// SetIsPublic sets the IsPublic field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ProblemInfoV2) SetIsPublic(isPublic bool) { + p.IsPublic = isPublic + p.require(problemInfoV2FieldIsPublic) +} + +func (p *ProblemInfoV2) UnmarshalJSON(data []byte) error { + type unmarshaler ProblemInfoV2 + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *p = ProblemInfoV2(value) + extraProperties, err := internal.ExtractExtraProperties(data, *p) + if err != nil { + return err + } + p.extraProperties = extraProperties + p.rawJSON = json.RawMessage(data) + return nil +} + +func (p *ProblemInfoV2) MarshalJSON() ([]byte, error) { + type embed ProblemInfoV2 + var marshaler = struct { + embed + }{ + embed: embed(*p), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, p.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (p *ProblemInfoV2) String() string { + if p == nil { + return "" + } + if len(p.rawJSON) > 0 { + if value, err := internal.StringifyJSON(p.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(p); err == nil { + return value + } + return fmt.Sprintf("%#v", p) +} + +var ( + testCaseExpectsFieldExpectedStdout = big.NewInt(1 << 0) +) + +type TestCaseExpects struct { + ExpectedStdout *string `json:"expectedStdout,omitempty" url:"expectedStdout,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TestCaseExpects) GetExpectedStdout() *string { + if t == nil { + return nil + } + return t.ExpectedStdout +} + +func (t *TestCaseExpects) GetExtraProperties() map[string]interface{} { + if t == nil { + return nil + } + return t.extraProperties +} + +func (t *TestCaseExpects) require(field *big.Int) { + if t.explicitFields == nil { + t.explicitFields = big.NewInt(0) + } + t.explicitFields.Or(t.explicitFields, field) +} + +// SetExpectedStdout sets the ExpectedStdout field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseExpects) SetExpectedStdout(expectedStdout *string) { + t.ExpectedStdout = expectedStdout + t.require(testCaseExpectsFieldExpectedStdout) +} + +func (t *TestCaseExpects) UnmarshalJSON(data []byte) error { + type unmarshaler TestCaseExpects + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TestCaseExpects(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TestCaseExpects) MarshalJSON() ([]byte, error) { + type embed TestCaseExpects + var marshaler = struct { + embed + }{ + embed: embed(*t), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, t.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (t *TestCaseExpects) String() string { + if t == nil { + return "" + } + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +type TestCaseFunction struct { + Type string + WithActualResult *TestCaseWithActualResultImplementation + Custom *VoidFunctionDefinition + + rawJSON json.RawMessage +} + +func (t *TestCaseFunction) GetType() string { + if t == nil { + return "" + } + return t.Type +} + +func (t *TestCaseFunction) GetWithActualResult() *TestCaseWithActualResultImplementation { + if t == nil { + return nil + } + return t.WithActualResult +} + +func (t *TestCaseFunction) GetCustom() *VoidFunctionDefinition { + if t == nil { + return nil + } + return t.Custom +} + +func (t *TestCaseFunction) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + t.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", t) + } + switch unmarshaler.Type { + case "withActualResult": + value := new(TestCaseWithActualResultImplementation) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + t.WithActualResult = value + case "custom": + value := new(VoidFunctionDefinition) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + t.Custom = value + } + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t TestCaseFunction) MarshalJSON() ([]byte, error) { + if err := t.validate(); err != nil { + return nil, err + } + if t.WithActualResult != nil { + return internal.MarshalJSONWithExtraProperty(t.WithActualResult, "type", "withActualResult") + } + if t.Custom != nil { + return internal.MarshalJSONWithExtraProperty(t.Custom, "type", "custom") + } + if len(t.rawJSON) > 0 { + return t.rawJSON, nil + } + return nil, fmt.Errorf("type %T does not define a non-empty union type", t) +} + +type TestCaseFunctionVisitor interface { + VisitWithActualResult(*TestCaseWithActualResultImplementation) error + VisitCustom(*VoidFunctionDefinition) error +} + +func (t *TestCaseFunction) Accept(visitor TestCaseFunctionVisitor) error { + if t.WithActualResult != nil { + return visitor.VisitWithActualResult(t.WithActualResult) + } + if t.Custom != nil { + return visitor.VisitCustom(t.Custom) + } + return fmt.Errorf("type %T does not define a non-empty union type", t) +} + +func (t *TestCaseFunction) validate() error { + if t == nil { + return fmt.Errorf("type %T is nil", t) + } + var fields []string + if t.WithActualResult != nil { + fields = append(fields, "withActualResult") + } + if t.Custom != nil { + fields = append(fields, "custom") + } + if len(fields) == 0 { + if t.Type != "" { + if len(t.rawJSON) > 0 { + return nil + } + return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", t, t.Type) + } + return fmt.Errorf("type %T is empty", t) + } + if len(fields) > 1 { + return fmt.Errorf("type %T defines values for %s, but only one value is allowed", t, fields) + } + if t.Type != "" { + field := fields[0] + if t.Type != field { + return fmt.Errorf( + "type %T defines a discriminant set to %q, but it does not match the %T field; either remove or update the discriminant to match", + t, + t.Type, + t, + ) + } + } + return nil +} + +type TestCaseID = string + +var ( + testCaseImplementationFieldDescription = big.NewInt(1 << 0) + testCaseImplementationFieldFunction = big.NewInt(1 << 1) +) + +type TestCaseImplementation struct { + Description *TestCaseImplementationDescription `json:"description" url:"description"` + Function *TestCaseFunction `json:"function" url:"function"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TestCaseImplementation) GetDescription() *TestCaseImplementationDescription { + if t == nil { + return nil + } + return t.Description +} + +func (t *TestCaseImplementation) GetFunction() *TestCaseFunction { + if t == nil { + return nil + } + return t.Function +} + +func (t *TestCaseImplementation) GetExtraProperties() map[string]interface{} { + if t == nil { + return nil + } + return t.extraProperties +} + +func (t *TestCaseImplementation) require(field *big.Int) { + if t.explicitFields == nil { + t.explicitFields = big.NewInt(0) + } + t.explicitFields.Or(t.explicitFields, field) +} + +// SetDescription sets the Description field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseImplementation) SetDescription(description *TestCaseImplementationDescription) { + t.Description = description + t.require(testCaseImplementationFieldDescription) +} + +// SetFunction sets the Function field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseImplementation) SetFunction(function *TestCaseFunction) { + t.Function = function + t.require(testCaseImplementationFieldFunction) +} + +func (t *TestCaseImplementation) UnmarshalJSON(data []byte) error { + type unmarshaler TestCaseImplementation + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TestCaseImplementation(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TestCaseImplementation) MarshalJSON() ([]byte, error) { + type embed TestCaseImplementation + var marshaler = struct { + embed + }{ + embed: embed(*t), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, t.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (t *TestCaseImplementation) String() string { + if t == nil { + return "" + } + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +var ( + testCaseImplementationDescriptionFieldBoards = big.NewInt(1 << 0) +) + +type TestCaseImplementationDescription struct { + Boards []*TestCaseImplementationDescriptionBoard `json:"boards" url:"boards"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TestCaseImplementationDescription) GetBoards() []*TestCaseImplementationDescriptionBoard { + if t == nil { + return nil + } + return t.Boards +} + +func (t *TestCaseImplementationDescription) GetExtraProperties() map[string]interface{} { + if t == nil { + return nil + } + return t.extraProperties +} + +func (t *TestCaseImplementationDescription) require(field *big.Int) { + if t.explicitFields == nil { + t.explicitFields = big.NewInt(0) + } + t.explicitFields.Or(t.explicitFields, field) +} + +// SetBoards sets the Boards field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseImplementationDescription) SetBoards(boards []*TestCaseImplementationDescriptionBoard) { + t.Boards = boards + t.require(testCaseImplementationDescriptionFieldBoards) +} + +func (t *TestCaseImplementationDescription) UnmarshalJSON(data []byte) error { + type unmarshaler TestCaseImplementationDescription + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TestCaseImplementationDescription(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TestCaseImplementationDescription) MarshalJSON() ([]byte, error) { + type embed TestCaseImplementationDescription + var marshaler = struct { + embed + }{ + embed: embed(*t), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, t.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (t *TestCaseImplementationDescription) String() string { + if t == nil { + return "" + } + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +type TestCaseImplementationDescriptionBoard struct { + Type string + HTML string + ParamID ParameterID + + rawJSON json.RawMessage +} + +func (t *TestCaseImplementationDescriptionBoard) GetType() string { + if t == nil { + return "" + } + return t.Type +} + +func (t *TestCaseImplementationDescriptionBoard) GetHTML() string { + if t == nil { + return "" + } + return t.HTML +} + +func (t *TestCaseImplementationDescriptionBoard) GetParamID() ParameterID { + if t == nil { + return "" + } + return t.ParamID +} + +func (t *TestCaseImplementationDescriptionBoard) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + t.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", t) + } + switch unmarshaler.Type { + case "html": + var valueUnmarshaler struct { + HTML string `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + t.HTML = valueUnmarshaler.HTML + case "paramId": + var valueUnmarshaler struct { + ParamID ParameterID `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + t.ParamID = valueUnmarshaler.ParamID + } + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t TestCaseImplementationDescriptionBoard) MarshalJSON() ([]byte, error) { + if err := t.validate(); err != nil { + return nil, err + } + if t.HTML != "" { + var marshaler = struct { + Type string `json:"type"` + HTML string `json:"value"` + }{ + Type: "html", + HTML: t.HTML, + } + return json.Marshal(marshaler) + } + if t.ParamID != "" { + var marshaler = struct { + Type string `json:"type"` + ParamID ParameterID `json:"value"` + }{ + Type: "paramId", + ParamID: t.ParamID, + } + return json.Marshal(marshaler) + } + if len(t.rawJSON) > 0 { + return t.rawJSON, nil + } + return nil, fmt.Errorf("type %T does not define a non-empty union type", t) +} + +type TestCaseImplementationDescriptionBoardVisitor interface { + VisitHTML(string) error + VisitParamID(ParameterID) error +} + +func (t *TestCaseImplementationDescriptionBoard) Accept(visitor TestCaseImplementationDescriptionBoardVisitor) error { + if t.HTML != "" { + return visitor.VisitHTML(t.HTML) + } + if t.ParamID != "" { + return visitor.VisitParamID(t.ParamID) + } + return fmt.Errorf("type %T does not define a non-empty union type", t) +} + +func (t *TestCaseImplementationDescriptionBoard) validate() error { + if t == nil { + return fmt.Errorf("type %T is nil", t) + } + var fields []string + if t.HTML != "" { + fields = append(fields, "html") + } + if t.ParamID != "" { + fields = append(fields, "paramId") + } + if len(fields) == 0 { + if t.Type != "" { + if len(t.rawJSON) > 0 { + return nil + } + return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", t, t.Type) + } + return fmt.Errorf("type %T is empty", t) + } + if len(fields) > 1 { + return fmt.Errorf("type %T defines values for %s, but only one value is allowed", t, fields) + } + if t.Type != "" { + field := fields[0] + if t.Type != field { + return fmt.Errorf( + "type %T defines a discriminant set to %q, but it does not match the %T field; either remove or update the discriminant to match", + t, + t.Type, + t, + ) + } + } + return nil +} + +type TestCaseImplementationReference struct { + Type string + TemplateID TestCaseTemplateID + Implementation *TestCaseImplementation + + rawJSON json.RawMessage +} + +func (t *TestCaseImplementationReference) GetType() string { + if t == nil { + return "" + } + return t.Type +} + +func (t *TestCaseImplementationReference) GetTemplateID() TestCaseTemplateID { + if t == nil { + return "" + } + return t.TemplateID +} + +func (t *TestCaseImplementationReference) GetImplementation() *TestCaseImplementation { + if t == nil { + return nil + } + return t.Implementation +} + +func (t *TestCaseImplementationReference) UnmarshalJSON(data []byte) error { + var unmarshaler struct { + Type string `json:"type"` + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + t.Type = unmarshaler.Type + if unmarshaler.Type == "" { + return fmt.Errorf("%T did not include discriminant type", t) + } + switch unmarshaler.Type { + case "templateId": + var valueUnmarshaler struct { + TemplateID TestCaseTemplateID `json:"value"` + } + if err := json.Unmarshal(data, &valueUnmarshaler); err != nil { + return err + } + t.TemplateID = valueUnmarshaler.TemplateID + case "implementation": + value := new(TestCaseImplementation) + if err := json.Unmarshal(data, &value); err != nil { + return err + } + t.Implementation = value + } + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t TestCaseImplementationReference) MarshalJSON() ([]byte, error) { + if err := t.validate(); err != nil { + return nil, err + } + if t.TemplateID != "" { + var marshaler = struct { + Type string `json:"type"` + TemplateID TestCaseTemplateID `json:"value"` + }{ + Type: "templateId", + TemplateID: t.TemplateID, + } + return json.Marshal(marshaler) + } + if t.Implementation != nil { + return internal.MarshalJSONWithExtraProperty(t.Implementation, "type", "implementation") + } + if len(t.rawJSON) > 0 { + return t.rawJSON, nil + } + return nil, fmt.Errorf("type %T does not define a non-empty union type", t) +} + +type TestCaseImplementationReferenceVisitor interface { + VisitTemplateID(TestCaseTemplateID) error + VisitImplementation(*TestCaseImplementation) error +} + +func (t *TestCaseImplementationReference) Accept(visitor TestCaseImplementationReferenceVisitor) error { + if t.TemplateID != "" { + return visitor.VisitTemplateID(t.TemplateID) + } + if t.Implementation != nil { + return visitor.VisitImplementation(t.Implementation) + } + return fmt.Errorf("type %T does not define a non-empty union type", t) +} + +func (t *TestCaseImplementationReference) validate() error { + if t == nil { + return fmt.Errorf("type %T is nil", t) + } + var fields []string + if t.TemplateID != "" { + fields = append(fields, "templateId") + } + if t.Implementation != nil { + fields = append(fields, "implementation") + } + if len(fields) == 0 { + if t.Type != "" { + if len(t.rawJSON) > 0 { + return nil + } + return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", t, t.Type) + } + return fmt.Errorf("type %T is empty", t) + } + if len(fields) > 1 { + return fmt.Errorf("type %T defines values for %s, but only one value is allowed", t, fields) + } + if t.Type != "" { + field := fields[0] + if t.Type != field { + return fmt.Errorf( + "type %T defines a discriminant set to %q, but it does not match the %T field; either remove or update the discriminant to match", + t, + t.Type, + t, + ) + } + } + return nil +} + +var ( + testCaseMetadataFieldID = big.NewInt(1 << 0) + testCaseMetadataFieldName = big.NewInt(1 << 1) + testCaseMetadataFieldHidden = big.NewInt(1 << 2) +) + +type TestCaseMetadata struct { + ID TestCaseID `json:"id" url:"id"` + Name string `json:"name" url:"name"` + Hidden bool `json:"hidden" url:"hidden"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TestCaseMetadata) GetID() TestCaseID { + if t == nil { + return "" + } + return t.ID +} + +func (t *TestCaseMetadata) GetName() string { + if t == nil { + return "" + } + return t.Name +} + +func (t *TestCaseMetadata) GetHidden() bool { + if t == nil { + return false + } + return t.Hidden +} + +func (t *TestCaseMetadata) GetExtraProperties() map[string]interface{} { + if t == nil { + return nil + } + return t.extraProperties +} + +func (t *TestCaseMetadata) require(field *big.Int) { + if t.explicitFields == nil { + t.explicitFields = big.NewInt(0) + } + t.explicitFields.Or(t.explicitFields, field) +} + +// SetID sets the ID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseMetadata) SetID(id TestCaseID) { + t.ID = id + t.require(testCaseMetadataFieldID) +} + +// SetName sets the Name field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseMetadata) SetName(name string) { + t.Name = name + t.require(testCaseMetadataFieldName) +} + +// SetHidden sets the Hidden field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseMetadata) SetHidden(hidden bool) { + t.Hidden = hidden + t.require(testCaseMetadataFieldHidden) +} + +func (t *TestCaseMetadata) UnmarshalJSON(data []byte) error { + type unmarshaler TestCaseMetadata + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TestCaseMetadata(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TestCaseMetadata) MarshalJSON() ([]byte, error) { + type embed TestCaseMetadata + var marshaler = struct { + embed + }{ + embed: embed(*t), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, t.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (t *TestCaseMetadata) String() string { + if t == nil { + return "" + } + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +var ( + testCaseTemplateFieldTemplateID = big.NewInt(1 << 0) + testCaseTemplateFieldName = big.NewInt(1 << 1) + testCaseTemplateFieldImplementation = big.NewInt(1 << 2) +) + +type TestCaseTemplate struct { + TemplateID TestCaseTemplateID `json:"templateId" url:"templateId"` + Name string `json:"name" url:"name"` + Implementation *TestCaseImplementation `json:"implementation" url:"implementation"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TestCaseTemplate) GetTemplateID() TestCaseTemplateID { + if t == nil { + return "" + } + return t.TemplateID +} + +func (t *TestCaseTemplate) GetName() string { + if t == nil { + return "" + } + return t.Name +} + +func (t *TestCaseTemplate) GetImplementation() *TestCaseImplementation { + if t == nil { + return nil + } + return t.Implementation +} + +func (t *TestCaseTemplate) GetExtraProperties() map[string]interface{} { + if t == nil { + return nil + } + return t.extraProperties +} + +func (t *TestCaseTemplate) require(field *big.Int) { + if t.explicitFields == nil { + t.explicitFields = big.NewInt(0) + } + t.explicitFields.Or(t.explicitFields, field) +} + +// SetTemplateID sets the TemplateID field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseTemplate) SetTemplateID(templateID TestCaseTemplateID) { + t.TemplateID = templateID + t.require(testCaseTemplateFieldTemplateID) +} + +// SetName sets the Name field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseTemplate) SetName(name string) { + t.Name = name + t.require(testCaseTemplateFieldName) +} + +// SetImplementation sets the Implementation field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseTemplate) SetImplementation(implementation *TestCaseImplementation) { + t.Implementation = implementation + t.require(testCaseTemplateFieldImplementation) +} + +func (t *TestCaseTemplate) UnmarshalJSON(data []byte) error { + type unmarshaler TestCaseTemplate + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TestCaseTemplate(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TestCaseTemplate) MarshalJSON() ([]byte, error) { + type embed TestCaseTemplate + var marshaler = struct { + embed + }{ + embed: embed(*t), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, t.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (t *TestCaseTemplate) String() string { + if t == nil { + return "" + } + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +type TestCaseTemplateID = string + +var ( + testCaseV2FieldMetadata = big.NewInt(1 << 0) + testCaseV2FieldImplementation = big.NewInt(1 << 1) + testCaseV2FieldArguments = big.NewInt(1 << 2) + testCaseV2FieldExpects = big.NewInt(1 << 3) +) + +type TestCaseV2 struct { + Metadata *TestCaseMetadata `json:"metadata" url:"metadata"` + Implementation *TestCaseImplementationReference `json:"implementation" url:"implementation"` + Arguments map[ParameterID]*common.VariableValue `json:"arguments" url:"arguments"` + Expects *TestCaseExpects `json:"expects,omitempty" url:"expects,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TestCaseV2) GetMetadata() *TestCaseMetadata { + if t == nil { + return nil + } + return t.Metadata +} + +func (t *TestCaseV2) GetImplementation() *TestCaseImplementationReference { + if t == nil { + return nil + } + return t.Implementation +} + +func (t *TestCaseV2) GetArguments() map[ParameterID]*common.VariableValue { + if t == nil { + return nil + } + return t.Arguments +} + +func (t *TestCaseV2) GetExpects() *TestCaseExpects { + if t == nil { + return nil + } + return t.Expects +} + +func (t *TestCaseV2) GetExtraProperties() map[string]interface{} { + if t == nil { + return nil + } + return t.extraProperties +} + +func (t *TestCaseV2) require(field *big.Int) { + if t.explicitFields == nil { + t.explicitFields = big.NewInt(0) + } + t.explicitFields.Or(t.explicitFields, field) +} + +// SetMetadata sets the Metadata field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseV2) SetMetadata(metadata *TestCaseMetadata) { + t.Metadata = metadata + t.require(testCaseV2FieldMetadata) +} + +// SetImplementation sets the Implementation field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseV2) SetImplementation(implementation *TestCaseImplementationReference) { + t.Implementation = implementation + t.require(testCaseV2FieldImplementation) +} + +// SetArguments sets the Arguments field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseV2) SetArguments(arguments map[ParameterID]*common.VariableValue) { + t.Arguments = arguments + t.require(testCaseV2FieldArguments) +} + +// SetExpects sets the Expects field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseV2) SetExpects(expects *TestCaseExpects) { + t.Expects = expects + t.require(testCaseV2FieldExpects) +} + +func (t *TestCaseV2) UnmarshalJSON(data []byte) error { + type unmarshaler TestCaseV2 + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TestCaseV2(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TestCaseV2) MarshalJSON() ([]byte, error) { + type embed TestCaseV2 + var marshaler = struct { + embed + }{ + embed: embed(*t), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, t.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (t *TestCaseV2) String() string { + if t == nil { + return "" + } + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +var ( + testCaseWithActualResultImplementationFieldGetActualResult = big.NewInt(1 << 0) + testCaseWithActualResultImplementationFieldAssertCorrectnessCheck = big.NewInt(1 << 1) +) + +type TestCaseWithActualResultImplementation struct { + GetActualResult *NonVoidFunctionDefinition `json:"getActualResult" url:"getActualResult"` + AssertCorrectnessCheck *AssertCorrectnessCheck `json:"assertCorrectnessCheck" url:"assertCorrectnessCheck"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TestCaseWithActualResultImplementation) GetGetActualResult() *NonVoidFunctionDefinition { + if t == nil { + return nil + } + return t.GetActualResult +} + +func (t *TestCaseWithActualResultImplementation) GetAssertCorrectnessCheck() *AssertCorrectnessCheck { + if t == nil { + return nil + } + return t.AssertCorrectnessCheck +} + +func (t *TestCaseWithActualResultImplementation) GetExtraProperties() map[string]interface{} { + if t == nil { + return nil + } + return t.extraProperties +} + +func (t *TestCaseWithActualResultImplementation) require(field *big.Int) { + if t.explicitFields == nil { + t.explicitFields = big.NewInt(0) + } + t.explicitFields.Or(t.explicitFields, field) +} + +// SetGetActualResult sets the GetActualResult field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseWithActualResultImplementation) SetGetActualResult(getActualResult *NonVoidFunctionDefinition) { + t.GetActualResult = getActualResult + t.require(testCaseWithActualResultImplementationFieldGetActualResult) +} + +// SetAssertCorrectnessCheck sets the AssertCorrectnessCheck field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (t *TestCaseWithActualResultImplementation) SetAssertCorrectnessCheck(assertCorrectnessCheck *AssertCorrectnessCheck) { + t.AssertCorrectnessCheck = assertCorrectnessCheck + t.require(testCaseWithActualResultImplementationFieldAssertCorrectnessCheck) +} + +func (t *TestCaseWithActualResultImplementation) UnmarshalJSON(data []byte) error { + type unmarshaler TestCaseWithActualResultImplementation + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TestCaseWithActualResultImplementation(value) + extraProperties, err := internal.ExtractExtraProperties(data, *t) + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TestCaseWithActualResultImplementation) MarshalJSON() ([]byte, error) { + type embed TestCaseWithActualResultImplementation + var marshaler = struct { + embed + }{ + embed: embed(*t), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, t.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (t *TestCaseWithActualResultImplementation) String() string { + if t == nil { + return "" + } + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +var ( + voidFunctionDefinitionFieldParameters = big.NewInt(1 << 0) + voidFunctionDefinitionFieldCode = big.NewInt(1 << 1) +) + +type VoidFunctionDefinition struct { + Parameters []*Parameter `json:"parameters" url:"parameters"` + Code *FunctionImplementationForMultipleLanguages `json:"code" url:"code"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (v *VoidFunctionDefinition) GetParameters() []*Parameter { + if v == nil { + return nil + } + return v.Parameters +} + +func (v *VoidFunctionDefinition) GetCode() *FunctionImplementationForMultipleLanguages { + if v == nil { + return nil + } + return v.Code +} + +func (v *VoidFunctionDefinition) GetExtraProperties() map[string]interface{} { + if v == nil { + return nil + } + return v.extraProperties +} + +func (v *VoidFunctionDefinition) require(field *big.Int) { + if v.explicitFields == nil { + v.explicitFields = big.NewInt(0) + } + v.explicitFields.Or(v.explicitFields, field) +} + +// SetParameters sets the Parameters field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (v *VoidFunctionDefinition) SetParameters(parameters []*Parameter) { + v.Parameters = parameters + v.require(voidFunctionDefinitionFieldParameters) +} + +// SetCode sets the Code field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (v *VoidFunctionDefinition) SetCode(code *FunctionImplementationForMultipleLanguages) { + v.Code = code + v.require(voidFunctionDefinitionFieldCode) +} + +func (v *VoidFunctionDefinition) UnmarshalJSON(data []byte) error { + type unmarshaler VoidFunctionDefinition + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *v = VoidFunctionDefinition(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err + } + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil +} + +func (v *VoidFunctionDefinition) MarshalJSON() ([]byte, error) { + type embed VoidFunctionDefinition + var marshaler = struct { + embed + }{ + embed: embed(*v), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, v.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (v *VoidFunctionDefinition) String() string { + if v == nil { + return "" + } + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(v); err == nil { + return value + } + return fmt.Sprintf("%#v", v) +} + +// The generated signature will include an additional param, actualResult +var ( + voidFunctionDefinitionThatTakesActualResultFieldAdditionalParameters = big.NewInt(1 << 0) + voidFunctionDefinitionThatTakesActualResultFieldCode = big.NewInt(1 << 1) +) + +type VoidFunctionDefinitionThatTakesActualResult struct { + AdditionalParameters []*Parameter `json:"additionalParameters" url:"additionalParameters"` + Code *FunctionImplementationForMultipleLanguages `json:"code" url:"code"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (v *VoidFunctionDefinitionThatTakesActualResult) GetAdditionalParameters() []*Parameter { + if v == nil { + return nil + } + return v.AdditionalParameters +} + +func (v *VoidFunctionDefinitionThatTakesActualResult) GetCode() *FunctionImplementationForMultipleLanguages { + if v == nil { + return nil + } + return v.Code +} + +func (v *VoidFunctionDefinitionThatTakesActualResult) GetExtraProperties() map[string]interface{} { + if v == nil { + return nil + } + return v.extraProperties +} + +func (v *VoidFunctionDefinitionThatTakesActualResult) require(field *big.Int) { + if v.explicitFields == nil { + v.explicitFields = big.NewInt(0) + } + v.explicitFields.Or(v.explicitFields, field) +} + +// SetAdditionalParameters sets the AdditionalParameters field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (v *VoidFunctionDefinitionThatTakesActualResult) SetAdditionalParameters(additionalParameters []*Parameter) { + v.AdditionalParameters = additionalParameters + v.require(voidFunctionDefinitionThatTakesActualResultFieldAdditionalParameters) +} + +// SetCode sets the Code field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (v *VoidFunctionDefinitionThatTakesActualResult) SetCode(code *FunctionImplementationForMultipleLanguages) { + v.Code = code + v.require(voidFunctionDefinitionThatTakesActualResultFieldCode) +} + +func (v *VoidFunctionDefinitionThatTakesActualResult) UnmarshalJSON(data []byte) error { + type unmarshaler VoidFunctionDefinitionThatTakesActualResult + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *v = VoidFunctionDefinitionThatTakesActualResult(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err + } + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil +} + +func (v *VoidFunctionDefinitionThatTakesActualResult) MarshalJSON() ([]byte, error) { + type embed VoidFunctionDefinitionThatTakesActualResult + var marshaler = struct { + embed + }{ + embed: embed(*v), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, v.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (v *VoidFunctionDefinitionThatTakesActualResult) String() string { + if v == nil { + return "" + } + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(v); err == nil { + return value + } + return fmt.Sprintf("%#v", v) +} + +var ( + voidFunctionSignatureFieldParameters = big.NewInt(1 << 0) +) + +type VoidFunctionSignature struct { + Parameters []*Parameter `json:"parameters" url:"parameters"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (v *VoidFunctionSignature) GetParameters() []*Parameter { + if v == nil { + return nil + } + return v.Parameters +} + +func (v *VoidFunctionSignature) GetExtraProperties() map[string]interface{} { + if v == nil { + return nil + } + return v.extraProperties +} + +func (v *VoidFunctionSignature) require(field *big.Int) { + if v.explicitFields == nil { + v.explicitFields = big.NewInt(0) + } + v.explicitFields.Or(v.explicitFields, field) +} + +// SetParameters sets the Parameters field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (v *VoidFunctionSignature) SetParameters(parameters []*Parameter) { + v.Parameters = parameters + v.require(voidFunctionSignatureFieldParameters) +} + +func (v *VoidFunctionSignature) UnmarshalJSON(data []byte) error { + type unmarshaler VoidFunctionSignature + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *v = VoidFunctionSignature(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err + } + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil +} + +func (v *VoidFunctionSignature) MarshalJSON() ([]byte, error) { + type embed VoidFunctionSignature + var marshaler = struct { + embed + }{ + embed: embed(*v), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, v.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (v *VoidFunctionSignature) String() string { + if v == nil { + return "" + } + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(v); err == nil { + return value + } + return fmt.Sprintf("%#v", v) +} + +var ( + voidFunctionSignatureThatTakesActualResultFieldParameters = big.NewInt(1 << 0) + voidFunctionSignatureThatTakesActualResultFieldActualResultType = big.NewInt(1 << 1) +) + +type VoidFunctionSignatureThatTakesActualResult struct { + Parameters []*Parameter `json:"parameters" url:"parameters"` + ActualResultType *common.VariableType `json:"actualResultType" url:"actualResultType"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (v *VoidFunctionSignatureThatTakesActualResult) GetParameters() []*Parameter { + if v == nil { + return nil + } + return v.Parameters +} + +func (v *VoidFunctionSignatureThatTakesActualResult) GetActualResultType() *common.VariableType { + if v == nil { + return nil + } + return v.ActualResultType +} + +func (v *VoidFunctionSignatureThatTakesActualResult) GetExtraProperties() map[string]interface{} { + if v == nil { + return nil + } + return v.extraProperties +} + +func (v *VoidFunctionSignatureThatTakesActualResult) require(field *big.Int) { + if v.explicitFields == nil { + v.explicitFields = big.NewInt(0) + } + v.explicitFields.Or(v.explicitFields, field) +} + +// SetParameters sets the Parameters field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (v *VoidFunctionSignatureThatTakesActualResult) SetParameters(parameters []*Parameter) { + v.Parameters = parameters + v.require(voidFunctionSignatureThatTakesActualResultFieldParameters) +} + +// SetActualResultType sets the ActualResultType field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (v *VoidFunctionSignatureThatTakesActualResult) SetActualResultType(actualResultType *common.VariableType) { + v.ActualResultType = actualResultType + v.require(voidFunctionSignatureThatTakesActualResultFieldActualResultType) +} + +func (v *VoidFunctionSignatureThatTakesActualResult) UnmarshalJSON(data []byte) error { + type unmarshaler VoidFunctionSignatureThatTakesActualResult + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *v = VoidFunctionSignatureThatTakesActualResult(value) + extraProperties, err := internal.ExtractExtraProperties(data, *v) + if err != nil { + return err + } + v.extraProperties = extraProperties + v.rawJSON = json.RawMessage(data) + return nil +} + +func (v *VoidFunctionSignatureThatTakesActualResult) MarshalJSON() ([]byte, error) { + type embed VoidFunctionSignatureThatTakesActualResult + var marshaler = struct { + embed + }{ + embed: embed(*v), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, v.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (v *VoidFunctionSignatureThatTakesActualResult) String() string { + if v == nil { + return "" + } + if len(v.rawJSON) > 0 { + if value, err := internal.StringifyJSON(v.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(v); err == nil { + return value + } + return fmt.Sprintf("%#v", v) +} diff --git a/seed/go-sdk/trace/v2/v3/problem/client.go b/seed/go-sdk/trace/v2/v3/problem/client.go new file mode 100644 index 000000000000..c0ceac4c712d --- /dev/null +++ b/seed/go-sdk/trace/v2/v3/problem/client.go @@ -0,0 +1,102 @@ +// Code generated by Fern. DO NOT EDIT. + +package problem + +import ( + context "context" + + common "github.com/trace/fern/common" + core "github.com/trace/fern/core" + internal "github.com/trace/fern/internal" + option "github.com/trace/fern/option" + v3 "github.com/trace/fern/v2/v3" +) + +type Client struct { + WithRawResponse *RawClient + + options *core.RequestOptions + baseURL string + caller *internal.Caller +} + +func NewClient(options *core.RequestOptions) *Client { + return &Client{ + WithRawResponse: NewRawClient(options), + options: options, + baseURL: options.BaseURL, + caller: internal.NewCaller( + &internal.CallerParams{ + Client: options.HTTPClient, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + }, + ), + } +} + +// Returns lightweight versions of all problems +func (c *Client) GetLightweightProblems( + ctx context.Context, + opts ...option.RequestOption, +) ([]*v3.LightweightProblemInfoV2, error) { + response, err := c.WithRawResponse.GetLightweightProblems( + ctx, + opts..., + ) + if err != nil { + return nil, err + } + return response.Body, nil +} + +// Returns latest versions of all problems +func (c *Client) GetProblems( + ctx context.Context, + opts ...option.RequestOption, +) ([]*v3.ProblemInfoV2, error) { + response, err := c.WithRawResponse.GetProblems( + ctx, + opts..., + ) + if err != nil { + return nil, err + } + return response.Body, nil +} + +// Returns latest version of a problem +func (c *Client) GetLatestProblem( + ctx context.Context, + problemID common.ProblemID, + opts ...option.RequestOption, +) (*v3.ProblemInfoV2, error) { + response, err := c.WithRawResponse.GetLatestProblem( + ctx, + problemID, + opts..., + ) + if err != nil { + return nil, err + } + return response.Body, nil +} + +// Returns requested version of a problem +func (c *Client) GetProblemVersion( + ctx context.Context, + problemID common.ProblemID, + problemVersion int, + opts ...option.RequestOption, +) (*v3.ProblemInfoV2, error) { + response, err := c.WithRawResponse.GetProblemVersion( + ctx, + problemID, + problemVersion, + opts..., + ) + if err != nil { + return nil, err + } + return response.Body, nil +} diff --git a/seed/go-sdk/trace/v2/v3/problem/raw_client.go b/seed/go-sdk/trace/v2/v3/problem/raw_client.go new file mode 100644 index 000000000000..0ad22d26812d --- /dev/null +++ b/seed/go-sdk/trace/v2/v3/problem/raw_client.go @@ -0,0 +1,204 @@ +// Code generated by Fern. DO NOT EDIT. + +package problem + +import ( + context "context" + http "net/http" + + common "github.com/trace/fern/common" + core "github.com/trace/fern/core" + internal "github.com/trace/fern/internal" + option "github.com/trace/fern/option" + v3 "github.com/trace/fern/v2/v3" +) + +type RawClient struct { + baseURL string + caller *internal.Caller + options *core.RequestOptions +} + +func NewRawClient(options *core.RequestOptions) *RawClient { + return &RawClient{ + options: options, + baseURL: options.BaseURL, + caller: internal.NewCaller( + &internal.CallerParams{ + Client: options.HTTPClient, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + }, + ), + } +} + +func (r *RawClient) GetLightweightProblems( + ctx context.Context, + opts ...option.RequestOption, +) (*core.Response[[]*v3.LightweightProblemInfoV2], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.trace.come", + ) + endpointURL := baseURL + "/problems-v2/lightweight-problem-info" + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + var response []*v3.LightweightProblemInfoV2 + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodGet, + Headers: headers, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + Response: &response, + }, + ) + if err != nil { + return nil, err + } + return &core.Response[[]*v3.LightweightProblemInfoV2]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: response, + }, nil +} + +func (r *RawClient) GetProblems( + ctx context.Context, + opts ...option.RequestOption, +) (*core.Response[[]*v3.ProblemInfoV2], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.trace.come", + ) + endpointURL := baseURL + "/problems-v2/problem-info" + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + var response []*v3.ProblemInfoV2 + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodGet, + Headers: headers, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + Response: &response, + }, + ) + if err != nil { + return nil, err + } + return &core.Response[[]*v3.ProblemInfoV2]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: response, + }, nil +} + +func (r *RawClient) GetLatestProblem( + ctx context.Context, + problemID common.ProblemID, + opts ...option.RequestOption, +) (*core.Response[*v3.ProblemInfoV2], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.trace.come", + ) + endpointURL := internal.EncodeURL( + baseURL+"/problems-v2/problem-info/%v", + problemID, + ) + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + var response *v3.ProblemInfoV2 + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodGet, + Headers: headers, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + Response: &response, + }, + ) + if err != nil { + return nil, err + } + return &core.Response[*v3.ProblemInfoV2]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: response, + }, nil +} + +func (r *RawClient) GetProblemVersion( + ctx context.Context, + problemID common.ProblemID, + problemVersion int, + opts ...option.RequestOption, +) (*core.Response[*v3.ProblemInfoV2], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.trace.come", + ) + endpointURL := internal.EncodeURL( + baseURL+"/problems-v2/problem-info/%v/version/%v", + problemID, + problemVersion, + ) + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + var response *v3.ProblemInfoV2 + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodGet, + Headers: headers, + MaxAttempts: options.MaxAttempts, + DisableRetries: options.DisableRetries, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + Response: &response, + }, + ) + if err != nil { + return nil, err + } + return &core.Response[*v3.ProblemInfoV2]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: response, + }, nil +} diff --git a/seed/go-sdk/trace/v2/v3/problem_test.go b/seed/go-sdk/trace/v2/v3/problem_test.go new file mode 100644 index 000000000000..50745e11c94a --- /dev/null +++ b/seed/go-sdk/trace/v2/v3/problem_test.go @@ -0,0 +1,8720 @@ +// Code generated by Fern. DO NOT EDIT. + +package v3 + +import ( + json "encoding/json" + assert "github.com/stretchr/testify/assert" + require "github.com/stretchr/testify/require" + common "github.com/trace/fern/common" + testing "testing" +) + +func TestGettersAssertCorrectnessCheck(t *testing.T) { + t.Run("GetType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &AssertCorrectnessCheck{} + var expected string + obj.Type = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetType(), "getter should return the property value") + }) + + t.Run("GetType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *AssertCorrectnessCheck + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetType() // Should return zero value + }) + + t.Run("GetDeepEquality", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &AssertCorrectnessCheck{} + var expected *DeepEqualityCorrectnessCheck + obj.DeepEquality = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetDeepEquality(), "getter should return the property value") + }) + + t.Run("GetDeepEquality_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &AssertCorrectnessCheck{} + obj.DeepEquality = nil + + // Act & Assert + assert.Nil(t, obj.GetDeepEquality(), "getter should return nil when property is nil") + }) + + t.Run("GetDeepEquality_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *AssertCorrectnessCheck + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetDeepEquality() // Should return zero value + }) + + t.Run("GetCustom", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &AssertCorrectnessCheck{} + var expected *VoidFunctionDefinitionThatTakesActualResult + obj.Custom = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetCustom(), "getter should return the property value") + }) + + t.Run("GetCustom_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &AssertCorrectnessCheck{} + obj.Custom = nil + + // Act & Assert + assert.Nil(t, obj.GetCustom(), "getter should return nil when property is nil") + }) + + t.Run("GetCustom_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *AssertCorrectnessCheck + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetCustom() // Should return zero value + }) + +} + +func TestSettersBasicCustomFiles(t *testing.T) { + t.Run("SetMethodName", func(t *testing.T) { + obj := &BasicCustomFiles{} + var fernTestValueMethodName string + obj.SetMethodName(fernTestValueMethodName) + assert.Equal(t, fernTestValueMethodName, obj.MethodName) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetSignature", func(t *testing.T) { + obj := &BasicCustomFiles{} + var fernTestValueSignature *NonVoidFunctionSignature + obj.SetSignature(fernTestValueSignature) + assert.Equal(t, fernTestValueSignature, obj.Signature) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetAdditionalFiles", func(t *testing.T) { + obj := &BasicCustomFiles{} + var fernTestValueAdditionalFiles map[common.Language]*Files + obj.SetAdditionalFiles(fernTestValueAdditionalFiles) + assert.Equal(t, fernTestValueAdditionalFiles, obj.AdditionalFiles) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetBasicTestCaseTemplate", func(t *testing.T) { + obj := &BasicCustomFiles{} + var fernTestValueBasicTestCaseTemplate *BasicTestCaseTemplate + obj.SetBasicTestCaseTemplate(fernTestValueBasicTestCaseTemplate) + assert.Equal(t, fernTestValueBasicTestCaseTemplate, obj.BasicTestCaseTemplate) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersBasicCustomFiles(t *testing.T) { + t.Run("GetMethodName", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicCustomFiles{} + var expected string + obj.MethodName = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetMethodName(), "getter should return the property value") + }) + + t.Run("GetMethodName_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BasicCustomFiles + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetMethodName() // Should return zero value + }) + + t.Run("GetSignature", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicCustomFiles{} + var expected *NonVoidFunctionSignature + obj.Signature = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSignature(), "getter should return the property value") + }) + + t.Run("GetSignature_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicCustomFiles{} + obj.Signature = nil + + // Act & Assert + assert.Nil(t, obj.GetSignature(), "getter should return nil when property is nil") + }) + + t.Run("GetSignature_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BasicCustomFiles + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSignature() // Should return zero value + }) + + t.Run("GetAdditionalFiles", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicCustomFiles{} + var expected map[common.Language]*Files + obj.AdditionalFiles = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetAdditionalFiles(), "getter should return the property value") + }) + + t.Run("GetAdditionalFiles_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicCustomFiles{} + obj.AdditionalFiles = nil + + // Act & Assert + assert.Nil(t, obj.GetAdditionalFiles(), "getter should return nil when property is nil") + }) + + t.Run("GetAdditionalFiles_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BasicCustomFiles + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetAdditionalFiles() // Should return zero value + }) + + t.Run("GetBasicTestCaseTemplate", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicCustomFiles{} + var expected *BasicTestCaseTemplate + obj.BasicTestCaseTemplate = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetBasicTestCaseTemplate(), "getter should return the property value") + }) + + t.Run("GetBasicTestCaseTemplate_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicCustomFiles{} + obj.BasicTestCaseTemplate = nil + + // Act & Assert + assert.Nil(t, obj.GetBasicTestCaseTemplate(), "getter should return nil when property is nil") + }) + + t.Run("GetBasicTestCaseTemplate_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BasicCustomFiles + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetBasicTestCaseTemplate() // Should return zero value + }) + +} + +func TestSettersMarkExplicitBasicCustomFiles(t *testing.T) { + t.Run("SetMethodName_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicCustomFiles{} + var fernTestValueMethodName string + + // Act + obj.SetMethodName(fernTestValueMethodName) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetSignature_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicCustomFiles{} + var fernTestValueSignature *NonVoidFunctionSignature + + // Act + obj.SetSignature(fernTestValueSignature) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetAdditionalFiles_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicCustomFiles{} + var fernTestValueAdditionalFiles map[common.Language]*Files + + // Act + obj.SetAdditionalFiles(fernTestValueAdditionalFiles) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetBasicTestCaseTemplate_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicCustomFiles{} + var fernTestValueBasicTestCaseTemplate *BasicTestCaseTemplate + + // Act + obj.SetBasicTestCaseTemplate(fernTestValueBasicTestCaseTemplate) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersBasicTestCaseTemplate(t *testing.T) { + t.Run("SetTemplateID", func(t *testing.T) { + obj := &BasicTestCaseTemplate{} + var fernTestValueTemplateID TestCaseTemplateID + obj.SetTemplateID(fernTestValueTemplateID) + assert.Equal(t, fernTestValueTemplateID, obj.TemplateID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetName", func(t *testing.T) { + obj := &BasicTestCaseTemplate{} + var fernTestValueName string + obj.SetName(fernTestValueName) + assert.Equal(t, fernTestValueName, obj.Name) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetDescription", func(t *testing.T) { + obj := &BasicTestCaseTemplate{} + var fernTestValueDescription *TestCaseImplementationDescription + obj.SetDescription(fernTestValueDescription) + assert.Equal(t, fernTestValueDescription, obj.Description) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetExpectedValueParameterID", func(t *testing.T) { + obj := &BasicTestCaseTemplate{} + var fernTestValueExpectedValueParameterID ParameterID + obj.SetExpectedValueParameterID(fernTestValueExpectedValueParameterID) + assert.Equal(t, fernTestValueExpectedValueParameterID, obj.ExpectedValueParameterID) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersBasicTestCaseTemplate(t *testing.T) { + t.Run("GetTemplateID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicTestCaseTemplate{} + var expected TestCaseTemplateID + obj.TemplateID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTemplateID(), "getter should return the property value") + }) + + t.Run("GetTemplateID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BasicTestCaseTemplate + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTemplateID() // Should return zero value + }) + + t.Run("GetName", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicTestCaseTemplate{} + var expected string + obj.Name = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetName(), "getter should return the property value") + }) + + t.Run("GetName_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BasicTestCaseTemplate + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetName() // Should return zero value + }) + + t.Run("GetDescription", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicTestCaseTemplate{} + var expected *TestCaseImplementationDescription + obj.Description = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetDescription(), "getter should return the property value") + }) + + t.Run("GetDescription_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicTestCaseTemplate{} + obj.Description = nil + + // Act & Assert + assert.Nil(t, obj.GetDescription(), "getter should return nil when property is nil") + }) + + t.Run("GetDescription_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BasicTestCaseTemplate + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetDescription() // Should return zero value + }) + + t.Run("GetExpectedValueParameterID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicTestCaseTemplate{} + var expected ParameterID + obj.ExpectedValueParameterID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetExpectedValueParameterID(), "getter should return the property value") + }) + + t.Run("GetExpectedValueParameterID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BasicTestCaseTemplate + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetExpectedValueParameterID() // Should return zero value + }) + +} + +func TestSettersMarkExplicitBasicTestCaseTemplate(t *testing.T) { + t.Run("SetTemplateID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicTestCaseTemplate{} + var fernTestValueTemplateID TestCaseTemplateID + + // Act + obj.SetTemplateID(fernTestValueTemplateID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetName_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicTestCaseTemplate{} + var fernTestValueName string + + // Act + obj.SetName(fernTestValueName) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetDescription_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicTestCaseTemplate{} + var fernTestValueDescription *TestCaseImplementationDescription + + // Act + obj.SetDescription(fernTestValueDescription) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetExpectedValueParameterID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicTestCaseTemplate{} + var fernTestValueExpectedValueParameterID ParameterID + + // Act + obj.SetExpectedValueParameterID(fernTestValueExpectedValueParameterID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersCreateProblemRequestV2(t *testing.T) { + t.Run("SetProblemName", func(t *testing.T) { + obj := &CreateProblemRequestV2{} + var fernTestValueProblemName string + obj.SetProblemName(fernTestValueProblemName) + assert.Equal(t, fernTestValueProblemName, obj.ProblemName) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetProblemDescription", func(t *testing.T) { + obj := &CreateProblemRequestV2{} + var fernTestValueProblemDescription *common.ProblemDescription + obj.SetProblemDescription(fernTestValueProblemDescription) + assert.Equal(t, fernTestValueProblemDescription, obj.ProblemDescription) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetCustomFiles", func(t *testing.T) { + obj := &CreateProblemRequestV2{} + var fernTestValueCustomFiles *CustomFiles + obj.SetCustomFiles(fernTestValueCustomFiles) + assert.Equal(t, fernTestValueCustomFiles, obj.CustomFiles) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetCustomTestCaseTemplates", func(t *testing.T) { + obj := &CreateProblemRequestV2{} + var fernTestValueCustomTestCaseTemplates []*TestCaseTemplate + obj.SetCustomTestCaseTemplates(fernTestValueCustomTestCaseTemplates) + assert.Equal(t, fernTestValueCustomTestCaseTemplates, obj.CustomTestCaseTemplates) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetTestcases", func(t *testing.T) { + obj := &CreateProblemRequestV2{} + var fernTestValueTestcases []*TestCaseV2 + obj.SetTestcases(fernTestValueTestcases) + assert.Equal(t, fernTestValueTestcases, obj.Testcases) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetSupportedLanguages", func(t *testing.T) { + obj := &CreateProblemRequestV2{} + var fernTestValueSupportedLanguages []common.Language + obj.SetSupportedLanguages(fernTestValueSupportedLanguages) + assert.Equal(t, fernTestValueSupportedLanguages, obj.SupportedLanguages) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetIsPublic", func(t *testing.T) { + obj := &CreateProblemRequestV2{} + var fernTestValueIsPublic bool + obj.SetIsPublic(fernTestValueIsPublic) + assert.Equal(t, fernTestValueIsPublic, obj.IsPublic) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersCreateProblemRequestV2(t *testing.T) { + t.Run("GetProblemName", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + var expected string + obj.ProblemName = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetProblemName(), "getter should return the property value") + }) + + t.Run("GetProblemName_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CreateProblemRequestV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetProblemName() // Should return zero value + }) + + t.Run("GetProblemDescription", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + var expected *common.ProblemDescription + obj.ProblemDescription = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetProblemDescription(), "getter should return the property value") + }) + + t.Run("GetProblemDescription_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + obj.ProblemDescription = nil + + // Act & Assert + assert.Nil(t, obj.GetProblemDescription(), "getter should return nil when property is nil") + }) + + t.Run("GetProblemDescription_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CreateProblemRequestV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetProblemDescription() // Should return zero value + }) + + t.Run("GetCustomFiles", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + var expected *CustomFiles + obj.CustomFiles = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetCustomFiles(), "getter should return the property value") + }) + + t.Run("GetCustomFiles_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + obj.CustomFiles = nil + + // Act & Assert + assert.Nil(t, obj.GetCustomFiles(), "getter should return nil when property is nil") + }) + + t.Run("GetCustomFiles_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CreateProblemRequestV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetCustomFiles() // Should return zero value + }) + + t.Run("GetCustomTestCaseTemplates", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + var expected []*TestCaseTemplate + obj.CustomTestCaseTemplates = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetCustomTestCaseTemplates(), "getter should return the property value") + }) + + t.Run("GetCustomTestCaseTemplates_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + obj.CustomTestCaseTemplates = nil + + // Act & Assert + assert.Nil(t, obj.GetCustomTestCaseTemplates(), "getter should return nil when property is nil") + }) + + t.Run("GetCustomTestCaseTemplates_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CreateProblemRequestV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetCustomTestCaseTemplates() // Should return zero value + }) + + t.Run("GetTestcases", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + var expected []*TestCaseV2 + obj.Testcases = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTestcases(), "getter should return the property value") + }) + + t.Run("GetTestcases_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + obj.Testcases = nil + + // Act & Assert + assert.Nil(t, obj.GetTestcases(), "getter should return nil when property is nil") + }) + + t.Run("GetTestcases_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CreateProblemRequestV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTestcases() // Should return zero value + }) + + t.Run("GetSupportedLanguages", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + var expected []common.Language + obj.SupportedLanguages = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSupportedLanguages(), "getter should return the property value") + }) + + t.Run("GetSupportedLanguages_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + obj.SupportedLanguages = nil + + // Act & Assert + assert.Nil(t, obj.GetSupportedLanguages(), "getter should return nil when property is nil") + }) + + t.Run("GetSupportedLanguages_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CreateProblemRequestV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSupportedLanguages() // Should return zero value + }) + + t.Run("GetIsPublic", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + var expected bool + obj.IsPublic = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetIsPublic(), "getter should return the property value") + }) + + t.Run("GetIsPublic_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CreateProblemRequestV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetIsPublic() // Should return zero value + }) + +} + +func TestSettersMarkExplicitCreateProblemRequestV2(t *testing.T) { + t.Run("SetProblemName_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + var fernTestValueProblemName string + + // Act + obj.SetProblemName(fernTestValueProblemName) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetProblemDescription_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + var fernTestValueProblemDescription *common.ProblemDescription + + // Act + obj.SetProblemDescription(fernTestValueProblemDescription) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetCustomFiles_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + var fernTestValueCustomFiles *CustomFiles + + // Act + obj.SetCustomFiles(fernTestValueCustomFiles) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetCustomTestCaseTemplates_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + var fernTestValueCustomTestCaseTemplates []*TestCaseTemplate + + // Act + obj.SetCustomTestCaseTemplates(fernTestValueCustomTestCaseTemplates) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetTestcases_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + var fernTestValueTestcases []*TestCaseV2 + + // Act + obj.SetTestcases(fernTestValueTestcases) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetSupportedLanguages_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + var fernTestValueSupportedLanguages []common.Language + + // Act + obj.SetSupportedLanguages(fernTestValueSupportedLanguages) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetIsPublic_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + var fernTestValueIsPublic bool + + // Act + obj.SetIsPublic(fernTestValueIsPublic) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestGettersCustomFiles(t *testing.T) { + t.Run("GetType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CustomFiles{} + var expected string + obj.Type = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetType(), "getter should return the property value") + }) + + t.Run("GetType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CustomFiles + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetType() // Should return zero value + }) + + t.Run("GetBasic", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CustomFiles{} + var expected *BasicCustomFiles + obj.Basic = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetBasic(), "getter should return the property value") + }) + + t.Run("GetBasic_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CustomFiles{} + obj.Basic = nil + + // Act & Assert + assert.Nil(t, obj.GetBasic(), "getter should return nil when property is nil") + }) + + t.Run("GetBasic_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CustomFiles + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetBasic() // Should return zero value + }) + + t.Run("GetCustom", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CustomFiles{} + var expected map[common.Language]*Files + obj.Custom = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetCustom(), "getter should return the property value") + }) + + t.Run("GetCustom_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CustomFiles{} + obj.Custom = nil + + // Act & Assert + assert.Nil(t, obj.GetCustom(), "getter should return nil when property is nil") + }) + + t.Run("GetCustom_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CustomFiles + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetCustom() // Should return zero value + }) + +} + +func TestSettersDeepEqualityCorrectnessCheck(t *testing.T) { + t.Run("SetExpectedValueParameterID", func(t *testing.T) { + obj := &DeepEqualityCorrectnessCheck{} + var fernTestValueExpectedValueParameterID ParameterID + obj.SetExpectedValueParameterID(fernTestValueExpectedValueParameterID) + assert.Equal(t, fernTestValueExpectedValueParameterID, obj.ExpectedValueParameterID) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersDeepEqualityCorrectnessCheck(t *testing.T) { + t.Run("GetExpectedValueParameterID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DeepEqualityCorrectnessCheck{} + var expected ParameterID + obj.ExpectedValueParameterID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetExpectedValueParameterID(), "getter should return the property value") + }) + + t.Run("GetExpectedValueParameterID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DeepEqualityCorrectnessCheck + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetExpectedValueParameterID() // Should return zero value + }) + +} + +func TestSettersMarkExplicitDeepEqualityCorrectnessCheck(t *testing.T) { + t.Run("SetExpectedValueParameterID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DeepEqualityCorrectnessCheck{} + var fernTestValueExpectedValueParameterID ParameterID + + // Act + obj.SetExpectedValueParameterID(fernTestValueExpectedValueParameterID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersDefaultProvidedFile(t *testing.T) { + t.Run("SetFile", func(t *testing.T) { + obj := &DefaultProvidedFile{} + var fernTestValueFile *FileInfoV2 + obj.SetFile(fernTestValueFile) + assert.Equal(t, fernTestValueFile, obj.File) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetRelatedTypes", func(t *testing.T) { + obj := &DefaultProvidedFile{} + var fernTestValueRelatedTypes []*common.VariableType + obj.SetRelatedTypes(fernTestValueRelatedTypes) + assert.Equal(t, fernTestValueRelatedTypes, obj.RelatedTypes) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersDefaultProvidedFile(t *testing.T) { + t.Run("GetFile", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DefaultProvidedFile{} + var expected *FileInfoV2 + obj.File = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetFile(), "getter should return the property value") + }) + + t.Run("GetFile_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DefaultProvidedFile{} + obj.File = nil + + // Act & Assert + assert.Nil(t, obj.GetFile(), "getter should return nil when property is nil") + }) + + t.Run("GetFile_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DefaultProvidedFile + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetFile() // Should return zero value + }) + + t.Run("GetRelatedTypes", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DefaultProvidedFile{} + var expected []*common.VariableType + obj.RelatedTypes = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetRelatedTypes(), "getter should return the property value") + }) + + t.Run("GetRelatedTypes_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DefaultProvidedFile{} + obj.RelatedTypes = nil + + // Act & Assert + assert.Nil(t, obj.GetRelatedTypes(), "getter should return nil when property is nil") + }) + + t.Run("GetRelatedTypes_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DefaultProvidedFile + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetRelatedTypes() // Should return zero value + }) + +} + +func TestSettersMarkExplicitDefaultProvidedFile(t *testing.T) { + t.Run("SetFile_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DefaultProvidedFile{} + var fernTestValueFile *FileInfoV2 + + // Act + obj.SetFile(fernTestValueFile) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetRelatedTypes_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DefaultProvidedFile{} + var fernTestValueRelatedTypes []*common.VariableType + + // Act + obj.SetRelatedTypes(fernTestValueRelatedTypes) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersFileInfoV2(t *testing.T) { + t.Run("SetFilename", func(t *testing.T) { + obj := &FileInfoV2{} + var fernTestValueFilename string + obj.SetFilename(fernTestValueFilename) + assert.Equal(t, fernTestValueFilename, obj.Filename) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetDirectory", func(t *testing.T) { + obj := &FileInfoV2{} + var fernTestValueDirectory string + obj.SetDirectory(fernTestValueDirectory) + assert.Equal(t, fernTestValueDirectory, obj.Directory) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetContents", func(t *testing.T) { + obj := &FileInfoV2{} + var fernTestValueContents string + obj.SetContents(fernTestValueContents) + assert.Equal(t, fernTestValueContents, obj.Contents) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetEditable", func(t *testing.T) { + obj := &FileInfoV2{} + var fernTestValueEditable bool + obj.SetEditable(fernTestValueEditable) + assert.Equal(t, fernTestValueEditable, obj.Editable) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersFileInfoV2(t *testing.T) { + t.Run("GetFilename", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FileInfoV2{} + var expected string + obj.Filename = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetFilename(), "getter should return the property value") + }) + + t.Run("GetFilename_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FileInfoV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetFilename() // Should return zero value + }) + + t.Run("GetDirectory", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FileInfoV2{} + var expected string + obj.Directory = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetDirectory(), "getter should return the property value") + }) + + t.Run("GetDirectory_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FileInfoV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetDirectory() // Should return zero value + }) + + t.Run("GetContents", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FileInfoV2{} + var expected string + obj.Contents = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetContents(), "getter should return the property value") + }) + + t.Run("GetContents_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FileInfoV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetContents() // Should return zero value + }) + + t.Run("GetEditable", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FileInfoV2{} + var expected bool + obj.Editable = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetEditable(), "getter should return the property value") + }) + + t.Run("GetEditable_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FileInfoV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetEditable() // Should return zero value + }) + +} + +func TestSettersMarkExplicitFileInfoV2(t *testing.T) { + t.Run("SetFilename_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FileInfoV2{} + var fernTestValueFilename string + + // Act + obj.SetFilename(fernTestValueFilename) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetDirectory_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FileInfoV2{} + var fernTestValueDirectory string + + // Act + obj.SetDirectory(fernTestValueDirectory) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetContents_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FileInfoV2{} + var fernTestValueContents string + + // Act + obj.SetContents(fernTestValueContents) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetEditable_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FileInfoV2{} + var fernTestValueEditable bool + + // Act + obj.SetEditable(fernTestValueEditable) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersFiles(t *testing.T) { + t.Run("SetFiles", func(t *testing.T) { + obj := &Files{} + var fernTestValueFiles []*FileInfoV2 + obj.SetFiles(fernTestValueFiles) + assert.Equal(t, fernTestValueFiles, obj.Files) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersFiles(t *testing.T) { + t.Run("GetFiles", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Files{} + var expected []*FileInfoV2 + obj.Files = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetFiles(), "getter should return the property value") + }) + + t.Run("GetFiles_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Files{} + obj.Files = nil + + // Act & Assert + assert.Nil(t, obj.GetFiles(), "getter should return nil when property is nil") + }) + + t.Run("GetFiles_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *Files + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetFiles() // Should return zero value + }) + +} + +func TestSettersMarkExplicitFiles(t *testing.T) { + t.Run("SetFiles_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Files{} + var fernTestValueFiles []*FileInfoV2 + + // Act + obj.SetFiles(fernTestValueFiles) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersFunctionImplementation(t *testing.T) { + t.Run("SetImpl", func(t *testing.T) { + obj := &FunctionImplementation{} + var fernTestValueImpl string + obj.SetImpl(fernTestValueImpl) + assert.Equal(t, fernTestValueImpl, obj.Impl) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetImports", func(t *testing.T) { + obj := &FunctionImplementation{} + var fernTestValueImports *string + obj.SetImports(fernTestValueImports) + assert.Equal(t, fernTestValueImports, obj.Imports) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersFunctionImplementation(t *testing.T) { + t.Run("GetImpl", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FunctionImplementation{} + var expected string + obj.Impl = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetImpl(), "getter should return the property value") + }) + + t.Run("GetImpl_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FunctionImplementation + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetImpl() // Should return zero value + }) + + t.Run("GetImports", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FunctionImplementation{} + var expected *string + obj.Imports = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetImports(), "getter should return the property value") + }) + + t.Run("GetImports_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FunctionImplementation{} + obj.Imports = nil + + // Act & Assert + assert.Nil(t, obj.GetImports(), "getter should return nil when property is nil") + }) + + t.Run("GetImports_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FunctionImplementation + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetImports() // Should return zero value + }) + +} + +func TestSettersMarkExplicitFunctionImplementation(t *testing.T) { + t.Run("SetImpl_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FunctionImplementation{} + var fernTestValueImpl string + + // Act + obj.SetImpl(fernTestValueImpl) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetImports_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FunctionImplementation{} + var fernTestValueImports *string + + // Act + obj.SetImports(fernTestValueImports) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersFunctionImplementationForMultipleLanguages(t *testing.T) { + t.Run("SetCodeByLanguage", func(t *testing.T) { + obj := &FunctionImplementationForMultipleLanguages{} + var fernTestValueCodeByLanguage map[common.Language]*FunctionImplementation + obj.SetCodeByLanguage(fernTestValueCodeByLanguage) + assert.Equal(t, fernTestValueCodeByLanguage, obj.CodeByLanguage) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersFunctionImplementationForMultipleLanguages(t *testing.T) { + t.Run("GetCodeByLanguage", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FunctionImplementationForMultipleLanguages{} + var expected map[common.Language]*FunctionImplementation + obj.CodeByLanguage = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetCodeByLanguage(), "getter should return the property value") + }) + + t.Run("GetCodeByLanguage_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FunctionImplementationForMultipleLanguages{} + obj.CodeByLanguage = nil + + // Act & Assert + assert.Nil(t, obj.GetCodeByLanguage(), "getter should return nil when property is nil") + }) + + t.Run("GetCodeByLanguage_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FunctionImplementationForMultipleLanguages + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetCodeByLanguage() // Should return zero value + }) + +} + +func TestSettersMarkExplicitFunctionImplementationForMultipleLanguages(t *testing.T) { + t.Run("SetCodeByLanguage_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FunctionImplementationForMultipleLanguages{} + var fernTestValueCodeByLanguage map[common.Language]*FunctionImplementation + + // Act + obj.SetCodeByLanguage(fernTestValueCodeByLanguage) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestGettersFunctionSignature(t *testing.T) { + t.Run("GetType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FunctionSignature{} + var expected string + obj.Type = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetType(), "getter should return the property value") + }) + + t.Run("GetType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FunctionSignature + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetType() // Should return zero value + }) + + t.Run("GetVoid", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FunctionSignature{} + var expected *VoidFunctionSignature + obj.Void = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetVoid(), "getter should return the property value") + }) + + t.Run("GetVoid_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FunctionSignature{} + obj.Void = nil + + // Act & Assert + assert.Nil(t, obj.GetVoid(), "getter should return nil when property is nil") + }) + + t.Run("GetVoid_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FunctionSignature + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetVoid() // Should return zero value + }) + + t.Run("GetNonVoid", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FunctionSignature{} + var expected *NonVoidFunctionSignature + obj.NonVoid = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetNonVoid(), "getter should return the property value") + }) + + t.Run("GetNonVoid_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FunctionSignature{} + obj.NonVoid = nil + + // Act & Assert + assert.Nil(t, obj.GetNonVoid(), "getter should return nil when property is nil") + }) + + t.Run("GetNonVoid_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FunctionSignature + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetNonVoid() // Should return zero value + }) + + t.Run("GetVoidThatTakesActualResult", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FunctionSignature{} + var expected *VoidFunctionSignatureThatTakesActualResult + obj.VoidThatTakesActualResult = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetVoidThatTakesActualResult(), "getter should return the property value") + }) + + t.Run("GetVoidThatTakesActualResult_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FunctionSignature{} + obj.VoidThatTakesActualResult = nil + + // Act & Assert + assert.Nil(t, obj.GetVoidThatTakesActualResult(), "getter should return nil when property is nil") + }) + + t.Run("GetVoidThatTakesActualResult_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FunctionSignature + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetVoidThatTakesActualResult() // Should return zero value + }) + +} + +func TestSettersGeneratedFiles(t *testing.T) { + t.Run("SetGeneratedTestCaseFiles", func(t *testing.T) { + obj := &GeneratedFiles{} + var fernTestValueGeneratedTestCaseFiles map[common.Language]*Files + obj.SetGeneratedTestCaseFiles(fernTestValueGeneratedTestCaseFiles) + assert.Equal(t, fernTestValueGeneratedTestCaseFiles, obj.GeneratedTestCaseFiles) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetGeneratedTemplateFiles", func(t *testing.T) { + obj := &GeneratedFiles{} + var fernTestValueGeneratedTemplateFiles map[common.Language]*Files + obj.SetGeneratedTemplateFiles(fernTestValueGeneratedTemplateFiles) + assert.Equal(t, fernTestValueGeneratedTemplateFiles, obj.GeneratedTemplateFiles) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetOther", func(t *testing.T) { + obj := &GeneratedFiles{} + var fernTestValueOther map[common.Language]*Files + obj.SetOther(fernTestValueOther) + assert.Equal(t, fernTestValueOther, obj.Other) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersGeneratedFiles(t *testing.T) { + t.Run("GetGeneratedTestCaseFiles", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GeneratedFiles{} + var expected map[common.Language]*Files + obj.GeneratedTestCaseFiles = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetGeneratedTestCaseFiles(), "getter should return the property value") + }) + + t.Run("GetGeneratedTestCaseFiles_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GeneratedFiles{} + obj.GeneratedTestCaseFiles = nil + + // Act & Assert + assert.Nil(t, obj.GetGeneratedTestCaseFiles(), "getter should return nil when property is nil") + }) + + t.Run("GetGeneratedTestCaseFiles_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GeneratedFiles + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetGeneratedTestCaseFiles() // Should return zero value + }) + + t.Run("GetGeneratedTemplateFiles", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GeneratedFiles{} + var expected map[common.Language]*Files + obj.GeneratedTemplateFiles = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetGeneratedTemplateFiles(), "getter should return the property value") + }) + + t.Run("GetGeneratedTemplateFiles_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GeneratedFiles{} + obj.GeneratedTemplateFiles = nil + + // Act & Assert + assert.Nil(t, obj.GetGeneratedTemplateFiles(), "getter should return nil when property is nil") + }) + + t.Run("GetGeneratedTemplateFiles_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GeneratedFiles + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetGeneratedTemplateFiles() // Should return zero value + }) + + t.Run("GetOther", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GeneratedFiles{} + var expected map[common.Language]*Files + obj.Other = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetOther(), "getter should return the property value") + }) + + t.Run("GetOther_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GeneratedFiles{} + obj.Other = nil + + // Act & Assert + assert.Nil(t, obj.GetOther(), "getter should return nil when property is nil") + }) + + t.Run("GetOther_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GeneratedFiles + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetOther() // Should return zero value + }) + +} + +func TestSettersMarkExplicitGeneratedFiles(t *testing.T) { + t.Run("SetGeneratedTestCaseFiles_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GeneratedFiles{} + var fernTestValueGeneratedTestCaseFiles map[common.Language]*Files + + // Act + obj.SetGeneratedTestCaseFiles(fernTestValueGeneratedTestCaseFiles) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetGeneratedTemplateFiles_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GeneratedFiles{} + var fernTestValueGeneratedTemplateFiles map[common.Language]*Files + + // Act + obj.SetGeneratedTemplateFiles(fernTestValueGeneratedTemplateFiles) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetOther_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GeneratedFiles{} + var fernTestValueOther map[common.Language]*Files + + // Act + obj.SetOther(fernTestValueOther) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersGetBasicSolutionFileRequest(t *testing.T) { + t.Run("SetMethodName", func(t *testing.T) { + obj := &GetBasicSolutionFileRequest{} + var fernTestValueMethodName string + obj.SetMethodName(fernTestValueMethodName) + assert.Equal(t, fernTestValueMethodName, obj.MethodName) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetSignature", func(t *testing.T) { + obj := &GetBasicSolutionFileRequest{} + var fernTestValueSignature *NonVoidFunctionSignature + obj.SetSignature(fernTestValueSignature) + assert.Equal(t, fernTestValueSignature, obj.Signature) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersGetBasicSolutionFileRequest(t *testing.T) { + t.Run("GetMethodName", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetBasicSolutionFileRequest{} + var expected string + obj.MethodName = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetMethodName(), "getter should return the property value") + }) + + t.Run("GetMethodName_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetBasicSolutionFileRequest + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetMethodName() // Should return zero value + }) + + t.Run("GetSignature", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetBasicSolutionFileRequest{} + var expected *NonVoidFunctionSignature + obj.Signature = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSignature(), "getter should return the property value") + }) + + t.Run("GetSignature_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetBasicSolutionFileRequest{} + obj.Signature = nil + + // Act & Assert + assert.Nil(t, obj.GetSignature(), "getter should return nil when property is nil") + }) + + t.Run("GetSignature_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetBasicSolutionFileRequest + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSignature() // Should return zero value + }) + +} + +func TestSettersMarkExplicitGetBasicSolutionFileRequest(t *testing.T) { + t.Run("SetMethodName_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetBasicSolutionFileRequest{} + var fernTestValueMethodName string + + // Act + obj.SetMethodName(fernTestValueMethodName) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetSignature_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetBasicSolutionFileRequest{} + var fernTestValueSignature *NonVoidFunctionSignature + + // Act + obj.SetSignature(fernTestValueSignature) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersGetBasicSolutionFileResponse(t *testing.T) { + t.Run("SetSolutionFileByLanguage", func(t *testing.T) { + obj := &GetBasicSolutionFileResponse{} + var fernTestValueSolutionFileByLanguage map[common.Language]*FileInfoV2 + obj.SetSolutionFileByLanguage(fernTestValueSolutionFileByLanguage) + assert.Equal(t, fernTestValueSolutionFileByLanguage, obj.SolutionFileByLanguage) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersGetBasicSolutionFileResponse(t *testing.T) { + t.Run("GetSolutionFileByLanguage", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetBasicSolutionFileResponse{} + var expected map[common.Language]*FileInfoV2 + obj.SolutionFileByLanguage = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSolutionFileByLanguage(), "getter should return the property value") + }) + + t.Run("GetSolutionFileByLanguage_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetBasicSolutionFileResponse{} + obj.SolutionFileByLanguage = nil + + // Act & Assert + assert.Nil(t, obj.GetSolutionFileByLanguage(), "getter should return nil when property is nil") + }) + + t.Run("GetSolutionFileByLanguage_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetBasicSolutionFileResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSolutionFileByLanguage() // Should return zero value + }) + +} + +func TestSettersMarkExplicitGetBasicSolutionFileResponse(t *testing.T) { + t.Run("SetSolutionFileByLanguage_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetBasicSolutionFileResponse{} + var fernTestValueSolutionFileByLanguage map[common.Language]*FileInfoV2 + + // Act + obj.SetSolutionFileByLanguage(fernTestValueSolutionFileByLanguage) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersGetFunctionSignatureRequest(t *testing.T) { + t.Run("SetFunctionSignature", func(t *testing.T) { + obj := &GetFunctionSignatureRequest{} + var fernTestValueFunctionSignature *FunctionSignature + obj.SetFunctionSignature(fernTestValueFunctionSignature) + assert.Equal(t, fernTestValueFunctionSignature, obj.FunctionSignature) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersGetFunctionSignatureRequest(t *testing.T) { + t.Run("GetFunctionSignature", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetFunctionSignatureRequest{} + var expected *FunctionSignature + obj.FunctionSignature = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetFunctionSignature(), "getter should return the property value") + }) + + t.Run("GetFunctionSignature_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetFunctionSignatureRequest{} + obj.FunctionSignature = nil + + // Act & Assert + assert.Nil(t, obj.GetFunctionSignature(), "getter should return nil when property is nil") + }) + + t.Run("GetFunctionSignature_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetFunctionSignatureRequest + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetFunctionSignature() // Should return zero value + }) + +} + +func TestSettersMarkExplicitGetFunctionSignatureRequest(t *testing.T) { + t.Run("SetFunctionSignature_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetFunctionSignatureRequest{} + var fernTestValueFunctionSignature *FunctionSignature + + // Act + obj.SetFunctionSignature(fernTestValueFunctionSignature) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersGetFunctionSignatureResponse(t *testing.T) { + t.Run("SetFunctionByLanguage", func(t *testing.T) { + obj := &GetFunctionSignatureResponse{} + var fernTestValueFunctionByLanguage map[common.Language]string + obj.SetFunctionByLanguage(fernTestValueFunctionByLanguage) + assert.Equal(t, fernTestValueFunctionByLanguage, obj.FunctionByLanguage) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersGetFunctionSignatureResponse(t *testing.T) { + t.Run("GetFunctionByLanguage", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetFunctionSignatureResponse{} + var expected map[common.Language]string + obj.FunctionByLanguage = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetFunctionByLanguage(), "getter should return the property value") + }) + + t.Run("GetFunctionByLanguage_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetFunctionSignatureResponse{} + obj.FunctionByLanguage = nil + + // Act & Assert + assert.Nil(t, obj.GetFunctionByLanguage(), "getter should return nil when property is nil") + }) + + t.Run("GetFunctionByLanguage_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetFunctionSignatureResponse + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetFunctionByLanguage() // Should return zero value + }) + +} + +func TestSettersMarkExplicitGetFunctionSignatureResponse(t *testing.T) { + t.Run("SetFunctionByLanguage_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetFunctionSignatureResponse{} + var fernTestValueFunctionByLanguage map[common.Language]string + + // Act + obj.SetFunctionByLanguage(fernTestValueFunctionByLanguage) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersGetGeneratedTestCaseFileRequest(t *testing.T) { + t.Run("SetTemplate", func(t *testing.T) { + obj := &GetGeneratedTestCaseFileRequest{} + var fernTestValueTemplate *TestCaseTemplate + obj.SetTemplate(fernTestValueTemplate) + assert.Equal(t, fernTestValueTemplate, obj.Template) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetTestCase", func(t *testing.T) { + obj := &GetGeneratedTestCaseFileRequest{} + var fernTestValueTestCase *TestCaseV2 + obj.SetTestCase(fernTestValueTestCase) + assert.Equal(t, fernTestValueTestCase, obj.TestCase) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersGetGeneratedTestCaseFileRequest(t *testing.T) { + t.Run("GetTemplate", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetGeneratedTestCaseFileRequest{} + var expected *TestCaseTemplate + obj.Template = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTemplate(), "getter should return the property value") + }) + + t.Run("GetTemplate_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetGeneratedTestCaseFileRequest{} + obj.Template = nil + + // Act & Assert + assert.Nil(t, obj.GetTemplate(), "getter should return nil when property is nil") + }) + + t.Run("GetTemplate_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetGeneratedTestCaseFileRequest + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTemplate() // Should return zero value + }) + + t.Run("GetTestCase", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetGeneratedTestCaseFileRequest{} + var expected *TestCaseV2 + obj.TestCase = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTestCase(), "getter should return the property value") + }) + + t.Run("GetTestCase_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetGeneratedTestCaseFileRequest{} + obj.TestCase = nil + + // Act & Assert + assert.Nil(t, obj.GetTestCase(), "getter should return nil when property is nil") + }) + + t.Run("GetTestCase_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetGeneratedTestCaseFileRequest + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTestCase() // Should return zero value + }) + +} + +func TestSettersMarkExplicitGetGeneratedTestCaseFileRequest(t *testing.T) { + t.Run("SetTemplate_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetGeneratedTestCaseFileRequest{} + var fernTestValueTemplate *TestCaseTemplate + + // Act + obj.SetTemplate(fernTestValueTemplate) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetTestCase_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetGeneratedTestCaseFileRequest{} + var fernTestValueTestCase *TestCaseV2 + + // Act + obj.SetTestCase(fernTestValueTestCase) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersGetGeneratedTestCaseTemplateFileRequest(t *testing.T) { + t.Run("SetTemplate", func(t *testing.T) { + obj := &GetGeneratedTestCaseTemplateFileRequest{} + var fernTestValueTemplate *TestCaseTemplate + obj.SetTemplate(fernTestValueTemplate) + assert.Equal(t, fernTestValueTemplate, obj.Template) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersGetGeneratedTestCaseTemplateFileRequest(t *testing.T) { + t.Run("GetTemplate", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetGeneratedTestCaseTemplateFileRequest{} + var expected *TestCaseTemplate + obj.Template = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTemplate(), "getter should return the property value") + }) + + t.Run("GetTemplate_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetGeneratedTestCaseTemplateFileRequest{} + obj.Template = nil + + // Act & Assert + assert.Nil(t, obj.GetTemplate(), "getter should return nil when property is nil") + }) + + t.Run("GetTemplate_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetGeneratedTestCaseTemplateFileRequest + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTemplate() // Should return zero value + }) + +} + +func TestSettersMarkExplicitGetGeneratedTestCaseTemplateFileRequest(t *testing.T) { + t.Run("SetTemplate_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetGeneratedTestCaseTemplateFileRequest{} + var fernTestValueTemplate *TestCaseTemplate + + // Act + obj.SetTemplate(fernTestValueTemplate) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersLightweightProblemInfoV2(t *testing.T) { + t.Run("SetProblemID", func(t *testing.T) { + obj := &LightweightProblemInfoV2{} + var fernTestValueProblemID common.ProblemID + obj.SetProblemID(fernTestValueProblemID) + assert.Equal(t, fernTestValueProblemID, obj.ProblemID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetProblemName", func(t *testing.T) { + obj := &LightweightProblemInfoV2{} + var fernTestValueProblemName string + obj.SetProblemName(fernTestValueProblemName) + assert.Equal(t, fernTestValueProblemName, obj.ProblemName) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetProblemVersion", func(t *testing.T) { + obj := &LightweightProblemInfoV2{} + var fernTestValueProblemVersion int + obj.SetProblemVersion(fernTestValueProblemVersion) + assert.Equal(t, fernTestValueProblemVersion, obj.ProblemVersion) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetVariableTypes", func(t *testing.T) { + obj := &LightweightProblemInfoV2{} + var fernTestValueVariableTypes []*common.VariableType + obj.SetVariableTypes(fernTestValueVariableTypes) + assert.Equal(t, fernTestValueVariableTypes, obj.VariableTypes) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersLightweightProblemInfoV2(t *testing.T) { + t.Run("GetProblemID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &LightweightProblemInfoV2{} + var expected common.ProblemID + obj.ProblemID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetProblemID(), "getter should return the property value") + }) + + t.Run("GetProblemID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *LightweightProblemInfoV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetProblemID() // Should return zero value + }) + + t.Run("GetProblemName", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &LightweightProblemInfoV2{} + var expected string + obj.ProblemName = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetProblemName(), "getter should return the property value") + }) + + t.Run("GetProblemName_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *LightweightProblemInfoV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetProblemName() // Should return zero value + }) + + t.Run("GetProblemVersion", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &LightweightProblemInfoV2{} + var expected int + obj.ProblemVersion = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetProblemVersion(), "getter should return the property value") + }) + + t.Run("GetProblemVersion_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *LightweightProblemInfoV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetProblemVersion() // Should return zero value + }) + + t.Run("GetVariableTypes", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &LightweightProblemInfoV2{} + var expected []*common.VariableType + obj.VariableTypes = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetVariableTypes(), "getter should return the property value") + }) + + t.Run("GetVariableTypes_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &LightweightProblemInfoV2{} + obj.VariableTypes = nil + + // Act & Assert + assert.Nil(t, obj.GetVariableTypes(), "getter should return nil when property is nil") + }) + + t.Run("GetVariableTypes_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *LightweightProblemInfoV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetVariableTypes() // Should return zero value + }) + +} + +func TestSettersMarkExplicitLightweightProblemInfoV2(t *testing.T) { + t.Run("SetProblemID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &LightweightProblemInfoV2{} + var fernTestValueProblemID common.ProblemID + + // Act + obj.SetProblemID(fernTestValueProblemID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetProblemName_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &LightweightProblemInfoV2{} + var fernTestValueProblemName string + + // Act + obj.SetProblemName(fernTestValueProblemName) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetProblemVersion_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &LightweightProblemInfoV2{} + var fernTestValueProblemVersion int + + // Act + obj.SetProblemVersion(fernTestValueProblemVersion) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetVariableTypes_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &LightweightProblemInfoV2{} + var fernTestValueVariableTypes []*common.VariableType + + // Act + obj.SetVariableTypes(fernTestValueVariableTypes) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersNonVoidFunctionDefinition(t *testing.T) { + t.Run("SetSignature", func(t *testing.T) { + obj := &NonVoidFunctionDefinition{} + var fernTestValueSignature *NonVoidFunctionSignature + obj.SetSignature(fernTestValueSignature) + assert.Equal(t, fernTestValueSignature, obj.Signature) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetCode", func(t *testing.T) { + obj := &NonVoidFunctionDefinition{} + var fernTestValueCode *FunctionImplementationForMultipleLanguages + obj.SetCode(fernTestValueCode) + assert.Equal(t, fernTestValueCode, obj.Code) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersNonVoidFunctionDefinition(t *testing.T) { + t.Run("GetSignature", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &NonVoidFunctionDefinition{} + var expected *NonVoidFunctionSignature + obj.Signature = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSignature(), "getter should return the property value") + }) + + t.Run("GetSignature_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &NonVoidFunctionDefinition{} + obj.Signature = nil + + // Act & Assert + assert.Nil(t, obj.GetSignature(), "getter should return nil when property is nil") + }) + + t.Run("GetSignature_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *NonVoidFunctionDefinition + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSignature() // Should return zero value + }) + + t.Run("GetCode", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &NonVoidFunctionDefinition{} + var expected *FunctionImplementationForMultipleLanguages + obj.Code = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetCode(), "getter should return the property value") + }) + + t.Run("GetCode_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &NonVoidFunctionDefinition{} + obj.Code = nil + + // Act & Assert + assert.Nil(t, obj.GetCode(), "getter should return nil when property is nil") + }) + + t.Run("GetCode_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *NonVoidFunctionDefinition + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetCode() // Should return zero value + }) + +} + +func TestSettersMarkExplicitNonVoidFunctionDefinition(t *testing.T) { + t.Run("SetSignature_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &NonVoidFunctionDefinition{} + var fernTestValueSignature *NonVoidFunctionSignature + + // Act + obj.SetSignature(fernTestValueSignature) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetCode_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &NonVoidFunctionDefinition{} + var fernTestValueCode *FunctionImplementationForMultipleLanguages + + // Act + obj.SetCode(fernTestValueCode) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersNonVoidFunctionSignature(t *testing.T) { + t.Run("SetParameters", func(t *testing.T) { + obj := &NonVoidFunctionSignature{} + var fernTestValueParameters []*Parameter + obj.SetParameters(fernTestValueParameters) + assert.Equal(t, fernTestValueParameters, obj.Parameters) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetReturnType", func(t *testing.T) { + obj := &NonVoidFunctionSignature{} + var fernTestValueReturnType *common.VariableType + obj.SetReturnType(fernTestValueReturnType) + assert.Equal(t, fernTestValueReturnType, obj.ReturnType) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersNonVoidFunctionSignature(t *testing.T) { + t.Run("GetParameters", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &NonVoidFunctionSignature{} + var expected []*Parameter + obj.Parameters = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetParameters(), "getter should return the property value") + }) + + t.Run("GetParameters_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &NonVoidFunctionSignature{} + obj.Parameters = nil + + // Act & Assert + assert.Nil(t, obj.GetParameters(), "getter should return nil when property is nil") + }) + + t.Run("GetParameters_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *NonVoidFunctionSignature + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetParameters() // Should return zero value + }) + + t.Run("GetReturnType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &NonVoidFunctionSignature{} + var expected *common.VariableType + obj.ReturnType = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetReturnType(), "getter should return the property value") + }) + + t.Run("GetReturnType_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &NonVoidFunctionSignature{} + obj.ReturnType = nil + + // Act & Assert + assert.Nil(t, obj.GetReturnType(), "getter should return nil when property is nil") + }) + + t.Run("GetReturnType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *NonVoidFunctionSignature + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetReturnType() // Should return zero value + }) + +} + +func TestSettersMarkExplicitNonVoidFunctionSignature(t *testing.T) { + t.Run("SetParameters_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &NonVoidFunctionSignature{} + var fernTestValueParameters []*Parameter + + // Act + obj.SetParameters(fernTestValueParameters) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetReturnType_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &NonVoidFunctionSignature{} + var fernTestValueReturnType *common.VariableType + + // Act + obj.SetReturnType(fernTestValueReturnType) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersParameter(t *testing.T) { + t.Run("SetParameterID", func(t *testing.T) { + obj := &Parameter{} + var fernTestValueParameterID ParameterID + obj.SetParameterID(fernTestValueParameterID) + assert.Equal(t, fernTestValueParameterID, obj.ParameterID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetName", func(t *testing.T) { + obj := &Parameter{} + var fernTestValueName string + obj.SetName(fernTestValueName) + assert.Equal(t, fernTestValueName, obj.Name) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetVariableType", func(t *testing.T) { + obj := &Parameter{} + var fernTestValueVariableType *common.VariableType + obj.SetVariableType(fernTestValueVariableType) + assert.Equal(t, fernTestValueVariableType, obj.VariableType) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersParameter(t *testing.T) { + t.Run("GetParameterID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Parameter{} + var expected ParameterID + obj.ParameterID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetParameterID(), "getter should return the property value") + }) + + t.Run("GetParameterID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *Parameter + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetParameterID() // Should return zero value + }) + + t.Run("GetName", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Parameter{} + var expected string + obj.Name = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetName(), "getter should return the property value") + }) + + t.Run("GetName_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *Parameter + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetName() // Should return zero value + }) + + t.Run("GetVariableType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Parameter{} + var expected *common.VariableType + obj.VariableType = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetVariableType(), "getter should return the property value") + }) + + t.Run("GetVariableType_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Parameter{} + obj.VariableType = nil + + // Act & Assert + assert.Nil(t, obj.GetVariableType(), "getter should return nil when property is nil") + }) + + t.Run("GetVariableType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *Parameter + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetVariableType() // Should return zero value + }) + +} + +func TestSettersMarkExplicitParameter(t *testing.T) { + t.Run("SetParameterID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Parameter{} + var fernTestValueParameterID ParameterID + + // Act + obj.SetParameterID(fernTestValueParameterID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetName_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Parameter{} + var fernTestValueName string + + // Act + obj.SetName(fernTestValueName) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetVariableType_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Parameter{} + var fernTestValueVariableType *common.VariableType + + // Act + obj.SetVariableType(fernTestValueVariableType) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersProblemInfoV2(t *testing.T) { + t.Run("SetProblemID", func(t *testing.T) { + obj := &ProblemInfoV2{} + var fernTestValueProblemID common.ProblemID + obj.SetProblemID(fernTestValueProblemID) + assert.Equal(t, fernTestValueProblemID, obj.ProblemID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetProblemDescription", func(t *testing.T) { + obj := &ProblemInfoV2{} + var fernTestValueProblemDescription *common.ProblemDescription + obj.SetProblemDescription(fernTestValueProblemDescription) + assert.Equal(t, fernTestValueProblemDescription, obj.ProblemDescription) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetProblemName", func(t *testing.T) { + obj := &ProblemInfoV2{} + var fernTestValueProblemName string + obj.SetProblemName(fernTestValueProblemName) + assert.Equal(t, fernTestValueProblemName, obj.ProblemName) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetProblemVersion", func(t *testing.T) { + obj := &ProblemInfoV2{} + var fernTestValueProblemVersion int + obj.SetProblemVersion(fernTestValueProblemVersion) + assert.Equal(t, fernTestValueProblemVersion, obj.ProblemVersion) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetSupportedLanguages", func(t *testing.T) { + obj := &ProblemInfoV2{} + var fernTestValueSupportedLanguages []common.Language + obj.SetSupportedLanguages(fernTestValueSupportedLanguages) + assert.Equal(t, fernTestValueSupportedLanguages, obj.SupportedLanguages) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetCustomFiles", func(t *testing.T) { + obj := &ProblemInfoV2{} + var fernTestValueCustomFiles *CustomFiles + obj.SetCustomFiles(fernTestValueCustomFiles) + assert.Equal(t, fernTestValueCustomFiles, obj.CustomFiles) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetGeneratedFiles", func(t *testing.T) { + obj := &ProblemInfoV2{} + var fernTestValueGeneratedFiles *GeneratedFiles + obj.SetGeneratedFiles(fernTestValueGeneratedFiles) + assert.Equal(t, fernTestValueGeneratedFiles, obj.GeneratedFiles) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetCustomTestCaseTemplates", func(t *testing.T) { + obj := &ProblemInfoV2{} + var fernTestValueCustomTestCaseTemplates []*TestCaseTemplate + obj.SetCustomTestCaseTemplates(fernTestValueCustomTestCaseTemplates) + assert.Equal(t, fernTestValueCustomTestCaseTemplates, obj.CustomTestCaseTemplates) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetTestcases", func(t *testing.T) { + obj := &ProblemInfoV2{} + var fernTestValueTestcases []*TestCaseV2 + obj.SetTestcases(fernTestValueTestcases) + assert.Equal(t, fernTestValueTestcases, obj.Testcases) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetIsPublic", func(t *testing.T) { + obj := &ProblemInfoV2{} + var fernTestValueIsPublic bool + obj.SetIsPublic(fernTestValueIsPublic) + assert.Equal(t, fernTestValueIsPublic, obj.IsPublic) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersProblemInfoV2(t *testing.T) { + t.Run("GetProblemID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var expected common.ProblemID + obj.ProblemID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetProblemID(), "getter should return the property value") + }) + + t.Run("GetProblemID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemInfoV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetProblemID() // Should return zero value + }) + + t.Run("GetProblemDescription", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var expected *common.ProblemDescription + obj.ProblemDescription = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetProblemDescription(), "getter should return the property value") + }) + + t.Run("GetProblemDescription_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + obj.ProblemDescription = nil + + // Act & Assert + assert.Nil(t, obj.GetProblemDescription(), "getter should return nil when property is nil") + }) + + t.Run("GetProblemDescription_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemInfoV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetProblemDescription() // Should return zero value + }) + + t.Run("GetProblemName", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var expected string + obj.ProblemName = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetProblemName(), "getter should return the property value") + }) + + t.Run("GetProblemName_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemInfoV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetProblemName() // Should return zero value + }) + + t.Run("GetProblemVersion", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var expected int + obj.ProblemVersion = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetProblemVersion(), "getter should return the property value") + }) + + t.Run("GetProblemVersion_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemInfoV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetProblemVersion() // Should return zero value + }) + + t.Run("GetSupportedLanguages", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var expected []common.Language + obj.SupportedLanguages = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetSupportedLanguages(), "getter should return the property value") + }) + + t.Run("GetSupportedLanguages_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + obj.SupportedLanguages = nil + + // Act & Assert + assert.Nil(t, obj.GetSupportedLanguages(), "getter should return nil when property is nil") + }) + + t.Run("GetSupportedLanguages_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemInfoV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetSupportedLanguages() // Should return zero value + }) + + t.Run("GetCustomFiles", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var expected *CustomFiles + obj.CustomFiles = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetCustomFiles(), "getter should return the property value") + }) + + t.Run("GetCustomFiles_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + obj.CustomFiles = nil + + // Act & Assert + assert.Nil(t, obj.GetCustomFiles(), "getter should return nil when property is nil") + }) + + t.Run("GetCustomFiles_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemInfoV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetCustomFiles() // Should return zero value + }) + + t.Run("GetGeneratedFiles", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var expected *GeneratedFiles + obj.GeneratedFiles = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetGeneratedFiles(), "getter should return the property value") + }) + + t.Run("GetGeneratedFiles_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + obj.GeneratedFiles = nil + + // Act & Assert + assert.Nil(t, obj.GetGeneratedFiles(), "getter should return nil when property is nil") + }) + + t.Run("GetGeneratedFiles_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemInfoV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetGeneratedFiles() // Should return zero value + }) + + t.Run("GetCustomTestCaseTemplates", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var expected []*TestCaseTemplate + obj.CustomTestCaseTemplates = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetCustomTestCaseTemplates(), "getter should return the property value") + }) + + t.Run("GetCustomTestCaseTemplates_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + obj.CustomTestCaseTemplates = nil + + // Act & Assert + assert.Nil(t, obj.GetCustomTestCaseTemplates(), "getter should return nil when property is nil") + }) + + t.Run("GetCustomTestCaseTemplates_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemInfoV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetCustomTestCaseTemplates() // Should return zero value + }) + + t.Run("GetTestcases", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var expected []*TestCaseV2 + obj.Testcases = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTestcases(), "getter should return the property value") + }) + + t.Run("GetTestcases_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + obj.Testcases = nil + + // Act & Assert + assert.Nil(t, obj.GetTestcases(), "getter should return nil when property is nil") + }) + + t.Run("GetTestcases_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemInfoV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTestcases() // Should return zero value + }) + + t.Run("GetIsPublic", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var expected bool + obj.IsPublic = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetIsPublic(), "getter should return the property value") + }) + + t.Run("GetIsPublic_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemInfoV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetIsPublic() // Should return zero value + }) + +} + +func TestSettersMarkExplicitProblemInfoV2(t *testing.T) { + t.Run("SetProblemID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var fernTestValueProblemID common.ProblemID + + // Act + obj.SetProblemID(fernTestValueProblemID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetProblemDescription_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var fernTestValueProblemDescription *common.ProblemDescription + + // Act + obj.SetProblemDescription(fernTestValueProblemDescription) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetProblemName_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var fernTestValueProblemName string + + // Act + obj.SetProblemName(fernTestValueProblemName) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetProblemVersion_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var fernTestValueProblemVersion int + + // Act + obj.SetProblemVersion(fernTestValueProblemVersion) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetSupportedLanguages_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var fernTestValueSupportedLanguages []common.Language + + // Act + obj.SetSupportedLanguages(fernTestValueSupportedLanguages) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetCustomFiles_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var fernTestValueCustomFiles *CustomFiles + + // Act + obj.SetCustomFiles(fernTestValueCustomFiles) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetGeneratedFiles_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var fernTestValueGeneratedFiles *GeneratedFiles + + // Act + obj.SetGeneratedFiles(fernTestValueGeneratedFiles) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetCustomTestCaseTemplates_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var fernTestValueCustomTestCaseTemplates []*TestCaseTemplate + + // Act + obj.SetCustomTestCaseTemplates(fernTestValueCustomTestCaseTemplates) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetTestcases_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var fernTestValueTestcases []*TestCaseV2 + + // Act + obj.SetTestcases(fernTestValueTestcases) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetIsPublic_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + var fernTestValueIsPublic bool + + // Act + obj.SetIsPublic(fernTestValueIsPublic) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersTestCaseExpects(t *testing.T) { + t.Run("SetExpectedStdout", func(t *testing.T) { + obj := &TestCaseExpects{} + var fernTestValueExpectedStdout *string + obj.SetExpectedStdout(fernTestValueExpectedStdout) + assert.Equal(t, fernTestValueExpectedStdout, obj.ExpectedStdout) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersTestCaseExpects(t *testing.T) { + t.Run("GetExpectedStdout", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseExpects{} + var expected *string + obj.ExpectedStdout = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetExpectedStdout(), "getter should return the property value") + }) + + t.Run("GetExpectedStdout_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseExpects{} + obj.ExpectedStdout = nil + + // Act & Assert + assert.Nil(t, obj.GetExpectedStdout(), "getter should return nil when property is nil") + }) + + t.Run("GetExpectedStdout_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseExpects + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetExpectedStdout() // Should return zero value + }) + +} + +func TestSettersMarkExplicitTestCaseExpects(t *testing.T) { + t.Run("SetExpectedStdout_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseExpects{} + var fernTestValueExpectedStdout *string + + // Act + obj.SetExpectedStdout(fernTestValueExpectedStdout) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestGettersTestCaseFunction(t *testing.T) { + t.Run("GetType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseFunction{} + var expected string + obj.Type = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetType(), "getter should return the property value") + }) + + t.Run("GetType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseFunction + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetType() // Should return zero value + }) + + t.Run("GetWithActualResult", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseFunction{} + var expected *TestCaseWithActualResultImplementation + obj.WithActualResult = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetWithActualResult(), "getter should return the property value") + }) + + t.Run("GetWithActualResult_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseFunction{} + obj.WithActualResult = nil + + // Act & Assert + assert.Nil(t, obj.GetWithActualResult(), "getter should return nil when property is nil") + }) + + t.Run("GetWithActualResult_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseFunction + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetWithActualResult() // Should return zero value + }) + + t.Run("GetCustom", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseFunction{} + var expected *VoidFunctionDefinition + obj.Custom = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetCustom(), "getter should return the property value") + }) + + t.Run("GetCustom_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseFunction{} + obj.Custom = nil + + // Act & Assert + assert.Nil(t, obj.GetCustom(), "getter should return nil when property is nil") + }) + + t.Run("GetCustom_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseFunction + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetCustom() // Should return zero value + }) + +} + +func TestSettersTestCaseImplementation(t *testing.T) { + t.Run("SetDescription", func(t *testing.T) { + obj := &TestCaseImplementation{} + var fernTestValueDescription *TestCaseImplementationDescription + obj.SetDescription(fernTestValueDescription) + assert.Equal(t, fernTestValueDescription, obj.Description) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetFunction", func(t *testing.T) { + obj := &TestCaseImplementation{} + var fernTestValueFunction *TestCaseFunction + obj.SetFunction(fernTestValueFunction) + assert.Equal(t, fernTestValueFunction, obj.Function) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersTestCaseImplementation(t *testing.T) { + t.Run("GetDescription", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseImplementation{} + var expected *TestCaseImplementationDescription + obj.Description = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetDescription(), "getter should return the property value") + }) + + t.Run("GetDescription_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseImplementation{} + obj.Description = nil + + // Act & Assert + assert.Nil(t, obj.GetDescription(), "getter should return nil when property is nil") + }) + + t.Run("GetDescription_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseImplementation + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetDescription() // Should return zero value + }) + + t.Run("GetFunction", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseImplementation{} + var expected *TestCaseFunction + obj.Function = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetFunction(), "getter should return the property value") + }) + + t.Run("GetFunction_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseImplementation{} + obj.Function = nil + + // Act & Assert + assert.Nil(t, obj.GetFunction(), "getter should return nil when property is nil") + }) + + t.Run("GetFunction_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseImplementation + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetFunction() // Should return zero value + }) + +} + +func TestSettersMarkExplicitTestCaseImplementation(t *testing.T) { + t.Run("SetDescription_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseImplementation{} + var fernTestValueDescription *TestCaseImplementationDescription + + // Act + obj.SetDescription(fernTestValueDescription) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetFunction_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseImplementation{} + var fernTestValueFunction *TestCaseFunction + + // Act + obj.SetFunction(fernTestValueFunction) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersTestCaseImplementationDescription(t *testing.T) { + t.Run("SetBoards", func(t *testing.T) { + obj := &TestCaseImplementationDescription{} + var fernTestValueBoards []*TestCaseImplementationDescriptionBoard + obj.SetBoards(fernTestValueBoards) + assert.Equal(t, fernTestValueBoards, obj.Boards) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersTestCaseImplementationDescription(t *testing.T) { + t.Run("GetBoards", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseImplementationDescription{} + var expected []*TestCaseImplementationDescriptionBoard + obj.Boards = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetBoards(), "getter should return the property value") + }) + + t.Run("GetBoards_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseImplementationDescription{} + obj.Boards = nil + + // Act & Assert + assert.Nil(t, obj.GetBoards(), "getter should return nil when property is nil") + }) + + t.Run("GetBoards_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseImplementationDescription + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetBoards() // Should return zero value + }) + +} + +func TestSettersMarkExplicitTestCaseImplementationDescription(t *testing.T) { + t.Run("SetBoards_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseImplementationDescription{} + var fernTestValueBoards []*TestCaseImplementationDescriptionBoard + + // Act + obj.SetBoards(fernTestValueBoards) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestGettersTestCaseImplementationDescriptionBoard(t *testing.T) { + t.Run("GetType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseImplementationDescriptionBoard{} + var expected string + obj.Type = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetType(), "getter should return the property value") + }) + + t.Run("GetType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseImplementationDescriptionBoard + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetType() // Should return zero value + }) + + t.Run("GetHTML", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseImplementationDescriptionBoard{} + var expected string + obj.HTML = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetHTML(), "getter should return the property value") + }) + + t.Run("GetHTML_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseImplementationDescriptionBoard + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetHTML() // Should return zero value + }) + + t.Run("GetParamID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseImplementationDescriptionBoard{} + var expected ParameterID + obj.ParamID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetParamID(), "getter should return the property value") + }) + + t.Run("GetParamID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseImplementationDescriptionBoard + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetParamID() // Should return zero value + }) + +} + +func TestGettersTestCaseImplementationReference(t *testing.T) { + t.Run("GetType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseImplementationReference{} + var expected string + obj.Type = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetType(), "getter should return the property value") + }) + + t.Run("GetType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseImplementationReference + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetType() // Should return zero value + }) + + t.Run("GetTemplateID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseImplementationReference{} + var expected TestCaseTemplateID + obj.TemplateID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTemplateID(), "getter should return the property value") + }) + + t.Run("GetTemplateID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseImplementationReference + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTemplateID() // Should return zero value + }) + + t.Run("GetImplementation", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseImplementationReference{} + var expected *TestCaseImplementation + obj.Implementation = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetImplementation(), "getter should return the property value") + }) + + t.Run("GetImplementation_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseImplementationReference{} + obj.Implementation = nil + + // Act & Assert + assert.Nil(t, obj.GetImplementation(), "getter should return nil when property is nil") + }) + + t.Run("GetImplementation_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseImplementationReference + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetImplementation() // Should return zero value + }) + +} + +func TestSettersTestCaseMetadata(t *testing.T) { + t.Run("SetID", func(t *testing.T) { + obj := &TestCaseMetadata{} + var fernTestValueID TestCaseID + obj.SetID(fernTestValueID) + assert.Equal(t, fernTestValueID, obj.ID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetName", func(t *testing.T) { + obj := &TestCaseMetadata{} + var fernTestValueName string + obj.SetName(fernTestValueName) + assert.Equal(t, fernTestValueName, obj.Name) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetHidden", func(t *testing.T) { + obj := &TestCaseMetadata{} + var fernTestValueHidden bool + obj.SetHidden(fernTestValueHidden) + assert.Equal(t, fernTestValueHidden, obj.Hidden) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersTestCaseMetadata(t *testing.T) { + t.Run("GetID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseMetadata{} + var expected TestCaseID + obj.ID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetID(), "getter should return the property value") + }) + + t.Run("GetID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseMetadata + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetID() // Should return zero value + }) + + t.Run("GetName", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseMetadata{} + var expected string + obj.Name = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetName(), "getter should return the property value") + }) + + t.Run("GetName_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseMetadata + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetName() // Should return zero value + }) + + t.Run("GetHidden", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseMetadata{} + var expected bool + obj.Hidden = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetHidden(), "getter should return the property value") + }) + + t.Run("GetHidden_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseMetadata + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetHidden() // Should return zero value + }) + +} + +func TestSettersMarkExplicitTestCaseMetadata(t *testing.T) { + t.Run("SetID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseMetadata{} + var fernTestValueID TestCaseID + + // Act + obj.SetID(fernTestValueID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetName_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseMetadata{} + var fernTestValueName string + + // Act + obj.SetName(fernTestValueName) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetHidden_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseMetadata{} + var fernTestValueHidden bool + + // Act + obj.SetHidden(fernTestValueHidden) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersTestCaseTemplate(t *testing.T) { + t.Run("SetTemplateID", func(t *testing.T) { + obj := &TestCaseTemplate{} + var fernTestValueTemplateID TestCaseTemplateID + obj.SetTemplateID(fernTestValueTemplateID) + assert.Equal(t, fernTestValueTemplateID, obj.TemplateID) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetName", func(t *testing.T) { + obj := &TestCaseTemplate{} + var fernTestValueName string + obj.SetName(fernTestValueName) + assert.Equal(t, fernTestValueName, obj.Name) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetImplementation", func(t *testing.T) { + obj := &TestCaseTemplate{} + var fernTestValueImplementation *TestCaseImplementation + obj.SetImplementation(fernTestValueImplementation) + assert.Equal(t, fernTestValueImplementation, obj.Implementation) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersTestCaseTemplate(t *testing.T) { + t.Run("GetTemplateID", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseTemplate{} + var expected TestCaseTemplateID + obj.TemplateID = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetTemplateID(), "getter should return the property value") + }) + + t.Run("GetTemplateID_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseTemplate + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetTemplateID() // Should return zero value + }) + + t.Run("GetName", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseTemplate{} + var expected string + obj.Name = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetName(), "getter should return the property value") + }) + + t.Run("GetName_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseTemplate + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetName() // Should return zero value + }) + + t.Run("GetImplementation", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseTemplate{} + var expected *TestCaseImplementation + obj.Implementation = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetImplementation(), "getter should return the property value") + }) + + t.Run("GetImplementation_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseTemplate{} + obj.Implementation = nil + + // Act & Assert + assert.Nil(t, obj.GetImplementation(), "getter should return nil when property is nil") + }) + + t.Run("GetImplementation_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseTemplate + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetImplementation() // Should return zero value + }) + +} + +func TestSettersMarkExplicitTestCaseTemplate(t *testing.T) { + t.Run("SetTemplateID_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseTemplate{} + var fernTestValueTemplateID TestCaseTemplateID + + // Act + obj.SetTemplateID(fernTestValueTemplateID) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetName_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseTemplate{} + var fernTestValueName string + + // Act + obj.SetName(fernTestValueName) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetImplementation_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseTemplate{} + var fernTestValueImplementation *TestCaseImplementation + + // Act + obj.SetImplementation(fernTestValueImplementation) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersTestCaseV2(t *testing.T) { + t.Run("SetMetadata", func(t *testing.T) { + obj := &TestCaseV2{} + var fernTestValueMetadata *TestCaseMetadata + obj.SetMetadata(fernTestValueMetadata) + assert.Equal(t, fernTestValueMetadata, obj.Metadata) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetImplementation", func(t *testing.T) { + obj := &TestCaseV2{} + var fernTestValueImplementation *TestCaseImplementationReference + obj.SetImplementation(fernTestValueImplementation) + assert.Equal(t, fernTestValueImplementation, obj.Implementation) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetArguments", func(t *testing.T) { + obj := &TestCaseV2{} + var fernTestValueArguments map[ParameterID]*common.VariableValue + obj.SetArguments(fernTestValueArguments) + assert.Equal(t, fernTestValueArguments, obj.Arguments) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetExpects", func(t *testing.T) { + obj := &TestCaseV2{} + var fernTestValueExpects *TestCaseExpects + obj.SetExpects(fernTestValueExpects) + assert.Equal(t, fernTestValueExpects, obj.Expects) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersTestCaseV2(t *testing.T) { + t.Run("GetMetadata", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseV2{} + var expected *TestCaseMetadata + obj.Metadata = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetMetadata(), "getter should return the property value") + }) + + t.Run("GetMetadata_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseV2{} + obj.Metadata = nil + + // Act & Assert + assert.Nil(t, obj.GetMetadata(), "getter should return nil when property is nil") + }) + + t.Run("GetMetadata_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetMetadata() // Should return zero value + }) + + t.Run("GetImplementation", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseV2{} + var expected *TestCaseImplementationReference + obj.Implementation = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetImplementation(), "getter should return the property value") + }) + + t.Run("GetImplementation_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseV2{} + obj.Implementation = nil + + // Act & Assert + assert.Nil(t, obj.GetImplementation(), "getter should return nil when property is nil") + }) + + t.Run("GetImplementation_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetImplementation() // Should return zero value + }) + + t.Run("GetArguments", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseV2{} + var expected map[ParameterID]*common.VariableValue + obj.Arguments = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetArguments(), "getter should return the property value") + }) + + t.Run("GetArguments_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseV2{} + obj.Arguments = nil + + // Act & Assert + assert.Nil(t, obj.GetArguments(), "getter should return nil when property is nil") + }) + + t.Run("GetArguments_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetArguments() // Should return zero value + }) + + t.Run("GetExpects", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseV2{} + var expected *TestCaseExpects + obj.Expects = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetExpects(), "getter should return the property value") + }) + + t.Run("GetExpects_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseV2{} + obj.Expects = nil + + // Act & Assert + assert.Nil(t, obj.GetExpects(), "getter should return nil when property is nil") + }) + + t.Run("GetExpects_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseV2 + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetExpects() // Should return zero value + }) + +} + +func TestSettersMarkExplicitTestCaseV2(t *testing.T) { + t.Run("SetMetadata_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseV2{} + var fernTestValueMetadata *TestCaseMetadata + + // Act + obj.SetMetadata(fernTestValueMetadata) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetImplementation_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseV2{} + var fernTestValueImplementation *TestCaseImplementationReference + + // Act + obj.SetImplementation(fernTestValueImplementation) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetArguments_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseV2{} + var fernTestValueArguments map[ParameterID]*common.VariableValue + + // Act + obj.SetArguments(fernTestValueArguments) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetExpects_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseV2{} + var fernTestValueExpects *TestCaseExpects + + // Act + obj.SetExpects(fernTestValueExpects) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersTestCaseWithActualResultImplementation(t *testing.T) { + t.Run("SetGetActualResult", func(t *testing.T) { + obj := &TestCaseWithActualResultImplementation{} + var fernTestValueGetActualResult *NonVoidFunctionDefinition + obj.SetGetActualResult(fernTestValueGetActualResult) + assert.Equal(t, fernTestValueGetActualResult, obj.GetActualResult) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetAssertCorrectnessCheck", func(t *testing.T) { + obj := &TestCaseWithActualResultImplementation{} + var fernTestValueAssertCorrectnessCheck *AssertCorrectnessCheck + obj.SetAssertCorrectnessCheck(fernTestValueAssertCorrectnessCheck) + assert.Equal(t, fernTestValueAssertCorrectnessCheck, obj.AssertCorrectnessCheck) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersTestCaseWithActualResultImplementation(t *testing.T) { + t.Run("GetGetActualResult", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseWithActualResultImplementation{} + var expected *NonVoidFunctionDefinition + obj.GetActualResult = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetGetActualResult(), "getter should return the property value") + }) + + t.Run("GetGetActualResult_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseWithActualResultImplementation{} + obj.GetActualResult = nil + + // Act & Assert + assert.Nil(t, obj.GetGetActualResult(), "getter should return nil when property is nil") + }) + + t.Run("GetGetActualResult_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseWithActualResultImplementation + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetGetActualResult() // Should return zero value + }) + + t.Run("GetAssertCorrectnessCheck", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseWithActualResultImplementation{} + var expected *AssertCorrectnessCheck + obj.AssertCorrectnessCheck = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetAssertCorrectnessCheck(), "getter should return the property value") + }) + + t.Run("GetAssertCorrectnessCheck_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseWithActualResultImplementation{} + obj.AssertCorrectnessCheck = nil + + // Act & Assert + assert.Nil(t, obj.GetAssertCorrectnessCheck(), "getter should return nil when property is nil") + }) + + t.Run("GetAssertCorrectnessCheck_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseWithActualResultImplementation + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetAssertCorrectnessCheck() // Should return zero value + }) + +} + +func TestSettersMarkExplicitTestCaseWithActualResultImplementation(t *testing.T) { + t.Run("SetGetActualResult_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseWithActualResultImplementation{} + var fernTestValueGetActualResult *NonVoidFunctionDefinition + + // Act + obj.SetGetActualResult(fernTestValueGetActualResult) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetAssertCorrectnessCheck_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseWithActualResultImplementation{} + var fernTestValueAssertCorrectnessCheck *AssertCorrectnessCheck + + // Act + obj.SetAssertCorrectnessCheck(fernTestValueAssertCorrectnessCheck) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersVoidFunctionDefinition(t *testing.T) { + t.Run("SetParameters", func(t *testing.T) { + obj := &VoidFunctionDefinition{} + var fernTestValueParameters []*Parameter + obj.SetParameters(fernTestValueParameters) + assert.Equal(t, fernTestValueParameters, obj.Parameters) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetCode", func(t *testing.T) { + obj := &VoidFunctionDefinition{} + var fernTestValueCode *FunctionImplementationForMultipleLanguages + obj.SetCode(fernTestValueCode) + assert.Equal(t, fernTestValueCode, obj.Code) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersVoidFunctionDefinition(t *testing.T) { + t.Run("GetParameters", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionDefinition{} + var expected []*Parameter + obj.Parameters = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetParameters(), "getter should return the property value") + }) + + t.Run("GetParameters_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionDefinition{} + obj.Parameters = nil + + // Act & Assert + assert.Nil(t, obj.GetParameters(), "getter should return nil when property is nil") + }) + + t.Run("GetParameters_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VoidFunctionDefinition + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetParameters() // Should return zero value + }) + + t.Run("GetCode", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionDefinition{} + var expected *FunctionImplementationForMultipleLanguages + obj.Code = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetCode(), "getter should return the property value") + }) + + t.Run("GetCode_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionDefinition{} + obj.Code = nil + + // Act & Assert + assert.Nil(t, obj.GetCode(), "getter should return nil when property is nil") + }) + + t.Run("GetCode_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VoidFunctionDefinition + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetCode() // Should return zero value + }) + +} + +func TestSettersMarkExplicitVoidFunctionDefinition(t *testing.T) { + t.Run("SetParameters_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionDefinition{} + var fernTestValueParameters []*Parameter + + // Act + obj.SetParameters(fernTestValueParameters) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetCode_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionDefinition{} + var fernTestValueCode *FunctionImplementationForMultipleLanguages + + // Act + obj.SetCode(fernTestValueCode) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersVoidFunctionDefinitionThatTakesActualResult(t *testing.T) { + t.Run("SetAdditionalParameters", func(t *testing.T) { + obj := &VoidFunctionDefinitionThatTakesActualResult{} + var fernTestValueAdditionalParameters []*Parameter + obj.SetAdditionalParameters(fernTestValueAdditionalParameters) + assert.Equal(t, fernTestValueAdditionalParameters, obj.AdditionalParameters) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetCode", func(t *testing.T) { + obj := &VoidFunctionDefinitionThatTakesActualResult{} + var fernTestValueCode *FunctionImplementationForMultipleLanguages + obj.SetCode(fernTestValueCode) + assert.Equal(t, fernTestValueCode, obj.Code) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersVoidFunctionDefinitionThatTakesActualResult(t *testing.T) { + t.Run("GetAdditionalParameters", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionDefinitionThatTakesActualResult{} + var expected []*Parameter + obj.AdditionalParameters = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetAdditionalParameters(), "getter should return the property value") + }) + + t.Run("GetAdditionalParameters_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionDefinitionThatTakesActualResult{} + obj.AdditionalParameters = nil + + // Act & Assert + assert.Nil(t, obj.GetAdditionalParameters(), "getter should return nil when property is nil") + }) + + t.Run("GetAdditionalParameters_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VoidFunctionDefinitionThatTakesActualResult + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetAdditionalParameters() // Should return zero value + }) + + t.Run("GetCode", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionDefinitionThatTakesActualResult{} + var expected *FunctionImplementationForMultipleLanguages + obj.Code = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetCode(), "getter should return the property value") + }) + + t.Run("GetCode_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionDefinitionThatTakesActualResult{} + obj.Code = nil + + // Act & Assert + assert.Nil(t, obj.GetCode(), "getter should return nil when property is nil") + }) + + t.Run("GetCode_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VoidFunctionDefinitionThatTakesActualResult + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetCode() // Should return zero value + }) + +} + +func TestSettersMarkExplicitVoidFunctionDefinitionThatTakesActualResult(t *testing.T) { + t.Run("SetAdditionalParameters_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionDefinitionThatTakesActualResult{} + var fernTestValueAdditionalParameters []*Parameter + + // Act + obj.SetAdditionalParameters(fernTestValueAdditionalParameters) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetCode_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionDefinitionThatTakesActualResult{} + var fernTestValueCode *FunctionImplementationForMultipleLanguages + + // Act + obj.SetCode(fernTestValueCode) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersVoidFunctionSignature(t *testing.T) { + t.Run("SetParameters", func(t *testing.T) { + obj := &VoidFunctionSignature{} + var fernTestValueParameters []*Parameter + obj.SetParameters(fernTestValueParameters) + assert.Equal(t, fernTestValueParameters, obj.Parameters) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersVoidFunctionSignature(t *testing.T) { + t.Run("GetParameters", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionSignature{} + var expected []*Parameter + obj.Parameters = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetParameters(), "getter should return the property value") + }) + + t.Run("GetParameters_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionSignature{} + obj.Parameters = nil + + // Act & Assert + assert.Nil(t, obj.GetParameters(), "getter should return nil when property is nil") + }) + + t.Run("GetParameters_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VoidFunctionSignature + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetParameters() // Should return zero value + }) + +} + +func TestSettersMarkExplicitVoidFunctionSignature(t *testing.T) { + t.Run("SetParameters_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionSignature{} + var fernTestValueParameters []*Parameter + + // Act + obj.SetParameters(fernTestValueParameters) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestSettersVoidFunctionSignatureThatTakesActualResult(t *testing.T) { + t.Run("SetParameters", func(t *testing.T) { + obj := &VoidFunctionSignatureThatTakesActualResult{} + var fernTestValueParameters []*Parameter + obj.SetParameters(fernTestValueParameters) + assert.Equal(t, fernTestValueParameters, obj.Parameters) + assert.NotNil(t, obj.explicitFields) + }) + + t.Run("SetActualResultType", func(t *testing.T) { + obj := &VoidFunctionSignatureThatTakesActualResult{} + var fernTestValueActualResultType *common.VariableType + obj.SetActualResultType(fernTestValueActualResultType) + assert.Equal(t, fernTestValueActualResultType, obj.ActualResultType) + assert.NotNil(t, obj.explicitFields) + }) + +} + +func TestGettersVoidFunctionSignatureThatTakesActualResult(t *testing.T) { + t.Run("GetParameters", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionSignatureThatTakesActualResult{} + var expected []*Parameter + obj.Parameters = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetParameters(), "getter should return the property value") + }) + + t.Run("GetParameters_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionSignatureThatTakesActualResult{} + obj.Parameters = nil + + // Act & Assert + assert.Nil(t, obj.GetParameters(), "getter should return nil when property is nil") + }) + + t.Run("GetParameters_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VoidFunctionSignatureThatTakesActualResult + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetParameters() // Should return zero value + }) + + t.Run("GetActualResultType", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionSignatureThatTakesActualResult{} + var expected *common.VariableType + obj.ActualResultType = expected + + // Act & Assert + assert.Equal(t, expected, obj.GetActualResultType(), "getter should return the property value") + }) + + t.Run("GetActualResultType_NilValue", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionSignatureThatTakesActualResult{} + obj.ActualResultType = nil + + // Act & Assert + assert.Nil(t, obj.GetActualResultType(), "getter should return nil when property is nil") + }) + + t.Run("GetActualResultType_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VoidFunctionSignatureThatTakesActualResult + // Should not panic - getters should handle nil receiver gracefully + defer func() { + if r := recover(); r != nil { + t.Errorf("Getter panicked on nil receiver: %v", r) + } + }() + _ = obj.GetActualResultType() // Should return zero value + }) + +} + +func TestSettersMarkExplicitVoidFunctionSignatureThatTakesActualResult(t *testing.T) { + t.Run("SetParameters_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionSignatureThatTakesActualResult{} + var fernTestValueParameters []*Parameter + + // Act + obj.SetParameters(fernTestValueParameters) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + + t.Run("SetActualResultType_MarksExplicit", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionSignatureThatTakesActualResult{} + var fernTestValueActualResultType *common.VariableType + + // Act + obj.SetActualResultType(fernTestValueActualResultType) + + // Assert - object with explicitly set field can be marshaled/unmarshaled + bytes, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed for test setup") + + // This test ensures JSON marshaling and unmarshaling succeed when the field has a zero/nil value + // Detect if marshaled JSON is an object or primitive to use correct unmarshal target + if len(bytes) > 0 && bytes[0] == '{' { + // JSON object - unmarshal into map + var unmarshaled map[string]interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } else { + // JSON primitive (string, number, boolean, null) - unmarshal into interface{} + var unmarshaled interface{} + err = json.Unmarshal(bytes, &unmarshaled) + require.NoError(t, err, "unmarshaling should succeed for test verification") + } + + // Note: This does not explicitly assert the presence of a specific JSON field + // It verifies that setting a field via setter allows successful JSON round-trip + }) + +} + +func TestJSONMarshalingBasicCustomFiles(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicCustomFiles{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled BasicCustomFiles + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj BasicCustomFiles + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj BasicCustomFiles + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingBasicTestCaseTemplate(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &BasicTestCaseTemplate{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled BasicTestCaseTemplate + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj BasicTestCaseTemplate + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj BasicTestCaseTemplate + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingCreateProblemRequestV2(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &CreateProblemRequestV2{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled CreateProblemRequestV2 + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj CreateProblemRequestV2 + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj CreateProblemRequestV2 + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingDeepEqualityCorrectnessCheck(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DeepEqualityCorrectnessCheck{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled DeepEqualityCorrectnessCheck + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj DeepEqualityCorrectnessCheck + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj DeepEqualityCorrectnessCheck + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingDefaultProvidedFile(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &DefaultProvidedFile{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled DefaultProvidedFile + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj DefaultProvidedFile + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj DefaultProvidedFile + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingFileInfoV2(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FileInfoV2{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled FileInfoV2 + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj FileInfoV2 + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj FileInfoV2 + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingFiles(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Files{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled Files + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj Files + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj Files + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingFunctionImplementation(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FunctionImplementation{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled FunctionImplementation + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj FunctionImplementation + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj FunctionImplementation + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingFunctionImplementationForMultipleLanguages(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &FunctionImplementationForMultipleLanguages{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled FunctionImplementationForMultipleLanguages + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj FunctionImplementationForMultipleLanguages + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj FunctionImplementationForMultipleLanguages + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingGeneratedFiles(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GeneratedFiles{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled GeneratedFiles + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj GeneratedFiles + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj GeneratedFiles + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingGetBasicSolutionFileRequest(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetBasicSolutionFileRequest{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled GetBasicSolutionFileRequest + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj GetBasicSolutionFileRequest + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj GetBasicSolutionFileRequest + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingGetBasicSolutionFileResponse(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetBasicSolutionFileResponse{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled GetBasicSolutionFileResponse + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj GetBasicSolutionFileResponse + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj GetBasicSolutionFileResponse + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingGetFunctionSignatureRequest(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetFunctionSignatureRequest{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled GetFunctionSignatureRequest + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj GetFunctionSignatureRequest + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj GetFunctionSignatureRequest + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingGetFunctionSignatureResponse(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetFunctionSignatureResponse{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled GetFunctionSignatureResponse + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj GetFunctionSignatureResponse + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj GetFunctionSignatureResponse + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingGetGeneratedTestCaseFileRequest(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetGeneratedTestCaseFileRequest{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled GetGeneratedTestCaseFileRequest + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj GetGeneratedTestCaseFileRequest + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj GetGeneratedTestCaseFileRequest + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingGetGeneratedTestCaseTemplateFileRequest(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &GetGeneratedTestCaseTemplateFileRequest{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled GetGeneratedTestCaseTemplateFileRequest + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj GetGeneratedTestCaseTemplateFileRequest + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj GetGeneratedTestCaseTemplateFileRequest + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingLightweightProblemInfoV2(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &LightweightProblemInfoV2{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled LightweightProblemInfoV2 + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj LightweightProblemInfoV2 + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj LightweightProblemInfoV2 + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingNonVoidFunctionDefinition(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &NonVoidFunctionDefinition{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled NonVoidFunctionDefinition + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj NonVoidFunctionDefinition + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj NonVoidFunctionDefinition + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingNonVoidFunctionSignature(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &NonVoidFunctionSignature{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled NonVoidFunctionSignature + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj NonVoidFunctionSignature + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj NonVoidFunctionSignature + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingParameter(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &Parameter{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled Parameter + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj Parameter + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj Parameter + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingProblemInfoV2(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &ProblemInfoV2{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled ProblemInfoV2 + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj ProblemInfoV2 + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj ProblemInfoV2 + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingTestCaseExpects(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseExpects{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled TestCaseExpects + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj TestCaseExpects + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj TestCaseExpects + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingTestCaseImplementation(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseImplementation{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled TestCaseImplementation + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj TestCaseImplementation + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj TestCaseImplementation + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingTestCaseImplementationDescription(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseImplementationDescription{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled TestCaseImplementationDescription + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj TestCaseImplementationDescription + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj TestCaseImplementationDescription + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingTestCaseMetadata(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseMetadata{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled TestCaseMetadata + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj TestCaseMetadata + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj TestCaseMetadata + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingTestCaseTemplate(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseTemplate{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled TestCaseTemplate + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj TestCaseTemplate + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj TestCaseTemplate + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingTestCaseV2(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseV2{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled TestCaseV2 + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj TestCaseV2 + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj TestCaseV2 + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingTestCaseWithActualResultImplementation(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &TestCaseWithActualResultImplementation{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled TestCaseWithActualResultImplementation + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj TestCaseWithActualResultImplementation + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj TestCaseWithActualResultImplementation + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingVoidFunctionDefinition(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionDefinition{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled VoidFunctionDefinition + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj VoidFunctionDefinition + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj VoidFunctionDefinition + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingVoidFunctionDefinitionThatTakesActualResult(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionDefinitionThatTakesActualResult{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled VoidFunctionDefinitionThatTakesActualResult + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj VoidFunctionDefinitionThatTakesActualResult + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj VoidFunctionDefinitionThatTakesActualResult + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingVoidFunctionSignature(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionSignature{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled VoidFunctionSignature + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj VoidFunctionSignature + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj VoidFunctionSignature + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestJSONMarshalingVoidFunctionSignatureThatTakesActualResult(t *testing.T) { + t.Run("MarshalUnmarshal", func(t *testing.T) { + t.Parallel() + // Arrange + obj := &VoidFunctionSignatureThatTakesActualResult{} + + // Act - Marshal to JSON + data, err := json.Marshal(obj) + require.NoError(t, err, "marshaling should succeed") + assert.NotNil(t, data, "marshaled data should not be nil") + assert.NotEmpty(t, data, "marshaled data should not be empty") + + // Unmarshal back and verify round-trip + var unmarshaled VoidFunctionSignatureThatTakesActualResult + err = json.Unmarshal(data, &unmarshaled) + assert.NoError(t, err, "round-trip unmarshal should succeed") + }) + + t.Run("UnmarshalInvalidJSON", func(t *testing.T) { + t.Parallel() + var obj VoidFunctionSignatureThatTakesActualResult + err := json.Unmarshal([]byte(`{invalid json}`), &obj) + assert.Error(t, err, "unmarshaling invalid JSON should return an error") + }) + + t.Run("UnmarshalEmptyObject", func(t *testing.T) { + t.Parallel() + var obj VoidFunctionSignatureThatTakesActualResult + err := json.Unmarshal([]byte(`{}`), &obj) + assert.NoError(t, err, "unmarshaling empty object should succeed") + }) +} + +func TestStringBasicCustomFiles(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &BasicCustomFiles{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BasicCustomFiles + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringBasicTestCaseTemplate(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &BasicTestCaseTemplate{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BasicTestCaseTemplate + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringCreateProblemRequestV2(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &CreateProblemRequestV2{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CreateProblemRequestV2 + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringDeepEqualityCorrectnessCheck(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &DeepEqualityCorrectnessCheck{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DeepEqualityCorrectnessCheck + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringDefaultProvidedFile(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &DefaultProvidedFile{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DefaultProvidedFile + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringFileInfoV2(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &FileInfoV2{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FileInfoV2 + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringFiles(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &Files{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *Files + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringFunctionImplementation(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &FunctionImplementation{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FunctionImplementation + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringFunctionImplementationForMultipleLanguages(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &FunctionImplementationForMultipleLanguages{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FunctionImplementationForMultipleLanguages + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringGeneratedFiles(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &GeneratedFiles{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GeneratedFiles + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringGetBasicSolutionFileRequest(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &GetBasicSolutionFileRequest{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetBasicSolutionFileRequest + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringGetBasicSolutionFileResponse(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &GetBasicSolutionFileResponse{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetBasicSolutionFileResponse + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringGetFunctionSignatureRequest(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &GetFunctionSignatureRequest{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetFunctionSignatureRequest + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringGetFunctionSignatureResponse(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &GetFunctionSignatureResponse{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetFunctionSignatureResponse + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringGetGeneratedTestCaseFileRequest(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &GetGeneratedTestCaseFileRequest{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetGeneratedTestCaseFileRequest + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringGetGeneratedTestCaseTemplateFileRequest(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &GetGeneratedTestCaseTemplateFileRequest{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetGeneratedTestCaseTemplateFileRequest + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringLightweightProblemInfoV2(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &LightweightProblemInfoV2{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *LightweightProblemInfoV2 + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringNonVoidFunctionDefinition(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &NonVoidFunctionDefinition{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *NonVoidFunctionDefinition + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringNonVoidFunctionSignature(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &NonVoidFunctionSignature{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *NonVoidFunctionSignature + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringParameter(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &Parameter{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *Parameter + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringProblemInfoV2(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &ProblemInfoV2{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemInfoV2 + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringTestCaseExpects(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &TestCaseExpects{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseExpects + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringTestCaseImplementation(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &TestCaseImplementation{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseImplementation + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringTestCaseImplementationDescription(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &TestCaseImplementationDescription{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseImplementationDescription + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringTestCaseMetadata(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &TestCaseMetadata{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseMetadata + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringTestCaseTemplate(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &TestCaseTemplate{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseTemplate + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringTestCaseV2(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &TestCaseV2{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseV2 + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringTestCaseWithActualResultImplementation(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &TestCaseWithActualResultImplementation{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseWithActualResultImplementation + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringVoidFunctionDefinition(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &VoidFunctionDefinition{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VoidFunctionDefinition + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringVoidFunctionDefinitionThatTakesActualResult(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &VoidFunctionDefinitionThatTakesActualResult{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VoidFunctionDefinitionThatTakesActualResult + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringVoidFunctionSignature(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &VoidFunctionSignature{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VoidFunctionSignature + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestStringVoidFunctionSignatureThatTakesActualResult(t *testing.T) { + t.Run("StringMethod", func(t *testing.T) { + t.Parallel() + obj := &VoidFunctionSignatureThatTakesActualResult{} + result := obj.String() + assert.NotEmpty(t, result, "String() should return a non-empty representation") + }) + + t.Run("StringMethod_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VoidFunctionSignatureThatTakesActualResult + result := obj.String() + assert.Equal(t, "", result, "String() should return for nil receiver") + }) +} + +func TestExtraPropertiesBasicCustomFiles(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &BasicCustomFiles{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BasicCustomFiles + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesBasicTestCaseTemplate(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &BasicTestCaseTemplate{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *BasicTestCaseTemplate + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesCreateProblemRequestV2(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &CreateProblemRequestV2{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *CreateProblemRequestV2 + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesDeepEqualityCorrectnessCheck(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &DeepEqualityCorrectnessCheck{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DeepEqualityCorrectnessCheck + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesDefaultProvidedFile(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &DefaultProvidedFile{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *DefaultProvidedFile + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesFileInfoV2(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &FileInfoV2{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FileInfoV2 + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesFiles(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &Files{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *Files + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesFunctionImplementation(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &FunctionImplementation{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FunctionImplementation + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesFunctionImplementationForMultipleLanguages(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &FunctionImplementationForMultipleLanguages{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *FunctionImplementationForMultipleLanguages + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesGeneratedFiles(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &GeneratedFiles{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GeneratedFiles + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesGetBasicSolutionFileRequest(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &GetBasicSolutionFileRequest{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetBasicSolutionFileRequest + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesGetBasicSolutionFileResponse(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &GetBasicSolutionFileResponse{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetBasicSolutionFileResponse + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesGetFunctionSignatureRequest(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &GetFunctionSignatureRequest{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetFunctionSignatureRequest + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesGetFunctionSignatureResponse(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &GetFunctionSignatureResponse{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetFunctionSignatureResponse + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesGetGeneratedTestCaseFileRequest(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &GetGeneratedTestCaseFileRequest{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetGeneratedTestCaseFileRequest + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesGetGeneratedTestCaseTemplateFileRequest(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &GetGeneratedTestCaseTemplateFileRequest{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *GetGeneratedTestCaseTemplateFileRequest + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesLightweightProblemInfoV2(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &LightweightProblemInfoV2{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *LightweightProblemInfoV2 + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesNonVoidFunctionDefinition(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &NonVoidFunctionDefinition{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *NonVoidFunctionDefinition + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesNonVoidFunctionSignature(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &NonVoidFunctionSignature{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *NonVoidFunctionSignature + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesParameter(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &Parameter{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *Parameter + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesProblemInfoV2(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &ProblemInfoV2{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *ProblemInfoV2 + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesTestCaseExpects(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &TestCaseExpects{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseExpects + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesTestCaseImplementation(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &TestCaseImplementation{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseImplementation + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesTestCaseImplementationDescription(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &TestCaseImplementationDescription{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseImplementationDescription + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesTestCaseMetadata(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &TestCaseMetadata{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseMetadata + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesTestCaseTemplate(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &TestCaseTemplate{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseTemplate + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesTestCaseV2(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &TestCaseV2{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseV2 + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesTestCaseWithActualResultImplementation(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &TestCaseWithActualResultImplementation{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *TestCaseWithActualResultImplementation + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesVoidFunctionDefinition(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &VoidFunctionDefinition{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VoidFunctionDefinition + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesVoidFunctionDefinitionThatTakesActualResult(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &VoidFunctionDefinitionThatTakesActualResult{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VoidFunctionDefinitionThatTakesActualResult + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesVoidFunctionSignature(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &VoidFunctionSignature{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VoidFunctionSignature + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} + +func TestExtraPropertiesVoidFunctionSignatureThatTakesActualResult(t *testing.T) { + t.Run("GetExtraProperties", func(t *testing.T) { + t.Parallel() + obj := &VoidFunctionSignatureThatTakesActualResult{} + // Should not panic when calling GetExtraProperties() + defer func() { + if r := recover(); r != nil { + t.Errorf("GetExtraProperties() panicked: %v", r) + } + }() + extraProps := obj.GetExtraProperties() + // Result can be nil or an empty/non-empty map + _ = extraProps + }) + + t.Run("GetExtraProperties_NilReceiver", func(t *testing.T) { + t.Parallel() + var obj *VoidFunctionSignatureThatTakesActualResult + extraProps := obj.GetExtraProperties() + assert.Nil(t, extraProps, "nil receiver should return nil without panicking") + }) +} From 7b70c89289f0452e714531c8993f75d9da9c2ff8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 17 Jun 2026 20:50:48 +0000 Subject: [PATCH 2/7] chore(cli): release 5.49.3 --- .../fix-go-dynamic-snippet-relocated-types.yml | 0 packages/cli/cli/versions.yml | 12 ++++++++++++ 2 files changed, 12 insertions(+) rename packages/cli/cli/changes/{unreleased => 5.49.3}/fix-go-dynamic-snippet-relocated-types.yml (100%) diff --git a/packages/cli/cli/changes/unreleased/fix-go-dynamic-snippet-relocated-types.yml b/packages/cli/cli/changes/5.49.3/fix-go-dynamic-snippet-relocated-types.yml similarity index 100% rename from packages/cli/cli/changes/unreleased/fix-go-dynamic-snippet-relocated-types.yml rename to packages/cli/cli/changes/5.49.3/fix-go-dynamic-snippet-relocated-types.yml diff --git a/packages/cli/cli/versions.yml b/packages/cli/cli/versions.yml index fe3d698d7f7e..e6458485375a 100644 --- a/packages/cli/cli/versions.yml +++ b/packages/cli/cli/versions.yml @@ -1,4 +1,16 @@ # yaml-language-server: $schema=../../../fern-versions-yml.schema.json +- version: 5.49.3 + changelogEntry: + - summary: | + When a generator breaks an import cycle by relocating types into a shared + package, the local generation runner now applies those relocations to the IR + that powers host-side dynamic snippet test generation. This keeps the + generated dynamic snippets referencing each relocated type from the same + package the generator declares it in, fixing undefined-symbol compile errors + in the Go SDK's dynamic snippet tests. + type: fix + createdAt: "2026-06-17" + irVersion: 67 - version: 5.49.2 changelogEntry: - summary: | From 4d95187bafbb0e5c6bfa2270a1c3245f0858bd61 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 17 Jun 2026 20:50:59 +0000 Subject: [PATCH 3/7] chore(go): release 1.45.5 --- .../fix-trace-relocated-type-references.yml | 0 generators/go/sdk/versions.yml | 14 ++++++++++++++ 2 files changed, 14 insertions(+) rename generators/go/sdk/changes/{unreleased => 1.45.5}/fix-trace-relocated-type-references.yml (100%) diff --git a/generators/go/sdk/changes/unreleased/fix-trace-relocated-type-references.yml b/generators/go/sdk/changes/1.45.5/fix-trace-relocated-type-references.yml similarity index 100% rename from generators/go/sdk/changes/unreleased/fix-trace-relocated-type-references.yml rename to generators/go/sdk/changes/1.45.5/fix-trace-relocated-type-references.yml diff --git a/generators/go/sdk/versions.yml b/generators/go/sdk/versions.yml index 9b997f0b21cc..821ffe1fe700 100644 --- a/generators/go/sdk/versions.yml +++ b/generators/go/sdk/versions.yml @@ -1,4 +1,18 @@ # yaml-language-server: $schema=../../../fern-versions-yml.schema.json +- version: 1.45.5 + changelogEntry: + - summary: | + Fix compile errors in generated Go SDKs where the v2/ TypeScript client, + its generated tests, and the generated dynamic snippet tests referenced + types in their original package after the v1 generator had relocated those + leaf types into the shared common package to break an import cycle. The v1 + generator now records the relocations in a sidecar that the v2 generator + reads, and also writes them to a host-readable file (when the Fern CLI asks + for it) so the CLI's dynamic snippet test generator references the relocated + types from the same package too. + type: fix + createdAt: "2026-06-17" + irVersion: 66 - version: 1.45.4 changelogEntry: - summary: | From acb8b470dccc351f0b9fca5b164f2c4166bd1e9e Mon Sep 17 00:00:00 2001 From: Sandeep Dinesh Date: Wed, 17 Jun 2026 14:03:53 -0700 Subject: [PATCH 4/7] chore(seed): update all seed snapshots (#16598) Co-authored-by: iamnamananand996 <31537362+iamnamananand996@users.noreply.github.com> --- seed/go-sdk/trace/.fern/metadata.json | 5 +++-- seed/go-sdk/trace/go.mod | 2 -- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/seed/go-sdk/trace/.fern/metadata.json b/seed/go-sdk/trace/.fern/metadata.json index b100b18d03b2..4325dc2a3860 100644 --- a/seed/go-sdk/trace/.fern/metadata.json +++ b/seed/go-sdk/trace/.fern/metadata.json @@ -1,12 +1,13 @@ { "cliVersion": "DUMMY", "generatorName": "fernapi/fern-go-sdk", - "generatorVersion": "latest", + "generatorVersion": "local", "generatorConfig": { "enableWireTests": false }, "originGitCommit": "DUMMY", - "invokedBy": "manual", + "invokedBy": "ci", "requestedVersion": "0.0.1", + "ciProvider": "github", "sdkVersion": "v0.0.1" } \ No newline at end of file diff --git a/seed/go-sdk/trace/go.mod b/seed/go-sdk/trace/go.mod index 094833f3557d..7492ec5c0360 100644 --- a/seed/go-sdk/trace/go.mod +++ b/seed/go-sdk/trace/go.mod @@ -2,8 +2,6 @@ module github.com/trace/fern go 1.21 -toolchain go1.23.8 - require github.com/google/uuid v1.6.0 require github.com/stretchr/testify v1.8.4 From 794dfc1b7fb98465d5647cc6e0c40fabb4de66dc Mon Sep 17 00:00:00 2001 From: Sandeep Dinesh Date: Wed, 17 Jun 2026 14:17:51 -0700 Subject: [PATCH 5/7] chore(seed): update all seed snapshots (#16601) Co-authored-by: jsklan <100491078+jsklan@users.noreply.github.com> From 080af758363d845f785147e72d2c213a5b4a9ad6 Mon Sep 17 00:00:00 2001 From: cbro Date: Wed, 17 Jun 2026 18:29:22 -0400 Subject: [PATCH 6/7] feat(docs): content-addressed doc publishing (#16097) Adds content-addressed doc publishing - content is hashed and compared with the server, only changed content is uploaded. --------- Co-authored-by: emjoseph Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .gitignore | 4 + .../cli/changes/unreleased/docs-ledger.yml | 12 + packages/cli/docs-resolver/package.json | 1 - .../src/ApiReferenceNodeConverter.ts | 7 +- .../__snapshots__/dependencies.test.ts.snap | 4 +- .../__snapshots__/dynamic.test.ts.snap | 2 +- .../dynamic/fixtures/simple/dynamic.json | 2 +- .../tests/ir/__snapshots__/ir.test.ts.snap | 60 +- .../src/__test__/buildLedgerInput.test.ts | 526 ++++++++++++++ .../buildLocaleApiDefinitions.test.ts | 171 +++++ .../src/__test__/docsDeployMode.test.ts | 62 ++ .../src/__test__/normalizeRepoUrl.test.ts | 26 + .../src/buildTranslatedDocsDefinition.ts | 174 +++++ .../src/docsDeployMode.ts | 35 + .../src/mapDocsConfigToLedgerConfig.ts | 305 ++++++++ .../src/normalizeRepoUrl.ts | 24 + .../src/publishDocs.ts | 224 +++++- .../src/publishDocsLedger.ts | 686 ++++++++++++++++++ .../src/publishDocsLedgerPreview.ts | 289 ++++++++ pnpm-lock.yaml | 101 +-- pnpm-workspace.yaml | 4 +- 21 files changed, 2617 insertions(+), 102 deletions(-) create mode 100644 packages/cli/cli/changes/unreleased/docs-ledger.yml create mode 100644 packages/cli/generation/remote-generation/remote-workspace-runner/src/__test__/buildLedgerInput.test.ts create mode 100644 packages/cli/generation/remote-generation/remote-workspace-runner/src/__test__/buildLocaleApiDefinitions.test.ts create mode 100644 packages/cli/generation/remote-generation/remote-workspace-runner/src/__test__/docsDeployMode.test.ts create mode 100644 packages/cli/generation/remote-generation/remote-workspace-runner/src/__test__/normalizeRepoUrl.test.ts create mode 100644 packages/cli/generation/remote-generation/remote-workspace-runner/src/buildTranslatedDocsDefinition.ts create mode 100644 packages/cli/generation/remote-generation/remote-workspace-runner/src/docsDeployMode.ts create mode 100644 packages/cli/generation/remote-generation/remote-workspace-runner/src/mapDocsConfigToLedgerConfig.ts create mode 100644 packages/cli/generation/remote-generation/remote-workspace-runner/src/normalizeRepoUrl.ts create mode 100644 packages/cli/generation/remote-generation/remote-workspace-runner/src/publishDocsLedger.ts create mode 100644 packages/cli/generation/remote-generation/remote-workspace-runner/src/publishDocsLedgerPreview.ts diff --git a/.gitignore b/.gitignore index cfbf376a0158..db42eeb2ac4e 100644 --- a/.gitignore +++ b/.gitignore @@ -42,6 +42,10 @@ generators/csharp/playground/**/obj/ next-env.d.ts .vercel +# python virtual envs (local dev tooling) +.venv/ +**/.venv/ + # misc .DS_Store *.swp diff --git a/packages/cli/cli/changes/unreleased/docs-ledger.yml b/packages/cli/cli/changes/unreleased/docs-ledger.yml new file mode 100644 index 000000000000..1f335e2057ea --- /dev/null +++ b/packages/cli/cli/changes/unreleased/docs-ledger.yml @@ -0,0 +1,12 @@ +- summary: | + Add docs deployment ledger. Set `FERN_DOCS_DEPLOY_MODE=ledger` to + publish via the new ledger backend; `legacy` (default) uses the + existing register flow. The ledger path uses content-addressed + storage for incremental deploys and supports multi-locale + translations (including localized API reference content with + per-locale apiManifest blobs and sidebar titles), custom JS + components, favicon resolution, git provenance metadata, + multi-domain forwarding, stable file-path references in page + markdown, MIME-type inference for uploads, and a dedicated preview + endpoint. + type: feat diff --git a/packages/cli/docs-resolver/package.json b/packages/cli/docs-resolver/package.json index 3625a83f88a0..aa3bdd34f3e1 100644 --- a/packages/cli/docs-resolver/package.json +++ b/packages/cli/docs-resolver/package.json @@ -47,7 +47,6 @@ "@fern-api/project-loader": "workspace:*", "@fern-api/register": "workspace:*", "@fern-api/task-context": "workspace:*", - "@fern-api/ui-core-utils": "catalog:", "@fern-api/workspace-loader": "workspace:*", "@open-rpc/meta-schema": "catalog:", "@types/fast-levenshtein": "catalog:", diff --git a/packages/cli/docs-resolver/src/ApiReferenceNodeConverter.ts b/packages/cli/docs-resolver/src/ApiReferenceNodeConverter.ts index 9e5c1c40fcf7..6a37753e967a 100644 --- a/packages/cli/docs-resolver/src/ApiReferenceNodeConverter.ts +++ b/packages/cli/docs-resolver/src/ApiReferenceNodeConverter.ts @@ -1,9 +1,8 @@ import { docsYml } from "@fern-api/configuration-loader"; -import { isNonNullish, titleCase } from "@fern-api/core-utils"; +import { isNonNullish, titleCase, visitDiscriminatedUnion } from "@fern-api/core-utils"; import { APIV1Read, FdrAPI, FernNavigation } from "@fern-api/fdr-sdk"; import { AbsoluteFilePath } from "@fern-api/fs-utils"; import { CliError, TaskContext } from "@fern-api/task-context"; -import { visitDiscriminatedUnion } from "@fern-api/ui-core-utils"; import { DocsWorkspace, FernWorkspace } from "@fern-api/workspace-loader"; import { camelCase, kebabCase } from "lodash-es"; import urlJoin from "url-join"; @@ -724,6 +723,7 @@ export class ApiReferenceNodeConverter { collapsed: undefined, operationType: graphqlOperation.operationType, graphqlOperationId: APIV1Read.GraphQlOperationId(graphqlOperation.id), + graphqlOperationIds: undefined, apiDefinitionId: this.apiDefinitionId, availability: convertDocsAvailability(endpointItem.availability ?? parentAvailability), title: @@ -876,6 +876,7 @@ export class ApiReferenceNodeConverter { collapsed: undefined, operationType: graphqlOperation.operationType, graphqlOperationId: APIV1Read.GraphQlOperationId(graphqlOperation.id), + graphqlOperationIds: undefined, apiDefinitionId: this.apiDefinitionId, availability: convertDocsAvailability(operationItem.availability ?? parentAvailability), title: operationItem.title ?? graphqlOperation.displayName ?? graphqlOperation.name ?? graphqlOperation.id, @@ -1355,6 +1356,7 @@ export class ApiReferenceNodeConverter { collapsed: undefined, operationType: entry.operation.operationType, graphqlOperationId: APIV1Read.GraphQlOperationId(entry.operation.id), + graphqlOperationIds: undefined, apiDefinitionId: this.apiDefinitionId, availability: convertDocsAvailability(parentAvailability), title: entry.operation.displayName ?? entry.operation.name ?? entry.operation.id, @@ -1384,6 +1386,7 @@ export class ApiReferenceNodeConverter { collapsed: undefined, operationType: firstOp.operationType, graphqlOperationId: APIV1Read.GraphQlOperationId(firstOp.id), + graphqlOperationIds: groupOps.map((op) => APIV1Read.GraphQlOperationId(op.id)), apiDefinitionId: this.apiDefinitionId, availability: convertDocsAvailability(parentAvailability), title: entry.parentField, diff --git a/packages/cli/ete-tests/src/tests/dependencies/__snapshots__/dependencies.test.ts.snap b/packages/cli/ete-tests/src/tests/dependencies/__snapshots__/dependencies.test.ts.snap index 058cf0a735a6..dc1c35318846 100644 --- a/packages/cli/ete-tests/src/tests/dependencies/__snapshots__/dependencies.test.ts.snap +++ b/packages/cli/ete-tests/src/tests/dependencies/__snapshots__/dependencies.test.ts.snap @@ -244,7 +244,7 @@ exports[`dependencies > correctly incorporates dependencies 1`] = ` "autogeneratedExamples": [ { "example": { - "id": "82444d62", + "id": "7cf5c162", "url": "", "name": null, "endpointHeaders": [], @@ -772,4 +772,4 @@ exports[`dependencies > correctly incorporates dependencies 1`] = ` }" `; -exports[`dependencies > file dependencies 1`] = `2290767`; +exports[`dependencies > file dependencies 1`] = `2290766`; diff --git a/packages/cli/ete-tests/src/tests/dynamic/__snapshots__/dynamic.test.ts.snap b/packages/cli/ete-tests/src/tests/dynamic/__snapshots__/dynamic.test.ts.snap index 8b378d797dc2..ca9c9d7338d9 100644 --- a/packages/cli/ete-tests/src/tests/dynamic/__snapshots__/dynamic.test.ts.snap +++ b/packages/cli/ete-tests/src/tests/dynamic/__snapshots__/dynamic.test.ts.snap @@ -1,3 +1,3 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`fdr > {"name":"simple"} 1`] = `"{"version":"1.0.0","types":{"type_commons:UndiscriminatedUnion":{"declaration":{"name":{"originalName":"UndiscriminatedUnion","camelCase":{"unsafeName":"undiscriminatedUnion","safeName":"undiscriminatedUnion"},"snakeCase":{"unsafeName":"undiscriminated_union","safeName":"undiscriminated_union"},"screamingSnakeCase":{"unsafeName":"UNDISCRIMINATED_UNION","safeName":"UNDISCRIMINATED_UNION"},"pascalCase":{"unsafeName":"UndiscriminatedUnion","safeName":"UndiscriminatedUnion"}},"fernFilepath":{"allParts":[{"originalName":"commons","camelCase":{"unsafeName":"commons","safeName":"commons"},"snakeCase":{"unsafeName":"commons","safeName":"commons"},"screamingSnakeCase":{"unsafeName":"COMMONS","safeName":"COMMONS"},"pascalCase":{"unsafeName":"Commons","safeName":"Commons"}}],"packagePath":[],"file":{"originalName":"commons","camelCase":{"unsafeName":"commons","safeName":"commons"},"snakeCase":{"unsafeName":"commons","safeName":"commons"},"screamingSnakeCase":{"unsafeName":"COMMONS","safeName":"COMMONS"},"pascalCase":{"unsafeName":"Commons","safeName":"Commons"}}}},"types":[{"value":"STRING","type":"primitive"},{"value":{"value":"STRING","type":"primitive"},"type":"list"},{"value":"INTEGER","type":"primitive"},{"value":{"value":{"value":"INTEGER","type":"primitive"},"type":"list"},"type":"list"}],"type":"undiscriminatedUnion"},"type_director:Director":{"declaration":{"name":{"originalName":"Director","camelCase":{"unsafeName":"director","safeName":"director"},"snakeCase":{"unsafeName":"director","safeName":"director"},"screamingSnakeCase":{"unsafeName":"DIRECTOR","safeName":"DIRECTOR"},"pascalCase":{"unsafeName":"Director","safeName":"Director"}},"fernFilepath":{"allParts":[{"originalName":"director","camelCase":{"unsafeName":"director","safeName":"director"},"snakeCase":{"unsafeName":"director","safeName":"director"},"screamingSnakeCase":{"unsafeName":"DIRECTOR","safeName":"DIRECTOR"},"pascalCase":{"unsafeName":"Director","safeName":"Director"}}],"packagePath":[],"file":{"originalName":"director","camelCase":{"unsafeName":"director","safeName":"director"},"snakeCase":{"unsafeName":"director","safeName":"director"},"screamingSnakeCase":{"unsafeName":"DIRECTOR","safeName":"DIRECTOR"},"pascalCase":{"unsafeName":"Director","safeName":"Director"}}}},"properties":[{"name":{"wireValue":"name","name":{"originalName":"name","camelCase":{"unsafeName":"name","safeName":"name"},"snakeCase":{"unsafeName":"name","safeName":"name"},"screamingSnakeCase":{"unsafeName":"NAME","safeName":"NAME"},"pascalCase":{"unsafeName":"Name","safeName":"Name"}}},"typeReference":{"value":"STRING","type":"primitive"}},{"name":{"wireValue":"age","name":{"originalName":"age","camelCase":{"unsafeName":"age","safeName":"age"},"snakeCase":{"unsafeName":"age","safeName":"age"},"screamingSnakeCase":{"unsafeName":"AGE","safeName":"AGE"},"pascalCase":{"unsafeName":"Age","safeName":"Age"}}},"typeReference":{"value":"type_director:Age","type":"named"}}],"additionalProperties":false,"type":"object"},"type_director:Age":{"declaration":{"name":{"originalName":"Age","camelCase":{"unsafeName":"age","safeName":"age"},"snakeCase":{"unsafeName":"age","safeName":"age"},"screamingSnakeCase":{"unsafeName":"AGE","safeName":"AGE"},"pascalCase":{"unsafeName":"Age","safeName":"Age"}},"fernFilepath":{"allParts":[{"originalName":"director","camelCase":{"unsafeName":"director","safeName":"director"},"snakeCase":{"unsafeName":"director","safeName":"director"},"screamingSnakeCase":{"unsafeName":"DIRECTOR","safeName":"DIRECTOR"},"pascalCase":{"unsafeName":"Director","safeName":"Director"}}],"packagePath":[],"file":{"originalName":"director","camelCase":{"unsafeName":"director","safeName":"director"},"snakeCase":{"unsafeName":"director","safeName":"director"},"screamingSnakeCase":{"unsafeName":"DIRECTOR","safeName":"DIRECTOR"},"pascalCase":{"unsafeName":"Director","safeName":"Director"}}}},"typeReference":{"value":"INTEGER","type":"primitive"},"type":"alias"},"type_director:LiteralString":{"declaration":{"name":{"originalName":"LiteralString","camelCase":{"unsafeName":"literalString","safeName":"literalString"},"snakeCase":{"unsafeName":"literal_string","safeName":"literal_string"},"screamingSnakeCase":{"unsafeName":"LITERAL_STRING","safeName":"LITERAL_STRING"},"pascalCase":{"unsafeName":"LiteralString","safeName":"LiteralString"}},"fernFilepath":{"allParts":[{"originalName":"director","camelCase":{"unsafeName":"director","safeName":"director"},"snakeCase":{"unsafeName":"director","safeName":"director"},"screamingSnakeCase":{"unsafeName":"DIRECTOR","safeName":"DIRECTOR"},"pascalCase":{"unsafeName":"Director","safeName":"Director"}}],"packagePath":[],"file":{"originalName":"director","camelCase":{"unsafeName":"director","safeName":"director"},"snakeCase":{"unsafeName":"director","safeName":"director"},"screamingSnakeCase":{"unsafeName":"DIRECTOR","safeName":"DIRECTOR"},"pascalCase":{"unsafeName":"Director","safeName":"Director"}}}},"typeReference":{"value":{"value":"hello","type":"string"},"type":"literal"},"type":"alias"},"type_imdb:CurrencyAmount":{"declaration":{"name":{"originalName":"CurrencyAmount","camelCase":{"unsafeName":"currencyAmount","safeName":"currencyAmount"},"snakeCase":{"unsafeName":"currency_amount","safeName":"currency_amount"},"screamingSnakeCase":{"unsafeName":"CURRENCY_AMOUNT","safeName":"CURRENCY_AMOUNT"},"pascalCase":{"unsafeName":"CurrencyAmount","safeName":"CurrencyAmount"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"typeReference":{"value":"STRING","type":"primitive"},"type":"alias"},"type_imdb:MovieId":{"declaration":{"name":{"originalName":"MovieId","camelCase":{"unsafeName":"movieId","safeName":"movieId"},"snakeCase":{"unsafeName":"movie_id","safeName":"movie_id"},"screamingSnakeCase":{"unsafeName":"MOVIE_ID","safeName":"MOVIE_ID"},"pascalCase":{"unsafeName":"MovieId","safeName":"MovieId"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"typeReference":{"value":"STRING","type":"primitive"},"type":"alias"},"type_imdb:ActorId":{"declaration":{"name":{"originalName":"ActorId","camelCase":{"unsafeName":"actorId","safeName":"actorId"},"snakeCase":{"unsafeName":"actor_id","safeName":"actor_id"},"screamingSnakeCase":{"unsafeName":"ACTOR_ID","safeName":"ACTOR_ID"},"pascalCase":{"unsafeName":"ActorId","safeName":"ActorId"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"typeReference":{"value":"STRING","type":"primitive"},"type":"alias"},"type_imdb:Movie":{"declaration":{"name":{"originalName":"Movie","camelCase":{"unsafeName":"movie","safeName":"movie"},"snakeCase":{"unsafeName":"movie","safeName":"movie"},"screamingSnakeCase":{"unsafeName":"MOVIE","safeName":"MOVIE"},"pascalCase":{"unsafeName":"Movie","safeName":"Movie"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"properties":[{"name":{"wireValue":"id","name":{"originalName":"id","camelCase":{"unsafeName":"id","safeName":"id"},"snakeCase":{"unsafeName":"id","safeName":"id"},"screamingSnakeCase":{"unsafeName":"ID","safeName":"ID"},"pascalCase":{"unsafeName":"Id","safeName":"Id"}}},"typeReference":{"value":"type_imdb:MovieId","type":"named"}},{"name":{"wireValue":"title","name":{"originalName":"title","camelCase":{"unsafeName":"title","safeName":"title"},"snakeCase":{"unsafeName":"title","safeName":"title"},"screamingSnakeCase":{"unsafeName":"TITLE","safeName":"TITLE"},"pascalCase":{"unsafeName":"Title","safeName":"Title"}}},"typeReference":{"value":"STRING","type":"primitive"}},{"name":{"wireValue":"rating","name":{"originalName":"rating","camelCase":{"unsafeName":"rating","safeName":"rating"},"snakeCase":{"unsafeName":"rating","safeName":"rating"},"screamingSnakeCase":{"unsafeName":"RATING","safeName":"RATING"},"pascalCase":{"unsafeName":"Rating","safeName":"Rating"}}},"typeReference":{"value":"DOUBLE","type":"primitive"}}],"additionalProperties":false,"type":"object"},"type_imdb:CreateMovieRequest":{"declaration":{"name":{"originalName":"CreateMovieRequest","camelCase":{"unsafeName":"createMovieRequest","safeName":"createMovieRequest"},"snakeCase":{"unsafeName":"create_movie_request","safeName":"create_movie_request"},"screamingSnakeCase":{"unsafeName":"CREATE_MOVIE_REQUEST","safeName":"CREATE_MOVIE_REQUEST"},"pascalCase":{"unsafeName":"CreateMovieRequest","safeName":"CreateMovieRequest"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"properties":[{"name":{"wireValue":"title","name":{"originalName":"title","camelCase":{"unsafeName":"title","safeName":"title"},"snakeCase":{"unsafeName":"title","safeName":"title"},"screamingSnakeCase":{"unsafeName":"TITLE","safeName":"TITLE"},"pascalCase":{"unsafeName":"Title","safeName":"Title"}}},"typeReference":{"value":"STRING","type":"primitive"}},{"name":{"wireValue":"ratings","name":{"originalName":"ratings","camelCase":{"unsafeName":"ratings","safeName":"ratings"},"snakeCase":{"unsafeName":"ratings","safeName":"ratings"},"screamingSnakeCase":{"unsafeName":"RATINGS","safeName":"RATINGS"},"pascalCase":{"unsafeName":"Ratings","safeName":"Ratings"}}},"typeReference":{"value":{"value":"DOUBLE","type":"primitive"},"type":"list"}}],"additionalProperties":false,"type":"object"},"type_imdb:DirectorWrapper":{"declaration":{"name":{"originalName":"DirectorWrapper","camelCase":{"unsafeName":"directorWrapper","safeName":"directorWrapper"},"snakeCase":{"unsafeName":"director_wrapper","safeName":"director_wrapper"},"screamingSnakeCase":{"unsafeName":"DIRECTOR_WRAPPER","safeName":"DIRECTOR_WRAPPER"},"pascalCase":{"unsafeName":"DirectorWrapper","safeName":"DirectorWrapper"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"properties":[{"name":{"wireValue":"director","name":{"originalName":"director","camelCase":{"unsafeName":"director","safeName":"director"},"snakeCase":{"unsafeName":"director","safeName":"director"},"screamingSnakeCase":{"unsafeName":"DIRECTOR","safeName":"DIRECTOR"},"pascalCase":{"unsafeName":"Director","safeName":"Director"}}},"typeReference":{"value":"type_director:Director","type":"named"}}],"additionalProperties":false,"type":"object"},"type_imdb:EmptyObject":{"declaration":{"name":{"originalName":"EmptyObject","camelCase":{"unsafeName":"emptyObject","safeName":"emptyObject"},"snakeCase":{"unsafeName":"empty_object","safeName":"empty_object"},"screamingSnakeCase":{"unsafeName":"EMPTY_OBJECT","safeName":"EMPTY_OBJECT"},"pascalCase":{"unsafeName":"EmptyObject","safeName":"EmptyObject"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"properties":[],"additionalProperties":false,"type":"object"},"type_imdb:Person":{"declaration":{"name":{"originalName":"Person","camelCase":{"unsafeName":"person","safeName":"person"},"snakeCase":{"unsafeName":"person","safeName":"person"},"screamingSnakeCase":{"unsafeName":"PERSON","safeName":"PERSON"},"pascalCase":{"unsafeName":"Person","safeName":"Person"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"discriminant":{"wireValue":"type","name":{"originalName":"type","camelCase":{"unsafeName":"type","safeName":"type"},"snakeCase":{"unsafeName":"type","safeName":"type"},"screamingSnakeCase":{"unsafeName":"TYPE","safeName":"TYPE"},"pascalCase":{"unsafeName":"Type","safeName":"Type"}}},"types":{"actor":{"typeReference":{"value":"type_imdb:ActorId","type":"named"},"discriminantValue":{"wireValue":"actor","name":{"originalName":"actor","camelCase":{"unsafeName":"actor","safeName":"actor"},"snakeCase":{"unsafeName":"actor","safeName":"actor"},"screamingSnakeCase":{"unsafeName":"ACTOR","safeName":"ACTOR"},"pascalCase":{"unsafeName":"Actor","safeName":"Actor"}}},"type":"singleProperty"},"director":{"typeId":"type_director:Director","discriminantValue":{"wireValue":"director","name":{"originalName":"director","camelCase":{"unsafeName":"director","safeName":"director"},"snakeCase":{"unsafeName":"director","safeName":"director"},"screamingSnakeCase":{"unsafeName":"DIRECTOR","safeName":"DIRECTOR"},"pascalCase":{"unsafeName":"Director","safeName":"Director"}}},"properties":[],"type":"samePropertiesAsObject"},"producer":{"typeId":"type_imdb:EmptyObject","discriminantValue":{"wireValue":"producer","name":{"originalName":"producer","camelCase":{"unsafeName":"producer","safeName":"producer"},"snakeCase":{"unsafeName":"producer","safeName":"producer"},"screamingSnakeCase":{"unsafeName":"PRODUCER","safeName":"PRODUCER"},"pascalCase":{"unsafeName":"Producer","safeName":"Producer"}}},"properties":[],"type":"samePropertiesAsObject"},"cinematographer":{"typeId":"type_imdb:EmptyObject","discriminantValue":{"wireValue":"cinematographer","name":{"originalName":"cinematographer","camelCase":{"unsafeName":"cinematographer","safeName":"cinematographer"},"snakeCase":{"unsafeName":"cinematographer","safeName":"cinematographer"},"screamingSnakeCase":{"unsafeName":"CINEMATOGRAPHER","safeName":"CINEMATOGRAPHER"},"pascalCase":{"unsafeName":"Cinematographer","safeName":"Cinematographer"}}},"properties":[],"type":"samePropertiesAsObject"}},"type":"discriminatedUnion"},"type_imdb:RecursiveType":{"declaration":{"name":{"originalName":"RecursiveType","camelCase":{"unsafeName":"recursiveType","safeName":"recursiveType"},"snakeCase":{"unsafeName":"recursive_type","safeName":"recursive_type"},"screamingSnakeCase":{"unsafeName":"RECURSIVE_TYPE","safeName":"RECURSIVE_TYPE"},"pascalCase":{"unsafeName":"RecursiveType","safeName":"RecursiveType"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"properties":[{"name":{"wireValue":"title","name":{"originalName":"title","camelCase":{"unsafeName":"title","safeName":"title"},"snakeCase":{"unsafeName":"title","safeName":"title"},"screamingSnakeCase":{"unsafeName":"TITLE","safeName":"TITLE"},"pascalCase":{"unsafeName":"Title","safeName":"Title"}}},"typeReference":{"value":"STRING","type":"primitive"}},{"name":{"wireValue":"ratings","name":{"originalName":"ratings","camelCase":{"unsafeName":"ratings","safeName":"ratings"},"snakeCase":{"unsafeName":"ratings","safeName":"ratings"},"screamingSnakeCase":{"unsafeName":"RATINGS","safeName":"RATINGS"},"pascalCase":{"unsafeName":"Ratings","safeName":"Ratings"}}},"typeReference":{"value":{"value":"DOUBLE","type":"primitive"},"type":"list"}},{"name":{"wireValue":"selfReferencing","name":{"originalName":"selfReferencing","camelCase":{"unsafeName":"selfReferencing","safeName":"selfReferencing"},"snakeCase":{"unsafeName":"self_referencing","safeName":"self_referencing"},"screamingSnakeCase":{"unsafeName":"SELF_REFERENCING","safeName":"SELF_REFERENCING"},"pascalCase":{"unsafeName":"SelfReferencing","safeName":"SelfReferencing"}}},"typeReference":{"value":{"value":"type_imdb:RecursiveType","type":"named"},"type":"list"}}],"extends":["type_imdb:CreateMovieRequest"],"additionalProperties":false,"type":"object"}},"headers":[{"name":{"wireValue":"X-API-VERSION","name":{"originalName":"apiVersion","camelCase":{"unsafeName":"apiVersion","safeName":"apiVersion"},"snakeCase":{"unsafeName":"api_version","safeName":"api_version"},"screamingSnakeCase":{"unsafeName":"API_VERSION","safeName":"API_VERSION"},"pascalCase":{"unsafeName":"ApiVersion","safeName":"ApiVersion"}}},"typeReference":{"value":{"value":"STRING","type":"primitive"},"type":"optional"}}],"endpoints":{"endpoint_imdb.createMovie":{"declaration":{"name":{"originalName":"createMovie","camelCase":{"unsafeName":"createMovie","safeName":"createMovie"},"snakeCase":{"unsafeName":"create_movie","safeName":"create_movie"},"screamingSnakeCase":{"unsafeName":"CREATE_MOVIE","safeName":"CREATE_MOVIE"},"pascalCase":{"unsafeName":"CreateMovie","safeName":"CreateMovie"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"location":{"method":"POST","path":"/test/{rootPathParam}/movies"},"request":{"pathParameters":[],"body":{"value":{"value":"type_imdb:CreateMovieRequest","type":"named"},"type":"typeReference"},"type":"body"},"response":{"type":"json"},"examples":[{"id":"b1661658","isUserSpecified":true,"endpoint":{"method":"POST","path":"/test/{rootPathParam}/movies"},"headers":{},"pathParameters":{"rootPathParam":"root"},"queryParameters":{},"requestBody":{"title":"Shrek","ratings":[10,10,10,10]}},{"id":"c66b4be5","isUserSpecified":true,"endpoint":{"method":"POST","path":"/test/{rootPathParam}/movies"},"headers":{},"pathParameters":{"rootPathParam":"root"},"queryParameters":{},"requestBody":{"title":"Winnie the Pooh","ratings":[1,2,3]}},{"id":"ecaa4a1d","isUserSpecified":false,"endpoint":{"method":"POST","path":"/test/{rootPathParam}/movies"},"headers":{},"pathParameters":{"rootPathParam":"rootPathParam"},"queryParameters":{},"requestBody":{"title":"title","ratings":[1.1,1.1]}},{"id":"bb62c8b8","isUserSpecified":false,"endpoint":{"method":"POST","path":"/test/{rootPathParam}/movies"},"headers":{},"pathParameters":{"rootPathParam":"rootPathParam"},"queryParameters":{},"requestBody":{"title":"title","ratings":[1.1,1.1]}}]},"endpoint_imdb.getMovie":{"declaration":{"name":{"originalName":"getMovie","camelCase":{"unsafeName":"getMovie","safeName":"getMovie"},"snakeCase":{"unsafeName":"get_movie","safeName":"get_movie"},"screamingSnakeCase":{"unsafeName":"GET_MOVIE","safeName":"GET_MOVIE"},"pascalCase":{"unsafeName":"GetMovie","safeName":"GetMovie"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"location":{"method":"GET","path":"/test/{rootPathParam}/movies/{movieId}"},"request":{"declaration":{"name":{"originalName":"GetMovieRequest","camelCase":{"unsafeName":"getMovieRequest","safeName":"getMovieRequest"},"snakeCase":{"unsafeName":"get_movie_request","safeName":"get_movie_request"},"screamingSnakeCase":{"unsafeName":"GET_MOVIE_REQUEST","safeName":"GET_MOVIE_REQUEST"},"pascalCase":{"unsafeName":"GetMovieRequest","safeName":"GetMovieRequest"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"pathParameters":[{"name":{"name":{"originalName":"movieId","camelCase":{"unsafeName":"movieId","safeName":"movieId"},"snakeCase":{"unsafeName":"movie_id","safeName":"movie_id"},"screamingSnakeCase":{"unsafeName":"MOVIE_ID","safeName":"MOVIE_ID"},"pascalCase":{"unsafeName":"MovieId","safeName":"MovieId"}},"wireValue":"movieId"},"typeReference":{"value":"type_imdb:MovieId","type":"named"}}],"queryParameters":[{"name":{"wireValue":"movieName","name":{"originalName":"movieName","camelCase":{"unsafeName":"movieName","safeName":"movieName"},"snakeCase":{"unsafeName":"movie_name","safeName":"movie_name"},"screamingSnakeCase":{"unsafeName":"MOVIE_NAME","safeName":"MOVIE_NAME"},"pascalCase":{"unsafeName":"MovieName","safeName":"MovieName"}}},"typeReference":{"value":{"value":"STRING","type":"primitive"},"type":"list"}}],"headers":[],"metadata":{"includePathParameters":false,"onlyPathParameters":false},"type":"inlined"},"response":{"type":"json"},"examples":[{"id":"a2c1f6ab","isUserSpecified":true,"endpoint":{"method":"GET","path":"/test/{rootPathParam}/movies/{movieId}"},"headers":{},"pathParameters":{"rootPathParam":"root","movieId":"id-123"},"queryParameters":{"movieName":"hello"}},{"id":"51944a56","isUserSpecified":true,"endpoint":{"method":"GET","path":"/test/{rootPathParam}/movies/{movieId}"},"headers":{},"pathParameters":{"rootPathParam":"root","movieId":"id-123"},"queryParameters":{"movieName":"hello"}},{"id":"8da3f9d7","isUserSpecified":false,"endpoint":{"method":"GET","path":"/test/{rootPathParam}/movies/{movieId}"},"headers":{},"pathParameters":{"rootPathParam":"rootPathParam","movieId":"movieId"},"queryParameters":{"movieName":"movieName"}},{"id":"f73bf377","isUserSpecified":false,"endpoint":{"method":"GET","path":"/test/{rootPathParam}/movies/{movieId}"},"headers":{},"pathParameters":{"rootPathParam":"rootPathParam","movieId":"movieId"},"queryParameters":{"movieName":"movieName"}},{"id":"d74d2200","isUserSpecified":false,"endpoint":{"method":"GET","path":"/test/{rootPathParam}/movies/{movieId}"},"headers":{},"pathParameters":{"rootPathParam":"rootPathParam","movieId":"movieId"},"queryParameters":{"movieName":"movieName"}}]},"endpoint_imdb.delete":{"declaration":{"name":{"originalName":"delete","camelCase":{"unsafeName":"delete","safeName":"delete"},"snakeCase":{"unsafeName":"delete","safeName":"delete"},"screamingSnakeCase":{"unsafeName":"DELETE","safeName":"DELETE"},"pascalCase":{"unsafeName":"Delete","safeName":"Delete"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"location":{"method":"DELETE","path":"/test/{rootPathParam}/movies/{movieId}"},"request":{"pathParameters":[{"name":{"name":{"originalName":"movieId","camelCase":{"unsafeName":"movieId","safeName":"movieId"},"snakeCase":{"unsafeName":"movie_id","safeName":"movie_id"},"screamingSnakeCase":{"unsafeName":"MOVIE_ID","safeName":"MOVIE_ID"},"pascalCase":{"unsafeName":"MovieId","safeName":"MovieId"}},"wireValue":"movieId"},"typeReference":{"value":"type_imdb:MovieId","type":"named"}}],"type":"body"},"response":{"type":"json"},"examples":[{"id":"a87620bc","isUserSpecified":false,"endpoint":{"method":"DELETE","path":"/test/{rootPathParam}/movies/{movieId}"},"headers":{},"pathParameters":{"rootPathParam":"rootPathParam","movieId":"movieId"},"queryParameters":{}},{"id":"125475db","isUserSpecified":false,"endpoint":{"method":"DELETE","path":"/test/{rootPathParam}/movies/{movieId}"},"headers":{},"pathParameters":{"rootPathParam":"rootPathParam","movieId":"movieId"},"queryParameters":{}}]},"endpoint_imdb.upload":{"declaration":{"name":{"originalName":"upload","camelCase":{"unsafeName":"upload","safeName":"upload"},"snakeCase":{"unsafeName":"upload","safeName":"upload"},"screamingSnakeCase":{"unsafeName":"UPLOAD","safeName":"UPLOAD"},"pascalCase":{"unsafeName":"Upload","safeName":"Upload"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"location":{"method":"POST","path":"/test/{rootPathParam}/movies/upload/{movieId}"},"request":{"pathParameters":[{"name":{"name":{"originalName":"movieId","camelCase":{"unsafeName":"movieId","safeName":"movieId"},"snakeCase":{"unsafeName":"movie_id","safeName":"movie_id"},"screamingSnakeCase":{"unsafeName":"MOVIE_ID","safeName":"MOVIE_ID"},"pascalCase":{"unsafeName":"MovieId","safeName":"MovieId"}},"wireValue":"movieId"},"typeReference":{"value":"type_imdb:MovieId","type":"named"}}],"body":{"type":"bytes"},"type":"body"},"response":{"type":"json"},"examples":[]}},"pathParameters":[{"name":{"name":{"originalName":"rootPathParam","camelCase":{"unsafeName":"rootPathParam","safeName":"rootPathParam"},"snakeCase":{"unsafeName":"root_path_param","safeName":"root_path_param"},"screamingSnakeCase":{"unsafeName":"ROOT_PATH_PARAM","safeName":"ROOT_PATH_PARAM"},"pascalCase":{"unsafeName":"RootPathParam","safeName":"RootPathParam"}},"wireValue":"rootPathParam"},"typeReference":{"value":"STRING","type":"primitive"}}]}"`; +exports[`fdr > {"name":"simple"} 1`] = `"{"version":"1.0.0","types":{"type_commons:UndiscriminatedUnion":{"declaration":{"name":{"originalName":"UndiscriminatedUnion","camelCase":{"unsafeName":"undiscriminatedUnion","safeName":"undiscriminatedUnion"},"snakeCase":{"unsafeName":"undiscriminated_union","safeName":"undiscriminated_union"},"screamingSnakeCase":{"unsafeName":"UNDISCRIMINATED_UNION","safeName":"UNDISCRIMINATED_UNION"},"pascalCase":{"unsafeName":"UndiscriminatedUnion","safeName":"UndiscriminatedUnion"}},"fernFilepath":{"allParts":[{"originalName":"commons","camelCase":{"unsafeName":"commons","safeName":"commons"},"snakeCase":{"unsafeName":"commons","safeName":"commons"},"screamingSnakeCase":{"unsafeName":"COMMONS","safeName":"COMMONS"},"pascalCase":{"unsafeName":"Commons","safeName":"Commons"}}],"packagePath":[],"file":{"originalName":"commons","camelCase":{"unsafeName":"commons","safeName":"commons"},"snakeCase":{"unsafeName":"commons","safeName":"commons"},"screamingSnakeCase":{"unsafeName":"COMMONS","safeName":"COMMONS"},"pascalCase":{"unsafeName":"Commons","safeName":"Commons"}}}},"types":[{"value":"STRING","type":"primitive"},{"value":{"value":"STRING","type":"primitive"},"type":"list"},{"value":"INTEGER","type":"primitive"},{"value":{"value":{"value":"INTEGER","type":"primitive"},"type":"list"},"type":"list"}],"type":"undiscriminatedUnion"},"type_director:Director":{"declaration":{"name":{"originalName":"Director","camelCase":{"unsafeName":"director","safeName":"director"},"snakeCase":{"unsafeName":"director","safeName":"director"},"screamingSnakeCase":{"unsafeName":"DIRECTOR","safeName":"DIRECTOR"},"pascalCase":{"unsafeName":"Director","safeName":"Director"}},"fernFilepath":{"allParts":[{"originalName":"director","camelCase":{"unsafeName":"director","safeName":"director"},"snakeCase":{"unsafeName":"director","safeName":"director"},"screamingSnakeCase":{"unsafeName":"DIRECTOR","safeName":"DIRECTOR"},"pascalCase":{"unsafeName":"Director","safeName":"Director"}}],"packagePath":[],"file":{"originalName":"director","camelCase":{"unsafeName":"director","safeName":"director"},"snakeCase":{"unsafeName":"director","safeName":"director"},"screamingSnakeCase":{"unsafeName":"DIRECTOR","safeName":"DIRECTOR"},"pascalCase":{"unsafeName":"Director","safeName":"Director"}}}},"properties":[{"name":{"wireValue":"name","name":{"originalName":"name","camelCase":{"unsafeName":"name","safeName":"name"},"snakeCase":{"unsafeName":"name","safeName":"name"},"screamingSnakeCase":{"unsafeName":"NAME","safeName":"NAME"},"pascalCase":{"unsafeName":"Name","safeName":"Name"}}},"typeReference":{"value":"STRING","type":"primitive"}},{"name":{"wireValue":"age","name":{"originalName":"age","camelCase":{"unsafeName":"age","safeName":"age"},"snakeCase":{"unsafeName":"age","safeName":"age"},"screamingSnakeCase":{"unsafeName":"AGE","safeName":"AGE"},"pascalCase":{"unsafeName":"Age","safeName":"Age"}}},"typeReference":{"value":"type_director:Age","type":"named"}}],"additionalProperties":false,"type":"object"},"type_director:Age":{"declaration":{"name":{"originalName":"Age","camelCase":{"unsafeName":"age","safeName":"age"},"snakeCase":{"unsafeName":"age","safeName":"age"},"screamingSnakeCase":{"unsafeName":"AGE","safeName":"AGE"},"pascalCase":{"unsafeName":"Age","safeName":"Age"}},"fernFilepath":{"allParts":[{"originalName":"director","camelCase":{"unsafeName":"director","safeName":"director"},"snakeCase":{"unsafeName":"director","safeName":"director"},"screamingSnakeCase":{"unsafeName":"DIRECTOR","safeName":"DIRECTOR"},"pascalCase":{"unsafeName":"Director","safeName":"Director"}}],"packagePath":[],"file":{"originalName":"director","camelCase":{"unsafeName":"director","safeName":"director"},"snakeCase":{"unsafeName":"director","safeName":"director"},"screamingSnakeCase":{"unsafeName":"DIRECTOR","safeName":"DIRECTOR"},"pascalCase":{"unsafeName":"Director","safeName":"Director"}}}},"typeReference":{"value":"INTEGER","type":"primitive"},"type":"alias"},"type_director:LiteralString":{"declaration":{"name":{"originalName":"LiteralString","camelCase":{"unsafeName":"literalString","safeName":"literalString"},"snakeCase":{"unsafeName":"literal_string","safeName":"literal_string"},"screamingSnakeCase":{"unsafeName":"LITERAL_STRING","safeName":"LITERAL_STRING"},"pascalCase":{"unsafeName":"LiteralString","safeName":"LiteralString"}},"fernFilepath":{"allParts":[{"originalName":"director","camelCase":{"unsafeName":"director","safeName":"director"},"snakeCase":{"unsafeName":"director","safeName":"director"},"screamingSnakeCase":{"unsafeName":"DIRECTOR","safeName":"DIRECTOR"},"pascalCase":{"unsafeName":"Director","safeName":"Director"}}],"packagePath":[],"file":{"originalName":"director","camelCase":{"unsafeName":"director","safeName":"director"},"snakeCase":{"unsafeName":"director","safeName":"director"},"screamingSnakeCase":{"unsafeName":"DIRECTOR","safeName":"DIRECTOR"},"pascalCase":{"unsafeName":"Director","safeName":"Director"}}}},"typeReference":{"value":{"value":"hello","type":"string"},"type":"literal"},"type":"alias"},"type_imdb:CurrencyAmount":{"declaration":{"name":{"originalName":"CurrencyAmount","camelCase":{"unsafeName":"currencyAmount","safeName":"currencyAmount"},"snakeCase":{"unsafeName":"currency_amount","safeName":"currency_amount"},"screamingSnakeCase":{"unsafeName":"CURRENCY_AMOUNT","safeName":"CURRENCY_AMOUNT"},"pascalCase":{"unsafeName":"CurrencyAmount","safeName":"CurrencyAmount"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"typeReference":{"value":"STRING","type":"primitive"},"type":"alias"},"type_imdb:MovieId":{"declaration":{"name":{"originalName":"MovieId","camelCase":{"unsafeName":"movieId","safeName":"movieId"},"snakeCase":{"unsafeName":"movie_id","safeName":"movie_id"},"screamingSnakeCase":{"unsafeName":"MOVIE_ID","safeName":"MOVIE_ID"},"pascalCase":{"unsafeName":"MovieId","safeName":"MovieId"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"typeReference":{"value":"STRING","type":"primitive"},"type":"alias"},"type_imdb:ActorId":{"declaration":{"name":{"originalName":"ActorId","camelCase":{"unsafeName":"actorId","safeName":"actorId"},"snakeCase":{"unsafeName":"actor_id","safeName":"actor_id"},"screamingSnakeCase":{"unsafeName":"ACTOR_ID","safeName":"ACTOR_ID"},"pascalCase":{"unsafeName":"ActorId","safeName":"ActorId"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"typeReference":{"value":"STRING","type":"primitive"},"type":"alias"},"type_imdb:Movie":{"declaration":{"name":{"originalName":"Movie","camelCase":{"unsafeName":"movie","safeName":"movie"},"snakeCase":{"unsafeName":"movie","safeName":"movie"},"screamingSnakeCase":{"unsafeName":"MOVIE","safeName":"MOVIE"},"pascalCase":{"unsafeName":"Movie","safeName":"Movie"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"properties":[{"name":{"wireValue":"id","name":{"originalName":"id","camelCase":{"unsafeName":"id","safeName":"id"},"snakeCase":{"unsafeName":"id","safeName":"id"},"screamingSnakeCase":{"unsafeName":"ID","safeName":"ID"},"pascalCase":{"unsafeName":"Id","safeName":"Id"}}},"typeReference":{"value":"type_imdb:MovieId","type":"named"}},{"name":{"wireValue":"title","name":{"originalName":"title","camelCase":{"unsafeName":"title","safeName":"title"},"snakeCase":{"unsafeName":"title","safeName":"title"},"screamingSnakeCase":{"unsafeName":"TITLE","safeName":"TITLE"},"pascalCase":{"unsafeName":"Title","safeName":"Title"}}},"typeReference":{"value":"STRING","type":"primitive"}},{"name":{"wireValue":"rating","name":{"originalName":"rating","camelCase":{"unsafeName":"rating","safeName":"rating"},"snakeCase":{"unsafeName":"rating","safeName":"rating"},"screamingSnakeCase":{"unsafeName":"RATING","safeName":"RATING"},"pascalCase":{"unsafeName":"Rating","safeName":"Rating"}}},"typeReference":{"value":"DOUBLE","type":"primitive"}}],"additionalProperties":false,"type":"object"},"type_imdb:CreateMovieRequest":{"declaration":{"name":{"originalName":"CreateMovieRequest","camelCase":{"unsafeName":"createMovieRequest","safeName":"createMovieRequest"},"snakeCase":{"unsafeName":"create_movie_request","safeName":"create_movie_request"},"screamingSnakeCase":{"unsafeName":"CREATE_MOVIE_REQUEST","safeName":"CREATE_MOVIE_REQUEST"},"pascalCase":{"unsafeName":"CreateMovieRequest","safeName":"CreateMovieRequest"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"properties":[{"name":{"wireValue":"title","name":{"originalName":"title","camelCase":{"unsafeName":"title","safeName":"title"},"snakeCase":{"unsafeName":"title","safeName":"title"},"screamingSnakeCase":{"unsafeName":"TITLE","safeName":"TITLE"},"pascalCase":{"unsafeName":"Title","safeName":"Title"}}},"typeReference":{"value":"STRING","type":"primitive"}},{"name":{"wireValue":"ratings","name":{"originalName":"ratings","camelCase":{"unsafeName":"ratings","safeName":"ratings"},"snakeCase":{"unsafeName":"ratings","safeName":"ratings"},"screamingSnakeCase":{"unsafeName":"RATINGS","safeName":"RATINGS"},"pascalCase":{"unsafeName":"Ratings","safeName":"Ratings"}}},"typeReference":{"value":{"value":"DOUBLE","type":"primitive"},"type":"list"}}],"additionalProperties":false,"type":"object"},"type_imdb:DirectorWrapper":{"declaration":{"name":{"originalName":"DirectorWrapper","camelCase":{"unsafeName":"directorWrapper","safeName":"directorWrapper"},"snakeCase":{"unsafeName":"director_wrapper","safeName":"director_wrapper"},"screamingSnakeCase":{"unsafeName":"DIRECTOR_WRAPPER","safeName":"DIRECTOR_WRAPPER"},"pascalCase":{"unsafeName":"DirectorWrapper","safeName":"DirectorWrapper"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"properties":[{"name":{"wireValue":"director","name":{"originalName":"director","camelCase":{"unsafeName":"director","safeName":"director"},"snakeCase":{"unsafeName":"director","safeName":"director"},"screamingSnakeCase":{"unsafeName":"DIRECTOR","safeName":"DIRECTOR"},"pascalCase":{"unsafeName":"Director","safeName":"Director"}}},"typeReference":{"value":"type_director:Director","type":"named"}}],"additionalProperties":false,"type":"object"},"type_imdb:EmptyObject":{"declaration":{"name":{"originalName":"EmptyObject","camelCase":{"unsafeName":"emptyObject","safeName":"emptyObject"},"snakeCase":{"unsafeName":"empty_object","safeName":"empty_object"},"screamingSnakeCase":{"unsafeName":"EMPTY_OBJECT","safeName":"EMPTY_OBJECT"},"pascalCase":{"unsafeName":"EmptyObject","safeName":"EmptyObject"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"properties":[],"additionalProperties":false,"type":"object"},"type_imdb:Person":{"declaration":{"name":{"originalName":"Person","camelCase":{"unsafeName":"person","safeName":"person"},"snakeCase":{"unsafeName":"person","safeName":"person"},"screamingSnakeCase":{"unsafeName":"PERSON","safeName":"PERSON"},"pascalCase":{"unsafeName":"Person","safeName":"Person"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"discriminant":{"wireValue":"type","name":{"originalName":"type","camelCase":{"unsafeName":"type","safeName":"type"},"snakeCase":{"unsafeName":"type","safeName":"type"},"screamingSnakeCase":{"unsafeName":"TYPE","safeName":"TYPE"},"pascalCase":{"unsafeName":"Type","safeName":"Type"}}},"types":{"actor":{"typeReference":{"value":"type_imdb:ActorId","type":"named"},"discriminantValue":{"wireValue":"actor","name":{"originalName":"actor","camelCase":{"unsafeName":"actor","safeName":"actor"},"snakeCase":{"unsafeName":"actor","safeName":"actor"},"screamingSnakeCase":{"unsafeName":"ACTOR","safeName":"ACTOR"},"pascalCase":{"unsafeName":"Actor","safeName":"Actor"}}},"type":"singleProperty"},"director":{"typeId":"type_director:Director","discriminantValue":{"wireValue":"director","name":{"originalName":"director","camelCase":{"unsafeName":"director","safeName":"director"},"snakeCase":{"unsafeName":"director","safeName":"director"},"screamingSnakeCase":{"unsafeName":"DIRECTOR","safeName":"DIRECTOR"},"pascalCase":{"unsafeName":"Director","safeName":"Director"}}},"properties":[],"type":"samePropertiesAsObject"},"producer":{"typeId":"type_imdb:EmptyObject","discriminantValue":{"wireValue":"producer","name":{"originalName":"producer","camelCase":{"unsafeName":"producer","safeName":"producer"},"snakeCase":{"unsafeName":"producer","safeName":"producer"},"screamingSnakeCase":{"unsafeName":"PRODUCER","safeName":"PRODUCER"},"pascalCase":{"unsafeName":"Producer","safeName":"Producer"}}},"properties":[],"type":"samePropertiesAsObject"},"cinematographer":{"typeId":"type_imdb:EmptyObject","discriminantValue":{"wireValue":"cinematographer","name":{"originalName":"cinematographer","camelCase":{"unsafeName":"cinematographer","safeName":"cinematographer"},"snakeCase":{"unsafeName":"cinematographer","safeName":"cinematographer"},"screamingSnakeCase":{"unsafeName":"CINEMATOGRAPHER","safeName":"CINEMATOGRAPHER"},"pascalCase":{"unsafeName":"Cinematographer","safeName":"Cinematographer"}}},"properties":[],"type":"samePropertiesAsObject"}},"type":"discriminatedUnion"},"type_imdb:RecursiveType":{"declaration":{"name":{"originalName":"RecursiveType","camelCase":{"unsafeName":"recursiveType","safeName":"recursiveType"},"snakeCase":{"unsafeName":"recursive_type","safeName":"recursive_type"},"screamingSnakeCase":{"unsafeName":"RECURSIVE_TYPE","safeName":"RECURSIVE_TYPE"},"pascalCase":{"unsafeName":"RecursiveType","safeName":"RecursiveType"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"properties":[{"name":{"wireValue":"title","name":{"originalName":"title","camelCase":{"unsafeName":"title","safeName":"title"},"snakeCase":{"unsafeName":"title","safeName":"title"},"screamingSnakeCase":{"unsafeName":"TITLE","safeName":"TITLE"},"pascalCase":{"unsafeName":"Title","safeName":"Title"}}},"typeReference":{"value":"STRING","type":"primitive"}},{"name":{"wireValue":"ratings","name":{"originalName":"ratings","camelCase":{"unsafeName":"ratings","safeName":"ratings"},"snakeCase":{"unsafeName":"ratings","safeName":"ratings"},"screamingSnakeCase":{"unsafeName":"RATINGS","safeName":"RATINGS"},"pascalCase":{"unsafeName":"Ratings","safeName":"Ratings"}}},"typeReference":{"value":{"value":"DOUBLE","type":"primitive"},"type":"list"}},{"name":{"wireValue":"selfReferencing","name":{"originalName":"selfReferencing","camelCase":{"unsafeName":"selfReferencing","safeName":"selfReferencing"},"snakeCase":{"unsafeName":"self_referencing","safeName":"self_referencing"},"screamingSnakeCase":{"unsafeName":"SELF_REFERENCING","safeName":"SELF_REFERENCING"},"pascalCase":{"unsafeName":"SelfReferencing","safeName":"SelfReferencing"}}},"typeReference":{"value":{"value":"type_imdb:RecursiveType","type":"named"},"type":"list"}}],"extends":["type_imdb:CreateMovieRequest"],"additionalProperties":false,"type":"object"}},"headers":[{"name":{"wireValue":"X-API-VERSION","name":{"originalName":"apiVersion","camelCase":{"unsafeName":"apiVersion","safeName":"apiVersion"},"snakeCase":{"unsafeName":"api_version","safeName":"api_version"},"screamingSnakeCase":{"unsafeName":"API_VERSION","safeName":"API_VERSION"},"pascalCase":{"unsafeName":"ApiVersion","safeName":"ApiVersion"}}},"typeReference":{"value":{"value":"STRING","type":"primitive"},"type":"optional"}}],"endpoints":{"endpoint_imdb.createMovie":{"declaration":{"name":{"originalName":"createMovie","camelCase":{"unsafeName":"createMovie","safeName":"createMovie"},"snakeCase":{"unsafeName":"create_movie","safeName":"create_movie"},"screamingSnakeCase":{"unsafeName":"CREATE_MOVIE","safeName":"CREATE_MOVIE"},"pascalCase":{"unsafeName":"CreateMovie","safeName":"CreateMovie"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"location":{"method":"POST","path":"/test/{rootPathParam}/movies"},"request":{"pathParameters":[],"body":{"value":{"value":"type_imdb:CreateMovieRequest","type":"named"},"type":"typeReference"},"type":"body"},"response":{"type":"json"},"examples":[{"id":"b1661658","isUserSpecified":true,"endpoint":{"method":"POST","path":"/test/{rootPathParam}/movies"},"headers":{},"pathParameters":{"rootPathParam":"root"},"queryParameters":{},"requestBody":{"title":"Shrek","ratings":[10,10,10,10]}},{"id":"c66b4be5","isUserSpecified":true,"endpoint":{"method":"POST","path":"/test/{rootPathParam}/movies"},"headers":{},"pathParameters":{"rootPathParam":"root"},"queryParameters":{},"requestBody":{"title":"Winnie the Pooh","ratings":[1,2,3]}},{"id":"df44c04d","isUserSpecified":false,"endpoint":{"method":"POST","path":"/test/{rootPathParam}/movies"},"headers":{},"pathParameters":{"rootPathParam":"rootPathParam"},"queryParameters":{},"requestBody":{"title":"title","ratings":[1.1,1.1]}},{"id":"edf15cf8","isUserSpecified":false,"endpoint":{"method":"POST","path":"/test/{rootPathParam}/movies"},"headers":{},"pathParameters":{"rootPathParam":"rootPathParam"},"queryParameters":{},"requestBody":{"title":"title","ratings":[1.1,1.1]}}]},"endpoint_imdb.getMovie":{"declaration":{"name":{"originalName":"getMovie","camelCase":{"unsafeName":"getMovie","safeName":"getMovie"},"snakeCase":{"unsafeName":"get_movie","safeName":"get_movie"},"screamingSnakeCase":{"unsafeName":"GET_MOVIE","safeName":"GET_MOVIE"},"pascalCase":{"unsafeName":"GetMovie","safeName":"GetMovie"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"location":{"method":"GET","path":"/test/{rootPathParam}/movies/{movieId}"},"request":{"declaration":{"name":{"originalName":"GetMovieRequest","camelCase":{"unsafeName":"getMovieRequest","safeName":"getMovieRequest"},"snakeCase":{"unsafeName":"get_movie_request","safeName":"get_movie_request"},"screamingSnakeCase":{"unsafeName":"GET_MOVIE_REQUEST","safeName":"GET_MOVIE_REQUEST"},"pascalCase":{"unsafeName":"GetMovieRequest","safeName":"GetMovieRequest"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"pathParameters":[{"name":{"name":{"originalName":"movieId","camelCase":{"unsafeName":"movieId","safeName":"movieId"},"snakeCase":{"unsafeName":"movie_id","safeName":"movie_id"},"screamingSnakeCase":{"unsafeName":"MOVIE_ID","safeName":"MOVIE_ID"},"pascalCase":{"unsafeName":"MovieId","safeName":"MovieId"}},"wireValue":"movieId"},"typeReference":{"value":"type_imdb:MovieId","type":"named"}}],"queryParameters":[{"name":{"wireValue":"movieName","name":{"originalName":"movieName","camelCase":{"unsafeName":"movieName","safeName":"movieName"},"snakeCase":{"unsafeName":"movie_name","safeName":"movie_name"},"screamingSnakeCase":{"unsafeName":"MOVIE_NAME","safeName":"MOVIE_NAME"},"pascalCase":{"unsafeName":"MovieName","safeName":"MovieName"}}},"typeReference":{"value":{"value":"STRING","type":"primitive"},"type":"list"}}],"headers":[],"metadata":{"includePathParameters":false,"onlyPathParameters":false},"type":"inlined"},"response":{"type":"json"},"examples":[{"id":"a2c1f6ab","isUserSpecified":true,"endpoint":{"method":"GET","path":"/test/{rootPathParam}/movies/{movieId}"},"headers":{},"pathParameters":{"rootPathParam":"root","movieId":"id-123"},"queryParameters":{"movieName":"hello"}},{"id":"51944a56","isUserSpecified":true,"endpoint":{"method":"GET","path":"/test/{rootPathParam}/movies/{movieId}"},"headers":{},"pathParameters":{"rootPathParam":"root","movieId":"id-123"},"queryParameters":{"movieName":"hello"}},{"id":"7d40e807","isUserSpecified":false,"endpoint":{"method":"GET","path":"/test/{rootPathParam}/movies/{movieId}"},"headers":{},"pathParameters":{"rootPathParam":"rootPathParam","movieId":"movieId"},"queryParameters":{"movieName":"movieName"}},{"id":"81bc2f17","isUserSpecified":false,"endpoint":{"method":"GET","path":"/test/{rootPathParam}/movies/{movieId}"},"headers":{},"pathParameters":{"rootPathParam":"rootPathParam","movieId":"movieId"},"queryParameters":{"movieName":"movieName"}},{"id":"79a80950","isUserSpecified":false,"endpoint":{"method":"GET","path":"/test/{rootPathParam}/movies/{movieId}"},"headers":{},"pathParameters":{"rootPathParam":"rootPathParam","movieId":"movieId"},"queryParameters":{"movieName":"movieName"}}]},"endpoint_imdb.delete":{"declaration":{"name":{"originalName":"delete","camelCase":{"unsafeName":"delete","safeName":"delete"},"snakeCase":{"unsafeName":"delete","safeName":"delete"},"screamingSnakeCase":{"unsafeName":"DELETE","safeName":"DELETE"},"pascalCase":{"unsafeName":"Delete","safeName":"Delete"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"location":{"method":"DELETE","path":"/test/{rootPathParam}/movies/{movieId}"},"request":{"pathParameters":[{"name":{"name":{"originalName":"movieId","camelCase":{"unsafeName":"movieId","safeName":"movieId"},"snakeCase":{"unsafeName":"movie_id","safeName":"movie_id"},"screamingSnakeCase":{"unsafeName":"MOVIE_ID","safeName":"MOVIE_ID"},"pascalCase":{"unsafeName":"MovieId","safeName":"MovieId"}},"wireValue":"movieId"},"typeReference":{"value":"type_imdb:MovieId","type":"named"}}],"type":"body"},"response":{"type":"json"},"examples":[{"id":"e1d0202c","isUserSpecified":false,"endpoint":{"method":"DELETE","path":"/test/{rootPathParam}/movies/{movieId}"},"headers":{},"pathParameters":{"rootPathParam":"rootPathParam","movieId":"movieId"},"queryParameters":{}},{"id":"9056d4fb","isUserSpecified":false,"endpoint":{"method":"DELETE","path":"/test/{rootPathParam}/movies/{movieId}"},"headers":{},"pathParameters":{"rootPathParam":"rootPathParam","movieId":"movieId"},"queryParameters":{}}]},"endpoint_imdb.upload":{"declaration":{"name":{"originalName":"upload","camelCase":{"unsafeName":"upload","safeName":"upload"},"snakeCase":{"unsafeName":"upload","safeName":"upload"},"screamingSnakeCase":{"unsafeName":"UPLOAD","safeName":"UPLOAD"},"pascalCase":{"unsafeName":"Upload","safeName":"Upload"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"location":{"method":"POST","path":"/test/{rootPathParam}/movies/upload/{movieId}"},"request":{"pathParameters":[{"name":{"name":{"originalName":"movieId","camelCase":{"unsafeName":"movieId","safeName":"movieId"},"snakeCase":{"unsafeName":"movie_id","safeName":"movie_id"},"screamingSnakeCase":{"unsafeName":"MOVIE_ID","safeName":"MOVIE_ID"},"pascalCase":{"unsafeName":"MovieId","safeName":"MovieId"}},"wireValue":"movieId"},"typeReference":{"value":"type_imdb:MovieId","type":"named"}}],"body":{"type":"bytes"},"type":"body"},"response":{"type":"json"},"examples":[]}},"pathParameters":[{"name":{"name":{"originalName":"rootPathParam","camelCase":{"unsafeName":"rootPathParam","safeName":"rootPathParam"},"snakeCase":{"unsafeName":"root_path_param","safeName":"root_path_param"},"screamingSnakeCase":{"unsafeName":"ROOT_PATH_PARAM","safeName":"ROOT_PATH_PARAM"},"pascalCase":{"unsafeName":"RootPathParam","safeName":"RootPathParam"}},"wireValue":"rootPathParam"},"typeReference":{"value":"STRING","type":"primitive"}}]}"`; diff --git a/packages/cli/ete-tests/src/tests/dynamic/fixtures/simple/dynamic.json b/packages/cli/ete-tests/src/tests/dynamic/fixtures/simple/dynamic.json index c44168ea027e..0413f7072b99 100644 --- a/packages/cli/ete-tests/src/tests/dynamic/fixtures/simple/dynamic.json +++ b/packages/cli/ete-tests/src/tests/dynamic/fixtures/simple/dynamic.json @@ -1 +1 @@ -{"version":"1.0.0","types":{"type_commons:UndiscriminatedUnion":{"declaration":{"name":{"originalName":"UndiscriminatedUnion","camelCase":{"unsafeName":"undiscriminatedUnion","safeName":"undiscriminatedUnion"},"snakeCase":{"unsafeName":"undiscriminated_union","safeName":"undiscriminated_union"},"screamingSnakeCase":{"unsafeName":"UNDISCRIMINATED_UNION","safeName":"UNDISCRIMINATED_UNION"},"pascalCase":{"unsafeName":"UndiscriminatedUnion","safeName":"UndiscriminatedUnion"}},"fernFilepath":{"allParts":[{"originalName":"commons","camelCase":{"unsafeName":"commons","safeName":"commons"},"snakeCase":{"unsafeName":"commons","safeName":"commons"},"screamingSnakeCase":{"unsafeName":"COMMONS","safeName":"COMMONS"},"pascalCase":{"unsafeName":"Commons","safeName":"Commons"}}],"packagePath":[],"file":{"originalName":"commons","camelCase":{"unsafeName":"commons","safeName":"commons"},"snakeCase":{"unsafeName":"commons","safeName":"commons"},"screamingSnakeCase":{"unsafeName":"COMMONS","safeName":"COMMONS"},"pascalCase":{"unsafeName":"Commons","safeName":"Commons"}}}},"types":[{"value":"STRING","type":"primitive"},{"value":{"value":"STRING","type":"primitive"},"type":"list"},{"value":"INTEGER","type":"primitive"},{"value":{"value":{"value":"INTEGER","type":"primitive"},"type":"list"},"type":"list"}],"type":"undiscriminatedUnion"},"type_director:Director":{"declaration":{"name":{"originalName":"Director","camelCase":{"unsafeName":"director","safeName":"director"},"snakeCase":{"unsafeName":"director","safeName":"director"},"screamingSnakeCase":{"unsafeName":"DIRECTOR","safeName":"DIRECTOR"},"pascalCase":{"unsafeName":"Director","safeName":"Director"}},"fernFilepath":{"allParts":[{"originalName":"director","camelCase":{"unsafeName":"director","safeName":"director"},"snakeCase":{"unsafeName":"director","safeName":"director"},"screamingSnakeCase":{"unsafeName":"DIRECTOR","safeName":"DIRECTOR"},"pascalCase":{"unsafeName":"Director","safeName":"Director"}}],"packagePath":[],"file":{"originalName":"director","camelCase":{"unsafeName":"director","safeName":"director"},"snakeCase":{"unsafeName":"director","safeName":"director"},"screamingSnakeCase":{"unsafeName":"DIRECTOR","safeName":"DIRECTOR"},"pascalCase":{"unsafeName":"Director","safeName":"Director"}}}},"properties":[{"name":{"wireValue":"name","name":{"originalName":"name","camelCase":{"unsafeName":"name","safeName":"name"},"snakeCase":{"unsafeName":"name","safeName":"name"},"screamingSnakeCase":{"unsafeName":"NAME","safeName":"NAME"},"pascalCase":{"unsafeName":"Name","safeName":"Name"}}},"typeReference":{"value":"STRING","type":"primitive"}},{"name":{"wireValue":"age","name":{"originalName":"age","camelCase":{"unsafeName":"age","safeName":"age"},"snakeCase":{"unsafeName":"age","safeName":"age"},"screamingSnakeCase":{"unsafeName":"AGE","safeName":"AGE"},"pascalCase":{"unsafeName":"Age","safeName":"Age"}}},"typeReference":{"value":"type_director:Age","type":"named"}}],"additionalProperties":false,"type":"object"},"type_director:Age":{"declaration":{"name":{"originalName":"Age","camelCase":{"unsafeName":"age","safeName":"age"},"snakeCase":{"unsafeName":"age","safeName":"age"},"screamingSnakeCase":{"unsafeName":"AGE","safeName":"AGE"},"pascalCase":{"unsafeName":"Age","safeName":"Age"}},"fernFilepath":{"allParts":[{"originalName":"director","camelCase":{"unsafeName":"director","safeName":"director"},"snakeCase":{"unsafeName":"director","safeName":"director"},"screamingSnakeCase":{"unsafeName":"DIRECTOR","safeName":"DIRECTOR"},"pascalCase":{"unsafeName":"Director","safeName":"Director"}}],"packagePath":[],"file":{"originalName":"director","camelCase":{"unsafeName":"director","safeName":"director"},"snakeCase":{"unsafeName":"director","safeName":"director"},"screamingSnakeCase":{"unsafeName":"DIRECTOR","safeName":"DIRECTOR"},"pascalCase":{"unsafeName":"Director","safeName":"Director"}}}},"typeReference":{"value":"INTEGER","type":"primitive"},"type":"alias"},"type_director:LiteralString":{"declaration":{"name":{"originalName":"LiteralString","camelCase":{"unsafeName":"literalString","safeName":"literalString"},"snakeCase":{"unsafeName":"literal_string","safeName":"literal_string"},"screamingSnakeCase":{"unsafeName":"LITERAL_STRING","safeName":"LITERAL_STRING"},"pascalCase":{"unsafeName":"LiteralString","safeName":"LiteralString"}},"fernFilepath":{"allParts":[{"originalName":"director","camelCase":{"unsafeName":"director","safeName":"director"},"snakeCase":{"unsafeName":"director","safeName":"director"},"screamingSnakeCase":{"unsafeName":"DIRECTOR","safeName":"DIRECTOR"},"pascalCase":{"unsafeName":"Director","safeName":"Director"}}],"packagePath":[],"file":{"originalName":"director","camelCase":{"unsafeName":"director","safeName":"director"},"snakeCase":{"unsafeName":"director","safeName":"director"},"screamingSnakeCase":{"unsafeName":"DIRECTOR","safeName":"DIRECTOR"},"pascalCase":{"unsafeName":"Director","safeName":"Director"}}}},"typeReference":{"value":{"value":"hello","type":"string"},"type":"literal"},"type":"alias"},"type_imdb:CurrencyAmount":{"declaration":{"name":{"originalName":"CurrencyAmount","camelCase":{"unsafeName":"currencyAmount","safeName":"currencyAmount"},"snakeCase":{"unsafeName":"currency_amount","safeName":"currency_amount"},"screamingSnakeCase":{"unsafeName":"CURRENCY_AMOUNT","safeName":"CURRENCY_AMOUNT"},"pascalCase":{"unsafeName":"CurrencyAmount","safeName":"CurrencyAmount"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"typeReference":{"value":"STRING","type":"primitive"},"type":"alias"},"type_imdb:MovieId":{"declaration":{"name":{"originalName":"MovieId","camelCase":{"unsafeName":"movieId","safeName":"movieId"},"snakeCase":{"unsafeName":"movie_id","safeName":"movie_id"},"screamingSnakeCase":{"unsafeName":"MOVIE_ID","safeName":"MOVIE_ID"},"pascalCase":{"unsafeName":"MovieId","safeName":"MovieId"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"typeReference":{"value":"STRING","type":"primitive"},"type":"alias"},"type_imdb:ActorId":{"declaration":{"name":{"originalName":"ActorId","camelCase":{"unsafeName":"actorId","safeName":"actorId"},"snakeCase":{"unsafeName":"actor_id","safeName":"actor_id"},"screamingSnakeCase":{"unsafeName":"ACTOR_ID","safeName":"ACTOR_ID"},"pascalCase":{"unsafeName":"ActorId","safeName":"ActorId"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"typeReference":{"value":"STRING","type":"primitive"},"type":"alias"},"type_imdb:Movie":{"declaration":{"name":{"originalName":"Movie","camelCase":{"unsafeName":"movie","safeName":"movie"},"snakeCase":{"unsafeName":"movie","safeName":"movie"},"screamingSnakeCase":{"unsafeName":"MOVIE","safeName":"MOVIE"},"pascalCase":{"unsafeName":"Movie","safeName":"Movie"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"properties":[{"name":{"wireValue":"id","name":{"originalName":"id","camelCase":{"unsafeName":"id","safeName":"id"},"snakeCase":{"unsafeName":"id","safeName":"id"},"screamingSnakeCase":{"unsafeName":"ID","safeName":"ID"},"pascalCase":{"unsafeName":"Id","safeName":"Id"}}},"typeReference":{"value":"type_imdb:MovieId","type":"named"}},{"name":{"wireValue":"title","name":{"originalName":"title","camelCase":{"unsafeName":"title","safeName":"title"},"snakeCase":{"unsafeName":"title","safeName":"title"},"screamingSnakeCase":{"unsafeName":"TITLE","safeName":"TITLE"},"pascalCase":{"unsafeName":"Title","safeName":"Title"}}},"typeReference":{"value":"STRING","type":"primitive"}},{"name":{"wireValue":"rating","name":{"originalName":"rating","camelCase":{"unsafeName":"rating","safeName":"rating"},"snakeCase":{"unsafeName":"rating","safeName":"rating"},"screamingSnakeCase":{"unsafeName":"RATING","safeName":"RATING"},"pascalCase":{"unsafeName":"Rating","safeName":"Rating"}}},"typeReference":{"value":"DOUBLE","type":"primitive"}}],"additionalProperties":false,"type":"object"},"type_imdb:CreateMovieRequest":{"declaration":{"name":{"originalName":"CreateMovieRequest","camelCase":{"unsafeName":"createMovieRequest","safeName":"createMovieRequest"},"snakeCase":{"unsafeName":"create_movie_request","safeName":"create_movie_request"},"screamingSnakeCase":{"unsafeName":"CREATE_MOVIE_REQUEST","safeName":"CREATE_MOVIE_REQUEST"},"pascalCase":{"unsafeName":"CreateMovieRequest","safeName":"CreateMovieRequest"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"properties":[{"name":{"wireValue":"title","name":{"originalName":"title","camelCase":{"unsafeName":"title","safeName":"title"},"snakeCase":{"unsafeName":"title","safeName":"title"},"screamingSnakeCase":{"unsafeName":"TITLE","safeName":"TITLE"},"pascalCase":{"unsafeName":"Title","safeName":"Title"}}},"typeReference":{"value":"STRING","type":"primitive"}},{"name":{"wireValue":"ratings","name":{"originalName":"ratings","camelCase":{"unsafeName":"ratings","safeName":"ratings"},"snakeCase":{"unsafeName":"ratings","safeName":"ratings"},"screamingSnakeCase":{"unsafeName":"RATINGS","safeName":"RATINGS"},"pascalCase":{"unsafeName":"Ratings","safeName":"Ratings"}}},"typeReference":{"value":{"value":"DOUBLE","type":"primitive"},"type":"list"}}],"additionalProperties":false,"type":"object"},"type_imdb:DirectorWrapper":{"declaration":{"name":{"originalName":"DirectorWrapper","camelCase":{"unsafeName":"directorWrapper","safeName":"directorWrapper"},"snakeCase":{"unsafeName":"director_wrapper","safeName":"director_wrapper"},"screamingSnakeCase":{"unsafeName":"DIRECTOR_WRAPPER","safeName":"DIRECTOR_WRAPPER"},"pascalCase":{"unsafeName":"DirectorWrapper","safeName":"DirectorWrapper"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"properties":[{"name":{"wireValue":"director","name":{"originalName":"director","camelCase":{"unsafeName":"director","safeName":"director"},"snakeCase":{"unsafeName":"director","safeName":"director"},"screamingSnakeCase":{"unsafeName":"DIRECTOR","safeName":"DIRECTOR"},"pascalCase":{"unsafeName":"Director","safeName":"Director"}}},"typeReference":{"value":"type_director:Director","type":"named"}}],"additionalProperties":false,"type":"object"},"type_imdb:EmptyObject":{"declaration":{"name":{"originalName":"EmptyObject","camelCase":{"unsafeName":"emptyObject","safeName":"emptyObject"},"snakeCase":{"unsafeName":"empty_object","safeName":"empty_object"},"screamingSnakeCase":{"unsafeName":"EMPTY_OBJECT","safeName":"EMPTY_OBJECT"},"pascalCase":{"unsafeName":"EmptyObject","safeName":"EmptyObject"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"properties":[],"additionalProperties":false,"type":"object"},"type_imdb:Person":{"declaration":{"name":{"originalName":"Person","camelCase":{"unsafeName":"person","safeName":"person"},"snakeCase":{"unsafeName":"person","safeName":"person"},"screamingSnakeCase":{"unsafeName":"PERSON","safeName":"PERSON"},"pascalCase":{"unsafeName":"Person","safeName":"Person"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"discriminant":{"wireValue":"type","name":{"originalName":"type","camelCase":{"unsafeName":"type","safeName":"type"},"snakeCase":{"unsafeName":"type","safeName":"type"},"screamingSnakeCase":{"unsafeName":"TYPE","safeName":"TYPE"},"pascalCase":{"unsafeName":"Type","safeName":"Type"}}},"types":{"actor":{"typeReference":{"value":"type_imdb:ActorId","type":"named"},"discriminantValue":{"wireValue":"actor","name":{"originalName":"actor","camelCase":{"unsafeName":"actor","safeName":"actor"},"snakeCase":{"unsafeName":"actor","safeName":"actor"},"screamingSnakeCase":{"unsafeName":"ACTOR","safeName":"ACTOR"},"pascalCase":{"unsafeName":"Actor","safeName":"Actor"}}},"type":"singleProperty"},"director":{"typeId":"type_director:Director","discriminantValue":{"wireValue":"director","name":{"originalName":"director","camelCase":{"unsafeName":"director","safeName":"director"},"snakeCase":{"unsafeName":"director","safeName":"director"},"screamingSnakeCase":{"unsafeName":"DIRECTOR","safeName":"DIRECTOR"},"pascalCase":{"unsafeName":"Director","safeName":"Director"}}},"properties":[],"type":"samePropertiesAsObject"},"producer":{"typeId":"type_imdb:EmptyObject","discriminantValue":{"wireValue":"producer","name":{"originalName":"producer","camelCase":{"unsafeName":"producer","safeName":"producer"},"snakeCase":{"unsafeName":"producer","safeName":"producer"},"screamingSnakeCase":{"unsafeName":"PRODUCER","safeName":"PRODUCER"},"pascalCase":{"unsafeName":"Producer","safeName":"Producer"}}},"properties":[],"type":"samePropertiesAsObject"},"cinematographer":{"typeId":"type_imdb:EmptyObject","discriminantValue":{"wireValue":"cinematographer","name":{"originalName":"cinematographer","camelCase":{"unsafeName":"cinematographer","safeName":"cinematographer"},"snakeCase":{"unsafeName":"cinematographer","safeName":"cinematographer"},"screamingSnakeCase":{"unsafeName":"CINEMATOGRAPHER","safeName":"CINEMATOGRAPHER"},"pascalCase":{"unsafeName":"Cinematographer","safeName":"Cinematographer"}}},"properties":[],"type":"samePropertiesAsObject"}},"type":"discriminatedUnion"},"type_imdb:RecursiveType":{"declaration":{"name":{"originalName":"RecursiveType","camelCase":{"unsafeName":"recursiveType","safeName":"recursiveType"},"snakeCase":{"unsafeName":"recursive_type","safeName":"recursive_type"},"screamingSnakeCase":{"unsafeName":"RECURSIVE_TYPE","safeName":"RECURSIVE_TYPE"},"pascalCase":{"unsafeName":"RecursiveType","safeName":"RecursiveType"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"properties":[{"name":{"wireValue":"title","name":{"originalName":"title","camelCase":{"unsafeName":"title","safeName":"title"},"snakeCase":{"unsafeName":"title","safeName":"title"},"screamingSnakeCase":{"unsafeName":"TITLE","safeName":"TITLE"},"pascalCase":{"unsafeName":"Title","safeName":"Title"}}},"typeReference":{"value":"STRING","type":"primitive"}},{"name":{"wireValue":"ratings","name":{"originalName":"ratings","camelCase":{"unsafeName":"ratings","safeName":"ratings"},"snakeCase":{"unsafeName":"ratings","safeName":"ratings"},"screamingSnakeCase":{"unsafeName":"RATINGS","safeName":"RATINGS"},"pascalCase":{"unsafeName":"Ratings","safeName":"Ratings"}}},"typeReference":{"value":{"value":"DOUBLE","type":"primitive"},"type":"list"}},{"name":{"wireValue":"selfReferencing","name":{"originalName":"selfReferencing","camelCase":{"unsafeName":"selfReferencing","safeName":"selfReferencing"},"snakeCase":{"unsafeName":"self_referencing","safeName":"self_referencing"},"screamingSnakeCase":{"unsafeName":"SELF_REFERENCING","safeName":"SELF_REFERENCING"},"pascalCase":{"unsafeName":"SelfReferencing","safeName":"SelfReferencing"}}},"typeReference":{"value":{"value":"type_imdb:RecursiveType","type":"named"},"type":"list"}}],"extends":["type_imdb:CreateMovieRequest"],"additionalProperties":false,"type":"object"}},"headers":[{"name":{"wireValue":"X-API-VERSION","name":{"originalName":"apiVersion","camelCase":{"unsafeName":"apiVersion","safeName":"apiVersion"},"snakeCase":{"unsafeName":"api_version","safeName":"api_version"},"screamingSnakeCase":{"unsafeName":"API_VERSION","safeName":"API_VERSION"},"pascalCase":{"unsafeName":"ApiVersion","safeName":"ApiVersion"}}},"typeReference":{"value":{"value":"STRING","type":"primitive"},"type":"optional"}}],"endpoints":{"endpoint_imdb.createMovie":{"declaration":{"name":{"originalName":"createMovie","camelCase":{"unsafeName":"createMovie","safeName":"createMovie"},"snakeCase":{"unsafeName":"create_movie","safeName":"create_movie"},"screamingSnakeCase":{"unsafeName":"CREATE_MOVIE","safeName":"CREATE_MOVIE"},"pascalCase":{"unsafeName":"CreateMovie","safeName":"CreateMovie"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"location":{"method":"POST","path":"/test/{rootPathParam}/movies"},"request":{"pathParameters":[],"body":{"value":{"value":"type_imdb:CreateMovieRequest","type":"named"},"type":"typeReference"},"type":"body"},"response":{"type":"json"},"examples":[{"id":"b1661658","isUserSpecified":true,"endpoint":{"method":"POST","path":"/test/{rootPathParam}/movies"},"headers":{},"pathParameters":{"rootPathParam":"root"},"queryParameters":{},"requestBody":{"title":"Shrek","ratings":[10,10,10,10]}},{"id":"c66b4be5","isUserSpecified":true,"endpoint":{"method":"POST","path":"/test/{rootPathParam}/movies"},"headers":{},"pathParameters":{"rootPathParam":"root"},"queryParameters":{},"requestBody":{"title":"Winnie the Pooh","ratings":[1,2,3]}},{"id":"ecaa4a1d","isUserSpecified":false,"endpoint":{"method":"POST","path":"/test/{rootPathParam}/movies"},"headers":{},"pathParameters":{"rootPathParam":"rootPathParam"},"queryParameters":{},"requestBody":{"title":"title","ratings":[1.1,1.1]}},{"id":"bb62c8b8","isUserSpecified":false,"endpoint":{"method":"POST","path":"/test/{rootPathParam}/movies"},"headers":{},"pathParameters":{"rootPathParam":"rootPathParam"},"queryParameters":{},"requestBody":{"title":"title","ratings":[1.1,1.1]}}]},"endpoint_imdb.getMovie":{"declaration":{"name":{"originalName":"getMovie","camelCase":{"unsafeName":"getMovie","safeName":"getMovie"},"snakeCase":{"unsafeName":"get_movie","safeName":"get_movie"},"screamingSnakeCase":{"unsafeName":"GET_MOVIE","safeName":"GET_MOVIE"},"pascalCase":{"unsafeName":"GetMovie","safeName":"GetMovie"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"location":{"method":"GET","path":"/test/{rootPathParam}/movies/{movieId}"},"request":{"declaration":{"name":{"originalName":"GetMovieRequest","camelCase":{"unsafeName":"getMovieRequest","safeName":"getMovieRequest"},"snakeCase":{"unsafeName":"get_movie_request","safeName":"get_movie_request"},"screamingSnakeCase":{"unsafeName":"GET_MOVIE_REQUEST","safeName":"GET_MOVIE_REQUEST"},"pascalCase":{"unsafeName":"GetMovieRequest","safeName":"GetMovieRequest"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"pathParameters":[{"name":{"name":{"originalName":"movieId","camelCase":{"unsafeName":"movieId","safeName":"movieId"},"snakeCase":{"unsafeName":"movie_id","safeName":"movie_id"},"screamingSnakeCase":{"unsafeName":"MOVIE_ID","safeName":"MOVIE_ID"},"pascalCase":{"unsafeName":"MovieId","safeName":"MovieId"}},"wireValue":"movieId"},"typeReference":{"value":"type_imdb:MovieId","type":"named"}}],"queryParameters":[{"name":{"wireValue":"movieName","name":{"originalName":"movieName","camelCase":{"unsafeName":"movieName","safeName":"movieName"},"snakeCase":{"unsafeName":"movie_name","safeName":"movie_name"},"screamingSnakeCase":{"unsafeName":"MOVIE_NAME","safeName":"MOVIE_NAME"},"pascalCase":{"unsafeName":"MovieName","safeName":"MovieName"}}},"typeReference":{"value":{"value":"STRING","type":"primitive"},"type":"list"}}],"headers":[],"metadata":{"includePathParameters":false,"onlyPathParameters":false},"type":"inlined"},"response":{"type":"json"},"examples":[{"id":"a2c1f6ab","isUserSpecified":true,"endpoint":{"method":"GET","path":"/test/{rootPathParam}/movies/{movieId}"},"headers":{},"pathParameters":{"rootPathParam":"root","movieId":"id-123"},"queryParameters":{"movieName":"hello"}},{"id":"51944a56","isUserSpecified":true,"endpoint":{"method":"GET","path":"/test/{rootPathParam}/movies/{movieId}"},"headers":{},"pathParameters":{"rootPathParam":"root","movieId":"id-123"},"queryParameters":{"movieName":"hello"}},{"id":"8da3f9d7","isUserSpecified":false,"endpoint":{"method":"GET","path":"/test/{rootPathParam}/movies/{movieId}"},"headers":{},"pathParameters":{"rootPathParam":"rootPathParam","movieId":"movieId"},"queryParameters":{"movieName":"movieName"}},{"id":"f73bf377","isUserSpecified":false,"endpoint":{"method":"GET","path":"/test/{rootPathParam}/movies/{movieId}"},"headers":{},"pathParameters":{"rootPathParam":"rootPathParam","movieId":"movieId"},"queryParameters":{"movieName":"movieName"}},{"id":"d74d2200","isUserSpecified":false,"endpoint":{"method":"GET","path":"/test/{rootPathParam}/movies/{movieId}"},"headers":{},"pathParameters":{"rootPathParam":"rootPathParam","movieId":"movieId"},"queryParameters":{"movieName":"movieName"}}]},"endpoint_imdb.delete":{"declaration":{"name":{"originalName":"delete","camelCase":{"unsafeName":"delete","safeName":"delete"},"snakeCase":{"unsafeName":"delete","safeName":"delete"},"screamingSnakeCase":{"unsafeName":"DELETE","safeName":"DELETE"},"pascalCase":{"unsafeName":"Delete","safeName":"Delete"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"location":{"method":"DELETE","path":"/test/{rootPathParam}/movies/{movieId}"},"request":{"pathParameters":[{"name":{"name":{"originalName":"movieId","camelCase":{"unsafeName":"movieId","safeName":"movieId"},"snakeCase":{"unsafeName":"movie_id","safeName":"movie_id"},"screamingSnakeCase":{"unsafeName":"MOVIE_ID","safeName":"MOVIE_ID"},"pascalCase":{"unsafeName":"MovieId","safeName":"MovieId"}},"wireValue":"movieId"},"typeReference":{"value":"type_imdb:MovieId","type":"named"}}],"type":"body"},"response":{"type":"json"},"examples":[{"id":"a87620bc","isUserSpecified":false,"endpoint":{"method":"DELETE","path":"/test/{rootPathParam}/movies/{movieId}"},"headers":{},"pathParameters":{"rootPathParam":"rootPathParam","movieId":"movieId"},"queryParameters":{}},{"id":"125475db","isUserSpecified":false,"endpoint":{"method":"DELETE","path":"/test/{rootPathParam}/movies/{movieId}"},"headers":{},"pathParameters":{"rootPathParam":"rootPathParam","movieId":"movieId"},"queryParameters":{}}]},"endpoint_imdb.upload":{"declaration":{"name":{"originalName":"upload","camelCase":{"unsafeName":"upload","safeName":"upload"},"snakeCase":{"unsafeName":"upload","safeName":"upload"},"screamingSnakeCase":{"unsafeName":"UPLOAD","safeName":"UPLOAD"},"pascalCase":{"unsafeName":"Upload","safeName":"Upload"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"location":{"method":"POST","path":"/test/{rootPathParam}/movies/upload/{movieId}"},"request":{"pathParameters":[{"name":{"name":{"originalName":"movieId","camelCase":{"unsafeName":"movieId","safeName":"movieId"},"snakeCase":{"unsafeName":"movie_id","safeName":"movie_id"},"screamingSnakeCase":{"unsafeName":"MOVIE_ID","safeName":"MOVIE_ID"},"pascalCase":{"unsafeName":"MovieId","safeName":"MovieId"}},"wireValue":"movieId"},"typeReference":{"value":"type_imdb:MovieId","type":"named"}}],"body":{"type":"bytes"},"type":"body"},"response":{"type":"json"},"examples":[]}},"pathParameters":[{"name":{"name":{"originalName":"rootPathParam","camelCase":{"unsafeName":"rootPathParam","safeName":"rootPathParam"},"snakeCase":{"unsafeName":"root_path_param","safeName":"root_path_param"},"screamingSnakeCase":{"unsafeName":"ROOT_PATH_PARAM","safeName":"ROOT_PATH_PARAM"},"pascalCase":{"unsafeName":"RootPathParam","safeName":"RootPathParam"}},"wireValue":"rootPathParam"},"typeReference":{"value":"STRING","type":"primitive"}}]} \ No newline at end of file +{"version":"1.0.0","types":{"type_commons:UndiscriminatedUnion":{"declaration":{"name":{"originalName":"UndiscriminatedUnion","camelCase":{"unsafeName":"undiscriminatedUnion","safeName":"undiscriminatedUnion"},"snakeCase":{"unsafeName":"undiscriminated_union","safeName":"undiscriminated_union"},"screamingSnakeCase":{"unsafeName":"UNDISCRIMINATED_UNION","safeName":"UNDISCRIMINATED_UNION"},"pascalCase":{"unsafeName":"UndiscriminatedUnion","safeName":"UndiscriminatedUnion"}},"fernFilepath":{"allParts":[{"originalName":"commons","camelCase":{"unsafeName":"commons","safeName":"commons"},"snakeCase":{"unsafeName":"commons","safeName":"commons"},"screamingSnakeCase":{"unsafeName":"COMMONS","safeName":"COMMONS"},"pascalCase":{"unsafeName":"Commons","safeName":"Commons"}}],"packagePath":[],"file":{"originalName":"commons","camelCase":{"unsafeName":"commons","safeName":"commons"},"snakeCase":{"unsafeName":"commons","safeName":"commons"},"screamingSnakeCase":{"unsafeName":"COMMONS","safeName":"COMMONS"},"pascalCase":{"unsafeName":"Commons","safeName":"Commons"}}}},"types":[{"value":"STRING","type":"primitive"},{"value":{"value":"STRING","type":"primitive"},"type":"list"},{"value":"INTEGER","type":"primitive"},{"value":{"value":{"value":"INTEGER","type":"primitive"},"type":"list"},"type":"list"}],"type":"undiscriminatedUnion"},"type_director:Director":{"declaration":{"name":{"originalName":"Director","camelCase":{"unsafeName":"director","safeName":"director"},"snakeCase":{"unsafeName":"director","safeName":"director"},"screamingSnakeCase":{"unsafeName":"DIRECTOR","safeName":"DIRECTOR"},"pascalCase":{"unsafeName":"Director","safeName":"Director"}},"fernFilepath":{"allParts":[{"originalName":"director","camelCase":{"unsafeName":"director","safeName":"director"},"snakeCase":{"unsafeName":"director","safeName":"director"},"screamingSnakeCase":{"unsafeName":"DIRECTOR","safeName":"DIRECTOR"},"pascalCase":{"unsafeName":"Director","safeName":"Director"}}],"packagePath":[],"file":{"originalName":"director","camelCase":{"unsafeName":"director","safeName":"director"},"snakeCase":{"unsafeName":"director","safeName":"director"},"screamingSnakeCase":{"unsafeName":"DIRECTOR","safeName":"DIRECTOR"},"pascalCase":{"unsafeName":"Director","safeName":"Director"}}}},"properties":[{"name":{"wireValue":"name","name":{"originalName":"name","camelCase":{"unsafeName":"name","safeName":"name"},"snakeCase":{"unsafeName":"name","safeName":"name"},"screamingSnakeCase":{"unsafeName":"NAME","safeName":"NAME"},"pascalCase":{"unsafeName":"Name","safeName":"Name"}}},"typeReference":{"value":"STRING","type":"primitive"}},{"name":{"wireValue":"age","name":{"originalName":"age","camelCase":{"unsafeName":"age","safeName":"age"},"snakeCase":{"unsafeName":"age","safeName":"age"},"screamingSnakeCase":{"unsafeName":"AGE","safeName":"AGE"},"pascalCase":{"unsafeName":"Age","safeName":"Age"}}},"typeReference":{"value":"type_director:Age","type":"named"}}],"additionalProperties":false,"type":"object"},"type_director:Age":{"declaration":{"name":{"originalName":"Age","camelCase":{"unsafeName":"age","safeName":"age"},"snakeCase":{"unsafeName":"age","safeName":"age"},"screamingSnakeCase":{"unsafeName":"AGE","safeName":"AGE"},"pascalCase":{"unsafeName":"Age","safeName":"Age"}},"fernFilepath":{"allParts":[{"originalName":"director","camelCase":{"unsafeName":"director","safeName":"director"},"snakeCase":{"unsafeName":"director","safeName":"director"},"screamingSnakeCase":{"unsafeName":"DIRECTOR","safeName":"DIRECTOR"},"pascalCase":{"unsafeName":"Director","safeName":"Director"}}],"packagePath":[],"file":{"originalName":"director","camelCase":{"unsafeName":"director","safeName":"director"},"snakeCase":{"unsafeName":"director","safeName":"director"},"screamingSnakeCase":{"unsafeName":"DIRECTOR","safeName":"DIRECTOR"},"pascalCase":{"unsafeName":"Director","safeName":"Director"}}}},"typeReference":{"value":"INTEGER","type":"primitive"},"type":"alias"},"type_director:LiteralString":{"declaration":{"name":{"originalName":"LiteralString","camelCase":{"unsafeName":"literalString","safeName":"literalString"},"snakeCase":{"unsafeName":"literal_string","safeName":"literal_string"},"screamingSnakeCase":{"unsafeName":"LITERAL_STRING","safeName":"LITERAL_STRING"},"pascalCase":{"unsafeName":"LiteralString","safeName":"LiteralString"}},"fernFilepath":{"allParts":[{"originalName":"director","camelCase":{"unsafeName":"director","safeName":"director"},"snakeCase":{"unsafeName":"director","safeName":"director"},"screamingSnakeCase":{"unsafeName":"DIRECTOR","safeName":"DIRECTOR"},"pascalCase":{"unsafeName":"Director","safeName":"Director"}}],"packagePath":[],"file":{"originalName":"director","camelCase":{"unsafeName":"director","safeName":"director"},"snakeCase":{"unsafeName":"director","safeName":"director"},"screamingSnakeCase":{"unsafeName":"DIRECTOR","safeName":"DIRECTOR"},"pascalCase":{"unsafeName":"Director","safeName":"Director"}}}},"typeReference":{"value":{"value":"hello","type":"string"},"type":"literal"},"type":"alias"},"type_imdb:CurrencyAmount":{"declaration":{"name":{"originalName":"CurrencyAmount","camelCase":{"unsafeName":"currencyAmount","safeName":"currencyAmount"},"snakeCase":{"unsafeName":"currency_amount","safeName":"currency_amount"},"screamingSnakeCase":{"unsafeName":"CURRENCY_AMOUNT","safeName":"CURRENCY_AMOUNT"},"pascalCase":{"unsafeName":"CurrencyAmount","safeName":"CurrencyAmount"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"typeReference":{"value":"STRING","type":"primitive"},"type":"alias"},"type_imdb:MovieId":{"declaration":{"name":{"originalName":"MovieId","camelCase":{"unsafeName":"movieId","safeName":"movieId"},"snakeCase":{"unsafeName":"movie_id","safeName":"movie_id"},"screamingSnakeCase":{"unsafeName":"MOVIE_ID","safeName":"MOVIE_ID"},"pascalCase":{"unsafeName":"MovieId","safeName":"MovieId"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"typeReference":{"value":"STRING","type":"primitive"},"type":"alias"},"type_imdb:ActorId":{"declaration":{"name":{"originalName":"ActorId","camelCase":{"unsafeName":"actorId","safeName":"actorId"},"snakeCase":{"unsafeName":"actor_id","safeName":"actor_id"},"screamingSnakeCase":{"unsafeName":"ACTOR_ID","safeName":"ACTOR_ID"},"pascalCase":{"unsafeName":"ActorId","safeName":"ActorId"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"typeReference":{"value":"STRING","type":"primitive"},"type":"alias"},"type_imdb:Movie":{"declaration":{"name":{"originalName":"Movie","camelCase":{"unsafeName":"movie","safeName":"movie"},"snakeCase":{"unsafeName":"movie","safeName":"movie"},"screamingSnakeCase":{"unsafeName":"MOVIE","safeName":"MOVIE"},"pascalCase":{"unsafeName":"Movie","safeName":"Movie"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"properties":[{"name":{"wireValue":"id","name":{"originalName":"id","camelCase":{"unsafeName":"id","safeName":"id"},"snakeCase":{"unsafeName":"id","safeName":"id"},"screamingSnakeCase":{"unsafeName":"ID","safeName":"ID"},"pascalCase":{"unsafeName":"Id","safeName":"Id"}}},"typeReference":{"value":"type_imdb:MovieId","type":"named"}},{"name":{"wireValue":"title","name":{"originalName":"title","camelCase":{"unsafeName":"title","safeName":"title"},"snakeCase":{"unsafeName":"title","safeName":"title"},"screamingSnakeCase":{"unsafeName":"TITLE","safeName":"TITLE"},"pascalCase":{"unsafeName":"Title","safeName":"Title"}}},"typeReference":{"value":"STRING","type":"primitive"}},{"name":{"wireValue":"rating","name":{"originalName":"rating","camelCase":{"unsafeName":"rating","safeName":"rating"},"snakeCase":{"unsafeName":"rating","safeName":"rating"},"screamingSnakeCase":{"unsafeName":"RATING","safeName":"RATING"},"pascalCase":{"unsafeName":"Rating","safeName":"Rating"}}},"typeReference":{"value":"DOUBLE","type":"primitive"}}],"additionalProperties":false,"type":"object"},"type_imdb:CreateMovieRequest":{"declaration":{"name":{"originalName":"CreateMovieRequest","camelCase":{"unsafeName":"createMovieRequest","safeName":"createMovieRequest"},"snakeCase":{"unsafeName":"create_movie_request","safeName":"create_movie_request"},"screamingSnakeCase":{"unsafeName":"CREATE_MOVIE_REQUEST","safeName":"CREATE_MOVIE_REQUEST"},"pascalCase":{"unsafeName":"CreateMovieRequest","safeName":"CreateMovieRequest"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"properties":[{"name":{"wireValue":"title","name":{"originalName":"title","camelCase":{"unsafeName":"title","safeName":"title"},"snakeCase":{"unsafeName":"title","safeName":"title"},"screamingSnakeCase":{"unsafeName":"TITLE","safeName":"TITLE"},"pascalCase":{"unsafeName":"Title","safeName":"Title"}}},"typeReference":{"value":"STRING","type":"primitive"}},{"name":{"wireValue":"ratings","name":{"originalName":"ratings","camelCase":{"unsafeName":"ratings","safeName":"ratings"},"snakeCase":{"unsafeName":"ratings","safeName":"ratings"},"screamingSnakeCase":{"unsafeName":"RATINGS","safeName":"RATINGS"},"pascalCase":{"unsafeName":"Ratings","safeName":"Ratings"}}},"typeReference":{"value":{"value":"DOUBLE","type":"primitive"},"type":"list"}}],"additionalProperties":false,"type":"object"},"type_imdb:DirectorWrapper":{"declaration":{"name":{"originalName":"DirectorWrapper","camelCase":{"unsafeName":"directorWrapper","safeName":"directorWrapper"},"snakeCase":{"unsafeName":"director_wrapper","safeName":"director_wrapper"},"screamingSnakeCase":{"unsafeName":"DIRECTOR_WRAPPER","safeName":"DIRECTOR_WRAPPER"},"pascalCase":{"unsafeName":"DirectorWrapper","safeName":"DirectorWrapper"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"properties":[{"name":{"wireValue":"director","name":{"originalName":"director","camelCase":{"unsafeName":"director","safeName":"director"},"snakeCase":{"unsafeName":"director","safeName":"director"},"screamingSnakeCase":{"unsafeName":"DIRECTOR","safeName":"DIRECTOR"},"pascalCase":{"unsafeName":"Director","safeName":"Director"}}},"typeReference":{"value":"type_director:Director","type":"named"}}],"additionalProperties":false,"type":"object"},"type_imdb:EmptyObject":{"declaration":{"name":{"originalName":"EmptyObject","camelCase":{"unsafeName":"emptyObject","safeName":"emptyObject"},"snakeCase":{"unsafeName":"empty_object","safeName":"empty_object"},"screamingSnakeCase":{"unsafeName":"EMPTY_OBJECT","safeName":"EMPTY_OBJECT"},"pascalCase":{"unsafeName":"EmptyObject","safeName":"EmptyObject"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"properties":[],"additionalProperties":false,"type":"object"},"type_imdb:Person":{"declaration":{"name":{"originalName":"Person","camelCase":{"unsafeName":"person","safeName":"person"},"snakeCase":{"unsafeName":"person","safeName":"person"},"screamingSnakeCase":{"unsafeName":"PERSON","safeName":"PERSON"},"pascalCase":{"unsafeName":"Person","safeName":"Person"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"discriminant":{"wireValue":"type","name":{"originalName":"type","camelCase":{"unsafeName":"type","safeName":"type"},"snakeCase":{"unsafeName":"type","safeName":"type"},"screamingSnakeCase":{"unsafeName":"TYPE","safeName":"TYPE"},"pascalCase":{"unsafeName":"Type","safeName":"Type"}}},"types":{"actor":{"typeReference":{"value":"type_imdb:ActorId","type":"named"},"discriminantValue":{"wireValue":"actor","name":{"originalName":"actor","camelCase":{"unsafeName":"actor","safeName":"actor"},"snakeCase":{"unsafeName":"actor","safeName":"actor"},"screamingSnakeCase":{"unsafeName":"ACTOR","safeName":"ACTOR"},"pascalCase":{"unsafeName":"Actor","safeName":"Actor"}}},"type":"singleProperty"},"director":{"typeId":"type_director:Director","discriminantValue":{"wireValue":"director","name":{"originalName":"director","camelCase":{"unsafeName":"director","safeName":"director"},"snakeCase":{"unsafeName":"director","safeName":"director"},"screamingSnakeCase":{"unsafeName":"DIRECTOR","safeName":"DIRECTOR"},"pascalCase":{"unsafeName":"Director","safeName":"Director"}}},"properties":[],"type":"samePropertiesAsObject"},"producer":{"typeId":"type_imdb:EmptyObject","discriminantValue":{"wireValue":"producer","name":{"originalName":"producer","camelCase":{"unsafeName":"producer","safeName":"producer"},"snakeCase":{"unsafeName":"producer","safeName":"producer"},"screamingSnakeCase":{"unsafeName":"PRODUCER","safeName":"PRODUCER"},"pascalCase":{"unsafeName":"Producer","safeName":"Producer"}}},"properties":[],"type":"samePropertiesAsObject"},"cinematographer":{"typeId":"type_imdb:EmptyObject","discriminantValue":{"wireValue":"cinematographer","name":{"originalName":"cinematographer","camelCase":{"unsafeName":"cinematographer","safeName":"cinematographer"},"snakeCase":{"unsafeName":"cinematographer","safeName":"cinematographer"},"screamingSnakeCase":{"unsafeName":"CINEMATOGRAPHER","safeName":"CINEMATOGRAPHER"},"pascalCase":{"unsafeName":"Cinematographer","safeName":"Cinematographer"}}},"properties":[],"type":"samePropertiesAsObject"}},"type":"discriminatedUnion"},"type_imdb:RecursiveType":{"declaration":{"name":{"originalName":"RecursiveType","camelCase":{"unsafeName":"recursiveType","safeName":"recursiveType"},"snakeCase":{"unsafeName":"recursive_type","safeName":"recursive_type"},"screamingSnakeCase":{"unsafeName":"RECURSIVE_TYPE","safeName":"RECURSIVE_TYPE"},"pascalCase":{"unsafeName":"RecursiveType","safeName":"RecursiveType"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"properties":[{"name":{"wireValue":"title","name":{"originalName":"title","camelCase":{"unsafeName":"title","safeName":"title"},"snakeCase":{"unsafeName":"title","safeName":"title"},"screamingSnakeCase":{"unsafeName":"TITLE","safeName":"TITLE"},"pascalCase":{"unsafeName":"Title","safeName":"Title"}}},"typeReference":{"value":"STRING","type":"primitive"}},{"name":{"wireValue":"ratings","name":{"originalName":"ratings","camelCase":{"unsafeName":"ratings","safeName":"ratings"},"snakeCase":{"unsafeName":"ratings","safeName":"ratings"},"screamingSnakeCase":{"unsafeName":"RATINGS","safeName":"RATINGS"},"pascalCase":{"unsafeName":"Ratings","safeName":"Ratings"}}},"typeReference":{"value":{"value":"DOUBLE","type":"primitive"},"type":"list"}},{"name":{"wireValue":"selfReferencing","name":{"originalName":"selfReferencing","camelCase":{"unsafeName":"selfReferencing","safeName":"selfReferencing"},"snakeCase":{"unsafeName":"self_referencing","safeName":"self_referencing"},"screamingSnakeCase":{"unsafeName":"SELF_REFERENCING","safeName":"SELF_REFERENCING"},"pascalCase":{"unsafeName":"SelfReferencing","safeName":"SelfReferencing"}}},"typeReference":{"value":{"value":"type_imdb:RecursiveType","type":"named"},"type":"list"}}],"extends":["type_imdb:CreateMovieRequest"],"additionalProperties":false,"type":"object"}},"headers":[{"name":{"wireValue":"X-API-VERSION","name":{"originalName":"apiVersion","camelCase":{"unsafeName":"apiVersion","safeName":"apiVersion"},"snakeCase":{"unsafeName":"api_version","safeName":"api_version"},"screamingSnakeCase":{"unsafeName":"API_VERSION","safeName":"API_VERSION"},"pascalCase":{"unsafeName":"ApiVersion","safeName":"ApiVersion"}}},"typeReference":{"value":{"value":"STRING","type":"primitive"},"type":"optional"}}],"endpoints":{"endpoint_imdb.createMovie":{"declaration":{"name":{"originalName":"createMovie","camelCase":{"unsafeName":"createMovie","safeName":"createMovie"},"snakeCase":{"unsafeName":"create_movie","safeName":"create_movie"},"screamingSnakeCase":{"unsafeName":"CREATE_MOVIE","safeName":"CREATE_MOVIE"},"pascalCase":{"unsafeName":"CreateMovie","safeName":"CreateMovie"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"location":{"method":"POST","path":"/test/{rootPathParam}/movies"},"request":{"pathParameters":[],"body":{"value":{"value":"type_imdb:CreateMovieRequest","type":"named"},"type":"typeReference"},"type":"body"},"response":{"type":"json"},"examples":[{"id":"b1661658","isUserSpecified":true,"endpoint":{"method":"POST","path":"/test/{rootPathParam}/movies"},"headers":{},"pathParameters":{"rootPathParam":"root"},"queryParameters":{},"requestBody":{"title":"Shrek","ratings":[10,10,10,10]}},{"id":"c66b4be5","isUserSpecified":true,"endpoint":{"method":"POST","path":"/test/{rootPathParam}/movies"},"headers":{},"pathParameters":{"rootPathParam":"root"},"queryParameters":{},"requestBody":{"title":"Winnie the Pooh","ratings":[1,2,3]}},{"id":"df44c04d","isUserSpecified":false,"endpoint":{"method":"POST","path":"/test/{rootPathParam}/movies"},"headers":{},"pathParameters":{"rootPathParam":"rootPathParam"},"queryParameters":{},"requestBody":{"title":"title","ratings":[1.1,1.1]}},{"id":"edf15cf8","isUserSpecified":false,"endpoint":{"method":"POST","path":"/test/{rootPathParam}/movies"},"headers":{},"pathParameters":{"rootPathParam":"rootPathParam"},"queryParameters":{},"requestBody":{"title":"title","ratings":[1.1,1.1]}}]},"endpoint_imdb.getMovie":{"declaration":{"name":{"originalName":"getMovie","camelCase":{"unsafeName":"getMovie","safeName":"getMovie"},"snakeCase":{"unsafeName":"get_movie","safeName":"get_movie"},"screamingSnakeCase":{"unsafeName":"GET_MOVIE","safeName":"GET_MOVIE"},"pascalCase":{"unsafeName":"GetMovie","safeName":"GetMovie"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"location":{"method":"GET","path":"/test/{rootPathParam}/movies/{movieId}"},"request":{"declaration":{"name":{"originalName":"GetMovieRequest","camelCase":{"unsafeName":"getMovieRequest","safeName":"getMovieRequest"},"snakeCase":{"unsafeName":"get_movie_request","safeName":"get_movie_request"},"screamingSnakeCase":{"unsafeName":"GET_MOVIE_REQUEST","safeName":"GET_MOVIE_REQUEST"},"pascalCase":{"unsafeName":"GetMovieRequest","safeName":"GetMovieRequest"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"pathParameters":[{"name":{"name":{"originalName":"movieId","camelCase":{"unsafeName":"movieId","safeName":"movieId"},"snakeCase":{"unsafeName":"movie_id","safeName":"movie_id"},"screamingSnakeCase":{"unsafeName":"MOVIE_ID","safeName":"MOVIE_ID"},"pascalCase":{"unsafeName":"MovieId","safeName":"MovieId"}},"wireValue":"movieId"},"typeReference":{"value":"type_imdb:MovieId","type":"named"}}],"queryParameters":[{"name":{"wireValue":"movieName","name":{"originalName":"movieName","camelCase":{"unsafeName":"movieName","safeName":"movieName"},"snakeCase":{"unsafeName":"movie_name","safeName":"movie_name"},"screamingSnakeCase":{"unsafeName":"MOVIE_NAME","safeName":"MOVIE_NAME"},"pascalCase":{"unsafeName":"MovieName","safeName":"MovieName"}}},"typeReference":{"value":{"value":"STRING","type":"primitive"},"type":"list"}}],"headers":[],"metadata":{"includePathParameters":false,"onlyPathParameters":false},"type":"inlined"},"response":{"type":"json"},"examples":[{"id":"a2c1f6ab","isUserSpecified":true,"endpoint":{"method":"GET","path":"/test/{rootPathParam}/movies/{movieId}"},"headers":{},"pathParameters":{"rootPathParam":"root","movieId":"id-123"},"queryParameters":{"movieName":"hello"}},{"id":"51944a56","isUserSpecified":true,"endpoint":{"method":"GET","path":"/test/{rootPathParam}/movies/{movieId}"},"headers":{},"pathParameters":{"rootPathParam":"root","movieId":"id-123"},"queryParameters":{"movieName":"hello"}},{"id":"7d40e807","isUserSpecified":false,"endpoint":{"method":"GET","path":"/test/{rootPathParam}/movies/{movieId}"},"headers":{},"pathParameters":{"rootPathParam":"rootPathParam","movieId":"movieId"},"queryParameters":{"movieName":"movieName"}},{"id":"81bc2f17","isUserSpecified":false,"endpoint":{"method":"GET","path":"/test/{rootPathParam}/movies/{movieId}"},"headers":{},"pathParameters":{"rootPathParam":"rootPathParam","movieId":"movieId"},"queryParameters":{"movieName":"movieName"}},{"id":"79a80950","isUserSpecified":false,"endpoint":{"method":"GET","path":"/test/{rootPathParam}/movies/{movieId}"},"headers":{},"pathParameters":{"rootPathParam":"rootPathParam","movieId":"movieId"},"queryParameters":{"movieName":"movieName"}}]},"endpoint_imdb.delete":{"declaration":{"name":{"originalName":"delete","camelCase":{"unsafeName":"delete","safeName":"delete"},"snakeCase":{"unsafeName":"delete","safeName":"delete"},"screamingSnakeCase":{"unsafeName":"DELETE","safeName":"DELETE"},"pascalCase":{"unsafeName":"Delete","safeName":"Delete"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"location":{"method":"DELETE","path":"/test/{rootPathParam}/movies/{movieId}"},"request":{"pathParameters":[{"name":{"name":{"originalName":"movieId","camelCase":{"unsafeName":"movieId","safeName":"movieId"},"snakeCase":{"unsafeName":"movie_id","safeName":"movie_id"},"screamingSnakeCase":{"unsafeName":"MOVIE_ID","safeName":"MOVIE_ID"},"pascalCase":{"unsafeName":"MovieId","safeName":"MovieId"}},"wireValue":"movieId"},"typeReference":{"value":"type_imdb:MovieId","type":"named"}}],"type":"body"},"response":{"type":"json"},"examples":[{"id":"e1d0202c","isUserSpecified":false,"endpoint":{"method":"DELETE","path":"/test/{rootPathParam}/movies/{movieId}"},"headers":{},"pathParameters":{"rootPathParam":"rootPathParam","movieId":"movieId"},"queryParameters":{}},{"id":"9056d4fb","isUserSpecified":false,"endpoint":{"method":"DELETE","path":"/test/{rootPathParam}/movies/{movieId}"},"headers":{},"pathParameters":{"rootPathParam":"rootPathParam","movieId":"movieId"},"queryParameters":{}}]},"endpoint_imdb.upload":{"declaration":{"name":{"originalName":"upload","camelCase":{"unsafeName":"upload","safeName":"upload"},"snakeCase":{"unsafeName":"upload","safeName":"upload"},"screamingSnakeCase":{"unsafeName":"UPLOAD","safeName":"UPLOAD"},"pascalCase":{"unsafeName":"Upload","safeName":"Upload"}},"fernFilepath":{"allParts":[{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}],"packagePath":[],"file":{"originalName":"imdb","camelCase":{"unsafeName":"imdb","safeName":"imdb"},"snakeCase":{"unsafeName":"imdb","safeName":"imdb"},"screamingSnakeCase":{"unsafeName":"IMDB","safeName":"IMDB"},"pascalCase":{"unsafeName":"Imdb","safeName":"Imdb"}}}},"location":{"method":"POST","path":"/test/{rootPathParam}/movies/upload/{movieId}"},"request":{"pathParameters":[{"name":{"name":{"originalName":"movieId","camelCase":{"unsafeName":"movieId","safeName":"movieId"},"snakeCase":{"unsafeName":"movie_id","safeName":"movie_id"},"screamingSnakeCase":{"unsafeName":"MOVIE_ID","safeName":"MOVIE_ID"},"pascalCase":{"unsafeName":"MovieId","safeName":"MovieId"}},"wireValue":"movieId"},"typeReference":{"value":"type_imdb:MovieId","type":"named"}}],"body":{"type":"bytes"},"type":"body"},"response":{"type":"json"},"examples":[]}},"pathParameters":[{"name":{"name":{"originalName":"rootPathParam","camelCase":{"unsafeName":"rootPathParam","safeName":"rootPathParam"},"snakeCase":{"unsafeName":"root_path_param","safeName":"root_path_param"},"screamingSnakeCase":{"unsafeName":"ROOT_PATH_PARAM","safeName":"ROOT_PATH_PARAM"},"pascalCase":{"unsafeName":"RootPathParam","safeName":"RootPathParam"}},"wireValue":"rootPathParam"},"typeReference":{"value":"STRING","type":"primitive"}}]} \ No newline at end of file diff --git a/packages/cli/ete-tests/src/tests/ir/__snapshots__/ir.test.ts.snap b/packages/cli/ete-tests/src/tests/ir/__snapshots__/ir.test.ts.snap index 9f4d8a524419..86ebc370fbb6 100644 --- a/packages/cli/ete-tests/src/tests/ir/__snapshots__/ir.test.ts.snap +++ b/packages/cli/ete-tests/src/tests/ir/__snapshots__/ir.test.ts.snap @@ -9027,7 +9027,7 @@ exports[`ir > {"name":"migration","version":"v53"} 1`] = ` "autogeneratedExamples": [ { "example": { - "id": "af5006c6", + "id": "ad8355e6", "name": null, "url": "/movies", "rootPathParameters": [], @@ -9451,7 +9451,7 @@ exports[`ir > {"name":"migration","version":"v53"} 1`] = ` }, { "example": { - "id": "12352e13", + "id": "382e8503", "name": null, "url": "/movies", "rootPathParameters": [], @@ -11286,7 +11286,7 @@ exports[`ir > {"name":"migration","version":"v53"} 1`] = ` "autogeneratedExamples": [ { "example": { - "id": "b4899d1c", + "id": "4d7afefc", "name": null, "url": "/movies/movieId", "rootPathParameters": [], @@ -11910,7 +11910,7 @@ exports[`ir > {"name":"migration","version":"v53"} 1`] = ` }, { "example": { - "id": "b198c97c", + "id": "196b404c", "name": null, "url": "/movies/movieId", "rootPathParameters": [], @@ -12153,7 +12153,7 @@ exports[`ir > {"name":"migration","version":"v53"} 1`] = ` }, { "example": { - "id": "4be98dcb", + "id": "448a81cb", "name": null, "url": "/movies/movieId", "rootPathParameters": [], @@ -12704,7 +12704,7 @@ exports[`ir > {"name":"migration","version":"v53"} 1`] = ` "autogeneratedExamples": [ { "example": { - "id": "b86e256f", + "id": "4ffc544f", "name": null, "url": "/movies/movieId", "rootPathParameters": [], @@ -12834,7 +12834,7 @@ exports[`ir > {"name":"migration","version":"v53"} 1`] = ` }, { "example": { - "id": "1fcfc248", + "id": "dfd0bd58", "name": null, "url": "/movies/movieId", "rootPathParameters": [], @@ -15427,7 +15427,7 @@ exports[`ir > {"name":"multiple-environment-urls"} 1`] = ` "autogeneratedExamples": [ { "example": { - "id": "82444d62", + "id": "7cf5c162", "url": "/a", "name": null, "endpointHeaders": [], @@ -15498,7 +15498,7 @@ exports[`ir > {"name":"multiple-environment-urls"} 1`] = ` "autogeneratedExamples": [ { "example": { - "id": "82444d62", + "id": "7cf5c162", "url": "/b", "name": null, "endpointHeaders": [], @@ -15598,7 +15598,7 @@ exports[`ir > {"name":"multiple-environment-urls"} 1`] = ` "autogeneratedExamples": [ { "example": { - "id": "82444d62", + "id": "7cf5c162", "url": "", "name": null, "endpointHeaders": [], @@ -16883,7 +16883,7 @@ exports[`ir > {"name":"nested-example-reference"} 1`] = ` "autogeneratedExamples": [ { "example": { - "id": "c351a3f9", + "id": "a877f409", "url": "/nested", "name": null, "endpointHeaders": [], @@ -17980,7 +17980,7 @@ exports[`ir > {"name":"packages"} 1`] = ` "autogeneratedExamples": [ { "example": { - "id": "82444d62", + "id": "7cf5c162", "url": "", "name": null, "endpointHeaders": [], @@ -19001,7 +19001,7 @@ exports[`ir > {"name":"response-property"} 1`] = ` "autogeneratedExamples": [ { "example": { - "id": "d7b56075", + "id": "309fe535", "url": "/movie", "name": null, "endpointHeaders": [], @@ -19293,7 +19293,7 @@ exports[`ir > {"name":"response-property"} 1`] = ` "autogeneratedExamples": [ { "example": { - "id": "d7b56075", + "id": "309fe535", "url": "/movie", "name": null, "endpointHeaders": [], @@ -20433,7 +20433,7 @@ exports[`ir > {"name":"simple","audiences":["internal"]} 1`] = ` "autogeneratedExamples": [ { "example": { - "id": "97aa4775", + "id": "935e18d5", "url": "/test/rootPathParam/movies", "name": null, "endpointHeaders": [], @@ -20537,7 +20537,7 @@ exports[`ir > {"name":"simple","audiences":["internal"]} 1`] = ` }, { "example": { - "id": "2dfcfb01", + "id": "9f02b741", "url": "/test/rootPathParam/movies", "name": null, "endpointHeaders": [], @@ -22194,7 +22194,7 @@ exports[`ir > {"name":"simple","audiences":["test"]} 1`] = ` "autogeneratedExamples": [ { "example": { - "id": "ecaa4a1d", + "id": "df44c04d", "url": "/test/rootPathParam/movies", "name": null, "endpointHeaders": [], @@ -22383,7 +22383,7 @@ exports[`ir > {"name":"simple","audiences":["test"]} 1`] = ` }, { "example": { - "id": "bb62c8b8", + "id": "edf15cf8", "url": "/test/rootPathParam/movies", "name": null, "endpointHeaders": [], @@ -26032,7 +26032,7 @@ exports[`ir > {"name":"simple"} 1`] = ` "autogeneratedExamples": [ { "example": { - "id": "97aa4775", + "id": "935e18d5", "url": "/test/rootPathParam/movies", "name": null, "endpointHeaders": [], @@ -26136,7 +26136,7 @@ exports[`ir > {"name":"simple"} 1`] = ` }, { "example": { - "id": "2dfcfb01", + "id": "9f02b741", "url": "/test/rootPathParam/movies", "name": null, "endpointHeaders": [], @@ -26818,7 +26818,7 @@ exports[`ir > {"name":"simple"} 1`] = ` "autogeneratedExamples": [ { "example": { - "id": "ecaa4a1d", + "id": "df44c04d", "url": "/test/rootPathParam/movies", "name": null, "endpointHeaders": [], @@ -27007,7 +27007,7 @@ exports[`ir > {"name":"simple"} 1`] = ` }, { "example": { - "id": "bb62c8b8", + "id": "edf15cf8", "url": "/test/rootPathParam/movies", "name": null, "endpointHeaders": [], @@ -27742,7 +27742,7 @@ exports[`ir > {"name":"simple"} 1`] = ` "autogeneratedExamples": [ { "example": { - "id": "8da3f9d7", + "id": "7d40e807", "url": "/test/rootPathParam/movies/movieId", "name": null, "endpointHeaders": [], @@ -27966,7 +27966,7 @@ exports[`ir > {"name":"simple"} 1`] = ` }, { "example": { - "id": "f73bf377", + "id": "81bc2f17", "url": "/test/rootPathParam/movies/movieId", "name": null, "endpointHeaders": [], @@ -28079,7 +28079,7 @@ exports[`ir > {"name":"simple"} 1`] = ` }, { "example": { - "id": "d74d2200", + "id": "79a80950", "url": "/test/rootPathParam/movies/movieId", "name": null, "endpointHeaders": [], @@ -28338,7 +28338,7 @@ exports[`ir > {"name":"simple"} 1`] = ` "autogeneratedExamples": [ { "example": { - "id": "a87620bc", + "id": "e1d0202c", "url": "/test/rootPathParam/movies/movieId", "name": null, "endpointHeaders": [], @@ -28413,7 +28413,7 @@ exports[`ir > {"name":"simple"} 1`] = ` }, { "example": { - "id": "125475db", + "id": "9056d4fb", "url": "/test/rootPathParam/movies/movieId", "name": null, "endpointHeaders": [], @@ -31193,7 +31193,7 @@ exports[`ir > {"name":"streaming"} 1`] = ` "autogeneratedExamples": [ { "example": { - "id": "336e6e59", + "id": "96bde829", "url": "/movies/streaming", "name": null, "endpointHeaders": [], @@ -31338,7 +31338,7 @@ exports[`ir > {"name":"streaming"} 1`] = ` "autogeneratedExamples": [ { "example": { - "id": "8f952748", + "id": "4777458", "url": "/movies/maybe-streaming", "name": null, "endpointHeaders": [], @@ -32000,7 +32000,7 @@ exports[`ir > {"name":"variables"} 1`] = ` "autogeneratedExamples": [ { "example": { - "id": "20f4e400", + "id": "4d1b3780", "url": "/root/movies/foo", "name": null, "endpointHeaders": [], diff --git a/packages/cli/generation/remote-generation/remote-workspace-runner/src/__test__/buildLedgerInput.test.ts b/packages/cli/generation/remote-generation/remote-workspace-runner/src/__test__/buildLedgerInput.test.ts new file mode 100644 index 000000000000..d5d933b04242 --- /dev/null +++ b/packages/cli/generation/remote-generation/remote-workspace-runner/src/__test__/buildLedgerInput.test.ts @@ -0,0 +1,526 @@ +import { createHash } from "crypto"; +import { describe, expect, it } from "vitest"; +import { buildLedgerInput } from "../publishDocsLedger.js"; + +type BuildLedgerInputArgs = Parameters[0]; +type ApiDefinition = BuildLedgerInputArgs["apiDefinitions"] extends Map ? T : never; +type FileManifestEntry = NonNullable[string]; + +function sha256(data: string): string { + return createHash("sha256").update(Buffer.from(data, "utf-8")).digest("hex"); +} + +const MINIMAL_ROOT = { + type: "root" as const, + version: "v1" as const, + id: "root-1", + child: { + type: "unversioned" as const, + id: "uv-1", + child: { type: "sidebarRoot" as const, id: "sr-1", children: [] } + } +}; + +function makeDocsDefinition({ + pages = {}, + root = MINIMAL_ROOT +}: { + pages?: Record; + root?: unknown; +} = {}) { + // Minimal DocsDefinition shape — only the fields buildLedgerInput reads. + return { + pages, + config: { root } + } as Parameters[0]["docsDefinition"]; +} + +describe("buildLedgerInput", () => { + it("hashes page content and creates blob refs", () => { + const markdown = "# Hello World"; + const { localeEntry, blobs } = buildLedgerInput({ + docsDefinition: makeDocsDefinition({ pages: { "page-1": { markdown } } }), + apiDefinitions: new Map() + }); + + const expectedHash = sha256(markdown); + expect(localeEntry.pages["page-1"]).toEqual({ + hash: expectedHash, + contentType: "text/markdown", + contentLength: Buffer.byteLength(markdown, "utf-8") + }); + expect(blobs.has(expectedHash)).toBe(true); + }); + + it("rewrites legacy FileId markdown refs to path refs before hashing page blobs", () => { + const fileId = "5ea17f4b-98bd-4d97-a07b-e92a314825d0"; + const fullPath = "docs/assets/docs/astro-hypervisor.svg"; + const markdown = `![Diagram](file:${fileId})\n`; + const expectedMarkdown = `![Diagram](file:${fullPath})\n`; + const { localeEntry, blobs } = buildLedgerInput({ + docsDefinition: makeDocsDefinition({ pages: { "page-1": { markdown } } }), + apiDefinitions: new Map(), + fileIdToPath: new Map([[fileId, fullPath]]) + }); + + const expectedHash = sha256(expectedMarkdown); + expect(localeEntry.pages["page-1"]).toEqual({ + hash: expectedHash, + contentType: "text/markdown", + contentLength: Buffer.byteLength(expectedMarkdown, "utf-8"), + referencedFiles: [fullPath] + }); + expect(blobs.get(expectedHash)?.toString("utf-8")).toBe(expectedMarkdown); + expect([...blobs.values()].some((buf) => buf.toString("utf-8").includes(fileId))).toBe(false); + }); + + it("skips null/undefined pages", () => { + const pages = { "page-1": null } as unknown as Record; + const { localeEntry } = buildLedgerInput({ + docsDefinition: makeDocsDefinition({ pages }), + apiDefinitions: new Map() + }); + + expect(Object.keys(localeEntry.pages)).toHaveLength(0); + }); + + it("maps a minimal DocsConfig to a LedgerConfig shape (mostly empty fields)", () => { + const { localeEntry } = buildLedgerInput({ + docsDefinition: makeDocsDefinition(), + apiDefinitions: new Map() + }); + + // With only `root` set on the source DocsConfig every LedgerConfig + // field is `undefined` — but `localeEntry.config` itself is the populated + // ledger object (not `undefined`), unlike the prior workaround. + expect(localeEntry.config).toBeDefined(); + expect(localeEntry.config?.title).toBeUndefined(); + expect(localeEntry.config?.colorsV3).toBeUndefined(); + expect(localeEntry.config?.metadata).toBeUndefined(); + expect(localeEntry.config?.redirects).toBeUndefined(); + }); + + it("translates a DocsConfig logo FileId into a LedgerConfig ImageRef using fileManifest dimensions", () => { + // Source DocsConfig: colorsV3.dark.logo points to a FileId that + // matches a fileManifest entry's fullPath (current FDR behaviour). + const docsDefinition = { + pages: {}, + config: { + root: MINIMAL_ROOT, + colorsV3: { + type: "dark" as const, + accentPrimary: { r: 1, g: 2, b: 3 }, + logo: "assets/logo.png" + } + } + } as unknown as Parameters[0]["docsDefinition"]; + + const fileManifest: Record = { + "assets/logo.png": { + hash: "deadbeef", + contentType: "image/png", + contentLength: 1234, + filename: "logo.png", + width: 320, + height: 160 + } + }; + + const { localeEntry } = buildLedgerInput({ + docsDefinition, + apiDefinitions: new Map(), + fileManifest, + // Identity map: fileId === sanitizedPath in the current FDR flow. + fileIdToPath: new Map([["assets/logo.png", "assets/logo.png"]]) + }); + + expect(localeEntry.config?.colorsV3).toEqual({ + type: "dark", + accentPrimary: { r: 1, g: 2, b: 3 }, + logo: { path: "assets/logo.png", width: 320, height: 160 } + }); + }); + + it("carries the favicon FileId through to the LedgerConfig as a fullPath (any extension)", () => { + const docsDefinition = { + pages: {}, + config: { + root: MINIMAL_ROOT, + favicon: "docs/assets/favicon.svg" + } + } as unknown as Parameters[0]["docsDefinition"]; + + const { localeEntry } = buildLedgerInput({ + docsDefinition, + apiDefinitions: new Map(), + // Identity map: fileId === sanitizedPath in the current FDR flow. + fileIdToPath: new Map([["docs/assets/favicon.svg", "docs/assets/favicon.svg"]]) + }); + + expect(localeEntry.config?.favicon).toBe("docs/assets/favicon.svg"); + }); + + it("omits the favicon from LedgerConfig when absent in DocsConfig", () => { + const { localeEntry } = buildLedgerInput({ + docsDefinition: makeDocsDefinition(), + apiDefinitions: new Map() + }); + + expect(localeEntry.config?.favicon).toBeUndefined(); + }); + + it("drops a logo ImageRef when the file is not measured (no width/height in manifest)", () => { + const docsDefinition = { + pages: {}, + config: { + root: MINIMAL_ROOT, + colorsV3: { + type: "light" as const, + accentPrimary: { r: 4, g: 5, b: 6 }, + logo: "assets/unmeasured.svg" + } + } + } as unknown as Parameters[0]["docsDefinition"]; + + const fileManifest: Record = { + "assets/unmeasured.svg": { + hash: "cafef00d", + contentType: "image/svg+xml", + contentLength: 42, + filename: "unmeasured.svg" + // width/height intentionally omitted + } + }; + + const { localeEntry } = buildLedgerInput({ + docsDefinition, + apiDefinitions: new Map(), + fileManifest, + fileIdToPath: new Map([["assets/unmeasured.svg", "assets/unmeasured.svg"]]) + }); + + // Logo absent rather than emitted with placeholder dimensions. + expect(localeEntry.config?.colorsV3).toEqual({ + type: "light", + accentPrimary: { r: 4, g: 5, b: 6 }, + logo: undefined, + backgroundImage: undefined, + background: undefined, + border: undefined, + sidebarBackground: undefined, + headerBackground: undefined, + cardBackground: undefined + }); + }); + + it("defaults locale to en", () => { + const { localeEntry } = buildLedgerInput({ + docsDefinition: makeDocsDefinition(), + apiDefinitions: new Map() + }); + + expect(localeEntry.locale).toBe("en"); + }); + + it("uses config.root for the root field", () => { + const { localeEntry } = buildLedgerInput({ + docsDefinition: makeDocsDefinition({ root: MINIMAL_ROOT }), + apiDefinitions: new Map() + }); + + expect(localeEntry.root).toEqual(MINIMAL_ROOT); + }); + + it("deduplicates pages with identical content", () => { + const markdown = "same content"; + const { blobs } = buildLedgerInput({ + docsDefinition: makeDocsDefinition({ + pages: { + "page-a": { markdown }, + "page-b": { markdown } + } + }), + apiDefinitions: new Map() + }); + + // Two pages with the same content should produce one blob (content-addressed). + const pageHashes = new Set( + Object.values(blobs) + .filter((buf) => buf.toString("utf-8") === markdown) + .map((_, i) => i) + ); + // The blobs map is keyed by hash, so duplicate content = one entry. + const markdownHash = sha256(markdown); + expect(blobs.get(markdownHash)?.toString("utf-8")).toBe(markdown); + }); + + it("sets apiManifest to null when apiDefinitions is empty", () => { + const { localeEntry } = buildLedgerInput({ + docsDefinition: makeDocsDefinition(), + apiDefinitions: new Map() + }); + + expect(localeEntry.apiManifest).toBeNull(); + }); + + it("apiManifest blob hash is stable across Map insertion order (determinism guard)", () => { + // Reproduces the docs-ledger deterministic-hash bug: `apiDefinitions` + // is built by `Promise.all` of /api/register calls in CLI, so its Map + // insertion order is whichever round-trip completed first. Without + // `stableStringify`, byte-identical content would hash differently + // across publishes and the docs-ledger "no-op republish" fast-path + // would never fire. The two manifests below have identical entries + // inserted in opposite orders and MUST produce the same blob hash. + const minimalApiDefinition: ApiDefinition = { + types: {}, + subpackages: {}, + rootPackage: { + endpoints: [], + types: [], + subpackages: [], + websockets: [], + webhooks: [] + }, + auth: undefined, + snippetsConfiguration: {}, + globalHeaders: [] + }; + + const forward = new Map(); + forward.set("api-def-a", minimalApiDefinition); + forward.set("api-def-b", minimalApiDefinition); + + const reverse = new Map(); + reverse.set("api-def-b", minimalApiDefinition); + reverse.set("api-def-a", minimalApiDefinition); + + const { localeEntry: inForward } = buildLedgerInput({ + docsDefinition: makeDocsDefinition(), + apiDefinitions: forward + }); + const { localeEntry: inReverse } = buildLedgerInput({ + docsDefinition: makeDocsDefinition(), + apiDefinitions: reverse + }); + + expect(inForward.apiManifest?.hash).toBe(inReverse.apiManifest?.hash); + expect(inForward.apiManifest?.contentLength).toBe(inReverse.apiManifest?.contentLength); + }); + + it("serializes apiManifest as a JSON blob ref when apiDefinitions is non-empty", () => { + const minimalApiDefinition: ApiDefinition = { + types: {}, + subpackages: {}, + rootPackage: { + endpoints: [], + types: [], + subpackages: [], + websockets: [], + webhooks: [] + }, + auth: undefined, + snippetsConfiguration: {}, + globalHeaders: [] + }; + + const apiDefinitions = new Map(); + apiDefinitions.set("api-def-1", minimalApiDefinition); + + const { localeEntry, blobs } = buildLedgerInput({ + docsDefinition: makeDocsDefinition(), + apiDefinitions + }); + + expect(localeEntry.apiManifest).not.toBeNull(); + expect(localeEntry.apiManifest?.contentType).toBe("application/json"); + expect(localeEntry.apiManifest?.contentLength).toBeGreaterThan(0); + + // The blob should exist in the blob map. + const manifestBuf = blobs.get(localeEntry.apiManifest?.hash ?? ""); + expect(manifestBuf).toBeDefined(); + + // Round-trip: the blob content should deserialize to match the input map. + const parsed = JSON.parse(manifestBuf?.toString("utf-8") ?? ""); + expect(parsed).toEqual({ "api-def-1": minimalApiDefinition }); + }); + + it("produces different apiManifest blobs for different apiDefinitions maps (locale isolation)", () => { + const baseApiDefinition: ApiDefinition = { + types: {}, + subpackages: {}, + rootPackage: { + endpoints: [], + types: [], + subpackages: [], + websockets: [], + webhooks: [] + }, + auth: undefined, + snippetsConfiguration: {}, + globalHeaders: [], + apiName: "plant-api" + }; + + const translatedApiDefinition: ApiDefinition = { + ...baseApiDefinition, + apiName: "plant-api-zh" + }; + + const baseMap = new Map([["api-1", baseApiDefinition]]); + const translatedMap = new Map([["api-1", translatedApiDefinition]]); + const docsDefinition = makeDocsDefinition(); + + const { localeEntry: baseEntry, blobs: baseBlobs } = buildLedgerInput({ + docsDefinition, + apiDefinitions: baseMap + }); + const { localeEntry: translatedEntry, blobs: translatedBlobs } = buildLedgerInput({ + docsDefinition, + apiDefinitions: translatedMap, + locale: "zh" + }); + + // Both should have apiManifest blobs. + expect(baseEntry.apiManifest).not.toBeNull(); + expect(translatedEntry.apiManifest).not.toBeNull(); + + // The hashes must differ because the API content differs. + expect(baseEntry.apiManifest?.hash).not.toBe(translatedEntry.apiManifest?.hash); + + // Each blob should deserialize to its respective definition. + const baseParsed = JSON.parse(baseBlobs.get(baseEntry.apiManifest?.hash ?? "")?.toString("utf-8") ?? ""); + const translatedParsed = JSON.parse( + translatedBlobs.get(translatedEntry.apiManifest?.hash ?? "")?.toString("utf-8") ?? "" + ); + expect(baseParsed["api-1"].apiName).toBe("plant-api"); + expect(translatedParsed["api-1"].apiName).toBe("plant-api-zh"); + }); + + it("forwards fileManifest unchanged (file blobs are loaded lazily, not included in blob map)", () => { + // Image entry — exercises width/height fields. + const imageBytes = Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]); // PNG header + const imageHash = createHash("sha256").update(new Uint8Array(imageBytes)).digest("hex"); + const imageEntry: FileManifestEntry = { + hash: imageHash, + contentType: "image/png", + contentLength: imageBytes.byteLength, + filename: "logo.png", + width: 200, + height: 100 + }; + + // Non-image entry — no width/height. + const docBytes = Buffer.from("hello world", "utf-8"); + const docHash = createHash("sha256").update(new Uint8Array(docBytes)).digest("hex"); + const docEntry: FileManifestEntry = { + hash: docHash, + contentType: "text/plain", + contentLength: docBytes.byteLength, + filename: "notes.txt" + }; + + const fileManifest: Record = { + "assets/logo.png": imageEntry, + "docs/notes.txt": docEntry + }; + + const { localeEntry, blobs } = buildLedgerInput({ + docsDefinition: makeDocsDefinition(), + apiDefinitions: new Map(), + fileManifest + }); + + // fileManifest round-trips unchanged. + expect(localeEntry.fileManifest).toEqual(fileManifest); + + // File blobs are NOT in the blob map — they are loaded lazily during + // the upload step via filePaths (hash → absolute path). + expect(blobs.has(imageHash)).toBe(false); + expect(blobs.has(docHash)).toBe(false); + }); + + it("legacy behaviour: omitting fileManifest still works", () => { + const { localeEntry, blobs } = buildLedgerInput({ + docsDefinition: makeDocsDefinition({ pages: { "page-1": { markdown: "# hi" } } }), + apiDefinitions: new Map() + }); + + expect(localeEntry.fileManifest).toBeUndefined(); + // Blob map still contains the page + config blobs. + expect(blobs.size).toBeGreaterThan(0); + }); + + // ── ADR 0011: git provenance ────────────────────────────────────── + + it("forwards git into DocsPublishInput when provided", () => { + const git = { + repoUrl: "https://github.com/acme/docs", + branch: "main", + commitSha: "abc123" + }; + const { localeEntry } = buildLedgerInput({ + docsDefinition: makeDocsDefinition(), + git, + apiDefinitions: new Map() + }); + + expect(localeEntry.git).toEqual(git); + }); + + it("omits git from DocsPublishInput when not provided", () => { + const { localeEntry } = buildLedgerInput({ + docsDefinition: makeDocsDefinition(), + apiDefinitions: new Map() + }); + + expect(localeEntry.git).toBeUndefined(); + }); + + it("forwards git without commitSha when commitSha is omitted", () => { + const git = { + repoUrl: "https://gitlab.com/acme/docs", + branch: "feature/x" + }; + const { localeEntry } = buildLedgerInput({ + docsDefinition: makeDocsDefinition(), + git, + apiDefinitions: new Map() + }); + + expect(localeEntry.git).toEqual(git); + expect(localeEntry.git?.commitSha).toBeUndefined(); + }); + + // ── integrations mapping ────────────────────────────────────────── + + it("maps integrations.intercom into LedgerConfig (context7 excluded)", () => { + const docsDefinition = { + pages: {}, + config: { + root: MINIMAL_ROOT, + integrations: { + intercom: "app_abc123", + context7: "file-id-for-context7" + } + } + } as unknown as Parameters[0]["docsDefinition"]; + + const { localeEntry } = buildLedgerInput({ + docsDefinition, + apiDefinitions: new Map() + }); + + expect(localeEntry.config?.integrations).toEqual({ + intercom: "app_abc123" + }); + }); + + it("omits integrations from LedgerConfig when absent in DocsConfig", () => { + const { localeEntry } = buildLedgerInput({ + docsDefinition: makeDocsDefinition(), + apiDefinitions: new Map() + }); + + expect(localeEntry.config?.integrations).toBeUndefined(); + }); +}); diff --git a/packages/cli/generation/remote-generation/remote-workspace-runner/src/__test__/buildLocaleApiDefinitions.test.ts b/packages/cli/generation/remote-generation/remote-workspace-runner/src/__test__/buildLocaleApiDefinitions.test.ts new file mode 100644 index 000000000000..3867fcb25e46 --- /dev/null +++ b/packages/cli/generation/remote-generation/remote-workspace-runner/src/__test__/buildLocaleApiDefinitions.test.ts @@ -0,0 +1,171 @@ +import { type TranslatedApiSpec } from "@fern-api/docs-resolver"; +import { type APIV1Write } from "@fern-api/fdr-sdk"; +import { type IntermediateRepresentation } from "@fern-api/ir-sdk"; +import { type TaskContext } from "@fern-api/task-context"; +import { beforeEach, describe, expect, it, type Mock, vi } from "vitest"; +import { buildLocaleApiDefinitions } from "../publishDocsLedger.js"; + +// Mock the heavy @fern-api/register module so we don't need a real IR. +vi.mock("@fern-api/register", () => ({ + convertIrToFdrApi: vi.fn() +})); + +// eslint-disable-next-line @typescript-eslint/no-require-imports +const { convertIrToFdrApi } = await import("@fern-api/register"); +const mockConvertIrToFdrApi = convertIrToFdrApi as Mock; + +function makeApiDefinition(overrides: Partial = {}): APIV1Write.ApiDefinition { + return { + types: {}, + subpackages: {}, + rootPackage: { + endpoints: [], + types: [], + subpackages: [], + websockets: [], + webhooks: [] + }, + auth: undefined, + snippetsConfiguration: {}, + globalHeaders: [], + ...overrides + } as unknown as APIV1Write.ApiDefinition; +} + +function makeTranslatedSpec(overrides: Partial = {}): TranslatedApiSpec { + return { + ir: {} as IntermediateRepresentation, + snippetsConfig: {}, + apiName: "translated-api", + ...overrides + } as TranslatedApiSpec; +} + +function makeContext(): TaskContext { + return { + logger: { + debug: vi.fn(), + info: vi.fn(), + warn: vi.fn(), + error: vi.fn() + } + } as unknown as TaskContext; +} + +describe("buildLocaleApiDefinitions", () => { + beforeEach(() => { + mockConvertIrToFdrApi.mockReset(); + }); + + it("replaces base definitions with translated ones for matching API IDs", () => { + const baseDef = makeApiDefinition({ apiName: "english" } as Partial); + const translatedDef = makeApiDefinition({ apiName: "chinese" } as Partial); + mockConvertIrToFdrApi.mockReturnValue(translatedDef); + + const baseApiDefinitions = new Map([["api-1", baseDef]]); + const translatedSpecs = new Map([["api-1", makeTranslatedSpec()]]); + const context = makeContext(); + + const result = buildLocaleApiDefinitions({ + baseApiDefinitions, + translatedSpecs, + context + }); + + expect(result.get("api-1")).toBe(translatedDef); + expect(result.get("api-1")).not.toBe(baseDef); + }); + + it("preserves base definitions for APIs without translations", () => { + const baseDef1 = makeApiDefinition(); + const baseDef2 = makeApiDefinition(); + const translatedDef = makeApiDefinition({ apiName: "translated" } as Partial); + mockConvertIrToFdrApi.mockReturnValue(translatedDef); + + const baseApiDefinitions = new Map([ + ["api-1", baseDef1], + ["api-2", baseDef2] + ]); + // Only api-1 has a translation. + const translatedSpecs = new Map([["api-1", makeTranslatedSpec()]]); + const context = makeContext(); + + const result = buildLocaleApiDefinitions({ + baseApiDefinitions, + translatedSpecs, + context + }); + + expect(result.get("api-1")).toBe(translatedDef); + expect(result.get("api-2")).toBe(baseDef2); + }); + + it("does not mutate the original base map", () => { + const baseDef = makeApiDefinition(); + const translatedDef = makeApiDefinition({ apiName: "translated" } as Partial); + mockConvertIrToFdrApi.mockReturnValue(translatedDef); + + const baseApiDefinitions = new Map([["api-1", baseDef]]); + const translatedSpecs = new Map([["api-1", makeTranslatedSpec()]]); + const context = makeContext(); + + buildLocaleApiDefinitions({ + baseApiDefinitions, + translatedSpecs, + context + }); + + // The original base map should still have the original definition. + expect(baseApiDefinitions.get("api-1")).toBe(baseDef); + }); + + it("falls back to base definition when conversion throws", () => { + const baseDef = makeApiDefinition(); + mockConvertIrToFdrApi.mockImplementation(() => { + throw new Error("IR conversion failed"); + }); + + const baseApiDefinitions = new Map([["api-1", baseDef]]); + const translatedSpecs = new Map([["api-1", makeTranslatedSpec()]]); + const context = makeContext(); + + const result = buildLocaleApiDefinitions({ + baseApiDefinitions, + translatedSpecs, + context + }); + + // Should fall back to base, not throw. + expect(result.get("api-1")).toBe(baseDef); + expect(context.logger.warn).toHaveBeenCalledWith( + expect.stringContaining('Failed to convert translated API definition for API "api-1"') + ); + }); + + it("passes correct arguments to convertIrToFdrApi", () => { + const translatedDef = makeApiDefinition(); + mockConvertIrToFdrApi.mockReturnValue(translatedDef); + + const spec = makeTranslatedSpec({ + apiName: "plant-api", + snippetsConfig: { typescriptSdk: undefined } as unknown as APIV1Write.SnippetsConfig + }); + const context = makeContext(); + + buildLocaleApiDefinitions({ + baseApiDefinitions: new Map([["api-1", makeApiDefinition()]]), + translatedSpecs: new Map([["api-1", spec]]), + context + }); + + expect(mockConvertIrToFdrApi).toHaveBeenCalledWith({ + ir: spec.ir, + snippetsConfig: spec.snippetsConfig, + playgroundConfig: spec.playgroundConfig, + graphqlOperations: spec.graphqlOperations, + graphqlTypes: spec.graphqlTypes, + context, + apiNameOverride: "plant-api" + }); + }); +}); diff --git a/packages/cli/generation/remote-generation/remote-workspace-runner/src/__test__/docsDeployMode.test.ts b/packages/cli/generation/remote-generation/remote-workspace-runner/src/__test__/docsDeployMode.test.ts new file mode 100644 index 000000000000..343b2a6545ef --- /dev/null +++ b/packages/cli/generation/remote-generation/remote-workspace-runner/src/__test__/docsDeployMode.test.ts @@ -0,0 +1,62 @@ +import { afterEach, describe, expect, it } from "vitest"; +import { getDocsDeployMode } from "../docsDeployMode.js"; + +describe("getDocsDeployMode", () => { + const originalDeployMode = process.env.FERN_DOCS_DEPLOY_MODE; + const originalSelfHosted = process.env.FERN_SELF_HOSTED; + + afterEach(() => { + if (originalDeployMode === undefined) { + delete process.env.FERN_DOCS_DEPLOY_MODE; + } else { + process.env.FERN_DOCS_DEPLOY_MODE = originalDeployMode; + } + if (originalSelfHosted === undefined) { + delete process.env.FERN_SELF_HOSTED; + } else { + process.env.FERN_SELF_HOSTED = originalSelfHosted; + } + }); + + it("defaults to legacy when env var is unset", () => { + delete process.env.FERN_DOCS_DEPLOY_MODE; + expect(getDocsDeployMode()).toBe("legacy"); + }); + + it("defaults to legacy when env var is empty", () => { + process.env.FERN_DOCS_DEPLOY_MODE = ""; + expect(getDocsDeployMode()).toBe("legacy"); + }); + + it("returns ledger", () => { + process.env.FERN_DOCS_DEPLOY_MODE = "ledger"; + expect(getDocsDeployMode()).toBe("ledger"); + }); + + it("is case-insensitive", () => { + process.env.FERN_DOCS_DEPLOY_MODE = "LEDGER"; + expect(getDocsDeployMode()).toBe("ledger"); + }); + + it("trims whitespace", () => { + process.env.FERN_DOCS_DEPLOY_MODE = " ledger "; + expect(getDocsDeployMode()).toBe("ledger"); + }); + + it("falls back to legacy for unrecognized values", () => { + process.env.FERN_DOCS_DEPLOY_MODE = "banana"; + expect(getDocsDeployMode()).toBe("legacy"); + }); + + it("forces legacy when FERN_SELF_HOSTED=true, even if deploy mode is ledger", () => { + process.env.FERN_SELF_HOSTED = "true"; + process.env.FERN_DOCS_DEPLOY_MODE = "ledger"; + expect(getDocsDeployMode()).toBe("legacy"); + }); + + it("does not force legacy when FERN_SELF_HOSTED is not 'true'", () => { + process.env.FERN_SELF_HOSTED = "false"; + process.env.FERN_DOCS_DEPLOY_MODE = "ledger"; + expect(getDocsDeployMode()).toBe("ledger"); + }); +}); diff --git a/packages/cli/generation/remote-generation/remote-workspace-runner/src/__test__/normalizeRepoUrl.test.ts b/packages/cli/generation/remote-generation/remote-workspace-runner/src/__test__/normalizeRepoUrl.test.ts new file mode 100644 index 000000000000..2e1525064417 --- /dev/null +++ b/packages/cli/generation/remote-generation/remote-workspace-runner/src/__test__/normalizeRepoUrl.test.ts @@ -0,0 +1,26 @@ +import { describe, expect, it } from "vitest"; +import { normalizeRepoUrlToHttps } from "../normalizeRepoUrl.js"; + +describe("normalizeRepoUrlToHttps", () => { + it("converts GitHub slug to HTTPS URL", () => { + expect(normalizeRepoUrlToHttps("acme/docs", "github")).toBe("https://github.com/acme/docs"); + }); + + it("converts GitLab slug to HTTPS URL", () => { + expect(normalizeRepoUrlToHttps("acme/docs", "gitlab")).toBe("https://gitlab.com/acme/docs"); + }); + + it("converts Bitbucket slug to HTTPS URL", () => { + expect(normalizeRepoUrlToHttps("acme/docs", "bitbucket")).toBe("https://bitbucket.org/acme/docs"); + }); + + it("passes through an HTTPS URL unchanged", () => { + const url = "https://github.enterprise.com/acme/docs"; + expect(normalizeRepoUrlToHttps(url, "github")).toBe(url); + }); + + it("passes through an HTTP URL unchanged", () => { + const url = "http://gitlab.internal/acme/docs"; + expect(normalizeRepoUrlToHttps(url, "gitlab")).toBe(url); + }); +}); diff --git a/packages/cli/generation/remote-generation/remote-workspace-runner/src/buildTranslatedDocsDefinition.ts b/packages/cli/generation/remote-generation/remote-workspace-runner/src/buildTranslatedDocsDefinition.ts new file mode 100644 index 000000000000..950e53211647 --- /dev/null +++ b/packages/cli/generation/remote-generation/remote-workspace-runner/src/buildTranslatedDocsDefinition.ts @@ -0,0 +1,174 @@ +import { + applyTranslatedFrontmatterToNavTree, + applyTranslatedNavigationOverlays, + type DocsDefinitionResolver, + getTranslatedAnnouncement, + replaceImagePathsAndUrls, + replaceReferencedCode, + replaceReferencedMarkdown, + stripMdxComments, + transformAtPrefixImports +} from "@fern-api/docs-resolver"; +import type { DocsV1Write } from "@fern-api/fdr-sdk"; +import { AbsoluteFilePath, doesPathExist, RelativeFilePath, relative, resolve } from "@fern-api/fs-utils"; +import type { TaskContext } from "@fern-api/task-context"; +import { readFile } from "fs/promises"; + +type DocsDefinition = DocsV1Write.DocsDefinition; + +/** + * Build a translated DocsDefinition by overlaying translated pages and + * navigation on top of the base definition. Applies the full MDX processing + * pipeline shared by both the V2 and ledger translation paths: + * + * 1. Locale-aware snippet resolution (prefers translated snippets) + * 2. `` reference resolution + * 3. `@/` import transforms + * 4. MDX comment stripping + * 5. Image path rewrites (using base page location) + * 6. `editThisPageUrl` rewriting to point to the translated file + * 7. Nav tree overlay (translated sidebar titles from frontmatter + docs.yml) + * 8. Translated announcement and navbar links + */ +export async function buildTranslatedDocsDefinition({ + docsDefinition, + locale, + localePages, + translationNavigationOverlays, + resolver, + context +}: { + docsDefinition: DocsDefinition; + locale: string; + localePages: Record; + translationNavigationOverlays: + | Record + | undefined; + resolver: DocsDefinitionResolver; + context: TaskContext; +}): Promise { + const collectedFileIds = resolver.getCollectedFileIds(); + const docsWorkspacePath = resolver.getDocsWorkspacePath(); + + const resolveLocalePath = async (filepath: AbsoluteFilePath): Promise => { + const relPath = relative(docsWorkspacePath, filepath); + const translatedPath = resolve(docsWorkspacePath, RelativeFilePath.of(`translations/${locale}/${relPath}`)); + return (await doesPathExist(translatedPath)) ? translatedPath : filepath; + }; + + const localeAwareMarkdownLoader = async (filepath: AbsoluteFilePath): Promise => { + const pathToRead = await resolveLocalePath(filepath); + const raw = await readFile(pathToRead, "utf-8"); + const fmMatch = raw.match(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/); + return fmMatch != null ? raw.slice(fmMatch[0].length) : raw; + }; + + const localeAwareFileLoader = async (filepath: AbsoluteFilePath): Promise => { + const pathToRead = await resolveLocalePath(filepath); + return readFile(pathToRead, "utf-8"); + }; + + const translatedPageEntries = await Promise.all( + Object.entries(localePages).map(async ([path, rawMarkdown]) => { + try { + const basePage = docsDefinition.pages[path as DocsV1Write.PageId]; + const absolutePathToMarkdownFile = resolve(docsWorkspacePath, RelativeFilePath.of(path)); + + const { markdown: markdownResolved } = await replaceReferencedMarkdown({ + markdown: rawMarkdown, + absolutePathToFernFolder: docsWorkspacePath, + absolutePathToMarkdownFile, + context, + markdownLoader: localeAwareMarkdownLoader + }); + + const codeResolved = await replaceReferencedCode({ + markdown: markdownResolved, + absolutePathToFernFolder: docsWorkspacePath, + absolutePathToMarkdownFile, + context, + fileLoader: localeAwareFileLoader + }); + + const importsResolved = transformAtPrefixImports({ + markdown: codeResolved, + absolutePathToFernFolder: docsWorkspacePath, + absolutePathToMarkdownFile + }); + + let processedMarkdown = stripMdxComments(importsResolved); + + processedMarkdown = replaceImagePathsAndUrls( + processedMarkdown, + collectedFileIds, + {}, + { + absolutePathToMarkdownFile, + absolutePathToFernFolder: docsWorkspacePath + }, + context + ); + + let editThisPageUrl = basePage?.editThisPageUrl; + if (editThisPageUrl != null) { + const fernPathPattern = `/fern/${path}`; + const translatedPathStr = `/fern/translations/${locale}/${path}`; + editThisPageUrl = editThisPageUrl.replace( + fernPathPattern, + translatedPathStr + ) as typeof editThisPageUrl; + } + + return [ + path, + { + markdown: processedMarkdown, + rawMarkdown: processedMarkdown, + editThisPageUrl, + editThisPageLaunch: basePage?.editThisPageLaunch + } + ]; + } catch (pageError) { + context.logger.warn( + `Failed to process translated page "${path}" for locale "${locale}": ${String(pageError)}. Falling back to base page.` + ); + return undefined; + } + }) + ); + + const translatedPages = { + ...docsDefinition.pages, + ...Object.fromEntries( + translatedPageEntries.filter((entry): entry is NonNullable => entry != null) + ) + }; + + let updatedRoot = applyTranslatedFrontmatterToNavTree( + docsDefinition.config.root, + localePages as Record, + context + ); + + const localeNavOverlay = translationNavigationOverlays?.[locale]; + let translatedAnnouncement = docsDefinition.config.announcement; + let translatedNavbarLinks = docsDefinition.config.navbarLinks; + if (localeNavOverlay != null) { + updatedRoot = applyTranslatedNavigationOverlays(updatedRoot, localeNavOverlay); + translatedAnnouncement = getTranslatedAnnouncement(localeNavOverlay) ?? translatedAnnouncement; + if (localeNavOverlay.navbarLinks != null) { + translatedNavbarLinks = localeNavOverlay.navbarLinks; + } + } + + return { + ...docsDefinition, + pages: translatedPages, + config: { + ...docsDefinition.config, + root: updatedRoot, + announcement: translatedAnnouncement, + navbarLinks: translatedNavbarLinks + } + }; +} diff --git a/packages/cli/generation/remote-generation/remote-workspace-runner/src/docsDeployMode.ts b/packages/cli/generation/remote-generation/remote-workspace-runner/src/docsDeployMode.ts new file mode 100644 index 000000000000..be22288fe7cb --- /dev/null +++ b/packages/cli/generation/remote-generation/remote-workspace-runner/src/docsDeployMode.ts @@ -0,0 +1,35 @@ +/** + * Controls which docs deployment backend the CLI writes to. + * + * Set via FERN_DOCS_DEPLOY_MODE environment variable: + * - "legacy" (default) — existing startDocsRegister / finishDocsRegister flow only. + * - "ledger" — docs-ledger only (fast, incremental). + * + * Self-hosted deployments (FERN_SELF_HOSTED=true) always use legacy mode because + * the self-hosted FDR does not expose ledger endpoints or S3 infrastructure. + */ +export type DocsDeployMode = "legacy" | "ledger"; + +const VALID_MODES = new Set(["legacy", "ledger"]); + +export function getDocsDeployMode(): DocsDeployMode { + if (process.env.FERN_SELF_HOSTED === "true") { + return "legacy"; + } + const raw = process.env.FERN_DOCS_DEPLOY_MODE?.toLowerCase().trim(); + if (raw == null || raw === "") { + return "legacy"; + } + if (isValidMode(raw)) { + return raw; + } + // biome-ignore lint/suspicious/noConsole: intentional user-facing warning for invalid env var + console.warn( + `[fern] Unrecognized FERN_DOCS_DEPLOY_MODE="${raw}" — falling back to "legacy". Valid values: legacy, ledger.` + ); + return "legacy"; +} + +function isValidMode(value: string): value is DocsDeployMode { + return VALID_MODES.has(value as DocsDeployMode); +} diff --git a/packages/cli/generation/remote-generation/remote-workspace-runner/src/mapDocsConfigToLedgerConfig.ts b/packages/cli/generation/remote-generation/remote-workspace-runner/src/mapDocsConfigToLedgerConfig.ts new file mode 100644 index 000000000000..8f47c1d05338 --- /dev/null +++ b/packages/cli/generation/remote-generation/remote-workspace-runner/src/mapDocsConfigToLedgerConfig.ts @@ -0,0 +1,305 @@ +import { assertNever } from "@fern-api/core-utils"; +import type { DocsV1Write } from "@fern-api/fdr-sdk"; +import type { FileManifestEntry, ImageRef, LedgerConfig, PathOrUrl } from "@fern-api/fdr-sdk/orpc-client"; + +type DocsConfig = DocsV1Write.DocsConfig; + +/** + * Resolve a FileId reference produced by the classic docs publish flow + * (FDR's startDocsRegister) to the `fullPath` string that the ledger flow + * uses to identify file artifacts. + * + * In the current FDR behaviour (`extractFileId` in publishDocs.ts), the + * "fileId" returned by FDR for a freshly-uploaded file is the same + * sanitized path used as the ledger fileManifest key, so the lookup is + * effectively the identity function. We still consult `fileIdToPath` + * first to remain forward-compatible with the legacy server response + * shape ({ uploadUrl, fileId }) where fileId is a separate UUID. + * + * Returns undefined when the FileId can't be mapped — callers MUST + * treat that as "field absent" rather than fabricating a path string. + */ +function resolveFileIdToPath( + fileId: string | undefined, + fileIdToPath: Map | undefined +): string | undefined { + if (fileId == null) { + return undefined; + } + const mapped = fileIdToPath?.get(fileId); + if (mapped != null) { + return mapped; + } + // Fallback: in the current FDR flow the fileId IS the sanitized path, + // so we can pass it through unchanged. + return fileId; +} + +function toImageRef( + fileId: string | undefined, + fileManifest: Record | undefined, + fileIdToPath: Map | undefined +): ImageRef | undefined { + const path = resolveFileIdToPath(fileId, fileIdToPath); + if (path == null) { + return undefined; + } + const entry = fileManifest?.[path]; + if (entry?.width == null || entry?.height == null) { + // Dimensions are required for ImageRef (next/image layout reservation). + // If the file wasn't measured (e.g. SVG or missing manifest entry) we + // drop the logo from the ledger config rather than send a half-valid + // ref that would fail server-side validation. + return undefined; + } + return { path, width: entry.width, height: entry.height }; +} + +function toPathOrUrl( + fileIdOrUrl: { type: "fileId"; value: string } | { type: "url"; value: string } | undefined, + fileIdToPath: Map | undefined +): PathOrUrl | undefined { + if (fileIdOrUrl == null) { + return undefined; + } + if (fileIdOrUrl.type === "url") { + return { type: "url", value: fileIdOrUrl.value }; + } + const path = resolveFileIdToPath(fileIdOrUrl.value, fileIdToPath); + if (path == null) { + return undefined; + } + return { type: "path", value: path }; +} + +type ThemeWithImages = Extract, { type: "dark" } | { type: "light" }>; + +function mapTheme( + theme: ThemeWithImages | NonNullable>["dark"], + fileManifest: Record | undefined, + fileIdToPath: Map | undefined +): { + logo?: ImageRef; + backgroundImage?: string; + accentPrimary: { r: number; g: number; b: number; a?: number }; + background?: { type: "solid"; r: number; g: number; b: number; a?: number } | { type: "gradient" }; + border?: { r: number; g: number; b: number; a?: number }; + sidebarBackground?: { r: number; g: number; b: number; a?: number }; + headerBackground?: { r: number; g: number; b: number; a?: number }; + cardBackground?: { r: number; g: number; b: number; a?: number }; +} { + // DocsConfig's per-theme `background` is a plain RGBA; LedgerConfig + // wraps it in a `solid` discriminated-union variant. We do not produce + // the `gradient` variant because DocsConfig has no source for it. + const background = theme.background != null ? { type: "solid" as const, ...theme.background } : undefined; + const backgroundImagePath = resolveFileIdToPath(theme.backgroundImage, fileIdToPath); + return { + logo: toImageRef(theme.logo, fileManifest, fileIdToPath), + backgroundImage: backgroundImagePath, + accentPrimary: theme.accentPrimary, + background, + border: theme.border, + sidebarBackground: theme.sidebarBackground, + headerBackground: theme.headerBackground, + cardBackground: theme.cardBackground + }; +} + +function mapColorsV3( + colors: DocsConfig["colorsV3"], + fileManifest: Record | undefined, + fileIdToPath: Map | undefined +): LedgerConfig["colorsV3"] { + if (colors == null) { + return undefined; + } + switch (colors.type) { + case "dark": + case "light": + return { + type: colors.type, + ...mapTheme(colors, fileManifest, fileIdToPath) + }; + case "darkAndLight": + return { + type: "darkAndLight", + dark: mapTheme(colors.dark, fileManifest, fileIdToPath), + light: mapTheme(colors.light, fileManifest, fileIdToPath) + }; + default: + assertNever(colors); + } +} + +function mapMetadata( + metadata: DocsConfig["metadata"], + fileIdToPath: Map | undefined +): LedgerConfig["metadata"] { + if (metadata == null) { + return undefined; + } + // Strip image fields and re-add them under PathOrUrl shape. + const { + "og:image": ogImage, + "og:logo": ogLogo, + "twitter:image": twitterImage, + "og:background-image": ogBackgroundImage, + "og:dynamic:background-image": ogDynamicBackgroundImage, + ...rest + } = metadata; + type LedgerMetadata = NonNullable; + const mapped: LedgerMetadata = { + ...rest, + "og:image": toPathOrUrl(ogImage, fileIdToPath) ?? undefined, + "og:logo": toPathOrUrl(ogLogo, fileIdToPath) ?? undefined, + "twitter:image": toPathOrUrl(twitterImage, fileIdToPath) ?? undefined, + "og:background-image": toPathOrUrl(ogBackgroundImage, fileIdToPath) ?? undefined, + "og:dynamic:background-image": toPathOrUrl(ogDynamicBackgroundImage, fileIdToPath) ?? undefined + }; + return mapped; +} + +type LedgerJsFile = NonNullable["files"]>[number]; + +function mapJsFiles(js: DocsConfig["js"], fileIdToPath: Map | undefined): LedgerConfig["js"] { + if (js == null) { + return undefined; + } + const files: LedgerJsFile[] = []; + for (const file of js.files) { + const path = resolveFileIdToPath(file.fileId, fileIdToPath); + if (path == null) { + continue; + } + files.push({ path, strategy: file.strategy }); + } + return { + remote: js.remote?.map((r) => ({ url: r.url, strategy: r.strategy })), + files, + inline: js.inline + }; +} + +function mapTypography( + typography: DocsConfig["typographyV2"], + fileIdToPath: Map | undefined +): LedgerConfig["typographyV2"] { + if (typography == null) { + return undefined; + } + const mapFont = ["bodyFont"]>(font: F) => { + if (font == null) { + return undefined; + } + return { + type: "custom" as const, + name: font.name, + variants: font.variants.map((variant) => ({ + fontFile: resolveFileIdToPath(variant.fontFile, fileIdToPath) ?? variant.fontFile, + weight: variant.weight, + style: variant.style + })), + display: font.display, + fallback: font.fallback, + fontVariationSettings: font.fontVariationSettings + }; + }; + return { + headingsFont: mapFont(typography.headingsFont), + bodyFont: mapFont(typography.bodyFont), + codeFont: mapFont(typography.codeFont) + }; +} + +function mapAgents(agents: DocsConfig["agents"]): LedgerConfig["agents"] { + if (agents == null) { + return undefined; + } + // llmsTxt / llmsFullTxt are intentionally dropped — the ledger contract + // serves these well-known files by convention via file artifact lookup + // (see LedgerConfigSchema doc comment in docs-ledger/contract.ts). + return { + pageDirective: agents.pageDirective, + pageDescriptionSource: agents.pageDescriptionSource, + siteDescription: agents.siteDescription + }; +} + +function mapIntegrations(integrations: DocsConfig["integrations"]): LedgerConfig["integrations"] { + if (integrations == null) { + return undefined; + } + // Only intercom is mapped. context7 is a well-known file artifact + // resolved on demand via resolveFiles (same convention as llms.txt, + // robots.txt, favicon — see LedgerConfigSchema doc comment). + return { + intercom: integrations.intercom + }; +} + +/** + * Map a classic DocsConfig (FileId-based) into the ledger-native LedgerConfig + * (path-based) shape. + * + * The two schemas have diverged: + * - DocsConfig.colorsV3.{dark,light}.logo: FileId → LedgerConfig: ImageRef { path, width, height } + * - DocsConfig.colorsV3.{dark,light}.backgroundImage: FileId → LedgerConfig: string (path) + * - DocsConfig.metadata image fields: FileIdOrUrl → LedgerConfig: PathOrUrl + * - DocsConfig.js.files[].fileId → LedgerConfig.js.files[].path + * - DocsConfig.typographyV2.*.variants[].fontFile: FileId → LedgerConfig: string (path) + * + * Dimensions for ImageRef come from `fileManifest` (populated by the + * publishDocs uploadFiles callback using `measureImageSizes`). If an image + * has no measured dimensions, the corresponding logo field is dropped rather + * than emitted with placeholder values. + * + * Fields that exist only in DocsConfig (agents.llmsTxt, languages, + * navigation, root, logoV2, colors, colorsV2, typography (v1), hideNavLinks, + * globalTheme, backgroundImage at the top level, logo at the top level) are + * intentionally omitted: LedgerConfig either exposes them by convention + * (llms*) or has dropped them (legacy v1/v2 variants). + * + * The favicon IS carried: it's a config-referenced file (like the logo/OG + * images) whose fullPath is resolved here and retained in the ledger + * manifest's `files` map so the read side can resolve it from S3 at its + * real extension (.svg/.png/.ico). + */ +export function mapDocsConfigToLedgerConfig({ + docsConfig, + fileManifest, + fileIdToPath +}: { + docsConfig: DocsConfig; + fileManifest: Record | undefined; + fileIdToPath: Map | undefined; +}): LedgerConfig { + return { + title: docsConfig.title, + defaultLanguage: docsConfig.defaultLanguage, + translations: docsConfig.translations, + announcement: docsConfig.announcement, + navbarLinks: docsConfig.navbarLinks, + footerLinks: docsConfig.footerLinks, + logoHeight: docsConfig.logoHeight, + logoHref: docsConfig.logoHref, + logoRightText: docsConfig.logoRightText, + favicon: resolveFileIdToPath(docsConfig.favicon, fileIdToPath), + agents: mapAgents(docsConfig.agents), + metadata: mapMetadata(docsConfig.metadata, fileIdToPath), + redirects: docsConfig.redirects, + colorsV3: mapColorsV3(docsConfig.colorsV3, fileManifest, fileIdToPath), + layout: docsConfig.layout, + theme: docsConfig.theme, + settings: docsConfig.settings, + typographyV2: mapTypography(docsConfig.typographyV2, fileIdToPath), + analyticsConfig: docsConfig.analyticsConfig, + css: docsConfig.css, + js: mapJsFiles(docsConfig.js, fileIdToPath), + aiChatConfig: docsConfig.aiChatConfig, + pageActions: docsConfig.pageActions, + editThisPageLaunch: docsConfig.editThisPageLaunch, + integrations: mapIntegrations(docsConfig.integrations), + header: docsConfig.header, + footer: docsConfig.footer + }; +} diff --git a/packages/cli/generation/remote-generation/remote-workspace-runner/src/normalizeRepoUrl.ts b/packages/cli/generation/remote-generation/remote-workspace-runner/src/normalizeRepoUrl.ts new file mode 100644 index 000000000000..a34c768d38a1 --- /dev/null +++ b/packages/cli/generation/remote-generation/remote-workspace-runner/src/normalizeRepoUrl.ts @@ -0,0 +1,24 @@ +import { assertNever } from "@fern-api/core-utils"; + +/** + * Converts a CI-source repo slug (e.g. "owner/repo") into an HTTPS URL + * suitable for the docs-ledger `git.repoUrl` field. + * + * If the value is already a full URL it is returned as-is. + */ +export function normalizeRepoUrlToHttps(repo: string, provider: "github" | "gitlab" | "bitbucket"): string { + if (repo.startsWith("https://") || repo.startsWith("http://")) { + return repo; + } + + switch (provider) { + case "github": + return `https://github.com/${repo}`; + case "gitlab": + return `https://gitlab.com/${repo}`; + case "bitbucket": + return `https://bitbucket.org/${repo}`; + default: + assertNever(provider); + } +} diff --git a/packages/cli/generation/remote-generation/remote-workspace-runner/src/publishDocs.ts b/packages/cli/generation/remote-generation/remote-workspace-runner/src/publishDocs.ts index 52395e14ba94..a95d7706e881 100644 --- a/packages/cli/generation/remote-generation/remote-workspace-runner/src/publishDocs.ts +++ b/packages/cli/generation/remote-generation/remote-workspace-runner/src/publishDocs.ts @@ -31,6 +31,7 @@ import { FdrClient, SDKSnippetHolder } from "@fern-api/fdr-sdk"; +import type { DocsPublishGitInput, FileManifestEntry } from "@fern-api/fdr-sdk/orpc-client"; type DynamicIr = APIV1Write.DynamicIr; type DynamicIRUpload = APIV1Write.DynamicIRUpload; @@ -58,9 +59,14 @@ import { createHash } from "crypto"; import { readFile } from "fs/promises"; import { chunk } from "lodash-es"; import * as mime from "mime-types"; +import { basename } from "path"; import terminalLink from "terminal-link"; +import { getDocsDeployMode } from "./docsDeployMode.js"; import { getDynamicGeneratorConfig } from "./getDynamicGeneratorConfig.js"; import { measureImageSizes } from "./measureImageSizes.js"; +import { normalizeRepoUrlToHttps } from "./normalizeRepoUrl.js"; +import { publishDocsViaLedger } from "./publishDocsLedger.js"; +import { publishDocsViaLedgerPreview } from "./publishDocsLedgerPreview.js"; import { asyncPool } from "./utils/asyncPool.js"; const MEASURE_IMAGE_BATCH_SIZE = 10; @@ -134,6 +140,17 @@ export function sanitizeRelativePathForS3(relativeFilePath: RelativeFilePath): R return relativeFilePath.replace(/\.\.\//g, "_dot_dot_/") as RelativeFilePath; } +/** + * Read a file once and return its bytes + sha256 hash. Avoids the double-read + * we'd otherwise do for files that need both hashing (legacy register) and + * inclusion in the ledger CAS blob map (publishDocsViaLedger). + */ +async function readAndHashFile(absoluteFilePath: AbsoluteFilePath | string): Promise<{ buffer: Buffer; hash: string }> { + const buffer = await readFile(absoluteFilePath); + const hash = createHash("sha256").update(new Uint8Array(buffer)).digest("hex"); + return { buffer, hash }; +} + interface CISource { type: "github" | "gitlab" | "bitbucket"; repo?: string; @@ -225,6 +242,11 @@ export async function publishDocs({ }); const authConfig = { type: "public" as const }; + const deployMode = getDocsDeployMode(); + if (deployMode !== "legacy") { + context.logger.info(`Docs deploy mode: ${deployMode}`); + } + if (excludeApis) { context.logger.debug( "Experimental flag 'exclude-apis' is enabled - API references will be excluded from S3 upload" @@ -284,6 +306,27 @@ export async function publishDocs({ // Read-form API definitions captured during registration, keyed by FDR // apiDefinitionId, used to localize sidebar (navigation) titles. Only populated // when translations are configured, to avoid extra conversion on normal publishes. + // Collect API definitions (keyed by FDR definition ID) for the ledger manifest. + const apiDefinitionCollector = new Map(); + + // Collect per-file manifest entries for the ledger publish. + // The manifest is keyed by `sanitizedPath` (fern-host-relative file path), + // which matches the `fullPath` used by the FDR register handler when + // routing fileManifest entries to file artifacts. + // + // File content is NOT kept in memory. Instead, ledgerFilePaths maps + // each content hash to the file's absolute path so that uploadMissingBlobs + // can re-read only the files the server actually needs. + const ledgerFileManifest: Record = {}; + const ledgerFilePaths = new Map(); + // FileId → fullPath lookup used by mapDocsConfigToLedgerConfig to + // translate DocsConfig's FileId-based references (e.g. colorsV3.dark.logo) + // into LedgerConfig path strings. + // + // Populated by the uploadFiles callback below in ledger mode as an + // identity map (fullPath → fullPath). + const ledgerFileIdToPath = new Map(); + const readApiDefinitionsById = new Map(); const captureReadApiDefinition = (definition: APIV1Write.ApiDefinition, apiDefinitionId: string): void => { if (!buildTranslatedApiDefinitions) { @@ -446,6 +489,7 @@ export async function publishDocs({ } captureReadApiDefinition(apiDefinition, response.apiDefinitionId); + apiDefinitionCollector.set(response.apiDefinitionId, apiDefinition); return response.apiDefinitionId; }; @@ -499,6 +543,22 @@ export async function publishDocs({ } const sanitizedPath = filePath.sanitizedPath; + const { buffer, hash } = await readAndHashFile(filePath.absoluteFilePath); + + // Populate the ledger file manifest entry for this image. + // mediaType is guaranteed non-false here because the file passed + // the mime.lookup filter upstream; fall back defensively anyway. + const contentType = mime.lookup(filePath.absoluteFilePath) || "application/octet-stream"; + ledgerFileManifest[sanitizedPath] = { + hash, + contentType, + contentLength: buffer.byteLength, + filename: basename(filePath.sanitizedPath), + width: image.width, + height: image.height + }; + ledgerFilePaths.set(hash, filePath.absoluteFilePath); + const obj = { filePath: CjsFdrSdk.docs.v1.write.FilePath( convertToFernHostRelativeFilePath(sanitizedPath) @@ -507,7 +567,7 @@ export async function publishDocs({ height: image.height, blurDataUrl: image.blurDataUrl, alt: undefined, - fileHash: await calculateFileHash(filePath.absoluteFilePath) + fileHash: hash } as DocsV2Write.ImageFilePath; return obj; } @@ -531,17 +591,71 @@ export async function publishDocs({ HASH_CONCURRENCY, nonImageFiles, async (file) => { + const { buffer, hash } = await readAndHashFile(file.absoluteFilePath); + + // Populate the ledger file manifest entry for this non-image file. + const contentType = mime.lookup(file.absoluteFilePath) || "application/octet-stream"; + ledgerFileManifest[file.sanitizedPath] = { + hash, + contentType, + contentLength: buffer.byteLength, + filename: basename(file.sanitizedPath) + }; + ledgerFilePaths.set(hash, file.absoluteFilePath); + return { path: CjsFdrSdk.docs.v1.write.FilePath( convertToFernHostRelativeFilePath(file.sanitizedPath) ), - fileHash: await calculateFileHash(file.absoluteFilePath) + fileHash: hash }; } ); const hashNonImageTime = performance.now() - hashNonImageStart; context.logger.debug(`Hashed ${filepaths.length} non-image files in ${hashNonImageTime.toFixed(0)}ms`); + // ── Ledger-only path ───────────────────────────────────── + // In ledger mode we do NOT call fdr.docs.v2.write.startDocsRegister + // / startDocsPreviewRegister. The legacy V2 register mints fresh + // FileId UUIDs per request even for byte-identical inputs, which + // then leak into the substituted markdown (via + // replaceImagePathsAndUrls below) and rotate the deployment hash + // on every publish — defeating the ledger's deployment-level dedup. + // + // Instead, we synthesize UploadedFile entries whose `fileId` is + // the file's sanitized fern-host-relative path. The resolver + // substitutes `file:` into the markdown, which: + // - is byte-identical across publishes of byte-identical + // inputs (sanitizedPath is deterministic), so pages dedup + // at the CAS layer; and + // - resolves directly through the existing path-keyed ledger + // reader endpoints (`fileArtifact`/`fileMetadata`, both + // keyed on `fullPath` ≡ sanitizedPath) — no new server- + // side resolver is needed. + // + // File bytes are uploaded later by the ledger missing-blobs + // step in publishDocsViaLedger / publishDocsViaLedgerPreview; + // they do not need a separate V2 upload round-trip. + if (deployMode === "ledger") { + const uploadedFiles: UploadedFile[] = []; + for (const file of filesWithSanitizedPaths) { + const manifestEntry = ledgerFileManifest[file.sanitizedPath]; + if (manifestEntry == null) { + continue; + } + ledgerFileIdToPath.set(file.sanitizedPath, file.sanitizedPath); + uploadedFiles.push({ + relativeFilePath: file.relativeFilePath, + absoluteFilePath: file.absoluteFilePath, + fileId: file.sanitizedPath + }); + } + context.logger.debug( + `[ledger] Skipping V2 startDocsRegister; resolved ${uploadedFiles.length} files by sanitizedPath` + ); + return uploadedFiles; + } + if (preview) { let startDocsRegisterResponse; try { @@ -681,30 +795,108 @@ export async function publishDocs({ `Memory after resolve: RSS=${(resolveMemory.rss / 1024 / 1024).toFixed(2)}MB, Heap=${(resolveMemory.heapUsed / 1024 / 1024).toFixed(2)}MB` ); - if (docsRegistrationId == null) { + if (docsRegistrationId == null && deployMode !== "ledger") { doUnlock(); return context.failAndThrow("Failed to publish docs.", "Docs registration ID is missing.", { code: CliError.Code.InternalError }); } - context.logger.info("Publishing docs to FDR..."); - const publishStart = performance.now(); - try { + // ── Build ledger git provenance ── + const ledgerGit: DocsPublishGitInput | undefined = + ciSource?.repo != null && ciSource?.branch != null + ? { + repoUrl: normalizeRepoUrlToHttps(ciSource.repo, ciSource.type), + branch: ciSource.branch, + commitSha: ciSource.commitSha + } + : undefined; + + // ── Publish helpers ────────────────────────────────────────── + const runLegacyPublish = async (): Promise => { + if (docsRegistrationId == null) { + return; + } + context.logger.info("Publishing docs to FDR..."); + const publishStart = performance.now(); await fdr.docs.v2.write.finishDocsRegister({ docsRegistrationId, docsDefinition, excludeApis, ...(isBasepathAware && !preview && { basepathAware: true }) }); - } catch (error) { - return context.failAndThrow("Failed to publish docs to " + domain, error, { - code: CliError.Code.NetworkError - }); - } + const publishTime = performance.now() - publishStart; + context.logger.debug(`Docs published to FDR in ${publishTime.toFixed(0)}ms`); + }; - const publishTime = performance.now() - publishStart; - context.logger.debug(`Docs published to FDR in ${publishTime.toFixed(0)}ms`); + const runLedgerPublish = async (): Promise => { + if (preview) { + const previewResult = await publishDocsViaLedgerPreview({ + docsDefinition, + organization, + basePath, + previewId: previewId != null ? sanitizePreviewId(previewId) : previewId, + git: ledgerGit, + token: token.value, + fdrOrigin, + headers, + context, + apiDefinitions: apiDefinitionCollector, + fileManifest: Object.keys(ledgerFileManifest).length > 0 ? ledgerFileManifest : undefined, + filePaths: ledgerFilePaths.size > 0 ? ledgerFilePaths : undefined, + fileIdToPath: ledgerFileIdToPath.size > 0 ? ledgerFileIdToPath : undefined, + resolver + }); + if (deployMode === "ledger") { + urlToOutput = previewResult.previewUrl; + } + context.logger.info(`[ledger] Preview deployment created: ${previewResult.deploymentId}`); + } else { + const ledgerResult = await publishDocsViaLedger({ + docsDefinition, + organization, + domain, + basepath: basePath, + previewId, + customDomains, + git: ledgerGit, + token: token.value, + fdrOrigin, + headers, + context, + apiDefinitions: apiDefinitionCollector, + fileManifest: Object.keys(ledgerFileManifest).length > 0 ? ledgerFileManifest : undefined, + filePaths: ledgerFilePaths.size > 0 ? ledgerFilePaths : undefined, + fileIdToPath: ledgerFileIdToPath.size > 0 ? ledgerFileIdToPath : undefined, + resolver + }); + context.logger.info( + `[ledger] Deployment ${ledgerResult.reusedDeployment ? "reused" : "created"}: ${ledgerResult.deploymentId}` + ); + } + }; + + // ── Execute publish path ───────────────────────────────────── + // Each publish writes exactly one artifact — legacy or ledger — and + // the read path is determined by the artifact type itself. A failure + // of the selected path is a hard failure: the docs were not updated. + if (deployMode === "ledger") { + try { + await runLedgerPublish(); + } catch (error) { + return context.failAndThrow("Failed to publish docs via ledger to " + domain, error, { + code: CliError.Code.NetworkError + }); + } + } else if (docsRegistrationId != null) { + try { + await runLegacyPublish(); + } catch (error) { + return context.failAndThrow("Failed to publish docs to " + domain, error, { + code: CliError.Code.NetworkError + }); + } + } // Register the translated API definitions for each locale. FDR keys API content // by apiDefinitionId, so each translated definition gets its own content-addressed @@ -740,13 +932,15 @@ export async function publishDocs({ } } - // Register translated page content for each configured locale. + // Register translated page content for each configured locale via the V2 endpoint. + // In ledger mode, translations are handled by publishDocsViaLedger (above), + // so this block only runs for the legacy mode. // In preview mode, register translations against the preview URL (not the production domain) // so that translated docs are visible in preview without overwriting production translations. const translationPages = resolver.getTranslationPages(); const translationNavigationOverlays = resolver.getTranslationNavigationOverlays(); const translationDomain = preview ? urlToOutput : domain; - if (translationPages != null && Object.keys(translationPages).length > 0) { + if (deployMode !== "ledger" && translationPages != null && Object.keys(translationPages).length > 0) { context.logger.info(`Registering translations for ${Object.keys(translationPages).length} locale(s)...`); await Promise.all( Object.entries(translationPages).map(async ([locale, localePages]) => { diff --git a/packages/cli/generation/remote-generation/remote-workspace-runner/src/publishDocsLedger.ts b/packages/cli/generation/remote-generation/remote-workspace-runner/src/publishDocsLedger.ts new file mode 100644 index 000000000000..07dd9182a46c --- /dev/null +++ b/packages/cli/generation/remote-generation/remote-workspace-runner/src/publishDocsLedger.ts @@ -0,0 +1,686 @@ +import { + applyTranslatedApiTitlesToNavTree, + type DocsDefinitionResolver, + type TranslatedApiSpec +} from "@fern-api/docs-resolver"; +import { + APIV1Read, + APIV1Write, + FdrAPI as CjsFdrSdk, + convertAPIDefinitionToDb, + convertDbAPIDefinitionToRead, + type DocsV1Write, + SDKSnippetHolder +} from "@fern-api/fdr-sdk"; +import { + type DocsPublishGitInput, + type DocsPublishInput, + type FileManifestEntry, + type LocaleEntry +} from "@fern-api/fdr-sdk/orpc-client"; +import { AbsoluteFilePath } from "@fern-api/fs-utils"; +import { convertIrToFdrApi } from "@fern-api/register"; +import type { TaskContext } from "@fern-api/task-context"; +import { createHash } from "crypto"; +import { readFile } from "fs/promises"; +import * as mime from "mime-types"; + +import { mapDocsConfigToLedgerConfig } from "./mapDocsConfigToLedgerConfig.js"; +import { asyncPool } from "./utils/asyncPool.js"; + +const UPLOAD_CONCURRENCY = 10; +const TRANSLATION_BUILD_CONCURRENCY = 4; +const UPLOAD_MAX_RETRIES = 3; +const UPLOAD_INITIAL_DELAY_MS = 1_000; + +type DocsDefinition = DocsV1Write.DocsDefinition; + +function sha256(data: Buffer): string { + return createHash("sha256").update(data).digest("hex"); +} + +/** + * Matches `file:` tokens in rewritten page markdown — the same + * pattern the docs bundle's MDX serializer uses to discover file references + * (`packages/fern-docs/bundle/src/mdx/bundler/serialize.ts`). Keeping the two + * in sync guarantees `referencedFiles` is exactly the set the bundle resolves + * per page (ADR 0014). + */ +const FILE_REF_PATTERN = /file:([^\s"'<>)}\]]+)/g; + +/** Deduplicated bare `fullPath`s of every `file:` token in `markdown`. */ +function extractReferencedFiles(markdown: string): string[] { + const paths = new Set(); + for (const match of markdown.matchAll(FILE_REF_PATTERN)) { + const fullPath = match[1]; + if (fullPath != null) { + paths.add(fullPath); + } + } + return [...paths]; +} + +function remapMarkdownFileReferences(markdown: string, fileIdToPath: Map | undefined): string { + if (fileIdToPath == null || fileIdToPath.size === 0) { + return markdown; + } + return markdown.replace(FILE_REF_PATTERN, (token, fileId: string) => `file:${fileIdToPath.get(fileId) ?? fileId}`); +} + +interface BlobRef { + hash: string; + contentType: string; + contentLength: number; +} + +/** + * `JSON.stringify` with deterministic key ordering at every level. Arrays + * keep their original ordering (positions are meaningful); object keys are + * sorted lexicographically via the replacer. Two inputs that differ only by + * key insertion order serialize identically — required so the apiManifest + * blob hash is stable across publishes (cf. FDR `stableStringify`). + */ +function stableStringify(value: unknown): string { + return JSON.stringify(value, (_key, val) => { + if (val != null && typeof val === "object" && !Array.isArray(val)) { + return Object.fromEntries(Object.entries(val).sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))); + } + return val; + }); +} + +/** + * Serializes a value to a JSON buffer using {@link stableStringify} and + * returns a BlobRef + the raw bytes, keyed by content hash for later upload. + */ +function jsonBlobRef(value: unknown): { ref: BlobRef; hash: string; buf: Buffer } { + const buf = Buffer.from(stableStringify(value), "utf-8"); + const hash = sha256(buf); + return { + ref: { hash, contentType: "application/json", contentLength: buf.length }, + hash, + buf + }; +} + +/** + * Build a DocsPublishInput from a resolved DocsDefinition and collect + * all content blobs that may need uploading. + * + * If `fileManifest` is provided, it is forwarded as-is into the resulting + * input. File blobs are NOT included in the returned blob map — they are + * loaded lazily during the upload step to avoid holding all file content in + * memory for the entire publish duration. The manifest's keys MUST be the + * same string the FDR register handler treats as `fullPath` (see + * {@link makeFileArtifact} in docsPublishTransform.ts) — the CLI uses + * sanitizedPath (fern-host-relative) which maps 1:1 to fullPath. + */ +export function buildLedgerInput({ + docsDefinition, + git, + apiDefinitions, + fileManifest, + fileIdToPath, + locale = "en" +}: { + docsDefinition: DocsDefinition; + git?: DocsPublishGitInput; + apiDefinitions: Map; + fileManifest?: Record; + /** + * Map from FileId (as returned by FDR's legacy startDocsRegister + * `uploadUrls`) to the `fullPath` string used to key `fileManifest`. + * Used by {@link mapDocsConfigToLedgerConfig} to translate DocsConfig's + * FileId-based references (e.g. `colorsV3.dark.logo`) into LedgerConfig's + * path-based references (e.g. `ImageRef { path, width, height }`). + */ + fileIdToPath?: Map; + /** Locale to stamp on segments. Defaults to "en". */ + locale?: string; +}): { localeEntry: LocaleEntry; blobs: Map } { + const blobs = new Map(); + + // Pages: hash each page's markdown content. + const pages: LocaleEntry["pages"] = {}; + for (const [pageId, page] of Object.entries(docsDefinition.pages)) { + if (page == null) { + continue; + } + const markdown = remapMarkdownFileReferences(page.markdown, fileIdToPath); + const buf = Buffer.from(markdown, "utf-8"); + const hash = sha256(buf); + // Capture the file/image artifacts this page embeds so FDR can + // materialise the page→file join into the route shards (ADR 0014, + // "File metadata on the render path"). The markdown reaching here has + // already had image paths rewritten to `file:` tokens by + // the resolver's replaceImagePathsAndUrls step, and in ledger mode the + // token suffix IS the file's `fullPath`. We scan with the SAME regex + // the bundle's MDX serializer uses to discover `file:` references, so + // `referencedFiles` is exactly the set the bundle will request for this + // page — a cheap O(content) scan over markdown already in memory, not a + // re-parse and not a server-side re-fetch. + const referencedFiles = extractReferencedFiles(markdown); + pages[pageId] = { + hash, + contentType: "text/markdown", + contentLength: buf.length, + ...(referencedFiles.length > 0 ? { referencedFiles } : {}) + }; + blobs.set(hash, buf); + } + + // Config is sent inline (not a CAS blob) per the docs-ledger contract. + // DocsConfig (FileId-based) is translated to LedgerConfig (path-based) + // up front so the wire payload is already in the schema FDR validates. + const ledgerConfig = mapDocsConfigToLedgerConfig({ + docsConfig: docsDefinition.config, + fileManifest, + fileIdToPath + }); + + // API manifest: serialize all API definitions as a single JSON blob. + // + // `apiDefinitions` is populated by the `registerApi` callback inside a + // `Promise.all`, so the Map's insertion order reflects whichever HTTP + // round-trip completed first — non-deterministic across publishes. + // {@link jsonBlobRef} uses {@link stableStringify}, which sorts object + // keys at every level, so the resulting bytes are stable regardless of + // Map iteration order. + // + // Determinism caveat: stable apiManifest bytes are necessary but not + // sufficient for a deterministic deployment hash. Page bodies must also + // be byte-identical, which requires that file references substituted + // into markdown (`file:` tokens emitted by replaceImagePathsAndUrls) + // be stable. In `ledger` deploy mode the CLI emits path tokens + // (`file:`) and short-circuits the V2 register call; in + // `legacy` mode the V2 register flow mints fresh UUID FileIds per + // request, so deployment-level dedup will not fire there. + let apiManifestRef: BlobRef | null = null; + if (apiDefinitions.size > 0) { + const manifestObj = Object.fromEntries(apiDefinitions); + const manifestBlob = jsonBlobRef(manifestObj); + blobs.set(manifestBlob.hash, manifestBlob.buf); + apiManifestRef = manifestBlob.ref; + } + + // jsFiles: custom React components, referenced markdown snippets, and + // custom header/footer components resolved by DocsDefinitionResolver. + let jsFilesRef: BlobRef | null = null; + if (docsDefinition.jsFiles != null && Object.keys(docsDefinition.jsFiles).length > 0) { + const jsFilesBlob = jsonBlobRef(docsDefinition.jsFiles); + blobs.set(jsFilesBlob.hash, jsFilesBlob.buf); + jsFilesRef = jsFilesBlob.ref; + } + + const localeEntry: LocaleEntry = { + root: docsDefinition.config.root ?? docsDefinition.config.navigation, + pages, + config: ledgerConfig, + apiManifest: apiManifestRef, + jsFiles: jsFilesRef, + fileManifest, + redirects: null, + locale, + git + }; + + return { localeEntry, blobs }; +} + +export interface LedgerPublishResult { + deploymentId: string; + siteId: string; + deploymentHash: string; + reusedDeployment: boolean; +} + +/** + * Publish docs via the new docs-ledger register → upload → finish flow. + * + * All locales (base + translations) are built upfront before any network + * calls. If any locale fails to build, the entire publish aborts. After + * building, a single register → upload → finish pipeline runs for the + * base locale, and then finishTranslation is called for each translation + * locale (blobs are already uploaded from the combined pool). + * + * This is a self-contained function that runs instead of the legacy + * finishDocsRegister path. + */ +export async function publishDocsViaLedger({ + docsDefinition, + organization, + domain, + basepath, + previewId, + customDomains, + git, + token, + fdrOrigin, + headers, + context, + apiDefinitions, + fileManifest, + filePaths, + fileIdToPath, + resolver +}: { + docsDefinition: DocsDefinition; + organization: string; + domain: string; + basepath: string | undefined; + previewId: string | undefined; + customDomains?: string[]; + git?: DocsPublishGitInput; + token: string; + fdrOrigin: string; + headers: Record; + context: TaskContext; + apiDefinitions: Map; + fileManifest?: Record; + /** Hash → absolute file path for lazy on-demand reads during upload. */ + filePaths?: Map; + fileIdToPath?: Map; + /** Resolver instance for accessing translation pages/overlays. Optional. */ + resolver?: DocsDefinitionResolver; +}): Promise { + // ── Phase 1: Build all locales upfront ────────────────────────────── + // If any locale fails to build, the entire publish aborts before any + // network calls are made. + + const { localeEntry: baseLocale, blobs } = buildLedgerInput({ + docsDefinition, + git, + apiDefinitions, + fileManifest, + fileIdToPath + }); + + const builtTranslations = await buildAllTranslationInputs({ + docsDefinition, + git, + apiDefinitions, + fileManifest, + fileIdToPath, + resolver, + context + }); + + // Merge all translation blobs into the base blob pool so the single + // upload phase covers everything. + for (const t of builtTranslations) { + for (const [hash, buf] of t.blobs) { + blobs.set(hash, buf); + } + } + + // ── Phase 2: Single register → upload → finish ───────────────────── + // Build a unified locales[] array where the base locale is the first + // entry and translations follow. The server processes all locales + // through the same pipeline. + + const { createDocsLedgerClient } = await import("@fern-api/fdr-sdk/orpc-client"); + const client = createDocsLedgerClient({ baseUrl: fdrOrigin, token, headers }); + + const locales: LocaleEntry[] = [baseLocale, ...builtTranslations.map((t) => t.localeEntry)]; + + const publishInput: DocsPublishInput = { + orgId: organization, + domain, + basepath: basepath ?? "", + customDomains: customDomains ?? [], + previewId: previewId ?? null, + defaultLocale: baseLocale.locale, + locales + }; + + // Register — server computes deployment hash, returns presigned S3 + // URLs for any blobs it doesn't already have in CAS (all locales). + context.logger.debug("[ledger] Registering deployment..."); + const registerStart = performance.now(); + const registerResult = await client.register(publishInput); + const registerTime = performance.now() - registerStart; + context.logger.debug( + `[ledger] Registered in ${registerTime.toFixed(0)}ms — hash=${registerResult.deploymentHash}, missing=${registerResult.missingContent.length} blobs` + ); + + // Upload all blobs the server doesn't have yet (all locales combined). + await uploadMissingBlobs(registerResult.missingContent, blobs, context, filePaths); + + // Finish — server persists the deployment + all locale segments in + // a single atomic transaction. Same input shape as register. + context.logger.debug("[ledger] Finishing deployment..."); + const finishStart = performance.now(); + const finishResult = await client.finish(publishInput); + const finishTime = performance.now() - finishStart; + context.logger.debug( + `[ledger] Finished in ${finishTime.toFixed(0)}ms — deploymentId=${finishResult.deploymentId}, reused=${finishResult.reusedDeployment}` + ); + + // Log translation results if any were processed. + if (finishResult.translationsProcessed != null) { + for (const tp of finishResult.translationsProcessed) { + context.logger.info(`[ledger] Locale "${tp.locale}": ${tp.segmentsAdded} segment(s) added`); + } + } + + return finishResult; +} + +/** + * Upload blobs the server reported as missing after a register call. + * Shared between the production and preview ledger flows. + * + * Small in-memory blobs (pages, config, apiManifest) are looked up in + * `blobs` first. File blobs are loaded lazily from disk via `filePaths` + * (hash → absolute path) to avoid holding every file's bytes in memory + * for the entire publish duration. + */ +export async function uploadMissingBlobs( + missingContent: ReadonlyArray<{ hash: string; uploadUrl: string }>, + blobs: Map, + context: TaskContext, + filePaths?: Map +): Promise { + if (missingContent.length > 0) { + context.logger.debug(`[ledger] Uploading ${missingContent.length} missing blobs...`); + const uploadStart = performance.now(); + + const results = await asyncPool(UPLOAD_CONCURRENCY, [...missingContent], async ({ hash, uploadUrl }) => { + // Prefer in-memory blobs (pages, config, apiManifest). + let blob = blobs.get(hash); + let contentType = "application/octet-stream"; + if (blob == null && filePaths != null) { + // Lazy read: only load file content for blobs the server + // actually needs, and discard after upload. + const filePath = filePaths.get(hash); + if (filePath != null) { + blob = await readFile(filePath); + // Infer MIME type from the file extension so S3 stores the + // correct Content-Type (e.g. image/png for .png files). + // The presigned URL enforces this value in its signature. + const inferred = mime.lookup(filePath); + if (inferred !== false) { + contentType = inferred; + } + } + } + if (blob == null) { + context.logger.warn(`[ledger] Server requested blob ${hash} but we don't have it — skipping`); + return "skipped" as const; + } + return uploadBlobWithRetry(blob, uploadUrl, hash, contentType, context); + }); + + const uploaded = results.filter((r) => r === "uploaded").length; + const alreadyExisted = results.filter((r) => r === "already_exists").length; + const uploadTime = performance.now() - uploadStart; + context.logger.debug( + `[ledger] Upload complete in ${uploadTime.toFixed(0)}ms — ${uploaded} uploaded, ${alreadyExisted} already in store` + ); + } else { + context.logger.debug("[ledger] All content already in CAS — no uploads needed"); + } +} + +type UploadResult = "uploaded" | "already_exists"; + +/** + * Upload a single blob to S3 with retries on transient failures (429, 5xx). + * Exponential backoff: 1s, 2s, 4s. + * + * Returns "already_exists" on 412 Precondition Failed — the presigned URL may + * include an If-None-Match condition, so 412 means the object already exists in S3. + * + * Fails fast on 403 (expired/invalid presigned URL) and 400 (content integrity + * mismatch) since these are not recoverable by retrying. + */ +async function uploadBlobWithRetry( + blob: Buffer, + uploadUrl: string, + hash: string, + contentType: string, + context: TaskContext +): Promise { + const body = blob.buffer.slice(blob.byteOffset, blob.byteOffset + blob.byteLength) as ArrayBuffer; + + for (let attempt = 0; attempt <= UPLOAD_MAX_RETRIES; attempt++) { + const response = await fetch(uploadUrl, { + method: "PUT", + headers: { "Content-Type": contentType }, + body + }); + + if (response.ok) { + return "uploaded"; + } + + if (response.status === 412) { + context.logger.debug(`[ledger] Blob ${hash} already exists in store — skipping`); + return "already_exists"; + } + + if (response.status === 403) { + const text = await response.text(); + throw new Error(`[ledger] Presigned URL rejected for ${hash} (expired or signature mismatch): ${text}`); + } + + if (response.status === 400) { + const text = await response.text(); + throw new Error(`[ledger] Content integrity check failed for ${hash}: ${text}`); + } + + const isRetryable = response.status === 429 || response.status >= 500; + if (isRetryable && attempt < UPLOAD_MAX_RETRIES) { + const delay = UPLOAD_INITIAL_DELAY_MS * 2 ** attempt; + context.logger.debug( + `[ledger] Upload ${hash} got ${response.status}, retrying in ${delay}ms (attempt ${attempt + 1}/${UPLOAD_MAX_RETRIES})` + ); + await new Promise((resolve) => setTimeout(resolve, delay)); + continue; + } + + const text = await response.text(); + throw new Error(`[ledger] S3 upload failed for ${hash}: ${response.status} ${text}`); + } + + throw new Error(`[ledger] Upload exhausted retries for ${hash}`); +} + +// ── Translation build helpers ────────────────────────────────────────── + +interface BuiltTranslation { + locale: string; + localePages: Record; + translatedDefinition: DocsDefinition; + localeEntry: LocaleEntry; + blobs: Map; +} + +/** + * Convert an APIV1Write.ApiDefinition to its APIV1Read form for nav title + * patching. Mirrors the `captureReadApiDefinition` helper in publishDocs.ts. + */ +function toReadApiDefinition( + definition: APIV1Write.ApiDefinition, + apiDefinitionId: string, + context: TaskContext +): APIV1Read.ApiDefinition | undefined { + try { + const dbApiDefinition = convertAPIDefinitionToDb( + definition, + CjsFdrSdk.ApiDefinitionId(apiDefinitionId), + new SDKSnippetHolder({ + snippetsConfigWithSdkId: {}, + snippetsBySdkId: {}, + snippetTemplatesByEndpoint: {}, + snippetTemplatesByEndpointId: {}, + snippetsBySdkIdAndEndpointId: {} + }) + ); + return convertDbAPIDefinitionToRead(dbApiDefinition); + } catch (error) { + context.logger.debug( + `[ledger] Failed to convert API definition "${apiDefinitionId}" to read form: ${String(error)}` + ); + return undefined; + } +} + +/** + * Build a locale-specific apiDefinitions map by replacing base API definitions + * with their translated equivalents (produced from translated OpenAPI specs + * under `translations//apis//`). + */ +export function buildLocaleApiDefinitions({ + baseApiDefinitions, + translatedSpecs, + context +}: { + baseApiDefinitions: Map; + translatedSpecs: Map; + context: TaskContext; +}): Map { + // Shallow clone — replaced entries are new objects from convertIrToFdrApi. + const localeApiDefs = new Map(baseApiDefinitions); + for (const [baseApiId, spec] of translatedSpecs) { + try { + const translatedApiDef = convertIrToFdrApi({ + ir: spec.ir, + snippetsConfig: spec.snippetsConfig, + playgroundConfig: spec.playgroundConfig, + graphqlOperations: spec.graphqlOperations, + graphqlTypes: spec.graphqlTypes, + context, + apiNameOverride: spec.apiName + }); + localeApiDefs.set(baseApiId, translatedApiDef); + } catch (error) { + context.logger.warn( + `[ledger] Failed to convert translated API definition for API "${baseApiId}": ${String(error)}. ` + + `Falling back to base (untranslated) API.` + ); + } + } + return localeApiDefs; +} + +/** + * Build ledger inputs for every translation locale the resolver discovered. + * + * For each locale, if translated API specs exist under + * `translations//apis//`, the locale receives its own + * apiManifest blob with translated descriptions/summaries and a nav tree + * with localized sidebar titles. Otherwise the base apiManifest is reused. + * + * Locales are built with bounded concurrency. If ANY locale fails, the + * returned promise rejects — callers should let the error propagate to + * abort the entire publish. + */ +async function buildAllTranslationInputs({ + docsDefinition, + git, + apiDefinitions, + fileManifest, + fileIdToPath, + resolver, + context +}: { + docsDefinition: DocsDefinition; + git?: DocsPublishGitInput; + apiDefinitions: Map; + fileManifest?: Record; + fileIdToPath?: Map; + resolver?: DocsDefinitionResolver; + context: TaskContext; +}): Promise { + if (resolver == null) { + return []; + } + + const translationPages = resolver.getTranslationPages(); + const translationNavigationOverlays = resolver.getTranslationNavigationOverlays(); + + if (translationPages == null || Object.keys(translationPages).length === 0) { + return []; + } + + // Get translated API specs (per-locale, per-base-apiDefinitionId). + // These are already populated by DocsDefinitionResolver.resolve() when + // buildTranslatedApiDefinitions=true. + const translatedApiSpecsByLocale = resolver.getTranslatedApiSpecs(); + + // Pre-compute base API read definitions once (expensive Write→Db→Read + // pipeline). Reused across all locales for nav title patching. + const baseReadApis: Record = {}; + if (translatedApiSpecsByLocale.size > 0) { + for (const [apiId, def] of apiDefinitions) { + const readDef = toReadApiDefinition(def, apiId, context); + if (readDef != null) { + baseReadApis[apiId] = readDef; + } + } + } + + const localeEntries = Object.entries(translationPages); + context.logger.info(`[ledger] Building ${localeEntries.length} translation locale(s)...`); + const { buildTranslatedDocsDefinition } = await import("./buildTranslatedDocsDefinition.js"); + + return asyncPool( + TRANSLATION_BUILD_CONCURRENCY, + localeEntries, + async ([locale, localePages]): Promise => { + const translatedDefinition = await buildTranslatedDocsDefinition({ + docsDefinition, + locale, + localePages, + translationNavigationOverlays, + resolver, + context + }); + + // Build locale-specific API definitions from translated OpenAPI specs. + const localeTranslatedSpecs = translatedApiSpecsByLocale.get(locale); + let localeApiDefinitions = apiDefinitions; + if (localeTranslatedSpecs != null && localeTranslatedSpecs.size > 0) { + localeApiDefinitions = buildLocaleApiDefinitions({ + baseApiDefinitions: apiDefinitions, + translatedSpecs: localeTranslatedSpecs, + context + }); + + // Patch sidebar titles in the nav tree so endpoint/subpackage + // names reflect the translated API content. + if (translatedDefinition.config.root != null) { + const translatedApisForTitles: Record = {}; + for (const [baseApiId] of localeTranslatedSpecs) { + const translatedDef = localeApiDefinitions.get(baseApiId); + if (translatedDef != null) { + const translatedRead = toReadApiDefinition(translatedDef, baseApiId, context); + if (translatedRead != null) { + translatedApisForTitles[baseApiId] = translatedRead; + } + } + } + if (Object.keys(translatedApisForTitles).length > 0) { + translatedDefinition.config.root = applyTranslatedApiTitlesToNavTree( + translatedDefinition.config.root, + baseReadApis, + translatedApisForTitles + ); + } + } + } + + const { localeEntry, blobs } = buildLedgerInput({ + docsDefinition: translatedDefinition, + git, + apiDefinitions: localeApiDefinitions, + fileManifest, + fileIdToPath, + locale + }); + + return { locale, localePages, translatedDefinition, localeEntry, blobs }; + } + ); +} diff --git a/packages/cli/generation/remote-generation/remote-workspace-runner/src/publishDocsLedgerPreview.ts b/packages/cli/generation/remote-generation/remote-workspace-runner/src/publishDocsLedgerPreview.ts new file mode 100644 index 000000000000..8b36c688f69b --- /dev/null +++ b/packages/cli/generation/remote-generation/remote-workspace-runner/src/publishDocsLedgerPreview.ts @@ -0,0 +1,289 @@ +import type { DocsDefinitionResolver } from "@fern-api/docs-resolver"; +import type { APIV1Write, DocsV1Write } from "@fern-api/fdr-sdk"; +import { + createDocsLedgerClient, + type DocsPublishGitInput, + type FileManifestEntry, + type LedgerPreviewRegisterResponse, + type LocaleEntry +} from "@fern-api/fdr-sdk/orpc-client"; +import type { AbsoluteFilePath } from "@fern-api/fs-utils"; +import type { TaskContext } from "@fern-api/task-context"; + +import { buildTranslatedDocsDefinition } from "./buildTranslatedDocsDefinition.js"; +import { buildLedgerInput, uploadMissingBlobs } from "./publishDocsLedger.js"; +import { asyncPool } from "./utils/asyncPool.js"; + +const TRANSLATION_BUILD_CONCURRENCY = 4; + +type DocsDefinition = DocsV1Write.DocsDefinition; + +export interface LedgerPreviewResult { + previewUrl: string; + deploymentId: string; +} + +/** + * Publish a docs preview via the dedicated ledger preview endpoint + * (POST /preview/init) followed by the standard finish call. + * + * All translation locales are built upfront before any network calls. + * If any locale fails to build, the entire preview publish aborts. + * + * Unlike the production {@link publishDocsViaLedger}, this flow: + * - Sends `LedgerPreviewRegisterInput` (no `domain` / `customDomains`). + * - Receives a server-generated preview URL and domain. + * - Finishes with the server-assigned domain + previewId so the deployment + * lands on the preview branch, not production. + */ +export async function publishDocsViaLedgerPreview({ + docsDefinition, + organization, + basePath, + previewId, + git, + token, + fdrOrigin, + headers, + context, + apiDefinitions, + fileManifest, + filePaths, + fileIdToPath, + resolver +}: { + docsDefinition: DocsDefinition; + organization: string; + basePath: string | undefined; + previewId: string | undefined; + git?: DocsPublishGitInput; + token: string; + fdrOrigin: string; + headers: Record; + context: TaskContext; + apiDefinitions: Map; + fileManifest?: Record; + /** Hash → absolute file path for lazy on-demand reads during upload. */ + filePaths?: Map; + fileIdToPath?: Map; + /** Resolver instance for accessing translation pages/overlays. Optional. */ + resolver?: DocsDefinitionResolver; +}): Promise { + // ── Phase 1: Build all locales upfront ────────────────────────────── + // Every locale must be present in previewRegister so the ledger can + // compute missing CAS blobs and return upload URLs for translation-only + // content before finish references those blobs. + + const { localeEntry: baseLocale, blobs } = buildLedgerInput({ + docsDefinition, + git, + apiDefinitions, + fileManifest, + fileIdToPath + }); + + const builtTranslationDefs = await buildAllTranslationDefinitions({ + docsDefinition, + resolver, + context + }); + + const translationInputs = builtTranslationDefs.map((t) => { + const { localeEntry, blobs: translationBlobs } = buildLedgerInput({ + docsDefinition: t.translatedDefinition, + git, + apiDefinitions, + fileManifest, + fileIdToPath, + locale: t.locale + }); + return { ...t, localeEntry, blobs: translationBlobs }; + }); + + // Merge all translation blobs into the base pool before register/upload. + for (const t of translationInputs) { + for (const [hash, buf] of t.blobs) { + blobs.set(hash, buf); + } + } + + const locales: LocaleEntry[] = [baseLocale, ...translationInputs.map((t) => t.localeEntry)]; + + // ── Phase 2: Single register → upload → finish ───────────────────── + + const client = createDocsLedgerClient({ baseUrl: fdrOrigin, token, headers }); + + context.logger.debug("[ledger-preview] Registering preview deployment..."); + const registerStart = performance.now(); + const previewRegisterInput = { + orgId: organization, + previewId: previewId ?? null, + basePath: basePath ?? "", + defaultLocale: baseLocale.locale, + locales, + // Keep the base-locale fields for compatibility with SDKs/servers that + // still type previewRegister as the single-locale preview init shape. + root: baseLocale.root, + pages: baseLocale.pages, + apiManifest: baseLocale.apiManifest, + config: baseLocale.config, + fileManifest: baseLocale.fileManifest, + jsFiles: baseLocale.jsFiles, + redirects: baseLocale.redirects, + locale: baseLocale.locale, + version: baseLocale.version, + repo: baseLocale.repo, + git + }; + const registerResult = await previewRegisterWithLocales({ + fdrOrigin, + token, + headers, + input: previewRegisterInput + }); + const registerTime = performance.now() - registerStart; + context.logger.debug( + `[ledger-preview] Registered in ${registerTime.toFixed(0)}ms — hash=${registerResult.deploymentHash}, ` + + `preview=${registerResult.previewUrl}, missing=${registerResult.missingContent.length} blobs` + ); + + await uploadMissingBlobs(registerResult.missingContent, blobs, context, filePaths); + + // Finish — server persists the preview deployment + all locale segments + // in a single call. + context.logger.debug("[ledger-preview] Finishing preview deployment..."); + const finishStart = performance.now(); + const finishResult = await client.finish({ + orgId: organization, + domain: registerResult.domain, + basepath: registerResult.basepath, + customDomains: [], + previewId: registerResult.previewId, + defaultLocale: baseLocale.locale, + locales + }); + const finishTime = performance.now() - finishStart; + context.logger.debug( + `[ledger-preview] Finished in ${finishTime.toFixed(0)}ms — deploymentId=${finishResult.deploymentId}, ` + + `reused=${finishResult.reusedDeployment}` + ); + + // Log translation results if any were processed. + if (finishResult.translationsProcessed != null) { + for (const tp of finishResult.translationsProcessed) { + context.logger.info(`[ledger-preview] Locale "${tp.locale}": ${tp.segmentsAdded} segment(s) added`); + } + } + + return { + previewUrl: registerResult.previewUrl, + deploymentId: finishResult.deploymentId + }; +} + +// ── Translation build helpers ────────────────────────────────────────── + +interface BuiltTranslationDef { + locale: string; + localePages: Record; + translatedDefinition: DocsDefinition; +} + +/** + * Build translated DocsDefinitions for every locale the resolver discovered. + * + * All locales are built in parallel. If ANY locale fails, the returned + * promise rejects — callers should let the error propagate to abort the + * entire publish. + * + * This only builds the DocsDefinitions (the expensive async part). The + * caller converts them to ledger locale entries before previewRegister so + * translation blobs are included in missingContent. + */ +async function buildAllTranslationDefinitions({ + docsDefinition, + resolver, + context +}: { + docsDefinition: DocsDefinition; + resolver?: DocsDefinitionResolver; + context: TaskContext; +}): Promise { + if (resolver == null) { + return []; + } + + const translationPages = resolver.getTranslationPages(); + const translationNavigationOverlays = resolver.getTranslationNavigationOverlays(); + + if (translationPages == null || Object.keys(translationPages).length === 0) { + return []; + } + + const localeEntries = Object.entries(translationPages); + context.logger.info(`[ledger-preview] Building ${localeEntries.length} translation locale(s)...`); + + return asyncPool( + TRANSLATION_BUILD_CONCURRENCY, + localeEntries, + async ([locale, localePages]): Promise => { + const translatedDefinition = await buildTranslatedDocsDefinition({ + docsDefinition, + locale, + localePages, + translationNavigationOverlays, + resolver, + context + }); + return { locale, localePages, translatedDefinition }; + } + ); +} + +interface PreviewRegisterInput { + orgId: string; + previewId: string | null; + basePath: string; + defaultLocale: string; + locales: LocaleEntry[]; + root: LocaleEntry["root"]; + pages: LocaleEntry["pages"]; + apiManifest: LocaleEntry["apiManifest"]; + config: LocaleEntry["config"]; + fileManifest: LocaleEntry["fileManifest"]; + jsFiles: LocaleEntry["jsFiles"]; + redirects: LocaleEntry["redirects"]; + locale: string; + version?: LocaleEntry["version"]; + repo?: LocaleEntry["repo"]; + git?: DocsPublishGitInput; +} + +async function previewRegisterWithLocales({ + fdrOrigin, + token, + headers, + input +}: { + fdrOrigin: string; + token: string; + headers: Record; + input: PreviewRegisterInput; +}): Promise { + const response = await fetch(`${fdrOrigin.replace(/\/+$/, "")}/docs-ledger/preview/init`, { + method: "POST", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${token}`, + ...headers + }, + body: JSON.stringify(input) + }); + + if (!response.ok) { + const body = await response.text(); + throw new Error(`[ledger-preview] Preview register failed: HTTP ${response.status}: ${body}`); + } + + return (await response.json()) as LedgerPreviewRegisterResponse; +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d41c3164190b..23edfcb4e83c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -590,7 +590,7 @@ overrides: minimatch: '>=10.2.3' qs: 6.15.2 url-join: ^4.0.1 - '@fern-api/fdr-sdk': 1.2.33-830bfae69e + '@fern-api/fdr-sdk': 1.2.36-1f77b99cda form-data: ^4.0.6 '@fern-api/ui-core-utils': 0.145.12-b50d999d1 vite: ^7.3.5 @@ -3887,8 +3887,8 @@ importers: packages/cli/api-importers/graphql: dependencies: '@fern-api/fdr-sdk': - specifier: 1.2.33-830bfae69e - version: 1.2.33-830bfae69e(@opentelemetry/api@1.9.1)(typescript@5.9.3) + specifier: 1.2.36-1f77b99cda + version: 1.2.36-1f77b99cda(@opentelemetry/api@1.9.1)(typescript@5.9.3) '@fern-api/fs-utils': specifier: workspace:* version: link:../../../commons/fs-utils @@ -4263,8 +4263,8 @@ importers: specifier: workspace:* version: link:../../configuration '@fern-api/fdr-sdk': - specifier: 1.2.33-830bfae69e - version: 1.2.33-830bfae69e(@opentelemetry/api@1.9.1)(typescript@5.9.3) + specifier: 1.2.36-1f77b99cda + version: 1.2.36-1f77b99cda(@opentelemetry/api@1.9.1)(typescript@5.9.3) '@fern-api/ir-generator': specifier: workspace:* version: link:../../generation/ir-generator @@ -4390,8 +4390,8 @@ importers: specifier: workspace:* version: link:../yaml/docs-validator '@fern-api/fdr-sdk': - specifier: 1.2.33-830bfae69e - version: 1.2.33-830bfae69e(@opentelemetry/api@1.9.1)(typescript@5.9.3) + specifier: 1.2.36-1f77b99cda + version: 1.2.36-1f77b99cda(@opentelemetry/api@1.9.1)(typescript@5.9.3) '@fern-api/fern-definition-formatter': specifier: workspace:* version: link:../fern-definition/formatter @@ -4842,8 +4842,8 @@ importers: specifier: workspace:* version: link:../yaml/docs-validator '@fern-api/fdr-sdk': - specifier: 1.2.33-830bfae69e - version: 1.2.33-830bfae69e(@opentelemetry/api@1.9.1)(typescript@5.9.3) + specifier: 1.2.36-1f77b99cda + version: 1.2.36-1f77b99cda(@opentelemetry/api@1.9.1)(typescript@5.9.3) '@fern-api/fern-definition-schema': specifier: workspace:* version: link:../fern-definition/schema @@ -5047,8 +5047,8 @@ importers: specifier: workspace:* version: link:../../commons/core-utils '@fern-api/fdr-sdk': - specifier: 1.2.33-830bfae69e - version: 1.2.33-830bfae69e(@opentelemetry/api@1.9.1)(typescript@5.9.3) + specifier: 1.2.36-1f77b99cda + version: 1.2.36-1f77b99cda(@opentelemetry/api@1.9.1)(typescript@5.9.3) '@fern-api/fern-definition-schema': specifier: workspace:* version: link:../fern-definition/schema @@ -5084,8 +5084,8 @@ importers: specifier: workspace:* version: link:../../commons/core-utils '@fern-api/fdr-sdk': - specifier: 1.2.33-830bfae69e - version: 1.2.33-830bfae69e(@opentelemetry/api@1.9.1)(typescript@5.9.3) + specifier: 1.2.36-1f77b99cda + version: 1.2.36-1f77b99cda(@opentelemetry/api@1.9.1)(typescript@5.9.3) '@fern-api/fs-utils': specifier: workspace:* version: link:../../commons/fs-utils @@ -5163,8 +5163,8 @@ importers: specifier: workspace:* version: link:../../configuration '@fern-api/fdr-sdk': - specifier: 1.2.33-830bfae69e - version: 1.2.33-830bfae69e(@opentelemetry/api@1.9.1)(typescript@5.9.3) + specifier: 1.2.36-1f77b99cda + version: 1.2.36-1f77b99cda(@opentelemetry/api@1.9.1)(typescript@5.9.3) '@fern-api/fs-utils': specifier: workspace:* version: link:../../../commons/fs-utils @@ -5203,8 +5203,8 @@ importers: specifier: workspace:* version: link:../commons '@fern-api/fdr-sdk': - specifier: 1.2.33-830bfae69e - version: 1.2.33-830bfae69e(@opentelemetry/api@1.9.1)(typescript@5.9.3) + specifier: 1.2.36-1f77b99cda + version: 1.2.36-1f77b99cda(@opentelemetry/api@1.9.1)(typescript@5.9.3) '@fern-api/fs-utils': specifier: workspace:* version: link:../../../commons/fs-utils @@ -5243,8 +5243,8 @@ importers: specifier: workspace:* version: link:../commons '@fern-api/fdr-sdk': - specifier: 1.2.33-830bfae69e - version: 1.2.33-830bfae69e(@opentelemetry/api@1.9.1)(typescript@5.9.3) + specifier: 1.2.36-1f77b99cda + version: 1.2.36-1f77b99cda(@opentelemetry/api@1.9.1)(typescript@5.9.3) '@fern-api/fs-utils': specifier: workspace:* version: link:../../../commons/fs-utils @@ -5310,8 +5310,8 @@ importers: packages/cli/docs-markdown-utils: dependencies: '@fern-api/fdr-sdk': - specifier: 1.2.33-830bfae69e - version: 1.2.33-830bfae69e(@opentelemetry/api@1.9.1)(typescript@5.9.3) + specifier: 1.2.36-1f77b99cda + version: 1.2.36-1f77b99cda(@opentelemetry/api@1.9.1)(typescript@5.9.3) '@fern-api/fs-utils': specifier: workspace:* version: link:../../commons/fs-utils @@ -5401,8 +5401,8 @@ importers: specifier: workspace:* version: link:../docs-resolver '@fern-api/fdr-sdk': - specifier: 1.2.33-830bfae69e - version: 1.2.33-830bfae69e(@opentelemetry/api@1.9.1)(typescript@5.9.3) + specifier: 1.2.36-1f77b99cda + version: 1.2.36-1f77b99cda(@opentelemetry/api@1.9.1)(typescript@5.9.3) '@fern-api/fs-utils': specifier: workspace:* version: link:../../commons/fs-utils @@ -5516,8 +5516,8 @@ importers: specifier: workspace:* version: link:../docs-markdown-utils '@fern-api/fdr-sdk': - specifier: 1.2.33-830bfae69e - version: 1.2.33-830bfae69e(@opentelemetry/api@1.9.1)(typescript@5.9.3) + specifier: 1.2.36-1f77b99cda + version: 1.2.36-1f77b99cda(@opentelemetry/api@1.9.1)(typescript@5.9.3) '@fern-api/fs-utils': specifier: workspace:* version: link:../../commons/fs-utils @@ -5545,9 +5545,6 @@ importers: '@fern-api/task-context': specifier: workspace:* version: link:../task-context - '@fern-api/ui-core-utils': - specifier: 0.145.12-b50d999d1 - version: 0.145.12-b50d999d1 '@fern-api/workspace-loader': specifier: workspace:* version: link:../workspace/loader @@ -5619,8 +5616,8 @@ importers: specifier: workspace:* version: link:../configuration '@fern-api/fdr-sdk': - specifier: 1.2.33-830bfae69e - version: 1.2.33-830bfae69e(@opentelemetry/api@1.9.1)(typescript@5.9.3) + specifier: 1.2.36-1f77b99cda + version: 1.2.36-1f77b99cda(@opentelemetry/api@1.9.1)(typescript@5.9.3) '@fern-api/fs-utils': specifier: workspace:* version: link:../../commons/fs-utils @@ -6324,8 +6321,8 @@ importers: specifier: 'catalog:' version: 0.0.6-2ee1b7e28 '@fern-api/fdr-sdk': - specifier: 1.2.33-830bfae69e - version: 1.2.33-830bfae69e(@opentelemetry/api@1.9.1)(typescript@5.9.3) + specifier: 1.2.36-1f77b99cda + version: 1.2.36-1f77b99cda(@opentelemetry/api@1.9.1)(typescript@5.9.3) '@fern-api/fs-utils': specifier: workspace:* version: link:../../../../commons/fs-utils @@ -6549,8 +6546,8 @@ importers: specifier: workspace:* version: link:../generation/local-generation/docker-utils '@fern-api/fdr-sdk': - specifier: 1.2.33-830bfae69e - version: 1.2.33-830bfae69e(@opentelemetry/api@1.9.1)(typescript@5.9.3) + specifier: 1.2.36-1f77b99cda + version: 1.2.36-1f77b99cda(@opentelemetry/api@1.9.1)(typescript@5.9.3) '@fern-api/fs-utils': specifier: workspace:* version: link:../../commons/fs-utils @@ -6795,8 +6792,8 @@ importers: specifier: workspace:* version: link:../../commons/core-utils '@fern-api/fdr-sdk': - specifier: 1.2.33-830bfae69e - version: 1.2.33-830bfae69e(@opentelemetry/api@1.9.1)(typescript@5.9.3) + specifier: 1.2.36-1f77b99cda + version: 1.2.36-1f77b99cda(@opentelemetry/api@1.9.1)(typescript@5.9.3) '@fern-api/fs-utils': specifier: workspace:* version: link:../../commons/fs-utils @@ -6991,8 +6988,8 @@ importers: specifier: workspace:* version: link:../../../commons/core-utils '@fern-api/fdr-sdk': - specifier: 1.2.33-830bfae69e - version: 1.2.33-830bfae69e(@opentelemetry/api@1.9.1)(typescript@5.9.3) + specifier: 1.2.36-1f77b99cda + version: 1.2.36-1f77b99cda(@opentelemetry/api@1.9.1)(typescript@5.9.3) '@fern-api/ir-sdk': specifier: workspace:* version: link:../../../ir-sdk @@ -7076,8 +7073,8 @@ importers: specifier: workspace:* version: link:../../../commons/core-utils '@fern-api/fdr-sdk': - specifier: 1.2.33-830bfae69e - version: 1.2.33-830bfae69e(@opentelemetry/api@1.9.1)(typescript@5.9.3) + specifier: 1.2.36-1f77b99cda + version: 1.2.36-1f77b99cda(@opentelemetry/api@1.9.1)(typescript@5.9.3) '@fern-api/fern-definition-schema': specifier: workspace:* version: link:../../fern-definition/schema @@ -7316,8 +7313,8 @@ importers: specifier: workspace:* version: link:../../docs-resolver '@fern-api/fdr-sdk': - specifier: 1.2.33-830bfae69e - version: 1.2.33-830bfae69e(@opentelemetry/api@1.9.1)(typescript@5.9.3) + specifier: 1.2.36-1f77b99cda + version: 1.2.36-1f77b99cda(@opentelemetry/api@1.9.1)(typescript@5.9.3) '@fern-api/fern-definition-schema': specifier: workspace:* version: link:../../fern-definition/schema @@ -7961,8 +7958,8 @@ importers: packages/core: dependencies: '@fern-api/fdr-sdk': - specifier: 1.2.33-830bfae69e - version: 1.2.33-830bfae69e(@opentelemetry/api@1.9.1)(typescript@5.9.3) + specifier: 1.2.36-1f77b99cda + version: 1.2.36-1f77b99cda(@opentelemetry/api@1.9.1)(typescript@5.9.3) '@fern-api/venus-api-sdk': specifier: 'catalog:' version: 5.0.0 @@ -9522,8 +9519,8 @@ packages: resolution: {integrity: sha512-3qhAAuc4ZJWLaFtyZzaYXfF9OQ5iviNrvLDXtjKScKUNS134fR3v3c3xedCidTq5KedapuBECziUaOmmd6KXVA==} engines: {node: '>=18.0.0'} - '@fern-api/fdr-sdk@1.2.33-830bfae69e': - resolution: {integrity: sha512-qGQpK6wyK/4POZy2IbsixhHNh+9gHezJ5oBymIo2WtZEDUNlriPr+1fONB79PQCtTO8y3p7VsV5ROmQYRFolTw==} + '@fern-api/fdr-sdk@1.2.36-1f77b99cda': + resolution: {integrity: sha512-y0v3z6OKl70fNvkV/hbqhhlwMzvVr/gUDxldnEle1y+ormBBKSR5uvqUl/MV+QNx38GyfoAeIPcGVd9aUL4vng==} '@fern-api/generator-cli@0.9.39': resolution: {integrity: sha512-ANgQButS7+YLpdfUGAjedhEkzZGfLxNJj7UKL7trRjuWy7DPWh9ePtx8IblAHnXPoYLkSInEoJB00EFCpkSE7A==} @@ -12967,6 +12964,10 @@ packages: resolution: {integrity: sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg==} hasBin: true + js-yaml@4.1.1: + resolution: {integrity: sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==} + hasBin: true + js-yaml@4.2.0: resolution: {integrity: sha512-ePWsvanv0DWuDRsW8dnt+R4jQ31SCRCQ7hhNcPXZPsoBZiemuZNYGf7adZdqX2D86j6rvKp3RpCxVTSb8WQlOw==} hasBin: true @@ -16479,7 +16480,7 @@ snapshots: '@fern-api/fai-sdk@0.0.6-2ee1b7e28': {} - '@fern-api/fdr-sdk@1.2.33-830bfae69e(@opentelemetry/api@1.9.1)(typescript@5.9.3)': + '@fern-api/fdr-sdk@1.2.36-1f77b99cda(@opentelemetry/api@1.9.1)(typescript@5.9.3)': dependencies: '@fern-api/ui-core-utils': 0.145.12-b50d999d1 '@orpc/client': 1.13.9(@opentelemetry/api@1.9.1) @@ -17527,7 +17528,7 @@ snapshots: colorette: 1.4.0 https-proxy-agent: 7.0.6 js-levenshtein: 1.1.6 - js-yaml: 4.2.0 + js-yaml: 4.1.1 minimatch: 10.2.5 pluralize: 8.0.0 yaml-ast-parser: 0.0.43 @@ -20177,6 +20178,10 @@ snapshots: argparse: 1.0.10 esprima: 4.0.1 + js-yaml@4.1.1: + dependencies: + argparse: 2.0.1 + js-yaml@4.2.0: dependencies: argparse: 2.0.1 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index e6497a21354f..18383104a3f3 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -68,7 +68,7 @@ catalog: "@bufbuild/protobuf": ^2.2.5 "@bufbuild/protoplugin": 2.2.5 "@fern-api/fai-sdk": 0.0.6-2ee1b7e28 - "@fern-api/fdr-sdk": 1.2.33-830bfae69e + "@fern-api/fdr-sdk": 1.2.36-1f77b99cda "@fern-api/generator-cli": 0.9.39 "@fern-api/ui-core-utils": 0.129.4-b6c699ad2 "@fern-api/venus-api-sdk": 5.0.0 @@ -270,7 +270,7 @@ overrides: minimatch: ">=10.2.3" qs: 6.15.2 url-join: ^4.0.1 - "@fern-api/fdr-sdk": 1.2.33-830bfae69e + "@fern-api/fdr-sdk": 1.2.36-1f77b99cda form-data: ^4.0.6 "@fern-api/ui-core-utils": 0.145.12-b50d999d1 vite: ^7.3.5 From 2091317ed0c8342ccdda5fd7791f1b661d293cd2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 17 Jun 2026 22:32:54 +0000 Subject: [PATCH 7/7] chore(cli): release 5.50.0 --- .../{unreleased => 5.50.0}/docs-ledger.yml | 0 packages/cli/cli/versions.yml | 16 ++++++++++++++++ 2 files changed, 16 insertions(+) rename packages/cli/cli/changes/{unreleased => 5.50.0}/docs-ledger.yml (100%) diff --git a/packages/cli/cli/changes/unreleased/docs-ledger.yml b/packages/cli/cli/changes/5.50.0/docs-ledger.yml similarity index 100% rename from packages/cli/cli/changes/unreleased/docs-ledger.yml rename to packages/cli/cli/changes/5.50.0/docs-ledger.yml diff --git a/packages/cli/cli/versions.yml b/packages/cli/cli/versions.yml index e6458485375a..ee9528519fd1 100644 --- a/packages/cli/cli/versions.yml +++ b/packages/cli/cli/versions.yml @@ -1,4 +1,20 @@ # yaml-language-server: $schema=../../../fern-versions-yml.schema.json +- version: 5.50.0 + changelogEntry: + - summary: | + Add docs deployment ledger. Set `FERN_DOCS_DEPLOY_MODE=ledger` to + publish via the new ledger backend; `legacy` (default) uses the + existing register flow. The ledger path uses content-addressed + storage for incremental deploys and supports multi-locale + translations (including localized API reference content with + per-locale apiManifest blobs and sidebar titles), custom JS + components, favicon resolution, git provenance metadata, + multi-domain forwarding, stable file-path references in page + markdown, MIME-type inference for uploads, and a dedicated preview + endpoint. + type: feat + createdAt: "2026-06-17" + irVersion: 67 - version: 5.49.3 changelogEntry: - summary: |