Openapi-generator: [BUG][typescript-fetch] withInterfaces option does not generate interfaces

Created on 26 Jul 2019  路  6Comments  路  Source: OpenAPITools/openapi-generator

Bug Report Checklist

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

Compare these files in the samples directory:

https://github.com/OpenAPITools/openapi-generator/blob/master/samples/client/petstore/typescript-fetch/builds/default/apis/PetApi.ts

vs

https://github.com/OpenAPITools/openapi-generator/blob/master/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/PetApi.ts

openapi-generator version

Master branch

Suggest a fix

Could not find reference to withInterfaces parameter in the mustache templates, and no difference in the generated api.

Option should be removed from documentation or re-implemented for typescript-fetch

https://openapi-generator.tech/docs/generators/typescript-fetch

TypeScript Bug

Most helpful comment

We're also kind of stuck with the missing interfaces. We were using them to mock the Apis for testing purposes.

All 6 comments

馃憤 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.

cc @TiFu are the interfaces necessary? classes can also be used as interfaces...

classes can also be used as interfaces...

Is that the recommended guidance outside the Angular style guide? I've found at least one dissenter: https://www.stevefenton.co.uk/2017/11/typescript-using-classes-interfaces/

are the interfaces necessary?

Even if not, the tooling not providing them when it used to should be a breaking change at least.

I agree that a class which contains logic either in the constructor or in some methods should not be used as an interface. However, for generated model-interfaces I think this is not a problem.

Yes, the refactoring caused some breaking changes, this should have been avoided.

I was not concerned with the models; but with the interfaces for api clients themselves. They used to have interfaces too and are arguably the more valuable piece that was lost.

We're also kind of stuck with the missing interfaces. We were using them to mock the Apis for testing purposes.

Was this page helpful?
0 / 5 - 0 ratings