@fern-api/fern-api-dev 5.92.0 → 5.92.2

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.
Files changed (2) hide show
  1. package/cli.cjs +108 -50
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -84773,6 +84773,10 @@ function getPackageNameFromGeneratorConfig(generatorInvocation) {
84773
84773
  if (packageName != null) {
84774
84774
  return packageName;
84775
84775
  }
84776
+ const kebabCasePackageName = generatorInvocation.raw.config["package-name"];
84777
+ if (typeof kebabCasePackageName === "string") {
84778
+ return kebabCasePackageName;
84779
+ }
84776
84780
  const modulePath = generatorInvocation.raw.config.module?.path;
84777
84781
  if (modulePath != null) {
84778
84782
  return modulePath;
@@ -103311,7 +103315,7 @@ function getFilesystemPublishTarget({ generatorInvocation, version: version7, us
103311
103315
  artifactId: packageName
103312
103316
  };
103313
103317
  } else if (typeof configObj["package-prefix"] === "string" && !packageName) {
103314
- context3.logger.warn("Java generator has package-prefix configured but packageName is missing");
103318
+ context3.logger.warn("Java generator has package-prefix configured but no package name could be resolved. Set 'package-name' (or 'group' and 'artifact') in the generator config to stamp Maven coordinates.");
103315
103319
  }
103316
103320
  return void 0;
103317
103321
  })();
@@ -350091,6 +350095,23 @@ var init_x_fern_discriminated = __esm({
350091
350095
  });
350092
350096
 
350093
350097
  // ../api-importers/v3-importer-commons/lib/converters/schema/OneOfSchemaConverter.js
350098
+ function isUnionWithoutVariants(type7) {
350099
+ return type7.type === "union" && type7.types.length === 0;
350100
+ }
350101
+ function getLiteralDiscriminant({ schema, discriminantProperty }) {
350102
+ const discriminantSchema = schema.properties?.[discriminantProperty];
350103
+ if (discriminantSchema == null || "$ref" in discriminantSchema) {
350104
+ return void 0;
350105
+ }
350106
+ const constValue = discriminantSchema.const;
350107
+ if (typeof constValue === "string") {
350108
+ return constValue;
350109
+ }
350110
+ if (discriminantSchema.enum?.length === 1 && typeof discriminantSchema.enum[0] === "string") {
350111
+ return discriminantSchema.enum[0];
350112
+ }
350113
+ return void 0;
350114
+ }
350094
350115
  var OneOfSchemaConverter;
