fern-api 0.16.29 → 0.16.31
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/bundle.cjs +48 -15
- package/package.json +1 -1
package/bundle.cjs
CHANGED
|
@@ -733310,10 +733310,12 @@ var GeneratorGroupSchema = z.strictObject({
|
|
|
733310
733310
|
// pnp:/home/circleci/project/packages/cli/config-management/generators-configuration/lib/schemas/GeneratorsConfigurationSchema.js
|
|
733311
733311
|
var DEFAULT_GROUP_GENERATORS_CONFIG_KEY = "default-group";
|
|
733312
733312
|
var OPENAPI_LOCATION_KEY = "openapi";
|
|
733313
|
+
var OPENAPI_OVERRIDES_LOCATION_KEY = "openapi-overrides";
|
|
733313
733314
|
var ASYNC_API_LOCATION_KEY = "async-api";
|
|
733314
733315
|
var GeneratorsConfigurationSchema = z.strictObject({
|
|
733315
733316
|
[DEFAULT_GROUP_GENERATORS_CONFIG_KEY]: z.optional(z.string()),
|
|
733316
733317
|
[OPENAPI_LOCATION_KEY]: z.optional(z.string()),
|
|
733318
|
+
[OPENAPI_OVERRIDES_LOCATION_KEY]: z.optional(z.string()),
|
|
733317
733319
|
[ASYNC_API_LOCATION_KEY]: z.optional(z.string()),
|
|
733318
733320
|
groups: z.optional(z.record(GeneratorGroupSchema))
|
|
733319
733321
|
});
|
|
@@ -733322,10 +733324,12 @@ var GeneratorsConfigurationSchema = z.strictObject({
|
|
|
733322
733324
|
async function convertGeneratorsConfiguration({ absolutePathToGeneratorsConfiguration, rawGeneratorsConfiguration }) {
|
|
733323
733325
|
const pathToOpenAPI = rawGeneratorsConfiguration[OPENAPI_LOCATION_KEY];
|
|
733324
733326
|
const pathToAsyncAPI = rawGeneratorsConfiguration[ASYNC_API_LOCATION_KEY];
|
|
733327
|
+
const pathToOpenAPIOverrides = rawGeneratorsConfiguration[OPENAPI_OVERRIDES_LOCATION_KEY];
|
|
733325
733328
|
return {
|
|
733326
733329
|
absolutePathToConfiguration: absolutePathToGeneratorsConfiguration,
|
|
733327
733330
|
absolutePathToAsyncAPI: pathToAsyncAPI != null ? join(dirname(absolutePathToGeneratorsConfiguration), RelativeFilePath.of(pathToAsyncAPI)) : void 0,
|
|
733328
733331
|
absolutePathToOpenAPI: pathToOpenAPI != null ? join(dirname(absolutePathToGeneratorsConfiguration), RelativeFilePath.of(pathToOpenAPI)) : void 0,
|
|
733332
|
+
absolutePathToOpenAPIOverrides: pathToOpenAPIOverrides != null ? join(dirname(absolutePathToGeneratorsConfiguration), RelativeFilePath.of(pathToOpenAPIOverrides)) : void 0,
|
|
733329
733333
|
rawConfiguration: rawGeneratorsConfiguration,
|
|
733330
733334
|
defaultGroup: rawGeneratorsConfiguration["default-group"],
|
|
733331
733335
|
groups: rawGeneratorsConfiguration.groups != null ? await Promise.all(Object.entries(rawGeneratorsConfiguration.groups).map(([groupName, group]) => convertGroup({
|
|
@@ -736951,7 +736955,7 @@ var AccessTokenPosthogManager = class {
|
|
|
736951
736955
|
properties: {
|
|
736952
736956
|
...event,
|
|
736953
736957
|
...event.properties,
|
|
736954
|
-
version: "0.16.
|
|
736958
|
+
version: "0.16.31",
|
|
736955
736959
|
usingAccessToken: true
|
|
736956
736960
|
}
|
|
736957
736961
|
});
|
|
@@ -737013,7 +737017,7 @@ var UserPosthogManager = class {
|
|
|
737013
737017
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
737014
737018
|
event: "CLI",
|
|
737015
737019
|
properties: {
|
|
737016
|
-
version: "0.16.
|
|
737020
|
+
version: "0.16.31",
|
|
737017
737021
|
...event,
|
|
737018
737022
|
...event.properties
|
|
737019
737023
|
}
|
|
@@ -751623,8 +751627,9 @@ function isObjectEqual(a2, b2) {
|
|
|
751623
751627
|
|
|
751624
751628
|
// pnp:/home/circleci/project/packages/cli/openapi-parser/lib/v3/converters/schema/convertObject.js
|
|
751625
751629
|
function convertObject2({ nameOverride, generatedName, breadcrumbs, properties, description, required, wrapAsNullable, allOf, context, propertiesToExclude, groupName }) {
|
|
751626
|
-
|
|
751627
|
-
|
|
751630
|
+
const allRequired = [...required ?? []];
|
|
751631
|
+
const propertiesToConvert = { ...properties };
|
|
751632
|
+
const inlinedParentProperties = [];
|
|
751628
751633
|
const parents = [];
|
|
751629
751634
|
for (const allOfElement of allOf) {
|
|
751630
751635
|
if (isReferenceObject(allOfElement)) {
|
|
@@ -751640,9 +751645,9 @@ function convertObject2({ nameOverride, generatedName, breadcrumbs, properties,
|
|
|
751640
751645
|
});
|
|
751641
751646
|
context.markSchemaAsReferencedByNonRequest(schemaId);
|
|
751642
751647
|
} else {
|
|
751643
|
-
|
|
751644
|
-
|
|
751645
|
-
|
|
751648
|
+
const allOfSchema = convertSchema(allOfElement, false, context, breadcrumbs);
|
|
751649
|
+
if (allOfSchema.type === "object") {
|
|
751650
|
+
inlinedParentProperties.push(...allOfSchema.properties);
|
|
751646
751651
|
}
|
|
751647
751652
|
}
|
|
751648
751653
|
}
|
|
@@ -751698,6 +751703,21 @@ function convertObject2({ nameOverride, generatedName, breadcrumbs, properties,
|
|
|
751698
751703
|
generatedName: getGeneratedPropertyName([...breadcrumbs, propertyName])
|
|
751699
751704
|
};
|
|
751700
751705
|
});
|
|
751706
|
+
convertedProperties.push(...inlinedParentProperties.map((property2) => {
|
|
751707
|
+
const conflicts = property2.conflict;
|
|
751708
|
+
for (const parent2 of parents) {
|
|
751709
|
+
const parentPropertySchema = parent2.properties[property2.key];
|
|
751710
|
+
if (parentPropertySchema != null && !isSchemaWithExampleEqual(property2.schema, parentPropertySchema)) {
|
|
751711
|
+
conflicts[parent2.schemaId] = { differentSchema: true };
|
|
751712
|
+
} else if (parentPropertySchema != null) {
|
|
751713
|
+
conflicts[parent2.schemaId] = { differentSchema: false };
|
|
751714
|
+
}
|
|
751715
|
+
}
|
|
751716
|
+
return {
|
|
751717
|
+
...property2,
|
|
751718
|
+
conflict: conflicts
|
|
751719
|
+
};
|
|
751720
|
+
}));
|
|
751701
751721
|
return wrapObject({
|
|
751702
751722
|
nameOverride,
|
|
751703
751723
|
generatedName,
|
|
@@ -754374,7 +754394,7 @@ var FERN_TYPE_EXTENSIONS = {
|
|
|
754374
754394
|
}
|
|
754375
754395
|
}
|
|
754376
754396
|
};
|
|
754377
|
-
async function loadOpenAPI({ absolutePathToOpenAPI, context }) {
|
|
754397
|
+
async function loadOpenAPI({ absolutePathToOpenAPI, absolutePathToOpenAPIOverrides, context }) {
|
|
754378
754398
|
const result2 = await (0, import_openapi_core.bundle)({
|
|
754379
754399
|
config: new import_openapi_core.Config({
|
|
754380
754400
|
apis: {},
|
|
@@ -754391,12 +754411,19 @@ async function loadOpenAPI({ absolutePathToOpenAPI, context }) {
|
|
|
754391
754411
|
keepUrlRefs: true
|
|
754392
754412
|
});
|
|
754393
754413
|
const parsed = await import_swagger_parser.default.parse(result2.bundle.parsed);
|
|
754394
|
-
|
|
754414
|
+
let overridesFilepath = void 0;
|
|
754415
|
+
if (absolutePathToOpenAPIOverrides != null) {
|
|
754416
|
+
overridesFilepath = absolutePathToOpenAPIOverrides;
|
|
754417
|
+
} else if (typeof parsed === "object" && parsed[FernOpenAPIExtension.OPENAPI_OVERIDES_FILEPATH] != null) {
|
|
754418
|
+
overridesFilepath = join(
|
|
754419
|
+
dirname(absolutePathToOpenAPI),
|
|
754420
|
+
RelativeFilePath.of(parsed[FernOpenAPIExtension.OPENAPI_OVERIDES_FILEPATH])
|
|
754421
|
+
);
|
|
754422
|
+
}
|
|
754395
754423
|
if (overridesFilepath != null) {
|
|
754396
|
-
const pathToFile = join(dirname(absolutePathToOpenAPI), RelativeFilePath.of(overridesFilepath));
|
|
754397
754424
|
let parsedOverrides = null;
|
|
754398
754425
|
try {
|
|
754399
|
-
const contents = (await (0, import_promises22.readFile)(
|
|
754426
|
+
const contents = (await (0, import_promises22.readFile)(overridesFilepath, "utf8")).toString();
|
|
754400
754427
|
try {
|
|
754401
754428
|
parsedOverrides = JSON.parse(contents);
|
|
754402
754429
|
} catch (err) {
|
|
@@ -754419,13 +754446,17 @@ async function generateIr2(openApi, taskContext) {
|
|
|
754419
754446
|
}
|
|
754420
754447
|
|
|
754421
754448
|
// pnp:/home/circleci/project/packages/cli/openapi-parser/lib/parse.js
|
|
754422
|
-
async function parse2({ absolutePathToAsyncAPI, absolutePathToOpenAPI, taskContext }) {
|
|
754449
|
+
async function parse2({ absolutePathToAsyncAPI, absolutePathToOpenAPI, absolutePathToOpenAPIOverrides, taskContext }) {
|
|
754423
754450
|
let asyncAPISchemas = {};
|
|
754424
754451
|
if (absolutePathToAsyncAPI != null) {
|
|
754425
754452
|
const asyncAPI = await loadAsyncAPI(absolutePathToAsyncAPI);
|
|
754426
754453
|
asyncAPISchemas = generateSchemasFromAsyncAPI(asyncAPI, taskContext);
|
|
754427
754454
|
}
|
|
754428
|
-
const openApiDocument = await loadOpenAPI({
|
|
754455
|
+
const openApiDocument = await loadOpenAPI({
|
|
754456
|
+
absolutePathToOpenAPI,
|
|
754457
|
+
context: taskContext,
|
|
754458
|
+
absolutePathToOpenAPIOverrides
|
|
754459
|
+
});
|
|
754429
754460
|
let openApiIr = void 0;
|
|
754430
754461
|
if (isOpenApiV3(openApiDocument)) {
|
|
754431
754462
|
openApiIr = generateIr(openApiDocument, taskContext);
|
|
@@ -754456,9 +754487,11 @@ function isOpenApiV2(openApi) {
|
|
|
754456
754487
|
|
|
754457
754488
|
// pnp:/home/circleci/project/packages/cli/workspace-loader/lib/utils/convertOpenApiWorkspaceToFernWorkspace.js
|
|
754458
754489
|
async function getOpenAPIIRFromOpenAPIWorkspace(openapiWorkspace, context) {
|
|
754490
|
+
var _a2;
|
|
754459
754491
|
return await parse2({
|
|
754460
754492
|
absolutePathToAsyncAPI: openapiWorkspace.absolutePathToAsyncAPI,
|
|
754461
754493
|
absolutePathToOpenAPI: openapiWorkspace.absolutePathToOpenAPI,
|
|
754494
|
+
absolutePathToOpenAPIOverrides: (_a2 = openapiWorkspace.generatorsConfiguration) == null ? void 0 : _a2.absolutePathToOpenAPIOverrides,
|
|
754462
754495
|
taskContext: context
|
|
754463
754496
|
});
|
|
754464
754497
|
}
|
|
@@ -761708,10 +761741,10 @@ var CliContext = class {
|
|
|
761708
761741
|
return "fern-api";
|
|
761709
761742
|
}
|
|
761710
761743
|
getPackageVersion() {
|
|
761711
|
-
if ("0.16.
|
|
761744
|
+
if ("0.16.31" == null) {
|
|
761712
761745
|
this.logger.error("CLI_VERSION is not defined");
|
|
761713
761746
|
}
|
|
761714
|
-
return "0.16.
|
|
761747
|
+
return "0.16.31";
|
|
761715
761748
|
}
|
|
761716
761749
|
getCliName() {
|
|
761717
761750
|
if ("fern" == null) {
|