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

feat: warn user about missing required dependencies in generated client #110

Closed
wants to merge 3 commits into from
Closed

feat: warn user about missing required dependencies in generated client #110

wants to merge 3 commits into from

Conversation

jordanshatford
Copy link
Collaborator

@jordanshatford jordanshatford commented Mar 21, 2024

Infer client only if all dependencies are present. Log warning to user about missing dependencies that are required.

@jordanshatford jordanshatford requested a review from mrlubos March 22, 2024 00:53
@jordanshatford
Copy link
Collaborator Author

@mrlubos I have updated the dependencies to match your issues

Copy link
Member

@mrlubos mrlubos left a comment

Choose a reason for hiding this comment

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

If you really want this, then if I have just angular installed, it should infer angular and show warning. This implementation would infer fetch and show no warnings (potentially). Again, the primary functionality here is to remove the need to specify client, not to do dependency checks

@jordanshatford jordanshatford requested a review from mrlubos March 22, 2024 02:01
@jordanshatford
Copy link
Collaborator Author

If you really want this, then if I have just angular installed, it should infer angular and show warning. This implementation would infer fetch and show no warnings (potentially). Again, the primary functionality here is to remove the need to specify client, not to do dependency checks

Addressed in latest commit

@@ -18,6 +18,15 @@ type Dependencies = Record<string, unknown>;
// TODO: add support for `openapi-ts.config.ts`
const configFiles = ['openapi-ts.config.js', 'openapi-ts.config.cjs', 'openapi-ts.config.mjs'];

// Mapping of all dependencies required by each client. These should be installed in the generated client package
const clientDependencies: Record<Config['client'], string[]> = {
angular: ['@angular/common', '@angular/core', 'rxjs'],
Copy link
Member

Choose a reason for hiding this comment

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

I thought CLI is used for Angular projects? https://angular.io/guide/setup-local

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Possibly, but the generated client for angular only imports code from these packages (so cli is not required). These are a map of dependencies that the client we generate needs.

Copy link
Member

Choose a reason for hiding this comment

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

Got it. In that case, can you update the warning message to clarify those are the dependencies that need to be installed in order for the client to work? Right now it just says they're required, but not why

@jordanshatford jordanshatford closed this by deleting the head repository Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants