Swagger-codegen: [typescript-angular] Invalid regular expression error

Created on 26 Sep 2017  Â·  8Comments  Â·  Source: swagger-api/swagger-codegen

Description

The code generated from the following template results in a runtime error, Invalid regular expression: /(?i)^(application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(;.*)?$/: Invalid group

https://github.com/swagger-api/swagger-codegen/blob/d2b91073e1fc499fea67141ff4c17740d25f8e83/modules/swagger-codegen/src/main/resources/typescript-angular/api.service.mustache#L82

Swagger-codegen version

Master branch (2.3.0)

Steps to reproduce

Paste the regular expression in Chrome Developer console, and Chrome raises the syntax error.

TypeScript Bug

Most helpful comment

@kimamula the issue has been fixed by #6584. Please pull the latest master to give it a try.

All 8 comments

@wing328 I think we need to add some basic tests for angular and run them on CI in order to avoid this kind of bugs. What do you say?

@taxpon definitely. It's better to rely on CI to catch similar issue moving forward.

Btw, npm run build didn't catch this issue so we need to write some integration tests similar to what we've done for TS Fetch: https://github.com/swagger-api/swagger-codegen/tree/master/samples/client/petstore/typescript-fetch

cc @TiFu @taxpon @sebastianhaas @kenisteward @Vrolijkx

+1

+1 - also worth mentioning that typescript-angular is still using the old and about-to-be-deprecated HttpModule instead of HttpClientModule

There is a PR to use the new one by default and optionally use the old one

On Wed, Sep 27, 2017, 9:09 AM Gabriel Imre notifications@github.com wrote:

+1 - also worth mentioning that typescript-angular is still using the old
and about-to-be-deprecated HttpModule instead of HttpClientModule

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/swagger-api/swagger-codegen/issues/6566#issuecomment-332514944,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AMPLtcq97Egsb1Mia38sExaUTNXyhysLks5smkjygaJpZM4Pj3EQ
.

@kimamula the issue has been fixed by #6584. Please pull the latest master to give it a try.

Was this page helpful?
0 / 5 - 0 ratings