-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cli): specify openrpc in docs.yml (#5613)
- Loading branch information
Showing
15 changed files
with
120 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# For unreleased changes, use unreleased.yml | ||
|
||
- version: 4.3.11 | ||
irVersion: 53 | ||
changelogEntry: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
packages/cli/docs-resolver/src/utils/generateFdrFromOpenrpc.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { OpenrpcDocument } from "@open-rpc/meta-schema"; | ||
import { readFile } from "fs/promises"; | ||
|
||
import { OpenrpcContext, OpenrpcDocumentConverterNode } from "@fern-api/docs-parsers"; | ||
import { AbsoluteFilePath } from "@fern-api/fs-utils"; | ||
import { TaskContext } from "@fern-api/task-context"; | ||
|
||
export async function generateFdrFromOpenrpc( | ||
openrpcPath: AbsoluteFilePath, | ||
context: TaskContext | ||
): Promise<ReturnType<OpenrpcDocumentConverterNode["convert"]>> { | ||
// Read and parse the OpenRPC document | ||
const openrpcContent = await readFile(openrpcPath, "utf-8"); | ||
const openrpcDocument = JSON.parse(openrpcContent) as OpenrpcDocument; | ||
|
||
const openrpcContext = new OpenrpcContext({ | ||
openrpc: openrpcDocument, | ||
logger: context.logger | ||
}); | ||
|
||
const openrpcFdrJson = new OpenrpcDocumentConverterNode({ | ||
input: openrpcDocument, | ||
context: openrpcContext, | ||
accessPath: [], | ||
pathId: "openrpc" | ||
}); | ||
|
||
return openrpcFdrJson.convert(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,8 +10,7 @@ import { docsYml } from "@fern-api/configuration"; | |
import { createFdrService } from "@fern-api/core"; | ||
import { MediaType } from "@fern-api/core-utils"; | ||
import { DocsDefinitionResolver, UploadedFile, wrapWithHttps } from "@fern-api/docs-resolver"; | ||
import { AbsoluteFilePath, RelativeFilePath, resolve } from "@fern-api/fs-utils"; | ||
import { convertToFernHostRelativeFilePath } from "@fern-api/fs-utils"; | ||
import { AbsoluteFilePath, RelativeFilePath, convertToFernHostRelativeFilePath, resolve } from "@fern-api/fs-utils"; | ||
import { convertIrToFdrApi } from "@fern-api/register"; | ||
import { TaskContext } from "@fern-api/task-context"; | ||
import { DocsWorkspace, FernWorkspace } from "@fern-api/workspace-loader"; | ||
|
@@ -214,11 +213,11 @@ export async function publishDocs({ | |
default: | ||
if (apiName != null) { | ||
return context.failAndThrow( | ||
`Failed to publish docs because API definition (${apiName}) could not be uploaded. Please contact [email protected]\n ${response.error}` | ||
`Failed to publish docs because API definition (${apiName}) could not be uploaded. Please contact [email protected]\n ${JSON.stringify(response.error)}` | ||
); | ||
} else { | ||
return context.failAndThrow( | ||
`Failed to publish docs because API definition could not be uploaded. Please contact [email protected]\n ${response.error}` | ||
`Failed to publish docs because API definition could not be uploaded. Please contact [email protected]\n ${JSON.stringify(response.error)}` | ||
); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.