@workos/oagen-emitters 0.8.0 → 0.8.1
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.
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +7 -0
- package/dist/index.mjs +1 -1
- package/dist/{plugin-bCMdV7KX.mjs → plugin-DOE0FqrZ.mjs} +19 -13
- package/dist/plugin-DOE0FqrZ.mjs.map +1 -0
- package/dist/plugin.mjs +1 -1
- package/package.json +1 -1
- package/src/dotnet/index.ts +6 -2
- package/src/dotnet/models.ts +19 -7
- package/src/go/fixtures.ts +10 -2
- package/src/python/client.ts +4 -6
- package/src/python/models.ts +30 -1
- package/dist/plugin-bCMdV7KX.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.8.1](https://github.com/workos/oagen-emitters/compare/v0.8.0...v0.8.1) (2026-05-05)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **emitters:** repair regressions surfaced by shared-schema spec rev ([#84](https://github.com/workos/oagen-emitters/issues/84)) ([a04d317](https://github.com/workos/oagen-emitters/commit/a04d3170707adea21f19632f2a149b735be91d50))
|
|
9
|
+
|
|
3
10
|
## [0.8.0](https://github.com/workos/oagen-emitters/compare/v0.7.5...v0.8.0) (2026-05-05)
|
|
4
11
|
|
|
5
12
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as nodeEmitter, a as rustExtractor, c as pythonExtractor, d as rubyEmitter, f as kotlinEmitter, g as pythonEmitter, h as phpEmitter, i as kotlinExtractor, l as rubyExtractor, m as goEmitter, n as elixirExtractor, o as goExtractor, p as dotnetEmitter, r as dotnetExtractor, s as phpExtractor, t as workosEmittersPlugin, u as nodeExtractor } from "./plugin-
|
|
1
|
+
import { _ as nodeEmitter, a as rustExtractor, c as pythonExtractor, d as rubyEmitter, f as kotlinEmitter, g as pythonEmitter, h as phpEmitter, i as kotlinExtractor, l as rubyExtractor, m as goEmitter, n as elixirExtractor, o as goExtractor, p as dotnetEmitter, r as dotnetExtractor, s as phpExtractor, t as workosEmittersPlugin, u as nodeExtractor } from "./plugin-DOE0FqrZ.mjs";
|
|
2
2
|
export { dotnetEmitter, dotnetExtractor, elixirExtractor, goEmitter, goExtractor, kotlinEmitter, kotlinExtractor, nodeEmitter, nodeExtractor, phpEmitter, phpExtractor, pythonEmitter, pythonExtractor, rubyEmitter, rubyExtractor, rustExtractor, workosEmittersPlugin };
|
|
@@ -7456,6 +7456,12 @@ function generateModels$5(models, ctx) {
|
|
|
7456
7456
|
const dirName = mountDirMap.get(service.name) ?? resolveDir(service.name);
|
|
7457
7457
|
serviceDirModelPaths.add(`src/${ctx.namespace}/${dirName}/models`);
|
|
7458
7458
|
}
|
|
7459
|
+
for (const dirPath of serviceDirModelPaths) if (!symbolsByDir.has(dirPath)) files.push({
|
|
7460
|
+
path: `${dirPath}/__init__.py`,
|
|
7461
|
+
content: "",
|
|
7462
|
+
integrateTarget: true,
|
|
7463
|
+
overwriteExisting: true
|
|
7464
|
+
});
|
|
7459
7465
|
for (const [dirPath, names] of symbolsByDir) {
|
|
7460
7466
|
const uniqueNames = [...new Set(names)].sort();
|
|
7461
7467
|
const importLines = [];
|
|
@@ -7639,7 +7645,7 @@ function deserializeField(ref, accessor, isRequired, walrusVar = "_v") {
|
|
|
7639
7645
|
const dispatchMap = entries.map(([value, modelName]) => `"${value}": ${className$5(modelName)}`).join(", ");
|
|
7640
7646
|
const dataExpr = isRequired ? accessor : walrusVar;
|
|
7641
7647
|
const dataCast = `cast(Dict[str, Any], ${dataExpr})`;
|
|
7642
|
-
const branch = `(_disc.from_dict(${dataCast}) if (_disc := ${`{${dispatchMap}}.get(${dataCast}.get("${ref.discriminator.property}"))`}) is not None else ${dataExpr})`;
|
|
7648
|
+
const branch = `(_disc.from_dict(${dataCast}) if (_disc := ${`{${dispatchMap}}.get(cast(str, ${dataCast}.get("${ref.discriminator.property}")))`}) is not None else ${dataExpr})`;
|
|
7643
7649
|
if (isRequired) return branch;
|
|
7644
7650
|
return `(${branch}) if (${walrusVar} := ${accessor}) is not None else None`;
|
|
7645
7651
|
}
|
|
@@ -7665,6 +7671,7 @@ function serializeField(ref, accessor) {
|
|
|
7665
7671
|
case "union": {
|
|
7666
7672
|
const modelVariants = (ref.variants ?? []).filter((v) => v.kind === "model");
|
|
7667
7673
|
if ([...new Set(modelVariants.map((v) => v.name))].length === 1) return `${accessor}.to_dict()`;
|
|
7674
|
+
if (ref.discriminator && ref.discriminator.mapping && modelVariants.length > 0) return `${accessor}.to_dict() if hasattr(${accessor}, "to_dict") else ${accessor}`;
|
|
7668
7675
|
return accessor;
|
|
7669
7676
|
}
|
|
7670
7677
|
default: return accessor;
|
|
@@ -9067,11 +9074,6 @@ function generateServiceInits(spec, ctx) {
|
|
|
9067
9074
|
integrateTarget: true,
|
|
9068
9075
|
overwriteExisting: true
|
|
9069
9076
|
});
|
|
9070
|
-
files.push({
|
|
9071
|
-
path: `src/${ctx.namespace}/${dirName}/models/__init__.py`,
|
|
9072
|
-
content: "",
|
|
9073
|
-
skipIfExists: true
|
|
9074
|
-
});
|
|
9075
9077
|
}
|
|
9076
9078
|
return files;
|
|
9077
9079
|
}
|
|
@@ -14071,12 +14073,16 @@ function generateFixtures$1(spec) {
|
|
|
14071
14073
|
content: JSON.stringify(fixture, null, 2)
|
|
14072
14074
|
});
|
|
14073
14075
|
}
|
|
14076
|
+
const seenListPaths = /* @__PURE__ */ new Set();
|
|
14074
14077
|
for (const service of spec.services) for (const op of service.operations) if (op.pagination) {
|
|
14075
14078
|
let itemModel = op.pagination.itemType.kind === "model" ? modelMap.get(op.pagination.itemType.name) : null;
|
|
14076
14079
|
if (itemModel) {
|
|
14077
14080
|
const unwrapped = unwrapListModel$1(itemModel, modelMap);
|
|
14078
14081
|
if (unwrapped) itemModel = unwrapped;
|
|
14079
14082
|
if (itemModel.fields.length === 0) continue;
|
|
14083
|
+
const path = `testdata/list_${fileName$1(itemModel.name)}.json`;
|
|
14084
|
+
if (seenListPaths.has(path)) continue;
|
|
14085
|
+
seenListPaths.add(path);
|
|
14080
14086
|
const listFixture = {
|
|
14081
14087
|
data: [generateModelFixture$1(itemModel, modelMap, enumMap)],
|
|
14082
14088
|
list_metadata: {
|
|
@@ -14085,7 +14091,7 @@ function generateFixtures$1(spec) {
|
|
|
14085
14091
|
}
|
|
14086
14092
|
};
|
|
14087
14093
|
files.push({
|
|
14088
|
-
path
|
|
14094
|
+
path,
|
|
14089
14095
|
content: JSON.stringify(listFixture, null, 2)
|
|
14090
14096
|
});
|
|
14091
14097
|
}
|
|
@@ -15199,9 +15205,9 @@ function generateModels$2(models, ctx, discCtx) {
|
|
|
15199
15205
|
if (models.length === 0) return [];
|
|
15200
15206
|
const enumConstByName = /* @__PURE__ */ new Map();
|
|
15201
15207
|
for (const e of ctx.spec.enums) if (e.values.length === 1) enumConstByName.set(e.name, String(e.values[0].value));
|
|
15202
|
-
const requestBodyOnlyNames = collectRequestBodyOnlyModelNames(ctx.spec.services, models);
|
|
15203
15208
|
const files = [];
|
|
15204
15209
|
primeModelAliases(models);
|
|
15210
|
+
const requestBodyOnlyNames = collectRequestBodyOnlyModelNames(ctx.spec.services, models);
|
|
15205
15211
|
const baseFieldLookup = /* @__PURE__ */ new Map();
|
|
15206
15212
|
if (discCtx) {
|
|
15207
15213
|
for (const model of models) if (discCtx.discriminatorBases.has(model.name)) {
|
|
@@ -15489,10 +15495,10 @@ function collectRequestBodyOnlyModelNames(services, models) {
|
|
|
15489
15495
|
const otherReferences = /* @__PURE__ */ new Set();
|
|
15490
15496
|
const collect = (ref, into) => {
|
|
15491
15497
|
if (!ref) return;
|
|
15492
|
-
walkTypeRef(ref, { model: (r) => into.add(r.name) });
|
|
15498
|
+
walkTypeRef(ref, { model: (r) => into.add(resolveModelName(r.name)) });
|
|
15493
15499
|
};
|
|
15494
15500
|
for (const service of services) for (const op of service.operations) {
|
|
15495
|
-
if (op.requestBody?.kind === "model") requestBodyNames.add(op.requestBody.name);
|
|
15501
|
+
if (op.requestBody?.kind === "model") requestBodyNames.add(resolveModelName(op.requestBody.name));
|
|
15496
15502
|
collect(op.response, otherReferences);
|
|
15497
15503
|
if (op.pagination) collect(op.pagination.itemType, otherReferences);
|
|
15498
15504
|
for (const p of [
|
|
@@ -17227,7 +17233,7 @@ const dotnetEmitter = {
|
|
|
17227
17233
|
lines.push(" {");
|
|
17228
17234
|
lines.push(" public override bool CanConvert(Type objectType) => objectType == typeof(object);");
|
|
17229
17235
|
lines.push("");
|
|
17230
|
-
lines.push(" public override object ReadJson(Newtonsoft.Json.JsonReader reader, Type objectType, object? existingValue, Newtonsoft.Json.JsonSerializer serializer)");
|
|
17236
|
+
lines.push(" public override object? ReadJson(Newtonsoft.Json.JsonReader reader, Type objectType, object? existingValue, Newtonsoft.Json.JsonSerializer serializer)");
|
|
17231
17237
|
lines.push(" {");
|
|
17232
17238
|
lines.push(" var jObject = JObject.Load(reader);");
|
|
17233
17239
|
lines.push(` var discriminatorValue = jObject["${disc.property}"]?.ToString();`);
|
|
@@ -17273,7 +17279,7 @@ const dotnetEmitter = {
|
|
|
17273
17279
|
lines.push("");
|
|
17274
17280
|
lines.push(` public override bool CanConvert(Type objectType) => typeof(${baseClass}).IsAssignableFrom(objectType);`);
|
|
17275
17281
|
lines.push("");
|
|
17276
|
-
lines.push(" public override object ReadJson(Newtonsoft.Json.JsonReader reader, Type objectType, object? existingValue, Newtonsoft.Json.JsonSerializer serializer)");
|
|
17282
|
+
lines.push(" public override object? ReadJson(Newtonsoft.Json.JsonReader reader, Type objectType, object? existingValue, Newtonsoft.Json.JsonSerializer serializer)");
|
|
17277
17283
|
lines.push(" {");
|
|
17278
17284
|
lines.push(" var jObject = JObject.Load(reader);");
|
|
17279
17285
|
lines.push(` var discriminatorValue = jObject["${disc.property}"]?.ToString();`);
|
|
@@ -22294,4 +22300,4 @@ const workosEmittersPlugin = {
|
|
|
22294
22300
|
//#endregion
|
|
22295
22301
|
export { nodeEmitter as _, rustExtractor as a, pythonExtractor as c, rubyEmitter as d, kotlinEmitter as f, pythonEmitter as g, phpEmitter as h, kotlinExtractor as i, rubyExtractor as l, goEmitter as m, elixirExtractor as n, goExtractor as o, dotnetEmitter as p, dotnetExtractor as r, phpExtractor as s, workosEmittersPlugin as t, nodeExtractor as u };
|
|
22296
22302
|
|
|
22297
|
-
//# sourceMappingURL=plugin-
|
|
22303
|
+
//# sourceMappingURL=plugin-DOE0FqrZ.mjs.map
|