Skip to content

[BUG] [typescript-angular] Angular 8: generated package.json includes @angular/http dependency #3460

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

Closed
3 of 6 tasks
daniel-sc opened this issue Jul 25, 2019 · 5 comments · Fixed by #3465
Closed
3 of 6 tasks

Comments

@daniel-sc
Copy link
Contributor

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

When generating for angular-typescript and setting the Angular version to 8.x (e.g. 8.1.1) the generated package.json is invalid, as the included @angular/http is not available in version 8.1.1.

openapi-generator version

4.0.3

Steps to reproduce

Generate with <ngVersion>8.1.1</ngVersion>

Suggest a fix

The dependency @angular/http should be removed from the generated package.json as it is now included in @angular/common - see e.g.: https://blog.angularindepth.com/embrace-yourself-angular-8-is-coming-1bf187c8f0bf

@auto-labeler
Copy link

auto-labeler bot commented Jul 25, 2019

👍 Thanks for opening this issue!
🏷 I have applied any labels matching special text in your issue.

The team will review the labels and make any necessary changes.

@macjohnny
Copy link
Member

@daniel-sc would you like to file a PR to fix that?

@macjohnny
Copy link
Member

you could use the {{#useHttpClient}} variable, see e.g.

{{#useHttpClient}}
import { HttpClient, HttpHeaders, HttpParams,
HttpResponse, HttpEvent, HttpParameterCodec } from '@angular/common/http';
import { CustomHttpParameterCodec } from '../encoder';
{{/useHttpClient}}
{{^useHttpClient}}
import { Http, Headers, URLSearchParams,
RequestMethod, RequestOptions, RequestOptionsArgs,
Response, ResponseContentType, QueryEncoder } from '@angular/http';
import { CustomQueryEncoderHelper } from '../encoder';
{{/useHttpClient}}

@eseliger
Copy link
Contributor

@macjohnny I have a fix for that ready, I can submit a pr in a few

@macjohnny
Copy link
Member

@eseliger that would be great!

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

Successfully merging a pull request may close this issue.

3 participants