350095
350116
  var init_OneOfSchemaConverter = __esm({
350096
350117
  "../api-importers/v3-importer-commons/lib/converters/schema/OneOfSchemaConverter.js"() {
@@ -350126,7 +350147,11 @@ var init_OneOfSchemaConverter = __esm({
350126
350147
  return this.convertAsUndiscriminatedUnion();
350127
350148
  }
350128
350149
  if (this.schema.discriminator != null) {
350129
- return this.convertAsDiscriminatedUnion();
350150
+ const discriminatedUnion2 = this.convertAsDiscriminatedUnion();
350151
+ if (discriminatedUnion2 != null && !isUnionWithoutVariants(discriminatedUnion2.type)) {
350152
+ return discriminatedUnion2;
350153
+ }
350154
+ return this.convertAsUndiscriminatedUnion() ?? discriminatedUnion2;
350130
350155
  }
350131
350156
  if (this.context.settings.inferForwardCompatible) {
350132
350157
  const openEndedEnum = this.convertAsOpenEndedEnum();
@@ -350213,44 +350238,80 @@ var init_OneOfSchemaConverter = __esm({
350213
350238
  };
350214
350239
  }
350215
350240
  /**
350216
- * When `discriminator.mapping` is absent, infers the mapping from the `oneOf`/`anyOf` $ref schemas.
350241
+ * The variants of the union, from `discriminator.mapping` when it is declared and otherwise
350242
+ * inferred from the `oneOf`/`anyOf` members.
350217
350243
  *
350218
350244
  * Per the OpenAPI 3.x spec, if no mapping is provided the discriminant values are derived from
350219
- * the schema names in the $ref paths. We also check the resolved schema's discriminant property
350220
- * for `const` or single-element `enum` values, which take precedence over the schema name.
350221
- */
350222
- inferDiscriminatorMapping(discriminantProperty) {
350245
+ * the schema names in the $ref paths. We also check the discriminant property of each member
350246
+ * for `const` or single-element `enum` values, which take precedence over the schema name and
350247
+ * are the only way to name a member that is inlined rather than $ref'd.
350248
+ *
350249
+ * Returns no variants when a member's discriminant value cannot be determined, since a union
350250
+ * missing that member is worse than an undiscriminated one.
350251
+ */
350252
+ getVariants(discriminantProperty) {
350253
+ const mapping = this.schema.discriminator?.mapping;
350254
+ if (mapping != null) {
350255
+ const variants2 = [];
350256
+ for (const [discriminant22, ref2] of Object.entries(mapping)) {
350257
+ const typeId = this.context.getTypeIdFromSchemaReference({ $ref: ref2 });
350258
+ if (typeId == null) {
350259
+ continue;
350260
+ }
350261
+ variants2.push({
350262
+ discriminant: discriminant22,
350263
+ typeId,
350264
+ ref: ref2,
350265
+ schema: this.resolveVariantSchema({ $ref: ref2 }),
350266
+ breadcrumbs: [...this.breadcrumbs, "discriminator", "mapping", discriminant22]
350267
+ });
350268
+ }
350269
+ return variants2;
350270
+ }
350223
350271
  const subSchemas = this.schema.oneOf ?? this.schema.anyOf ?? [];
350224
- const mapping = {};
350225
- for (const subSchema of subSchemas) {
350272
+ const variants = [];
350273
+ for (const [index3, subSchema] of subSchemas.entries()) {
350274
+ const schema = this.resolveVariantSchema(subSchema);
350275
+ const literalDiscriminant = schema != null ? getLiteralDiscriminant({ schema, discriminantProperty }) : void 0;
350226
350276
  if (!this.context.isReferenceObject(subSchema)) {
350277
+ if (literalDiscriminant == null) {
350278
+ return [];
350279
+ }
350280
+ variants.push({
350281
+ discriminant: literalDiscriminant,
350282
+ typeId: this.context.convertBreadcrumbsToName([`${this.id}_${index3}`]),
350283
+ schema,
350284
+ breadcrumbs: [...this.breadcrumbs, `oneOf[${index3}]`]
350285
+ });
350227
350286
  continue;
350228
350287
  }
350229
350288
  const ref2 = subSchema.$ref;
350230
350289
  const schemaName = ref2.split("/").pop();
350231
- if (schemaName == null) {
350232
- continue;
350290
+ const typeId = this.context.getTypeIdFromSchemaReference(subSchema);
350291
+ const discriminant22 = literalDiscriminant ?? schemaName;
350292
+ if (typeId == null || discriminant22 == null) {
350293
+ return [];
350233
350294
  }
350234
- const resolved = this.context.resolveReference({
350235
- reference: subSchema,
350236
- breadcrumbs: this.breadcrumbs,
350237
- skipErrorCollector: true
350295
+ variants.push({
350296
+ discriminant: discriminant22,
350297
+ typeId,
350298
+ ref: ref2,
350299
+ schema,
350300
+ breadcrumbs: [...this.breadcrumbs, "discriminator", "mapping", discriminant22]
350238
350301
  });
350239
- let discriminantValue = schemaName;
350240
- if (resolved.resolved) {
350241
- const discriminantPropSchema = resolved.value.properties?.[discriminantProperty];
350242
- if (discriminantPropSchema != null && !this.context.isReferenceObject(discriminantPropSchema)) {
350243
- const constValue = discriminantPropSchema.const;
350244
- if (typeof constValue === "string") {
350245
- discriminantValue = constValue;
350246
- } else if (discriminantPropSchema.enum != null && discriminantPropSchema.enum.length === 1 && typeof discriminantPropSchema.enum[0] === "string") {
350247
- discriminantValue = discriminantPropSchema.enum[0];
350248
- }
350249
- }
350250
- }
350251
- mapping[discriminantValue] = ref2;
350252
350302
  }
350253
- return mapping;
350303
+ return variants;
350304
+ }
350305
+ resolveVariantSchema(schemaOrReference) {
350306
+ if (!this.context.isReferenceObject(schemaOrReference)) {
350307
+ return schemaOrReference;
350308
+ }
350309
+ const resolved = this.context.resolveReference({
350310
+ reference: schemaOrReference,
350311
+ breadcrumbs: this.breadcrumbs,
350312
+ skipErrorCollector: true
350313
+ });
350314
+ return resolved.resolved ? resolved.value : void 0;
350254
350315
  }
350255
350316
  convertAsDiscriminatedUnion() {
350256
350317
  if (this.schema.discriminator == null) {
@@ -350260,18 +350321,13 @@ var init_OneOfSchemaConverter = __esm({
350260
350321
  const unionTypes = [];
350261
350322
  let referencedTypes = /* @__PURE__ */ new Set();
350262
350323
  let inlinedTypes = {};
350263
- const effectiveMapping = this.schema.discriminator.mapping ?? this.inferDiscriminatorMapping(discriminantProperty);
350264
- for (const [discriminant22, reference4] of Object.entries(effectiveMapping)) {
350265
- const typeId = this.context.getTypeIdFromSchemaReference({ $ref: reference4 });
350266
- const breadcrumbs = [...this.breadcrumbs, "discriminator", "mapping", discriminant22];
350267
- const resolvedSchema = this.context.resolveReference({
350268
- reference: { $ref: reference4 },
350269
- breadcrumbs
350270
- });
350271
- let schemaOrReference = { $ref: reference4 };
350272
- if (resolvedSchema.resolved && resolvedSchema.value.properties != null && discriminantProperty in resolvedSchema.value.properties) {
350273
- const filteredSchema = this.filterDiscriminantFromSchema(resolvedSchema.value, discriminantProperty);
350274
- schemaOrReference = filteredSchema;
350324
+ for (const { discriminant: discriminant22, typeId, ref: ref2, schema: variantSchema, breadcrumbs } of this.getVariants(discriminantProperty)) {
350325
+ let schemaOrReference = ref2 != null ? { $ref: ref2 } : variantSchema;
350326
+ if (variantSchema?.properties != null && discriminantProperty in variantSchema.properties) {
350327
+ schemaOrReference = this.filterDiscriminantFromSchema(variantSchema, discriminantProperty);
350328
+ }
350329
+ if (schemaOrReference == null) {
350330
+ continue;
350275
350331
  }
350276
350332
  const singleUnionTypeSchemaConverter = new SchemaOrReferenceConverter({
350277
350333
  context: this.context,
@@ -350294,9 +350350,9 @@ var init_OneOfSchemaConverter = __esm({
350294
350350
  name: discriminant22,
350295
350351
  wireValue: discriminant22
350296
350352
  });
350297
- const rawSchemaName = reference4.split("/").pop() ?? typeId;
350298
- const schemaTitle = resolvedSchema.resolved ? resolvedSchema.value.title : void 0;
350299
- const schemaDescription = resolvedSchema.resolved ? resolvedSchema.value.description : void 0;
350353
+ const rawSchemaName = ref2?.split("/").pop() ?? typeId;
350354
+ const schemaTitle = variantSchema?.title;
350355
+ const schemaDescription = variantSchema?.description;
350300
350356
  const variantDisplayName = schemaTitle ?? discriminant22 ?? rawSchemaName;
350301
350357
  if (convertedSchema.schema?.typeDeclaration != null && schemaTitle != null) {
350302
350358
  convertedSchema.schema.typeDeclaration.name.displayName = schemaTitle;
@@ -702673,7 +702729,7 @@ var AccessTokenPosthogManager = class {
702673
702729
  properties: {
702674
702730
  ...event,
702675
702731
  ...event.properties,
702676
- version: "5.92.0",
702732
+ version: "5.92.2",
702677
702733
  usingAccessToken: true,
702678
702734
  ...getRunIdProperties()
702679
702735
  }
@@ -702739,7 +702795,7 @@ var UserPosthogManager = class {
702739
702795
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
702740
702796
  event: "CLI",
702741
702797
  properties: {
702742
- version: "5.92.0",
702798
+ version: "5.92.2",
702743
702799
  ...event,
702744
702800
  ...event.properties,
702745
702801
  usingAccessToken: false,
@@ -883905,7 +883961,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
883905
883961
  var LOGS_FOLDER_NAME = "logs";
883906
883962
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
883907
883963
  function getCliSource() {
883908
- const version7 = "5.92.0";
883964
+ const version7 = "5.92.2";
883909
883965
  return `cli@${version7}`;
883910
883966
  }
883911
883967
  var DebugLogger = class {
@@ -909221,7 +909277,7 @@ var LegacyDocsPublisher = class {
909221
909277
  previewId,
909222
909278
  disableTemplates: void 0,
909223
909279
  skipUpload,
909224
- cliVersion: "5.92.0",
909280
+ cliVersion: "5.92.2",
909225
909281
  loginCommand: "fern auth login"
909226
909282
  });
909227
909283
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -928955,6 +929011,8 @@ var Generation = class {
928955
929011
  extraDependencies: () => this.customConfig["extra-dependencies"] ?? {},
928956
929012
  /** When true, omits Fern platform headers (X-Fern-Language, SDK name/version, User-Agent) from generated SDK requests. Default: false. */
928957
929013
  omitFernHeaders: () => this.customConfig["omit-fern-headers"] ?? false,
929014
+ /** When true, explicitly provided constructor auth credentials take precedence over env-var defaults when selecting the auth scheme (explicit basic auth wins over OAuth env vars). Default: false. */
929015
+ preferExplicitAuth: () => this.customConfig["prefer-explicit-auth"] ?? false,
928958
929016
  /** When true, emits the platform observability headers (X-Fern-Runtime, X-Fern-Runtime-Version, X-Fern-Platform). Default: false. Still subject to omitFernHeaders. */
928959
929017
  includePlatformHeaders: () => this.customConfig["include-platform-headers"] ?? false,
928960
929018
  /** When true, exposes an `AppInfo` client option whose sanitized product token is appended to the `User-Agent` header (RFC 9110). Default: false. Independent of includePlatformHeaders; still subject to omitFernHeaders. */
@@ -976135,7 +976193,7 @@ function getAutomationContextFromEnv() {
976135
976193
  config_branch: process.env.FERN_CONFIG_BRANCH,
976136
976194
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
976137
976195
  trigger: process.env.GITHUB_EVENT_NAME,
976138
- cli_version: "5.92.0"
976196
+ cli_version: "5.92.2"
976139
976197
  };
976140
976198
  }
976141
976199
  function isAutomationMode() {
@@ -976967,7 +977025,7 @@ var CliContext = class _CliContext {
976967
977025
  if (false) {
976968
977026
  this.logger.error("CLI_VERSION is not defined");
976969
977027
  }
976970
- return "5.92.0";
977028
+ return "5.92.2";
976971
977029
  }
976972
977030
  getCliName() {
976973
977031
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.92.0",
2
+ "version": "5.92.2",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",