Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(cli): Add @fern-api/source-resolver #5295

Merged
merged 5 commits into from
Dec 1, 2024
Merged

Conversation

amckinney
Copy link
Contributor

Overview

This adds the new @fern-api/source-resolver and @fern-api/cli-source-resolver packages which are primarily used in the @fern-api/ir-generator.

Rationale

The primary SourceResolver implementation requires access to the filesystem, so we abstract this interface away in a separate package, and require it as input to generateIntermediateRepresentation.

The implementation defined in @fern-api/cli-source-resolver is explicitly provided in every node-compatible call-site (e.g. the CLI), whereas browser-compatible callers can provide the NopSourceResolver, and can still receive valid IR output.

With this, the @fern-api/ir-generator no longer depends on fs/promises.

context,
fdrApiDefinitionId,
includeOptionalRequestPropertyExamples,
sourceResolver = new NopSourceResolver()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dsinghvi this will be fixed before merge - if everything else look good I'll make this a required property so that every caller needs to explicitly pass it in themselves. It's otherwise too easy for us to miss it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to a required property in this commit.

Copy link

github-actions bot commented Nov 28, 2024

@amckinney amckinney changed the title Add @fern-api/source-resolver chore(cli): Add @fern-api/source-resolver Nov 28, 2024
@dsinghvi
Copy link
Member

@amckinney is it easy to nest source-resolver under cli/generation ? If not, no worries

@amckinney
Copy link
Contributor Author

@dsinghvi sounds great to me! I'll handle this in a follow up commit so that the other PRs branched off this one don't need to be rebased.

@amckinney amckinney merged commit edc2457 into main Dec 1, 2024
47 of 50 checks passed
@amckinney amckinney deleted the amckinney/source-resolver branch December 1, 2024 01:48
@amckinney
Copy link
Contributor Author

@dsinghvi follow-up PR here: #5312

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants