Skip to content

Commit

Permalink
(fix): use display names for services (#3289)
Browse files Browse the repository at this point in the history
* (fix): use display names for services

* (chore): fix tests
  • Loading branch information
dsinghvi authored Mar 28, 2024
1 parent dbefb29 commit 1ad0473
Show file tree
Hide file tree
Showing 17 changed files with 100 additions and 56 deletions.
47 changes: 27 additions & 20 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/cli/configuration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"dependencies": {
"@fern-api/core-utils": "workspace:*",
"@fern-api/fdr-sdk": "0.60.0-1-g4795d27",
"@fern-api/fdr-sdk": "0.62.1",
"@fern-api/fs-utils": "workspace:*",
"@fern-api/task-context": "workspace:*",
"@fern-fern/fiddle-sdk": "^0.0.486",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/docs-preview/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"dependencies": {
"@fern-api/configuration": "workspace:*",
"@fern-api/core-utils": "workspace:*",
"@fern-api/fdr-sdk": "0.60.0-1-g4795d27",
"@fern-api/fdr-sdk": "0.62.1",
"@fern-api/fs-utils": "workspace:*",
"@fern-api/ir-generator": "workspace:*",
"@fern-api/register": "workspace:*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@fern-api/core": "workspace:*",
"@fern-api/core-utils": "workspace:*",
"@fern-api/docs-validator": "workspace:*",
"@fern-api/fdr-sdk": "0.60.0-1-g4795d27",
"@fern-api/fdr-sdk": "0.62.1",
"@fern-api/fs-utils": "workspace:*",
"@fern-api/ir-generator": "workspace:*",
"@fern-api/ir-migrations": "workspace:*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ exports[`open api parser apiture simple 1`] = `
{
"definitionFiles": {
"accountJointOwners.yml": {
"docs": "Account Joint Owners",
"imports": {
"root": "__package__.yml",
},
"service": {
"auth": false,
"base-path": "",
"display-name": "Account Joint Owners",
"endpoints": {
"listAccountJointOwners": {
"auth": true,
Expand Down Expand Up @@ -55,12 +57,14 @@ exports[`open api parser apiture simple 1`] = `
},
},
"accounts.yml": {
"docs": "Banking Accounts",
"imports": {
"root": "__package__.yml",
},
"service": {
"auth": false,
"base-path": "",
"display-name": "Accounts",
"endpoints": {
"getAccount": {
"auth": true,
Expand Down Expand Up @@ -316,12 +320,14 @@ Optionally, an agent can access a business customer's ACH accounts when acting o
},
},
"institutions.yml": {
"docs": "Banking Institutions",
"imports": {
"root": "__package__.yml",
},
"service": {
"auth": false,
"base-path": "",
"display-name": "Institutions",
"endpoints": {
"getCutoffTimes": {
"auth": true,
Expand Down Expand Up @@ -807,12 +813,14 @@ The authenticated user must have the \`account.allows.manageJointOwners\` permis
},
},
"overdraftProtection.yml": {
"docs": "Overdraft Protection Settings",
"imports": {
"root": "__package__.yml",
},
"service": {
"auth": false,
"base-path": "",
"display-name": "Overdraft Protection",
"endpoints": {
"getOverdraftProtection": {
"auth": true,
Expand Down Expand Up @@ -977,12 +985,14 @@ The user must have the \`allows.manageOverdraftAccounts\` permission on the acco
},
},
"transactionCategories.yml": {
"docs": "Banking Account Transaction Categories",
"imports": {
"root": "__package__.yml",
},
"service": {
"auth": false,
"base-path": "",
"display-name": "Transaction Categories",
"endpoints": {
"listTransactionCategories": {
"auth": true,
Expand Down Expand Up @@ -1032,12 +1042,14 @@ This is a _conditional operation_ when the \`If-None-Match\` header is used. If
},
},
"transactions.yml": {
"docs": "Banking Account Transactions",
"imports": {
"root": "__package__.yml",
},
"service": {
"auth": false,
"base-path": "",
"display-name": "Transactions",
"endpoints": {
"listTransactions": {
"auth": true,
Expand Down Expand Up @@ -1192,12 +1204,14 @@ The default response lists only recent transactions. Normally, this is transacti
},
},
"transfers.yml": {
"docs": "Banking Transfers",
"imports": {
"root": "__package__.yml",
},
"service": {
"auth": false,
"base-path": "",
"display-name": "Transfers",
"endpoints": {
"createTransfer": {
"auth": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,14 @@ exports[`open api parser assembly simple 1`] = `
},
},
"lemur.yml": {
"docs": "LeMUR related operations",
"imports": {
"root": "__package__.yml",
},
"service": {
"auth": false,
"base-path": "",
"display-name": "LeMUR",
"endpoints": {
"actionItems": {
"auth": true,
Expand Down Expand Up @@ -352,12 +354,14 @@ The parameter should map to a JSON encoded list of strings.
},
},
},
"docs": "Real-time transcription",
"imports": {
"root": "__package__.yml",
},
"service": {
"auth": false,
"base-path": "",
"display-name": "realtime",
"endpoints": {
"createTemporaryToken": {
"auth": true,
Expand Down Expand Up @@ -428,12 +432,14 @@ The parameter should map to a JSON encoded list of strings.
},
},
"transcript.yml": {
"docs": "Transcript related operations",
"imports": {
"root": "__package__.yml",
},
"service": {
"auth": false,
"base-path": "",
"display-name": "transcript",
"endpoints": {
"create": {
"auth": true,
Expand Down
10 changes: 6 additions & 4 deletions packages/cli/openapi-ir-to-fern/src/buildServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ export function buildServices(context: OpenApiIrConverterContext): {
name: endpointId,
schema: convertedEndpoint.value
});
context.builder.setServiceInfo(file, {
displayName: irTag?.id,
docs: irTag?.description ?? undefined
});
if (irTag?.id != null || irTag?.description != null) {
context.builder.setServiceInfo(file, {
displayName: irTag?.id,
docs: irTag?.description ?? undefined
});
}
}
return { schemaIdsToExclude, sdkGroups };
}
16 changes: 10 additions & 6 deletions packages/cli/openapi-ir-to-fern/src/utils/getEndpointLocation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,22 @@ export interface EndpointLocation {
}

export function getEndpointLocation(endpoint: Endpoint): EndpointLocation {
const tag = endpoint.tags[0];
if (endpoint.sdkName != null) {
const filename =
const filenameWithoutExtension =
endpoint.sdkName.groupName.length === 0
? "__package__.yml"
: `${endpoint.sdkName.groupName.map((part) => camelCase(part)).join("/")}.yml`;
? "__package__"
: `${endpoint.sdkName.groupName.map((part) => camelCase(part)).join("/")}`;
const filename = `${filenameWithoutExtension}.yml`;
// only if the tag lines up with `x-fern-sdk-group-name` do we use it
const isTagApplicable = filenameWithoutExtension.toLowerCase() === tag?.toLowerCase().replaceAll(" ", "");
return {
file: RelativeFilePath.of(filename),
endpointId: endpoint.sdkName.methodName
endpointId: endpoint.sdkName.methodName,
// only if the tag lines up with `x-fern-sdk-group-name` do we use it
tag: isTagApplicable ? tag : undefined
};
}

const tag = endpoint.tags[0];
const operationId = endpoint.operationId;

if (operationId == null) {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/register/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@fern-api/configuration": "workspace:*",
"@fern-api/core": "workspace:*",
"@fern-api/core-utils": "workspace:*",
"@fern-api/fdr-sdk": "0.60.0-1-g4795d27",
"@fern-api/fdr-sdk": "0.62.1",
"@fern-api/ir-generator": "workspace:*",
"@fern-api/ir-sdk": "workspace:*",
"@fern-api/task-context": "workspace:*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export function convertIrToFdrApi({
const service = subpackage.service != null ? ir.services[subpackage.service] : undefined;
fdrApi.subpackages[subpackageId] = {
subpackageId,
displayName: service?.displayName,
name: service?.displayName ?? subpackage.name.originalName,
description: subpackage.docs ?? undefined,
...convertPackage(subpackage, ir)
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"depcheck": "depcheck"
},
"dependencies": {
"@fern-api/fdr-sdk": "0.60.0-1-g4795d27",
"@fern-api/fdr-sdk": "0.62.1",
"@fern-api/venus-api-sdk": "0.0.38",
"@fern-fern/fiddle-sdk": "^0.0.486"
},
Expand Down
Loading

0 comments on commit 1ad0473

Please sign in to comment.