fern-api 0.19.22 → 0.19.24-rc0

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/bundle.cjs +380 -28
  2. package/package.json +1 -1
package/bundle.cjs CHANGED
@@ -340602,6 +340602,12 @@ var init_OpenApiIntermediateRepresentation = __esm({
340602
340602
  }
340603
340603
  });
340604
340604
 
340605
+ // pnp:/home/circleci/project/packages/cli/openapi-ir-sdk/lib/sdk/api/resources/finalIr/types/SdkGroupInfo.js
340606
+ var init_SdkGroupInfo = __esm({
340607
+ "pnp:/home/circleci/project/packages/cli/openapi-ir-sdk/lib/sdk/api/resources/finalIr/types/SdkGroupInfo.js"() {
340608
+ }
340609
+ });
340610
+
340605
340611
  // pnp:/home/circleci/project/packages/cli/openapi-ir-sdk/lib/sdk/api/resources/finalIr/types/GlobalHeader.js
340606
340612
  var init_GlobalHeader = __esm({
340607
340613
  "pnp:/home/circleci/project/packages/cli/openapi-ir-sdk/lib/sdk/api/resources/finalIr/types/GlobalHeader.js"() {
@@ -341536,6 +341542,7 @@ var init_UnDiscriminatedOneOfSchema = __esm({
341536
341542
  var init_types28 = __esm({
341537
341543
  "pnp:/home/circleci/project/packages/cli/openapi-ir-sdk/lib/sdk/api/resources/finalIr/types/index.js"() {
341538
341544
  init_OpenApiIntermediateRepresentation();
341545
+ init_SdkGroupInfo();
341539
341546
  init_GlobalHeader();
341540
341547
  init_Tags();
341541
341548
  init_HttpError();
@@ -344300,6 +344307,7 @@ var init_OpenApiIntermediateRepresentation2 = __esm({
344300
344307
  title: schemas_exports5.string().optional(),
344301
344308
  description: schemas_exports5.string().optional(),
344302
344309
  servers: schemas_exports5.list(schemas_exports5.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).Server)),
344310
+ groups: schemas_exports5.record(schemas_exports5.string(), schemas_exports5.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).SdkGroupInfo)),
344303
344311
  tags: schemas_exports5.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).Tags),
344304
344312
  hasEndpointsMarkedInternal: schemas_exports5.boolean(),
344305
344313
  endpoints: schemas_exports5.list(schemas_exports5.lazyObject(async () => (await Promise.resolve().then(() => (init_serialization3(), serialization_exports3))).Endpoint)),
@@ -344315,6 +344323,18 @@ var init_OpenApiIntermediateRepresentation2 = __esm({
344315
344323
  }
344316
344324
  });
344317
344325
 
344326
+ // pnp:/home/circleci/project/packages/cli/openapi-ir-sdk/lib/sdk/serialization/resources/finalIr/types/SdkGroupInfo.js
344327
+ var SdkGroupInfo;
344328
+ var init_SdkGroupInfo2 = __esm({
344329
+ "pnp:/home/circleci/project/packages/cli/openapi-ir-sdk/lib/sdk/serialization/resources/finalIr/types/SdkGroupInfo.js"() {
344330
+ init_core3();
344331
+ SdkGroupInfo = schemas_exports5.objectWithoutOptionalProperties({
344332
+ summary: schemas_exports5.string().optional(),
344333
+ description: schemas_exports5.string().optional()
344334
+ });
344335
+ }
344336
+ });
344337
+
344318
344338
  // pnp:/home/circleci/project/packages/cli/openapi-ir-sdk/lib/sdk/serialization/resources/finalIr/types/GlobalHeader.js
344319
344339
  var GlobalHeader;
344320
344340
  var init_GlobalHeader2 = __esm({
@@ -345216,6 +345236,7 @@ var init_UnDiscriminatedOneOfSchema2 = __esm({
345216
345236
  var init_types32 = __esm({
345217
345237
  "pnp:/home/circleci/project/packages/cli/openapi-ir-sdk/lib/sdk/serialization/resources/finalIr/types/index.js"() {
345218
345238
  init_OpenApiIntermediateRepresentation2();
345239
+ init_SdkGroupInfo2();
345219
345240
  init_GlobalHeader2();
345220
345241
  init_Tags2();
345221
345242
  init_HttpError2();
@@ -345326,6 +345347,7 @@ __export(finalIr_exports2, {
345326
345347
  Request: () => Request3,
345327
345348
  Response: () => Response3,
345328
345349
  Schema: () => Schema3,
345350
+ SdkGroupInfo: () => SdkGroupInfo,
345329
345351
  StringSchema: () => StringSchema,
345330
345352
  SupportedSdkLanguage: () => SupportedSdkLanguage4,
345331
345353
  Tags: () => Tags,
@@ -346087,6 +346109,7 @@ __export(serialization_exports3, {
346087
346109
  Schema: () => Schema3,
346088
346110
  SchemaId: () => SchemaId,
346089
346111
  SchemaWithExample: () => SchemaWithExample2,
346112
+ SdkGroupInfo: () => SdkGroupInfo,
346090
346113
  SdkGroupName: () => SdkGroupName,
346091
346114
  SecurityScheme: () => SecurityScheme2,
346092
346115
  SecuritySchemeId: () => SecuritySchemeId,
@@ -827010,7 +827033,7 @@ var AccessTokenPosthogManager = class {
827010
827033
  properties: {
827011
827034
  ...event,
827012
827035
  ...event.properties,
827013
- version: "0.19.22",
827036
+ version: "0.19.24-rc0",
827014
827037
  usingAccessToken: true
827015
827038
  }
827016
827039
  });
@@ -827072,7 +827095,7 @@ var UserPosthogManager = class {
827072
827095
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
827073
827096
  event: "CLI",
827074
827097
  properties: {
827075
- version: "0.19.22",
827098
+ version: "0.19.24-rc0",
827076
827099
  ...event,
827077
827100
  ...event.properties
827078
827101
  }
@@ -839766,6 +839789,7 @@ var FernOpenAPIExtension = {
839766
839789
  BOOLEAN_LITERAL: "x-fern-boolean-literal",
839767
839790
  SERVER_NAME_V1: "x-name",
839768
839791
  SERVER_NAME_V2: "x-fern-server-name",
839792
+ GROUPS: TypedExtensionId.of("x-fern-groups"),
839769
839793
  OPENAPI_OVERIDES_FILEPATH: "x-fern-overrides-filepath",
839770
839794
  TYPE_DEFINITION: "x-fern-type",
839771
839795
  STREAMING: "x-fern-streaming",
@@ -842475,6 +842499,191 @@ function enumContainsValue({ schema: schema2, value }) {
842475
842499
  }).includes(value);
842476
842500
  }
842477
842501
 
842502
+ // pnp:/home/circleci/project/packages/cli/openapi-parser/lib/schema/utils/convertSchemaToSchemaWithExample.js
842503
+ function convertSchemaToSchemaWithExample(schema2) {
842504
+ switch (schema2.type) {
842505
+ case "object":
842506
+ return SchemaWithExample.object({
842507
+ allOf: schema2.allOf,
842508
+ properties: schema2.properties.map((objectProperty) => convertToObjectProperty2(objectProperty)),
842509
+ allOfPropertyConflicts: schema2.allOfPropertyConflicts,
842510
+ description: schema2.description,
842511
+ generatedName: schema2.generatedName,
842512
+ nameOverride: schema2.nameOverride,
842513
+ groupName: schema2.groupName,
842514
+ fullExamples: void 0
842515
+ });
842516
+ case "array":
842517
+ return SchemaWithExample.array({
842518
+ description: schema2.description,
842519
+ value: convertSchemaToSchemaWithExample(schema2.value),
842520
+ generatedName: schema2.generatedName,
842521
+ nameOverride: schema2.nameOverride,
842522
+ groupName: schema2.groupName
842523
+ });
842524
+ case "enum":
842525
+ return SchemaWithExample.enum({
842526
+ description: schema2.description,
842527
+ generatedName: schema2.generatedName,
842528
+ nameOverride: schema2.nameOverride,
842529
+ values: schema2.values,
842530
+ groupName: schema2.groupName,
842531
+ example: void 0
842532
+ });
842533
+ case "literal":
842534
+ return SchemaWithExample.literal({
842535
+ description: schema2.description,
842536
+ value: schema2.value,
842537
+ generatedName: schema2.generatedName,
842538
+ nameOverride: schema2.nameOverride,
842539
+ groupName: schema2.groupName
842540
+ });
842541
+ case "nullable":
842542
+ return SchemaWithExample.nullable({
842543
+ generatedName: schema2.generatedName,
842544
+ nameOverride: schema2.nameOverride,
842545
+ description: schema2.description,
842546
+ value: convertSchemaToSchemaWithExample(schema2.value),
842547
+ groupName: schema2.groupName
842548
+ });
842549
+ case "optional":
842550
+ return SchemaWithExample.optional({
842551
+ generatedName: schema2.generatedName,
842552
+ nameOverride: schema2.nameOverride,
842553
+ description: schema2.description,
842554
+ value: convertSchemaToSchemaWithExample(schema2.value),
842555
+ groupName: schema2.groupName
842556
+ });
842557
+ case "primitive":
842558
+ return SchemaWithExample.primitive({
842559
+ description: schema2.description,
842560
+ schema: convertToPrimitiveSchemaValue2(schema2.schema),
842561
+ generatedName: schema2.generatedName,
842562
+ nameOverride: schema2.nameOverride,
842563
+ groupName: schema2.groupName
842564
+ });
842565
+ case "map":
842566
+ return SchemaWithExample.map({
842567
+ description: schema2.description,
842568
+ key: SchemaWithExample.primitive({
842569
+ description: schema2.key.description,
842570
+ schema: convertToPrimitiveSchemaValue2(schema2.key.schema),
842571
+ generatedName: schema2.key.generatedName,
842572
+ nameOverride: schema2.key.nameOverride,
842573
+ groupName: schema2.groupName
842574
+ }),
842575
+ value: convertSchemaToSchemaWithExample(schema2.value),
842576
+ generatedName: schema2.generatedName,
842577
+ nameOverride: schema2.nameOverride,
842578
+ groupName: schema2.groupName
842579
+ });
842580
+ case "reference":
842581
+ return SchemaWithExample.reference({
842582
+ description: schema2.description,
842583
+ generatedName: schema2.generatedName,
842584
+ nameOverride: schema2.nameOverride,
842585
+ schema: schema2.schema,
842586
+ groupName: schema2.groupName
842587
+ });
842588
+ case "oneOf":
842589
+ return SchemaWithExample.oneOf(convertToOneOf2(schema2.value));
842590
+ case "unknown":
842591
+ return SchemaWithExample.unknown({
842592
+ nameOverride: schema2.nameOverride,
842593
+ generatedName: schema2.generatedName,
842594
+ example: void 0,
842595
+ groupName: void 0,
842596
+ description: void 0
842597
+ });
842598
+ default:
842599
+ assertNever(schema2);
842600
+ }
842601
+ }
842602
+ function convertToOneOf2(oneOfSchema) {
842603
+ switch (oneOfSchema.type) {
842604
+ case "discriminated":
842605
+ return OneOfSchemaWithExample.discriminated({
842606
+ commonProperties: oneOfSchema.commonProperties.map((commonProperty) => {
842607
+ return {
842608
+ key: commonProperty.key,
842609
+ schema: convertSchemaToSchemaWithExample(commonProperty.schema)
842610
+ };
842611
+ }),
842612
+ description: oneOfSchema.description,
842613
+ discriminantProperty: oneOfSchema.discriminantProperty,
842614
+ generatedName: oneOfSchema.generatedName,
842615
+ nameOverride: oneOfSchema.nameOverride,
842616
+ schemas: Object.fromEntries(Object.entries(oneOfSchema.schemas).map(([discriminantValue, schemaWithExample]) => {
842617
+ return [discriminantValue, convertSchemaToSchemaWithExample(schemaWithExample)];
842618
+ })),
842619
+ groupName: oneOfSchema.groupName
842620
+ });
842621
+ case "undisciminated":
842622
+ return OneOfSchemaWithExample.undisciminated({
842623
+ description: oneOfSchema.description,
842624
+ generatedName: oneOfSchema.generatedName,
842625
+ nameOverride: oneOfSchema.nameOverride,
842626
+ schemas: oneOfSchema.schemas.map((oneOfSchema2) => convertSchemaToSchemaWithExample(oneOfSchema2)),
842627
+ groupName: oneOfSchema.groupName
842628
+ });
842629
+ default:
842630
+ assertNever(oneOfSchema);
842631
+ }
842632
+ }
842633
+ function convertToPrimitiveSchemaValue2(primitiveSchema) {
842634
+ switch (primitiveSchema.type) {
842635
+ case "string":
842636
+ return PrimitiveSchemaValueWithExample.string({
842637
+ maxLength: primitiveSchema.maxLength,
842638
+ minLength: primitiveSchema.minLength,
842639
+ example: void 0
842640
+ });
842641
+ case "base64":
842642
+ return PrimitiveSchemaValueWithExample.base64({
842643
+ example: void 0
842644
+ });
842645
+ case "boolean":
842646
+ return PrimitiveSchemaValueWithExample.boolean({
842647
+ example: void 0
842648
+ });
842649
+ case "date":
842650
+ return PrimitiveSchemaValueWithExample.date({
842651
+ example: void 0
842652
+ });
842653
+ case "datetime":
842654
+ return PrimitiveSchemaValueWithExample.datetime({
842655
+ example: void 0
842656
+ });
842657
+ case "double":
842658
+ return PrimitiveSchemaValueWithExample.double({
842659
+ example: void 0
842660
+ });
842661
+ case "float":
842662
+ return PrimitiveSchemaValueWithExample.float({
842663
+ example: void 0
842664
+ });
842665
+ case "int":
842666
+ return PrimitiveSchemaValueWithExample.int({
842667
+ example: void 0
842668
+ });
842669
+ case "int64":
842670
+ return PrimitiveSchemaValueWithExample.int64({
842671
+ example: void 0
842672
+ });
842673
+ default:
842674
+ assertNever(primitiveSchema);
842675
+ }
842676
+ }
842677
+ function convertToObjectProperty2(objectProperty) {
842678
+ return {
842679
+ conflict: objectProperty.conflict,
842680
+ generatedName: objectProperty.generatedName,
842681
+ key: objectProperty.key,
842682
+ schema: convertSchemaToSchemaWithExample(objectProperty.schema),
842683
+ audiences: objectProperty.audiences
842684
+ };
842685
+ }
842686
+
842478
842687
  // pnp:/home/circleci/project/packages/cli/openapi-parser/lib/schema/utils/isSchemaRequired.js
842479
842688
  function isSchemaRequired4(schema2) {
842480
842689
  return schema2.type !== "optional" && schema2.type !== "nullable";
@@ -842500,11 +842709,8 @@ var ExampleEndpointFactory = class {
842500
842709
  this.logger.debug(`Building endpoint example for ${endpoint.method.toUpperCase()} ${endpoint.path}`);
842501
842710
  const requestSchemaIdResponse = getRequestSchema(endpoint.request);
842502
842711
  const responseSchemaIdResponse = getResponseSchema(endpoint.response);
842503
- if ((requestSchemaIdResponse == null ? void 0 : requestSchemaIdResponse.type) === "unsupported" || (responseSchemaIdResponse == null ? void 0 : responseSchemaIdResponse.type) === "unsupported") {
842504
- return void 0;
842505
- }
842506
842712
  let requestExample = void 0;
842507
- if (requestSchemaIdResponse != null) {
842713
+ if (requestSchemaIdResponse != null && requestSchemaIdResponse.type === "present") {
842508
842714
  const required = this.isSchemaRequired(requestSchemaIdResponse.schema);
842509
842715
  requestExample = this.exampleTypeFactory.buildExample({
842510
842716
  schema: requestSchemaIdResponse.schema,
@@ -842519,7 +842725,7 @@ var ExampleEndpointFactory = class {
842519
842725
  }
842520
842726
  }
842521
842727
  let responseExample = void 0;
842522
- if (responseSchemaIdResponse != null) {
842728
+ if (responseSchemaIdResponse != null && responseSchemaIdResponse.type === "present") {
842523
842729
  const required = this.isSchemaRequired(responseSchemaIdResponse.schema);
842524
842730
  responseExample = this.exampleTypeFactory.buildExample({
842525
842731
  schema: responseSchemaIdResponse.schema,
@@ -842606,9 +842812,12 @@ var ExampleEndpointFactory = class {
842606
842812
  });
842607
842813
  }
842608
842814
  }
842609
- let exampleName = (_c3 = requestSchemaIdResponse == null ? void 0 : requestSchemaIdResponse.example) == null ? void 0 : _c3.name;
842610
- if (exampleName == null && (requestSchemaIdResponse == null ? void 0 : requestSchemaIdResponse.schema) != null) {
842611
- exampleName = getNameFromSchemaWithExample(requestSchemaIdResponse.schema);
842815
+ let exampleName = void 0;
842816
+ if ((requestSchemaIdResponse == null ? void 0 : requestSchemaIdResponse.type) === "present") {
842817
+ exampleName = (_c3 = requestSchemaIdResponse == null ? void 0 : requestSchemaIdResponse.example) == null ? void 0 : _c3.name;
842818
+ if (exampleName == null && (requestSchemaIdResponse == null ? void 0 : requestSchemaIdResponse.schema) != null) {
842819
+ exampleName = getNameFromSchemaWithExample(requestSchemaIdResponse.schema);
842820
+ }
842612
842821
  }
842613
842822
  const codeSamples = endpoint.examples.filter(hasIncompleteExample).flatMap((example) => example.codeSamples);
842614
842823
  return {
@@ -842641,10 +842850,17 @@ function getRequestSchema(request) {
842641
842850
  if (request == null) {
842642
842851
  return void 0;
842643
842852
  }
842644
- if (request.type !== "json") {
842645
- return { type: "unsupported" };
842853
+ if (request.type === "multipart") {
842854
+ return {
842855
+ type: "present",
842856
+ schema: convertMultipartRequestToSchema(request),
842857
+ example: void 0
842858
+ };
842859
+ }
842860
+ if (request.type === "json") {
842861
+ return { type: "present", schema: request.schema, example: ((_a4 = request.fullExamples) == null ? void 0 : _a4[0]) ?? void 0 };
842646
842862
  }
842647
- return { type: "present", schema: request.schema, example: ((_a4 = request.fullExamples) == null ? void 0 : _a4[0]) ?? void 0 };
842863
+ return { type: "unsupported" };
842648
842864
  }
842649
842865
  function getResponseSchema(response) {
842650
842866
  var _a4;
@@ -842709,6 +842925,60 @@ function getNameFromSchemaWithExample(schema2) {
842709
842925
  assertNever(schema2);
842710
842926
  }
842711
842927
  }
842928
+ function convertMultipartRequestToSchema(request) {
842929
+ return SchemaWithExample.object({
842930
+ properties: request.properties.map((property5) => {
842931
+ if (property5.schema.type === "file") {
842932
+ const innerSchema = SchemaWithExample.primitive({
842933
+ schema: api_exports5.PrimitiveSchemaValueWithExample.string({
842934
+ minLength: void 0,
842935
+ maxLength: void 0,
842936
+ example: void 0
842937
+ }),
842938
+ description: property5.description,
842939
+ nameOverride: void 0,
842940
+ generatedName: "",
842941
+ groupName: void 0
842942
+ });
842943
+ const maybeArraySchema = property5.schema.isArray ? SchemaWithExample.array({
842944
+ value: innerSchema,
842945
+ groupName: void 0,
842946
+ nameOverride: void 0,
842947
+ generatedName: "",
842948
+ description: void 0
842949
+ }) : innerSchema;
842950
+ const maybeOptionalSchema = property5.schema.isOptional ? SchemaWithExample.optional({
842951
+ value: maybeArraySchema,
842952
+ groupName: void 0,
842953
+ nameOverride: void 0,
842954
+ generatedName: "",
842955
+ description: void 0
842956
+ }) : maybeArraySchema;
842957
+ return {
842958
+ key: property5.key,
842959
+ schema: maybeOptionalSchema,
842960
+ audiences: [],
842961
+ conflict: {},
842962
+ generatedName: property5.key
842963
+ };
842964
+ }
842965
+ return {
842966
+ key: property5.key,
842967
+ schema: convertSchemaToSchemaWithExample(property5.schema.value),
842968
+ audiences: [],
842969
+ conflict: {},
842970
+ generatedName: property5.key
842971
+ };
842972
+ }).filter(isNonNullish),
842973
+ allOf: [],
842974
+ allOfPropertyConflicts: [],
842975
+ fullExamples: void 0,
842976
+ description: request.description,
842977
+ nameOverride: void 0,
842978
+ generatedName: "",
842979
+ groupName: void 0
842980
+ });
842981
+ }
842712
842982
 
842713
842983
  // pnp:/home/circleci/project/packages/cli/openapi-parser/lib/asyncapi/ExampleWebsocketSessionFactory.js
842714
842984
  var ExampleWebsocketSessionFactory = class {
@@ -842911,6 +843181,7 @@ var ExampleWebsocketSessionFactory = class {
842911
843181
 
842912
843182
  // pnp:/home/circleci/project/packages/cli/openapi-parser/lib/asyncapi/fernExtensions.js
842913
843183
  var FernAsyncAPIExtension = {
843184
+ FERN_DISPLAY_NAME: "x-fern-display-name",
842914
843185
  FERN_EXAMPLES: "x-fern-examples"
842915
843186
  };
842916
843187
 
@@ -843033,7 +843304,7 @@ function parseAsyncAPI({ document: document4, taskContext }) {
843033
843304
  groupName: (tag == null ? void 0 : tag.name) != null ? [tag.name] : ["Websocket"],
843034
843305
  publish: publishSchema != null ? convertSchemaWithExampleToSchema(publishSchema) : publishSchema,
843035
843306
  subscribe: subscribeSchema != null ? convertSchemaWithExampleToSchema(subscribeSchema) : subscribeSchema,
843036
- summary: void 0,
843307
+ summary: getExtension(channel, FernAsyncAPIExtension.FERN_DISPLAY_NAME),
843037
843308
  path: channelPath,
843038
843309
  description: void 0,
843039
843310
  examples
@@ -844468,6 +844739,15 @@ function convertToError({ statusCode, errorBodyCollector, context }) {
844468
844739
  };
844469
844740
  }
844470
844741
 
844742
+ // pnp:/home/circleci/project/packages/cli/openapi-parser/lib/openapi/v3/extensions/getFernGroups.js
844743
+ var XFernGroupsSchema = z.record(z.string(), z.object({
844744
+ summary: z.string().optional(),
844745
+ description: z.string().optional()
844746
+ }));
844747
+ function getFernGroups({ document: document4, context }) {
844748
+ return getExtensionAndValidate(document4, FernOpenAPIExtension.GROUPS, XFernGroupsSchema, context);
844749
+ }
844750
+
844471
844751
  // pnp:/home/circleci/project/packages/cli/openapi-parser/lib/openapi/v3/extensions/getGlobalHeaders.js
844472
844752
  function getGlobalHeaders(document4) {
844473
844753
  const globalHeaders = getExtension(document4, FernOpenAPIExtension.FERN_GLOBAL_HEADERS);
@@ -844842,9 +845122,13 @@ function generateIr({ openApi, taskContext, disableExamples }) {
844842
845122
  schemas[key2] = schema2;
844843
845123
  taskContext.logger.debug(`Converted schema ${key2}`);
844844
845124
  }
845125
+ const groupInfo = getFernGroups({ document: openApi, context });
844845
845126
  const ir = {
844846
845127
  title: openApi.info.title,
844847
845128
  description: openApi.info.description,
845129
+ groups: Object.fromEntries(Object.entries(groupInfo ?? {}).map(([key2, value]) => {
845130
+ return [key2, { summary: value.summary ?? void 0, description: value.description ?? void 0 }];
845131
+ })),
844848
845132
  servers: (openApi.servers ?? []).map((server) => convertServer(server)),
844849
845133
  tags: {
844850
845134
  tagsById: Object.fromEntries((openApi.tags ?? []).map((tag) => {
@@ -844952,7 +845236,8 @@ async function parse3({ workspace, taskContext }) {
844952
845236
  variables: {},
844953
845237
  nonRequestReferencedSchemas: /* @__PURE__ */ new Set(),
844954
845238
  securitySchemes: {},
844955
- globalHeaders: []
845239
+ globalHeaders: [],
845240
+ groups: {}
844956
845241
  };
844957
845242
  for (const spec of workspace.specs) {
844958
845243
  const contents = (await (0, import_promises25.readFile)(spec.absoluteFilepath)).toString();
@@ -845032,7 +845317,11 @@ function merge3(ir1, ir2) {
845032
845317
  ...ir1.securitySchemes,
845033
845318
  ...ir2.securitySchemes
845034
845319
  },
845035
- globalHeaders: ir1.globalHeaders != null ? [...ir1.globalHeaders, ...ir2.globalHeaders ?? []] : void 0
845320
+ globalHeaders: ir1.globalHeaders != null ? [...ir1.globalHeaders, ...ir2.globalHeaders ?? []] : void 0,
845321
+ groups: {
845322
+ ...ir1.groups,
845323
+ ...ir2.groups
845324
+ }
845036
845325
  };
845037
845326
  }
845038
845327
  async function loadAsyncAPI({ absoluteFilePathToAsyncAPI, absoluteFilePathToAsyncAPIOverrides, context }) {
@@ -845397,6 +845686,9 @@ function buildChannel({ channel, context, declarationFile }) {
845397
845686
  path: channel.path,
845398
845687
  auth: false
845399
845688
  };
845689
+ if (channel.summary != null) {
845690
+ convertedChannel["display-name"] = channel.summary;
845691
+ }
845400
845692
  const queryParameters = {};
845401
845693
  if (channel.handshake.queryParameters.length > 0) {
845402
845694
  for (const queryParameter of channel.handshake.queryParameters) {
@@ -846124,7 +846416,8 @@ function getRequest({ declarationFile, context, request, requestNameOverride, ge
846124
846416
  headers,
846125
846417
  body: {
846126
846418
  properties
846127
- }
846419
+ },
846420
+ "content-type": "multipart/form-data"
846128
846421
  }
846129
846422
  };
846130
846423
  }
@@ -846245,6 +846538,19 @@ function buildServices(context) {
846245
846538
  if (sdkGroup != null) {
846246
846539
  sdkGroups.add(sdkGroup);
846247
846540
  }
846541
+ let group = void 0;
846542
+ if (endpoint.sdkName != null) {
846543
+ const groupInfo = context.ir.groups;
846544
+ for (const groupName of endpoint.sdkName.groupName) {
846545
+ const value = groupInfo[groupName];
846546
+ if (value == null) {
846547
+ break;
846548
+ } else if (value.summary != null || value.description != null) {
846549
+ group = groupInfo[groupName];
846550
+ break;
846551
+ }
846552
+ }
846553
+ }
846248
846554
  const irTag = tag == null ? void 0 : tags.tagsById[tag];
846249
846555
  const convertedEndpoint = buildEndpoint({
846250
846556
  context,
@@ -846258,8 +846564,8 @@ function buildServices(context) {
846258
846564
  });
846259
846565
  if ((irTag == null ? void 0 : irTag.id) != null || (irTag == null ? void 0 : irTag.description) != null) {
846260
846566
  context.builder.setServiceInfo(file, {
846261
- displayName: irTag == null ? void 0 : irTag.id,
846262
- docs: (irTag == null ? void 0 : irTag.description) ?? void 0
846567
+ displayName: (group == null ? void 0 : group.summary) ?? (irTag == null ? void 0 : irTag.id),
846568
+ docs: (group == null ? void 0 : group.description) ?? (irTag == null ? void 0 : irTag.description) ?? void 0
846263
846569
  });
846264
846570
  }
846265
846571
  }
@@ -850806,10 +851112,10 @@ var CliContext = class {
850806
851112
  return "fern-api";
850807
851113
  }
850808
851114
  getPackageVersion() {
850809
- if ("0.19.22" == null) {
851115
+ if ("0.19.24-rc0" == null) {
850810
851116
  this.logger.error("CLI_VERSION is not defined");
850811
851117
  }
850812
- return "0.19.22";
851118
+ return "0.19.24-rc0";
850813
851119
  }
850814
851120
  getCliName() {
850815
851121
  if ("fern" == null) {
@@ -851417,7 +851723,7 @@ function convertService(irService, ir) {
851417
851723
  response: irEndpoint.response != null ? convertResponse2(irEndpoint.response) : void 0,
851418
851724
  errors: convertResponseErrors(irEndpoint.errors, ir),
851419
851725
  errorsV2: convertResponseErrorsV2(irEndpoint.errors, ir),
851420
- examples: irEndpoint.examples.filter((example) => example.exampleType === "userProvided").map((example) => convertHttpEndpointExample(example, ir))
851726
+ examples: irEndpoint.examples.filter((example) => example.exampleType === "userProvided").map((example) => convertHttpEndpointExample(example, irEndpoint, ir))
851421
851727
  };
851422
851728
  });
851423
851729
  }
@@ -851757,8 +852063,8 @@ function convertResponseErrorsV2(irResponseErrors, ir) {
851757
852063
  }
851758
852064
  return errors;
851759
852065
  }
851760
- function convertHttpEndpointExample(irExample, ir) {
851761
- var _a4, _b3, _c3, _d;
852066
+ function convertHttpEndpointExample(irExample, irEndpoint, ir) {
852067
+ var _a4, _b3, _c3, _d, _e;
851762
852068
  return {
851763
852069
  name: (_a4 = irExample.name) == null ? void 0 : _a4.originalName,
851764
852070
  description: irExample.docs ?? void 0,
@@ -851776,7 +852082,46 @@ function convertHttpEndpointExample(irExample, ir) {
851776
852082
  return headers;
851777
852083
  }, {}),
851778
852084
  requestBody: (_b3 = irExample.request) == null ? void 0 : _b3.jsonExample,
851779
- requestBodyV3: irExample.request != null ? { type: "json", value: irExample.request.jsonExample } : void 0,
852085
+ requestBodyV3: (_c3 = irEndpoint.requestBody) == null ? void 0 : _c3._visit({
852086
+ inlinedRequestBody: () => irExample.request != null ? { type: "json", value: irExample.request.jsonExample } : void 0,
852087
+ reference: () => irExample.request != null ? { type: "json", value: irExample.request.jsonExample } : void 0,
852088
+ fileUpload: (fileUploadSchema) => {
852089
+ if (irExample.request == null) {
852090
+ return void 0;
852091
+ }
852092
+ const value = {};
852093
+ if (isPlainObject(irExample.request.jsonExample)) {
852094
+ const fullExample = irExample.request.jsonExample;
852095
+ for (const property5 of fileUploadSchema.properties) {
852096
+ property5._visit({
852097
+ file: (file) => {
852098
+ if (file.type === "file") {
852099
+ value[file.key.wireValue] = {
852100
+ type: "filename",
852101
+ value: "<file1>"
852102
+ };
852103
+ } else if (file.type === "fileArray") {
852104
+ value[file.key.wireValue] = {
852105
+ type: "filename",
852106
+ value: "<file1>"
852107
+ };
852108
+ }
852109
+ },
852110
+ bodyProperty: (bodyProperty) => {
852111
+ value[bodyProperty.name.wireValue] = {
852112
+ type: "json",
852113
+ value: fullExample[bodyProperty.name.wireValue]
852114
+ };
852115
+ },
852116
+ _other: noop_default
852117
+ });
852118
+ }
852119
+ }
852120
+ return { type: "form", value };
852121
+ },
852122
+ bytes: () => void 0,
852123
+ _other: () => void 0
852124
+ }),
851780
852125
  responseStatusCode: api_exports4.http.ExampleResponse._visit(irExample.response, {
851781
852126
  ok: ({ body }) => body != null ? 200 : 204,
851782
852127
  error: ({ error: errorName }) => {
@@ -851790,9 +852135,9 @@ function convertHttpEndpointExample(irExample, ir) {
851790
852135
  throw new Error("Unknown ExampleResponse: " + irExample.response.type);
851791
852136
  }
851792
852137
  }),
851793
- responseBody: (_c3 = irExample.response.body) == null ? void 0 : _c3.jsonExample,
852138
+ responseBody: (_d = irExample.response.body) == null ? void 0 : _d.jsonExample,
851794
852139
  responseBodyV3: irExample.response.body != null ? { type: "json", value: irExample.response.body.jsonExample } : void 0,
851795
- codeSamples: (_d = irExample.codeSamples) == null ? void 0 : _d.map((codeSample) => ExampleCodeSample._visit(codeSample, {
852140
+ codeSamples: (_e = irExample.codeSamples) == null ? void 0 : _e.map((codeSample) => ExampleCodeSample._visit(codeSample, {
851796
852141
  language: (value) => {
851797
852142
  var _a5;
851798
852143
  return {
@@ -854288,6 +854633,9 @@ function convertExampleRequestBody({ endpoint, example, typeResolver, exampleRes
854288
854633
  if (requestType == null) {
854289
854634
  return void 0;
854290
854635
  }
854636
+ if (typeof requestType === "string" && parseBytesRequest(requestType) != null) {
854637
+ return void 0;
854638
+ }
854291
854639
  if (!isInlineRequestBody(requestType)) {
854292
854640
  return ExampleRequestBody.reference(convertTypeReferenceExample({
854293
854641
  example: example.request,
@@ -854308,6 +854656,10 @@ function convertExampleRequestBody({ endpoint, example, typeResolver, exampleRes
854308
854656
  const exampleProperties = [];
854309
854657
  for (const [wireKey, propertyExample] of Object.entries(example.request)) {
854310
854658
  const inlinedRequestPropertyDeclaration = (_b3 = requestType.properties) == null ? void 0 : _b3[wireKey];
854659
+ const inilnedRequestPropertyType = typeof inlinedRequestPropertyDeclaration === "string" ? inlinedRequestPropertyDeclaration : inlinedRequestPropertyDeclaration == null ? void 0 : inlinedRequestPropertyDeclaration.type;
854660
+ if (inilnedRequestPropertyType != null && parseRawFileType(inilnedRequestPropertyType) != null) {
854661
+ continue;
854662
+ }
854311
854663
  if (inlinedRequestPropertyDeclaration != null) {
854312
854664
  exampleProperties.push({
854313
854665
  name: file.casingsGenerator.generateNameAndWireValue({
@@ -857030,7 +857382,7 @@ var TypeResolverImpl = class {
857030
857382
  resolveTypeOrThrow({ type: type2, file }) {
857031
857383
  const resolvedType = this.resolveType({ type: type2, file });
857032
857384
  if (resolvedType == null) {
857033
- throw new Error("Cannot resolve type: " + type2);
857385
+ throw new Error("Cannot resolve type: " + type2 + " in file " + file.relativeFilepath);
857034
857386
  }
857035
857387
  return resolvedType;
857036
857388
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fern-api",
3
- "version": "0.19.22",
3
+ "version": "0.19.24-rc0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/fern-api/fern.git",