Skip to content

Commit

Permalink
fix(cli): log the name of the api that fails to register (#4753)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsinghvi committed Sep 26, 2024
1 parent d95bbc6 commit 2c5bf84
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
4 changes: 4 additions & 0 deletions fern/pages/changelogs/cli/2024-09-26.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## 0.43.2
**`(fix):`** The CLI now prints which API cannot be registered if `fern generate --docs` fails.


7 changes: 7 additions & 0 deletions packages/cli/cli/versions.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
- changelogEntry:
- summary: |
The CLI now prints which API cannot be registered if `fern generate --docs` fails.
type: fix
irVersion: 53
version: 0.43.2

- changelogEntry:
- summary: |
The CLI now supports running OpenAPI generator 0.1.0 with IR version 53.
Expand Down
4 changes: 3 additions & 1 deletion packages/cli/docs-resolver/src/DocsDefinitionResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export class DocsDefinitionResolver {
ir: IntermediateRepresentation;
snippetsConfig: APIV1Write.SnippetsConfig;
playgroundConfig?: DocsV1Write.PlaygroundConfig;
apiName?: string;
}) => Promise<string>
) {}

Expand Down Expand Up @@ -383,7 +384,8 @@ export class DocsDefinitionResolver {
const apiDefinitionId = await this.registerApi({
ir,
snippetsConfig,
playgroundConfig: { oauth: item.playground?.oauth }
playgroundConfig: { oauth: item.playground?.oauth },
apiName: item.apiName
});
const api = convertIrToApiDefinition(ir, apiDefinitionId, { oauth: item.playground?.oauth });
const node = new ApiReferenceNodeConverter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export async function publishDocs({
}
}
},
async ({ ir, snippetsConfig, playgroundConfig }) => {
async ({ ir, snippetsConfig, playgroundConfig, apiName }) => {
const apiDefinition = convertIrToFdrApi({ ir, snippetsConfig, playgroundConfig });
context.logger.debug("Calling registerAPI... ", JSON.stringify(apiDefinition, undefined, 4));
const response = await fdr.api.v1.register.registerApiDefinition({
Expand All @@ -172,7 +172,11 @@ export async function publishDocs({
);
}
default:
return context.failAndThrow("Failed to register API", response.error);
if (apiName != null) {
return context.failAndThrow(`Failed to register API ${apiName}`, response.error);
} else {
return context.failAndThrow("Failed to register API", response.error);
}
}
}
}
Expand Down

0 comments on commit 2c5bf84

Please sign in to comment.