@workos/oagen 0.24.3 → 0.24.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -252,6 +252,28 @@ function walkTypeRef(ref, visitor) {
252
252
  default: assertNever(ref);
253
253
  }
254
254
  }
255
+ /**
256
+ * Validate model-placement hints against the FULL spec. Run once at the start of
257
+ * generation — where the complete model/service universe is known — so typos in
258
+ * `modelHints` fail loud even though {@link assignModelsToServices} is
259
+ * intentionally lenient about the partial slices it may be handed.
260
+ */
261
+ function validateModelHints(models, services, hints) {
262
+ const modelNames = new Set(models.map((m) => m.name));
263
+ const serviceNames = new Set(services.map((s) => s.name));
264
+ for (const [modelName, serviceName] of Object.entries(hints)) {
265
+ if (!modelNames.has(modelName)) {
266
+ const err = /* @__PURE__ */ new Error(`modelHints: unknown model "${modelName}". Hint keys must match an IR model name (post-cleanSchemaName/schemaNameTransform).`);
267
+ err.name = "ConfigError";
268
+ throw err;
269
+ }
270
+ if (!serviceNames.has(serviceName)) {
271
+ const err = /* @__PURE__ */ new Error(`modelHints: unknown service "${serviceName}" for model "${modelName}". Hint values must match an IR service name (PascalCase, derived from the operation's first tag).`);
272
+ err.name = "ConfigError";
273
+ throw err;
274
+ }
275
+ }
276
+ }
255
277
  //#endregion
256
278
  //#region src/utils/naming.ts
257
279
  /**
@@ -6425,6 +6447,7 @@ async function removeEmptyParents(startDir, stopDir) {
6425
6447
  //#endregion
6426
6448
  //#region src/engine/orchestrator.ts
6427
6449
  async function generate(spec, emitter, options) {
6450
+ if (options.modelHints) validateModelHints(spec.models, spec.services, options.modelHints);
6428
6451
  const scopedServices = options.services && options.services.length > 0 ? resolveScopedServices(spec, options.services, options.mountRules) : void 0;
6429
6452
  const scoped = scopedServices !== void 0;
6430
6453
  const noPrune = options.noPrune === true || scoped;