@fern-api/fern-api-dev 5.75.2 → 5.75.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.
Files changed (2) hide show
  1. package/cli.cjs +156 -16
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -344223,13 +344223,28 @@ function getLiteralValueFromSchema(schema) {
344223
344223
  }
344224
344224
  return void 0;
344225
344225
  }
344226
- var LITERAL_REGEX, ExampleConverter;
344226
+ var LITERAL_REGEX, EXAMPLE_CONVERTER_SHARED_STATE, MERGE_ONLY_OBJECT_SCHEMA_FIELDS, ExampleConverter;
344227
344227
  var init_ExampleConverter = __esm({
344228
344228
  "../api-importers/v3-importer-commons/lib/converters/ExampleConverter.js"() {
344229
344229
  "use strict";
344230
344230
  init_lib4();
344231
344231
  init_lib29();
344232
344232
  LITERAL_REGEX = /^literal<\s*(?:"(.*)"|(true|false))\s*>$/;
344233
+ EXAMPLE_CONVERTER_SHARED_STATE = /* @__PURE__ */ new WeakMap();
344234
+ MERGE_ONLY_OBJECT_SCHEMA_FIELDS = /* @__PURE__ */ new Set([
344235
+ "type",
344236
+ "properties",
344237
+ "required",
344238
+ "allOf",
344239
+ "description",
344240
+ "title",
344241
+ "deprecated",
344242
+ "readOnly",
344243
+ "writeOnly",
344244
+ "xml",
344245
+ "externalDocs",
344246
+ "discriminator"
344247
+ ]);
344233
344248
  ExampleConverter = class _ExampleConverter extends AbstractConverter {
344234
344249
  MAX_DEPTH = 12;
344235
344250
  EXAMPLE_STRING = examples_exports.STRING;
@@ -344244,6 +344259,7 @@ var init_ExampleConverter = __esm({
344244
344259
  exampleGenerationStrategy;
344245
344260
  generateOptionalProperties;
344246
344261
  seenRefs;
344262
+ sharedState;
344247
344263
  constructor({ breadcrumbs, context: context3, schema, example, depth = 0, exampleGenerationStrategy, generateOptionalProperties = false, seenRefs = /* @__PURE__ */ new Set() }) {
344248
344264
  super({ breadcrumbs, context: context3 });
344249
344265
  this.example = example;
@@ -344252,6 +344268,16 @@ var init_ExampleConverter = __esm({
344252
344268
  this.exampleGenerationStrategy = exampleGenerationStrategy;
344253
344269
  this.generateOptionalProperties = generateOptionalProperties;
344254
344270
  this.seenRefs = seenRefs;
344271
+ const existingSharedState = EXAMPLE_CONVERTER_SHARED_STATE.get(context3);
344272
+ if (existingSharedState != null) {
344273
+ this.sharedState = existingSharedState;
344274
+ } else {
344275
+ this.sharedState = {
344276
+ mergedAllOfProperties: /* @__PURE__ */ new WeakMap(),
344277
+ mergeOnlyAllOfSchemas: /* @__PURE__ */ new WeakMap()
344278
+ };
344279
+ EXAMPLE_CONVERTER_SHARED_STATE.set(context3, this.sharedState);
344280
+ }
344255
344281
  }
344256
344282
  convert() {
344257
344283
  if (this.depth > this.MAX_DEPTH) {
@@ -344720,7 +344746,8 @@ var init_ExampleConverter = __esm({
344720
344746
  };
344721
344747
  }
344722
344748
  const exampleObj = typeof this.example !== "object" || this.example == null ? {} : this.example;
344723
- const { mergedProperties, mergedRequired } = this.mergeAllOfProperties(resolvedSchema);
344749
+ const canGenerateFromMergedAllOf = this.example === void 0 && this.canGenerateFromMergedAllOf(resolvedSchema);
344750
+ const { mergedProperties, mergedRequired } = this.mergeAllOfProperties(resolvedSchema, /* @__PURE__ */ new Set(), 0, canGenerateFromMergedAllOf);
344724
344751
  const resultsByKey = Object.entries(mergedProperties).map(([key2, property24]) => {
344725
344752
  if (typeof property24 !== "object") {
344726
344753
  return {
@@ -344830,7 +344857,7 @@ var init_ExampleConverter = __esm({
344830
344857
  return { key: key2, result };
344831
344858
  }
344832
344859
  });
344833
- const allOfResults = (resolvedSchema.allOf ?? []).map((subSchema, index3) => {
344860
+ const allOfResults = canGenerateFromMergedAllOf ? [] : (resolvedSchema.allOf ?? []).map((subSchema, index3) => {
344834
344861
  const resolvedSubSchema = this.context.resolveMaybeReference({
344835
344862
  schemaOrReference: subSchema,
344836
344863
  breadcrumbs: [...this.breadcrumbs, `allOf[${index3}]`],
@@ -345212,11 +345239,21 @@ var init_ExampleConverter = __esm({
345212
345239
  *
345213
345240
  * Precedence: the override's fields win; the base's fields fill in anything missing.
345214
345241
  */
345215
- mergeAllOfProperties(resolvedSchema, visited = /* @__PURE__ */ new Set(), depth = 0) {
345242
+ mergeAllOfProperties(resolvedSchema, visited = /* @__PURE__ */ new Set(), depth = 0, useCache = false) {
345243
+ if (useCache) {
345244
+ const cached2 = this.sharedState.mergedAllOfProperties.get(resolvedSchema)?.get(depth);
345245
+ if (cached2 != null) {
345246
+ return cached2;
345247
+ }
345248
+ }
345216
345249
  const directProps = resolvedSchema.properties ?? {};
345217
345250
  const directRequired = resolvedSchema.required ?? [];
345218
345251
  if (depth > this.MAX_DEPTH || resolvedSchema.allOf == null || resolvedSchema.allOf.length === 0) {
345219
- return { mergedProperties: directProps, mergedRequired: directRequired };
345252
+ const result2 = { mergedProperties: directProps, mergedRequired: directRequired };
345253
+ if (useCache) {
345254
+ this.cacheMergedAllOfProperties(resolvedSchema, depth, result2);
345255
+ }
345256
+ return result2;
345220
345257
  }
345221
345258
  const baseProps = {};
345222
345259
  const baseRequired = new Set(directRequired);
@@ -345238,7 +345275,7 @@ var init_ExampleConverter = __esm({
345238
345275
  if (refKey != null) {
345239
345276
  childVisited.add(refKey);
345240
345277
  }
345241
- const nested = this.mergeAllOfProperties(resolved, childVisited, depth + 1);
345278
+ const nested = this.mergeAllOfProperties(resolved, childVisited, depth + 1, useCache);
345242
345279
  for (const req of nested.mergedRequired) {
345243
345280
  baseRequired.add(req);
345244
345281
  }
@@ -345292,7 +345329,58 @@ var init_ExampleConverter = __esm({
345292
345329
  merged[key2] = baseProp;
345293
345330
  }
345294
345331
  }
345295
- return { mergedProperties: merged, mergedRequired: [...baseRequired] };
345332
+ const result = { mergedProperties: merged, mergedRequired: [...baseRequired] };
345333
+ if (useCache) {
345334
+ this.cacheMergedAllOfProperties(resolvedSchema, depth, result);
345335
+ }
345336
+ return result;
345337
+ }
345338
+ cacheMergedAllOfProperties(schema, depth, mergedAllOfProperties) {
345339
+ const cachedByDepth = this.sharedState.mergedAllOfProperties.get(schema);
345340
+ if (cachedByDepth != null) {
345341
+ cachedByDepth.set(depth, mergedAllOfProperties);
345342
+ } else {
345343
+ this.sharedState.mergedAllOfProperties.set(schema, /* @__PURE__ */ new Map([[depth, mergedAllOfProperties]]));
345344
+ }
345345
+ }
345346
+ canGenerateFromMergedAllOf(resolvedSchema, visiting = /* @__PURE__ */ new WeakSet()) {
345347
+ if (resolvedSchema.allOf == null || resolvedSchema.allOf.length === 0) {
345348
+ return false;
345349
+ }
345350
+ if (!this.isMergeOnlyObjectSchema(resolvedSchema)) {
345351
+ return false;
345352
+ }
345353
+ const cached2 = this.sharedState.mergeOnlyAllOfSchemas.get(resolvedSchema);
345354
+ if (cached2 != null) {
345355
+ return cached2;
345356
+ }
345357
+ if (visiting.has(resolvedSchema)) {
345358
+ return false;
345359
+ }
345360
+ visiting.add(resolvedSchema);
345361
+ const canGenerateFromMergedAllOf = resolvedSchema.allOf.every((subSchema) => {
345362
+ const resolved = this.context.resolveMaybeReference({
345363
+ schemaOrReference: subSchema,
345364
+ breadcrumbs: this.breadcrumbs,
345365
+ skipErrorCollector: true
345366
+ });
345367
+ if (resolved == null || !this.isMergeOnlyObjectSchema(resolved)) {
345368
+ return false;
345369
+ }
345370
+ return resolved.allOf == null || resolved.allOf.length === 0 ? true : this.canGenerateFromMergedAllOf(resolved, visiting);
345371
+ });
345372
+ visiting.delete(resolvedSchema);
345373
+ this.sharedState.mergeOnlyAllOfSchemas.set(resolvedSchema, canGenerateFromMergedAllOf);
345374
+ return canGenerateFromMergedAllOf;
345375
+ }
345376
+ isMergeOnlyObjectSchema(schema) {
345377
+ if (schema.type != null && schema.type !== "object") {
345378
+ return false;
345379
+ }
345380
+ if (schema.type == null && schema.properties == null && schema.allOf == null) {
345381
+ return false;
345382
+ }
345383
+ return Object.keys(schema).every((key2) => MERGE_ONLY_OBJECT_SCHEMA_FIELDS.has(key2));
345296
345384
  }
345297
345385
  /**
345298
345386
  * Checks if a schema is a "constraint-only" schema that only has validation constraints
@@ -691061,7 +691149,7 @@ var AccessTokenPosthogManager = class {
691061
691149
  properties: {
691062
691150
  ...event,
691063
691151
  ...event.properties,
691064
- version: "5.75.2",
691152
+ version: "5.75.4",
691065
691153
  usingAccessToken: true,
691066
691154
  ...getRunIdProperties()
691067
691155
  }
@@ -691127,7 +691215,7 @@ var UserPosthogManager = class {
691127
691215
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
691128
691216
  event: "CLI",
691129
691217
  properties: {
691130
- version: "5.75.2",
691218
+ version: "5.75.4",
691131
691219
  ...event,
691132
691220
  ...event.properties,
691133
691221
  usingAccessToken: false,
@@ -866427,7 +866515,9 @@ var ValidMarkdownRule = {
866427
866515
  const message = markdownParseResult.message != null ? `Markdown failed to parse: ${markdownParseResult.message}` : "Markdown failed to parse";
866428
866516
  return [
866429
866517
  {
866430
- severity: "fatal",
866518
+ // Surfaced as a warning (not an error) so re-enabling this rule does not
866519
+ // suddenly break existing `fern check` runs on repos with latent MDX issues.
866520
+ severity: "warning",
866431
866521
  message
866432
866522
  }
866433
866523
  ];
@@ -868404,6 +868494,8 @@ var allRules = [
868404
868494
  // Check non-component references (will skip v2 files)
868405
868495
  ValidLocalReferencesRule,
868406
868496
  // Validate that local references actually exist
868497
+ ValidMarkdownRule,
868498
+ // Compile each page's MDX and surface syntax errors (e.g. unclosed components)
868407
868499
  NavigationConflicts,
868408
868500
  ValidateVersionFileRule,
868409
868501
  ValidateProductFileRule,
@@ -872228,7 +872320,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
872228
872320
  var LOGS_FOLDER_NAME = "logs";
872229
872321
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
872230
872322
  function getCliSource() {
872231
- const version7 = "5.75.2";
872323
+ const version7 = "5.75.4";
872232
872324
  return `cli@${version7}`;
872233
872325
  }
872234
872326
  var DebugLogger = class {
@@ -904817,7 +904909,7 @@ var LegacyDocsPublisher = class {
904817
904909
  previewId,
904818
904910
  disableTemplates: void 0,
904819
904911
  skipUpload,
904820
- cliVersion: "5.75.2",
904912
+ cliVersion: "5.75.4",
904821
904913
  loginCommand: "fern auth login"
904822
904914
  });
904823
904915
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -929150,6 +929242,9 @@ var DynamicTypeInstantiationMapper = class {
929150
929242
  return this.convertLiteralToOptionalPrimitive(named.typeReference.value);
929151
929243
  }
929152
929244
  }
929245
+ if (inner2.type === "literal") {
929246
+ return this.convertLiteralToOptionalPrimitive(inner2.value);
929247
+ }
929153
929248
  return go_exports.TypeInstantiation.optional(this.convert({ typeReference: inner2, value: args.value, as: args.as }));
929154
929249
  }
929155
929250
  case "optional": {
@@ -929174,6 +929269,9 @@ var DynamicTypeInstantiationMapper = class {
929174
929269
  return this.convertLiteralToOptionalPrimitive(named.typeReference.value);
929175
929270
  }
929176
929271
  }
929272
+ if (inner2.type === "literal") {
929273
+ return this.convertLiteralToOptionalPrimitive(inner2.value);
929274
+ }
929177
929275
  return go_exports.TypeInstantiation.optional(this.convert({ typeReference: inner2, value: args.value, as: args.as }));
929178
929276
  }
929179
929277
  case "primitive":
@@ -941638,6 +941736,10 @@ var EndpointSnippetGenerator5 = class {
941638
941736
  assertNever(named);
941639
941737
  }
941640
941738
  }
941739
+ // Whether a type resolves to a literal, treating optional/nullable literals AS literals.
941740
+ // Used for request-body properties and path parameters, which omit ALL literals (required
941741
+ // and optional alike) from the generated method call because they are set internally.
941742
+ // Contrast with resolvesToNonOptionalLiteralType below, which keeps optional literals.
941641
941743
  resolvesToLiteralType(typeReference2) {
941642
941744
  switch (typeReference2.type) {
941643
941745
  case "literal":
@@ -941665,6 +941767,44 @@ var EndpointSnippetGenerator5 = class {
941665
941767
  assertNever(typeReference2);
941666
941768
  }
941667
941769
  }
941770
+ // Whether a type resolves to a REQUIRED literal, i.e. a literal NOT wrapped in optional/nullable.
941771
+ // Used to filter query parameters and headers: a required literal (e.g. response_type="code") is
941772
+ // hardcoded inside the generated method and omitted from its signature, so passing it as a keyword
941773
+ // argument raises TypeError. An optional literal, by contrast, stays in the signature, so it must
941774
+ // remain a valid keyword argument and is kept.
941775
+ //
941776
+ // This deliberately differs from resolvesToLiteralType above in the optional/nullable cases: here
941777
+ // they return false (keep the parameter) instead of recursing. The asymmetry is intentional and is
941778
+ // validated by the literal fixture's wire tests. Note the two cannot be collapsed into a single
941779
+ // guard like `t.type !== "optional" && resolvesToLiteralType(t)`: a named alias whose target is
941780
+ // optional<literal> has top-level type "named", so such a guard would misclassify it as a required
941781
+ // literal and wrongly drop it, whereas recursing through the alias here correctly returns false.
941782
+ resolvesToNonOptionalLiteralType(typeReference2) {
941783
+ switch (typeReference2.type) {
941784
+ case "literal":
941785
+ return true;
941786
+ case "named": {
941787
+ const named = this.context.resolveNamedType({ typeId: typeReference2.value });
941788
+ if (named == null) {
941789
+ return false;
941790
+ }
941791
+ if (named.type === "alias") {
941792
+ return this.resolvesToNonOptionalLiteralType(named.typeReference);
941793
+ }
941794
+ return false;
941795
+ }
941796
+ case "optional":
941797
+ case "nullable":
941798
+ case "list":
941799
+ case "map":
941800
+ case "set":
941801
+ case "primitive":
941802
+ case "unknown":
941803
+ return false;
941804
+ default:
941805
+ assertNever(typeReference2);
941806
+ }
941807
+ }
941668
941808
  getBodyRequestArgsForBytes({ body, value: value2 }) {
941669
941809
  const typeInstantiation = this.getBytesBodyRequestTypeInstantiation({ value: value2 });
941670
941810
  if (python_exports.TypeInstantiation.isNop(typeInstantiation)) {
@@ -941778,7 +941918,7 @@ var EndpointSnippetGenerator5 = class {
941778
941918
  parameters: request7.queryParameters ?? [],
941779
941919
  values: snippet.queryParameters ?? {}
941780
941920
  });
941781
- const queryParameterFields = queryParameters.map((queryParameter) => ({
941921
+ const queryParameterFields = queryParameters.filter((queryParameter) => !this.resolvesToNonOptionalLiteralType(queryParameter.typeReference)).map((queryParameter) => ({
941782
941922
  name: this.context.getPropertyName(queryParameter.name.name),
941783
941923
  value: this.context.dynamicTypeLiteralMapper.convert(queryParameter)
941784
941924
  }));
@@ -941788,7 +941928,7 @@ var EndpointSnippetGenerator5 = class {
941788
941928
  parameters: request7.headers ?? [],
941789
941929
  values: snippet.headers ?? {}
941790
941930
  });
941791
- const headerFields = headers2.map((header) => ({
941931
+ const headerFields = headers2.filter((header) => !this.resolvesToNonOptionalLiteralType(header.typeReference)).map((header) => ({
941792
941932
  name: this.context.getPropertyName(header.name.name),
941793
941933
  value: this.context.dynamicTypeLiteralMapper.convert(header)
941794
941934
  }));
@@ -971604,7 +971744,7 @@ function getAutomationContextFromEnv() {
971604
971744
  config_branch: process.env.FERN_CONFIG_BRANCH,
971605
971745
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
971606
971746
  trigger: process.env.GITHUB_EVENT_NAME,
971607
- cli_version: "5.75.2"
971747
+ cli_version: "5.75.4"
971608
971748
  };
971609
971749
  }
971610
971750
  function isAutomationMode() {
@@ -972436,7 +972576,7 @@ var CliContext = class _CliContext {
972436
972576
  if (false) {
972437
972577
  this.logger.error("CLI_VERSION is not defined");
972438
972578
  }
972439
- return "5.75.2";
972579
+ return "5.75.4";
972440
972580
  }
972441
972581
  getCliName() {
972442
972582
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.75.2",
2
+ "version": "5.75.4",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",