@workos/oagen-emitters 0.14.3 → 0.14.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.
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "0.14.3"
2
+ ".": "0.14.4"
3
3
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.14.4](https://github.com/workos/oagen-emitters/compare/v0.14.3...v0.14.4) (2026-05-26)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **ruby:** avoid double-wrapping T.nilable and skip T.untyped ([#127](https://github.com/workos/oagen-emitters/issues/127)) ([e42083f](https://github.com/workos/oagen-emitters/commit/e42083f77773f3ae96b750577db36cde01b65f4f))
9
+
3
10
  ## [0.14.3](https://github.com/workos/oagen-emitters/compare/v0.14.2...v0.14.3) (2026-05-22)
4
11
 
5
12
 
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { _ as pythonEmitter, a as rustExtractor, c as pythonExtractor, d as rustEmitter, f as rubyEmitter, g as phpEmitter, h as goEmitter, i as kotlinExtractor, l as rubyExtractor, m as dotnetEmitter, n as elixirExtractor, o as goExtractor, p as kotlinEmitter, r as dotnetExtractor, s as phpExtractor, t as workosEmittersPlugin, u as nodeExtractor, v as nodeEmitter } from "./plugin-D0qLBiGv.mjs";
1
+ import { _ as pythonEmitter, a as rustExtractor, c as pythonExtractor, d as rustEmitter, f as rubyEmitter, g as phpEmitter, h as goEmitter, i as kotlinExtractor, l as rubyExtractor, m as dotnetEmitter, n as elixirExtractor, o as goExtractor, p as kotlinEmitter, r as dotnetExtractor, s as phpExtractor, t as workosEmittersPlugin, u as nodeExtractor, v as nodeEmitter } from "./plugin-BGVaMGqe.mjs";
2
2
  export { dotnetEmitter, dotnetExtractor, elixirExtractor, goEmitter, goExtractor, kotlinEmitter, kotlinExtractor, nodeEmitter, nodeExtractor, phpEmitter, phpExtractor, pythonEmitter, pythonExtractor, rubyEmitter, rubyExtractor, rustEmitter, rustExtractor, workosEmittersPlugin };
@@ -7767,13 +7767,13 @@ function detectDiscriminatedShape(modelName, rawSchemas) {
7767
7767
  return {
7768
7768
  nameSuffix: variantNameSuffix(discValue),
7769
7769
  discriminatorValue: discValue,
7770
- fields: variantFields(fv, discProp, modelName, rawSchemas)
7770
+ fields: variantFields(fv, discProp, modelName)
7771
7771
  };
7772
7772
  }).filter((v) => v !== null);
7773
7773
  if (variants.length !== flattenedVariants.length) return null;
