openapi-client icon indicating copy to clipboard operation
openapi-client copied to clipboard

TypeScript code generation fixes and type updates

Open Sunjammer opened this issue 7 years ago • 3 comments

This PR fixes some generated types that are invalid in strict mode TS, adds appropriate type assertions, narrowly improves assignment of optional params according to their type and maps 'file' param types to 'File' objects, which may or may not be correct :-P

Open for criticism/style change requests etc. I'm new to OpenAPI so I expect there to be unforeseen things or misunderstandings. Here to help!

Sunjammer avatar May 16 '18 11:05 Sunjammer

@Sunjammer thanks for the PR! I probably won't get time until the weekend to give it the once over and test it out. Will report back then when I do 👍

mikestead avatar May 16 '18 22:05 mikestead

Hello! I just discovered this great project, but like @Sunjammer, I prefer to use Typescript with its strict mode enabled, and the currently-generated code doesn't work with that.

I think there is probably a way to let it pass without breaking backwards compatibility, though an alternative would be to break it in favor of providing more user-friendly typings (although I literally just started using this project an hour ago, it seems like there might be some opportunities for improvement, but I could be wrong).

Anyways, I'd be happy to "pick up the torch" on this PR if @Sunjammer's unavailable, or I am happy to help move it along in whatever other way might be useful, just let me know.

Thanks again for creating this tool, @mikestead!

toolness avatar Aug 05 '18 19:08 toolness

@toolness thanks for your offer, I'm very open to this.

I'd really prefer to not break backwards compatibility if we can help it as there are some large sites with this in production. That said, if there's a fairly painless upgrade path that respects the openapi 2 spec then I'd consider a major bump.

mikestead avatar Aug 06 '18 22:08 mikestead