fern-api 0.19.16 → 0.19.18

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 +77 -29
  2. package/package.json +1 -1
package/bundle.cjs CHANGED
@@ -832299,7 +832299,7 @@ var AccessTokenPosthogManager = class {
832299
832299
  properties: {
832300
832300
  ...event,
832301
832301
  ...event.properties,
832302
- version: "0.19.16",
832302
+ version: "0.19.18",
832303
832303
  usingAccessToken: true
832304
832304
  }
832305
832305
  });
@@ -832361,7 +832361,7 @@ var UserPosthogManager = class {
832361
832361
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
832362
832362
  event: "CLI",
832363
832363
  properties: {
832364
- version: "0.19.16",
832364
+ version: "0.19.18",
832365
832365
  ...event,
832366
832366
  ...event.properties
832367
832367
  }
@@ -843361,6 +843361,7 @@ __export(schemas_exports3, {
843361
843361
  ErrorDiscriminationSchema: () => ErrorDiscriminationSchema,
843362
843362
  ErrorReferenceSchema: () => ErrorReferenceSchema,
843363
843363
  ExampleCodeSampleSchema: () => ExampleCodeSampleSchema,
843364
+ ExampleEndpointCallArraySchema: () => ExampleEndpointCallArraySchema,
843364
843365
  ExampleEndpointCallSchema: () => ExampleEndpointCallSchema,
843365
843366
  ExampleResponseSchema: () => ExampleResponseSchema,
843366
843367
  ExampleTypeReferenceSchema: () => ExampleTypeReferenceSchema,
@@ -843672,6 +843673,7 @@ var ExampleEndpointCallSchema = WithNameAndDocsSchema.extend({
843672
843673
  response: z.optional(ExampleResponseSchema),
843673
843674
  "code-samples": z.optional(z.array(ExampleCodeSampleSchema))
843674
843675
  });
843676
+ var ExampleEndpointCallArraySchema = z.array(ExampleEndpointCallSchema);
843675
843677
 
843676
843678
  // pnp:/home/circleci/project/packages/cli/yaml/yaml-schema/lib/schemas/ExampleWebSocketMessage.js
843677
843679
  var ExampleWebSocketMessage = z.object({
@@ -845012,6 +845014,18 @@ function getExtension(object4, extension2) {
845012
845014
  }
845013
845015
  return void 0;
845014
845016
  }
845017
+ function getExtensionAndValidate(object4, extension2, schema2, context, breadcrumbs = []) {
845018
+ try {
845019
+ const extensionValue = getExtension(object4, extension2);
845020
+ if (extensionValue != null) {
845021
+ return schema2.parse(extensionValue);
845022
+ }
845023
+ } catch (e) {
845024
+ const breadcrumb = compact_default(breadcrumbs).join(" -> ");
845025
+ context.logger.error(`${breadcrumb.length > 0 ? `${breadcrumb}: ` : ""}Failed to parse ${extension2}`);
845026
+ }
845027
+ return void 0;
845028
+ }
845015
845029
 
845016
845030
  // pnp:/home/circleci/project/packages/cli/openapi-parser/lib/openapi/v3/extensions/extensions.js
845017
845031
  var OpenAPIExtension = {
@@ -845019,7 +845033,9 @@ var OpenAPIExtension = {
845019
845033
  ENUM_VAR_NAMES: "x-enum-varnames",
845020
845034
  INTERNAL: "x-internal",
845021
845035
  EXAMPLES: "x-examples",
845022
- TAGS: "x-tags"
845036
+ TAGS: "x-tags",
845037
+ REDOCLY_CODE_SAMPLES_KEBAB: "x-code-samples",
845038
+ REDOCLY_CODE_SAMPLES_CAMEL: "x-codeSamples"
845023
845039
  };
845024
845040
 
845025
845041
  // pnp:/home/circleci/project/packages/cli/openapi-parser/lib/openapi/v3/extensions/id.js
@@ -848674,27 +848690,18 @@ var DummyOpenAPIV3ParserContext = class extends AbstractOpenAPIV3ParserContext {
848674
848690
  }
848675
848691
  };
848676
848692
 
848677
- // pnp:/home/circleci/project/packages/cli/openapi-parser/lib/openapi/v3/extensions/getFernAvailability.js
848678
- function getFernAvailability(operationObject) {
848679
- const availability = getExtension(operationObject, FernOpenAPIExtension.AVAILABILITY);
848680
- if (availability === "ga" || availability === "generally-available") {
848681
- return EndpointAvailability.GenerallyAvailable;
848682
- } else if (availability === "beta" || availability === "pre-release") {
848683
- return EndpointAvailability.Beta;
848684
- } else if (availability === "deprecated") {
848685
- return EndpointAvailability.Deprecated;
848686
- }
848687
- if (operationObject.deprecated) {
848688
- return EndpointAvailability.Deprecated;
848689
- }
848690
- return void 0;
848691
- }
848693
+ // pnp:/home/circleci/project/packages/cli/openapi-parser/lib/openapi/v3/schemas/RedoclyCodeSampleSchema.js
848694
+ var RedoclyCodeSampleSchema = z.object({
848695
+ lang: z.string(),
848696
+ label: z.optional(z.string()),
848697
+ source: z.string()
848698
+ });
848699
+ var RedoclyCodeSampleArraySchema = z.array(RedoclyCodeSampleSchema);
848692
848700
 
848693
- // pnp:/home/circleci/project/packages/cli/openapi-parser/lib/openapi/v3/extensions/getFernExamples.js
848694
- function getFernExamples2(operationObject) {
848695
- const raw = getExtension(operationObject, FernOpenAPIExtension.EXAMPLES) ?? [];
848696
- const validated = raw.map((value) => schemas_exports3.ExampleEndpointCallSchema.parse(value));
848697
- return validated.map((value) => ({
848701
+ // pnp:/home/circleci/project/packages/cli/openapi-parser/lib/openapi/v3/extensions/getExamplesFromExtension.js
848702
+ function getExamplesFromExtension(operationContext, operationObject, context) {
848703
+ const exampleEndpointCalls = getExtensionAndValidate(operationObject, FernOpenAPIExtension.EXAMPLES, schemas_exports3.ExampleEndpointCallArraySchema, context, [...operationContext.baseBreadcrumbs, `${operationContext.method} ${operationContext.path}`]) ?? [];
848704
+ const fernExamples = exampleEndpointCalls.map((value) => ({
848698
848705
  name: value.name,
848699
848706
  pathParameters: value["path-parameters"] ? Object.entries(value["path-parameters"]).map(([name2, value2]) => ({
848700
848707
  name: name2,
@@ -848724,6 +848731,47 @@ function getFernExamples2(operationObject) {
848724
848731
  })),
848725
848732
  description: void 0
848726
848733
  }));
848734
+ const redoclyCodeSamplesKebabCase = getExtensionAndValidate(operationObject, OpenAPIExtension.REDOCLY_CODE_SAMPLES_KEBAB, RedoclyCodeSampleArraySchema, context, [...operationContext.baseBreadcrumbs, `${operationContext.method} ${operationContext.path}`]) ?? [];
848735
+ const redoclyCodeSamplesCamelCase = getExtensionAndValidate(operationObject, OpenAPIExtension.REDOCLY_CODE_SAMPLES_CAMEL, RedoclyCodeSampleArraySchema, context, [...operationContext.baseBreadcrumbs, `${operationContext.method} ${operationContext.path}`]) ?? [];
848736
+ const redoclyCodeSamples = [
848737
+ ...redoclyCodeSamplesCamelCase,
848738
+ ...redoclyCodeSamplesKebabCase
848739
+ ];
848740
+ if (redoclyCodeSamples.length > 0) {
848741
+ fernExamples.push({
848742
+ name: void 0,
848743
+ pathParameters: void 0,
848744
+ queryParameters: void 0,
848745
+ headers: void 0,
848746
+ request: void 0,
848747
+ response: void 0,
848748
+ codeSamples: redoclyCodeSamples.map((value) => api_exports3.CustomCodeSample.language({
848749
+ name: value.label ?? value.lang,
848750
+ language: value.lang,
848751
+ code: value.source,
848752
+ install: void 0,
848753
+ description: void 0
848754
+ })),
848755
+ description: void 0
848756
+ });
848757
+ }
848758
+ return fernExamples;
848759
+ }
848760
+
848761
+ // pnp:/home/circleci/project/packages/cli/openapi-parser/lib/openapi/v3/extensions/getFernAvailability.js
848762
+ function getFernAvailability(operationObject) {
848763
+ const availability = getExtension(operationObject, FernOpenAPIExtension.AVAILABILITY);
848764
+ if (availability === "ga" || availability === "generally-available") {
848765
+ return EndpointAvailability.GenerallyAvailable;
848766
+ } else if (availability === "beta" || availability === "pre-release") {
848767
+ return EndpointAvailability.Beta;
848768
+ } else if (availability === "deprecated") {
848769
+ return EndpointAvailability.Deprecated;
848770
+ }
848771
+ if (operationObject.deprecated) {
848772
+ return EndpointAvailability.Deprecated;
848773
+ }
848774
+ return void 0;
848727
848775
  }
848728
848776
 
848729
848777
  // pnp:/home/circleci/project/packages/cli/openapi-parser/lib/openapi/v3/converters/convertServer.js
@@ -849030,7 +849078,7 @@ function convertHttpOperation({ operationContext, context, responseStatusCode, s
849030
849078
  responseStatusCode
849031
849079
  });
849032
849080
  const availability = getFernAvailability(operation);
849033
- const examples = [...getFernExamples2(operation)];
849081
+ const examples = [...getExamplesFromExtension(operationContext, operation, context)];
849034
849082
  return {
849035
849083
  summary: operation.summary,
849036
849084
  internal: getExtension(operation, OpenAPIExtension.INTERNAL),
@@ -855918,10 +855966,10 @@ var CliContext = class {
855918
855966
  return "fern-api";
855919
855967
  }
855920
855968
  getPackageVersion() {
855921
- if ("0.19.16" == null) {
855969
+ if ("0.19.18" == null) {
855922
855970
  this.logger.error("CLI_VERSION is not defined");
855923
855971
  }
855924
- return "0.19.16";
855972
+ return "0.19.18";
855925
855973
  }
855926
855974
  getCliName() {
855927
855975
  if ("fern" == null) {
@@ -860831,6 +860879,9 @@ var ExampleGenerator = class {
860831
860879
  });
860832
860880
  }
860833
860881
  generateExampleTypeReference(typeReference, depth) {
860882
+ if (this.exceedsMaxDepth(depth)) {
860883
+ return this.generateExampleUnknown({});
860884
+ }
860834
860885
  switch (typeReference.type) {
860835
860886
  case "container":
860836
860887
  return this.generateExampleContainer(typeReference.container, depth);
@@ -860876,9 +860927,6 @@ var ExampleGenerator = class {
860876
860927
  }
860877
860928
  }
860878
860929
  generateExampleTypeReferenceList(typeReference, depth) {
860879
- if (this.exceedsMaxDepth(depth)) {
860880
- return this.generateExampleUnknown({});
860881
- }
860882
860930
  const exampleTypeReference = this.generateExampleTypeReference(typeReference, depth);
860883
860931
  return {
860884
860932
  jsonExample: [exampleTypeReference.jsonExample],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fern-api",
3
- "version": "0.19.16",
3
+ "version": "0.19.18",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/fern-api/fern.git",