7774
7774
  return {
7775
7775
  modelName,
7776
- baseFields: baseObject ? collectObjectFields(baseObject, modelName, rawSchemas) : [],
7776
+ baseFields: baseObject ? collectObjectFields(baseObject, modelName) : [],
7777
7777
  discriminatorProperty: discProp,
7778
7778
  discriminatorPropertyDomain: toCamelCase(discProp),
7779
7779
  variants
@@ -7784,8 +7784,8 @@ function mergeBase(prev, next) {
7784
7784
  return {
7785
7785
  type: "object",
7786
7786
  properties: {
7787
- ...prev.properties ?? {},
7788
- ...next.properties ?? {}
7787
+ ...prev.properties,
7788
+ ...next.properties
7789
7789
  },
7790
7790
  required: [...new Set([...prev.required ?? [], ...next.required ?? []])]
7791
7791
  };
@@ -7911,29 +7911,29 @@ function readConstString(schema) {
7911
7911
  function variantNameSuffix(constValue) {
7912
7912
  return toPascalCase(constValue);
7913
7913
  }
7914
- function collectObjectFields(schema, parentName, rawSchemas) {
7914
+ function collectObjectFields(schema, parentName) {
7915
7915
  const props = schema.properties ?? {};
7916
7916
  const required = new Set(schema.required ?? []);
7917
7917
  const fields = [];
7918
- for (const [name, propSchema] of Object.entries(props)) fields.push(buildField(name, propSchema, required.has(name), parentName, rawSchemas));
7918
+ for (const [name, propSchema] of Object.entries(props)) fields.push(buildField(name, propSchema, required.has(name), parentName));
7919
7919
  return fields;
7920
7920
  }
7921
- function variantFields(fv, discriminatorProperty, parentName, rawSchemas) {
7921
+ function variantFields(fv, discriminatorProperty, parentName) {
7922
7922
  const fields = [];
7923
7923
  for (const [name, propSchema] of fv.alwaysProperties) {
7924
7924
  if (name === discriminatorProperty) continue;
7925
- fields.push(buildField(name, propSchema, fv.required.has(name), parentName, rawSchemas));
7925
+ fields.push(buildField(name, propSchema, fv.required.has(name), parentName));
7926
7926
  }
7927
7927
  for (const [name, propSchema] of fv.optionalProperties) {
7928
7928
  if (name === discriminatorProperty) continue;
7929
- fields.push(buildField(name, propSchema, false, parentName, rawSchemas));
7929
+ fields.push(buildField(name, propSchema, false, parentName));
7930
7930
  }
7931
7931
  return fields;
7932
7932
  }
7933
- function buildField(rawName, schema, required, parentName, rawSchemas) {
7933
+ function buildField(rawName, schema, required, parentName) {
7934
7934
  const modelDeps = /* @__PURE__ */ new Set();
7935
- const domainType = rawSchemaToTS(schema, parentName, rawName, false, modelDeps, rawSchemas);
7936
- const wireType = rawSchemaToTS(schema, parentName, rawName, true, modelDeps, rawSchemas);
7935
+ const domainType = rawSchemaToTS(schema, parentName, rawName, false, modelDeps);
7936
+ const wireType = rawSchemaToTS(schema, parentName, rawName, true, modelDeps);
7937
7937
  return {
7938
7938
  name: rawName,
7939
7939
  description: schema.description,
@@ -7956,7 +7956,7 @@ function typeOf(schema) {
7956
7956
  function isNullable(schema) {
7957
7957
  return Array.isArray(schema.type) && schema.type.includes("null");
7958
7958
  }
7959
- function rawSchemaToTS(schema, parentName, fieldName, isWire, modelDeps, rawSchemas) {
7959
+ function rawSchemaToTS(schema, parentName, fieldName, isWire, modelDeps) {
7960
7960
  if (schema.$ref) {
7961
7961
  const refName = schema.$ref.split("/").pop();
7962
7962
  modelDeps.add(refName);
@@ -7971,7 +7971,7 @@ function rawSchemaToTS(schema, parentName, fieldName, isWire, modelDeps, rawSche
7971
7971
  if (baseType === "string") core = !isWire && schema.format === "date-time" ? "Date" : "string";
7972
7972
  else if (baseType === "integer" || baseType === "number") core = "number";
7973
7973
  else if (baseType === "boolean") core = "boolean";
7974
- else if (baseType === "array" && schema.items) core = `${parenthesizeUnion(rawSchemaToTS(schema.items, parentName, singularize$3(fieldName), isWire, modelDeps, rawSchemas))}[]`;
7974
+ else if (baseType === "array" && schema.items) core = `${parenthesizeUnion(rawSchemaToTS(schema.items, parentName, singularize$3(fieldName), isWire, modelDeps))}[]`;
7975
7975
  else if (baseType === "object" && schema.properties) {
7976
7976
  const synthName = `${parentName}_${singularize$3(fieldName)}`;
7977
7977
  modelDeps.add(synthName);
@@ -24962,7 +24962,7 @@ function mapSorbetType(ref) {
24962
24962
  if (unique.length === 1) return unique[0];
24963
24963
  return `T.any(${unique.join(", ")})`;
24964
24964
  },
24965
- nullable: (_ref, inner) => `T.nilable(${inner})`,
24965
+ nullable: (_ref, inner) => wrapNilable(inner),
24966
24966
  literal: (r) => typeof r.value === "string" ? "String" : r.value === null ? "NilClass" : typeof r.value === "number" ? Number.isInteger(r.value) ? "Integer" : "Float" : "T::Boolean",
24967
24967
  map: (_ref, value) => `T::Hash[String, ${value}]`
24968
24968
  });
@@ -24990,7 +24990,7 @@ function generateRbiFiles(spec, ctx) {
24990
24990
  const fname = fieldName$1(f.name);
24991
24991
  if (seenFieldNames.has(fname)) continue;
24992
24992
  seenFieldNames.add(fname);
24993
- const sorbetType = f.required ? mapSorbetType(f.type) : `T.nilable(${unwrapNilable(mapSorbetType(f.type))})`;
24993
+ const sorbetType = f.required ? mapSorbetType(f.type) : wrapNilable(mapSorbetType(f.type));
24994
24994
  lines.push(` sig { returns(${sorbetType}) }`);
24995
24995
  lines.push(` def ${fname}; end`);
24996
24996
  lines.push("");
@@ -25097,7 +25097,7 @@ function generateRbiFiles(spec, ctx) {
25097
25097
  const n = fieldName$1(f.name);
25098
25098
  if (seen.has(n)) continue;
25099
25099
  seen.add(n);
25100
- sigParams.push(`${n}: T.nilable(${unwrapNilable(mapSorbetType(f.type))})`);
25100
+ sigParams.push(`${n}: ${wrapNilable(mapSorbetType(f.type))}`);
25101
25101
  }
25102
25102
  for (const q of queryParams) {
25103
25103
  if (hiddenParams.has(q.name)) continue;
@@ -25105,14 +25105,14 @@ function generateRbiFiles(spec, ctx) {
25105
25105
  const n = safeParamName(q.name);
25106
25106
  if (seen.has(n)) continue;
25107
25107
  seen.add(n);
25108
- sigParams.push(`${n}: T.nilable(${unwrapNilable(mapSorbetType(q.type))})`);
25108
+ sigParams.push(`${n}: ${wrapNilable(mapSorbetType(q.type))}`);
25109
25109
  }
25110
25110
  for (const group of parameterGroups) {
25111
25111
  if (!group.optional) continue;
25112
25112
  const n = fieldName$1(group.name);
25113
25113
  if (seen.has(n)) continue;
25114
25114
  seen.add(n);
25115
- sigParams.push(`${n}: T.nilable(${groupSorbetType(group)})`);
25115
+ sigParams.push(`${n}: ${wrapNilable(groupSorbetType(group))}`);
25116
25116
  }
25117
25117
  sigParams.push("request_options: T::Hash[Symbol, T.untyped]");
25118
25118
  const retType = mapSorbetReturnType(op.response, listWrapperModels, modelNames);
@@ -25166,12 +25166,17 @@ function unwrapNilable(type) {
25166
25166
  const match = type.match(/^T\.nilable\((.+)\)$/);
25167
25167
  return match ? match[1] : type;
25168
25168
  }
25169
+ /** Wrap a type in T.nilable(), skipping T.untyped (which already includes nil) and avoiding double-wrapping. */
25170
+ function wrapNilable(type) {
25171
+ if (type === "T.untyped") return type;
25172
+ return `T.nilable(${unwrapNilable(type)})`;
25173
+ }
25169
25174
  /** Map a response TypeRef to a Sorbet return type. */
25170
25175
  function mapSorbetReturnType(ref, listWrapperModels, modelNames) {
25171
25176
  if (ref.kind === "model" && listWrapperModels.has(ref.name)) return "WorkOS::Types::ListStruct";
25172
25177
  if (ref.kind === "model" && modelNames.has(ref.name)) return `WorkOS::${className(ref.name)}`;
25173
25178
  if (ref.kind === "array" && ref.items.kind === "model" && modelNames.has(ref.items.name)) return `T::Array[WorkOS::${className(ref.items.name)}]`;
25174
- if (ref.kind === "nullable") return `T.nilable(${mapSorbetReturnType(ref.inner, listWrapperModels, modelNames)})`;
25179
+ if (ref.kind === "nullable") return wrapNilable(mapSorbetReturnType(ref.inner, listWrapperModels, modelNames));
25175
25180
  if (ref.kind === "primitive" && ref.type === "unknown") return "NilClass";
25176
25181
  return mapSorbetType(ref);
25177
25182
  }
@@ -27645,4 +27650,4 @@ const workosEmittersPlugin = {
27645
27650
  //#endregion
27646
27651
  export { pythonEmitter as _, rustExtractor as a, pythonExtractor as c, rustEmitter as d, rubyEmitter as f, phpEmitter as g, goEmitter as h, kotlinExtractor as i, rubyExtractor as l, dotnetEmitter as m, elixirExtractor as n, goExtractor as o, kotlinEmitter as p, dotnetExtractor as r, phpExtractor as s, workosEmittersPlugin as t, nodeExtractor as u, nodeEmitter as v };
27647
27652
 
27648
- //# sourceMappingURL=plugin-D0qLBiGv.mjs.map
27653
+ //# sourceMappingURL=plugin-BGVaMGqe.mjs.map