astahmer / typed-openapi

Generate a headless Typescript API client from an OpenAPI spec
https://typed-openapi-web.vercel.app/
179 stars 22 forks source link

fix: refer Schema namespace in generated body type #16

Closed TimPetricola closed 10 months ago

TimPetricola commented 10 months ago

Fix https://github.com/astahmer/typed-openapi/issues/11

Since https://github.com/astahmer/typed-openapi/pull/9, body: is accessible on endpoints. But these types references live under the Schemas namespace, which is not added in the body: type. IT results in a broken typescript file:

Screenshot 2023-11-22 at 09 46 52

This PR ensures that we rely on the Schemas namespace to generate correct types:

Screenshot 2023-11-22 at 09 47 24

Current test suite is enough to confirm the new behaviors works as expected and .client.ts files generated in tests are now correct

vercel[bot] commented 10 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
typed-openapi ❌ Failed (Inspect) Nov 22, 2023 8:48am
astahmer commented 10 months ago

looks fine to me, I can't check (am in vacation and not logged in) why the vercel hosted playground fails tho, is it ok for you locally? will merge if so

TimPetricola commented 10 months ago

@astahmer Just tried locally if the web playground to confirm it worked, and everything is fine!

astahmer commented 10 months ago

seems like the merge commit failed here, can't see the logs while not logged in since it happens at build step, I'm guessing the lockfile maybe needs to be updated ? if you can make a fix I'll merge it, then the changesets PR will be updated and I'll merge it as well for a release

otherwise, I'll be back Monday

https://github.com/astahmer/typed-openapi/actions/runs/6957915056

TimPetricola commented 10 months ago

@astahmer super weird, I didn't have any issue to build locally.

Anyway, the failing build comes from an unused import. I'm removing it in https://github.com/astahmer/typed-openapi/pull/17

TimPetricola commented 10 months ago

Thanks for the quick merge @astahmer ! Looks like it went fine and the release PR has been updated here 😌 https://github.com/astahmer/typed-openapi/pull/15