or run

tessl search
Log in

Version

Files

tile.json

task.mdevals/scenario-9/

Blueprint Schema Module

Define decorated data models for a blueprint collaboration service. The goal is to rely on the dependency's schema inference to keep nested classes, arrays, maps, raw literal objects, lazy references, and ambiguous-type errors behaving correctly.

Capabilities

Schema generation for nested shapes

  • Building the compiled schemas exported for the profile, block, and blueprint classes yields nested subdocuments for layout and block settings, with arrays of classes and map fields preserved as the dependency's nested document and map types. @test

Raw literal metadata retention

  • The blueprint schema stores layout as a raw literal object with required canvas.width, canvas.height, and theme keys while allowing extra keys to pass through. @test

Lazy reference resolution

  • The blueprint schema links ownerRef to the profile class using a lazy reference form that still serializes to the reference id field even when the profile class is declared later. @test

Ambiguous union surfaces error

  • Invoking the exported builder for the ambiguous shape raises the dependency's "cannot determine type" style error for the trouble property because its union type lacks an explicit type hint. @test

Implementation

@generates

API

export class Profile {
  id: string;
  email: string;
  displayName?: string;
}

export class BlockSetting {
  key: string;
  value: string;
  flags: Map<string, boolean>;
}

export class Block {
  title: string;
  settings: BlockSetting[];
  metadata: { accent: string; weight: number };
}

export class Blueprint {
  name: string;
  ownerRef: () => Profile;
  reviewers: Profile[];
  layout: { canvas: { width: number; height: number }; theme: string };
  blocks: Block[];
  labels: Map<string, string>;
  sourceSnapshot: { provider: string; payload: Record<string, unknown> };
}

export class AmbiguousShape {
  trouble: string | number;
  noted?: string;
}

export const blueprintSchema: unknown;
export const profileSchema: unknown;
export const blockSchema: unknown;
export const ambiguousSchemaBuilder: () => unknown;

Dependencies { .dependencies }

@nestjs/mongoose { .dependency }

Provides schema decorators, definition factories, and Nest integration for MongoDB.