Skip to content
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

feat(openapi-generator): support types imported from node_modules #766

Merged
merged 19 commits into from
May 23, 2024

Conversation

anshchaturvedi
Copy link
Contributor

@anshchaturvedi anshchaturvedi commented May 15, 2024

Ticket: DX-389

This PR aims to introduce support to parse types from libraries living inside node_modules. Previously openapi-generator only parsed types that were defined locally and this heavily interfered with creating an automated solution for generating OpenAPI specifications when API's changes are introduced.

This PR also includes a more sophisticated end-to-end testing strategy so that any implementations that change the logic of how we generate our documentation will be caught by our tests.

@anshchaturvedi anshchaturvedi force-pushed the DX-389-node-modules-generator branch from de8290e to 87fc87e Compare May 17, 2024 15:12
@anshchaturvedi anshchaturvedi changed the title feat(openapi-generator): support wallet-platform-types feat(openapi-generator): support types imported from node_modules May 17, 2024
@anshchaturvedi anshchaturvedi marked this pull request as ready for review May 17, 2024 20:42
@anshchaturvedi anshchaturvedi requested a review from a team as a code owner May 17, 2024 20:42
@ericcrosson-bitgo ericcrosson-bitgo requested a review from a team May 17, 2024 21:37
Copy link
Contributor

@bitgopatmcl bitgopatmcl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if this should count as a breaking change. Even though I haven't ran into it in testing, a package that previously didn't expect to have node_modules parsed may suddenly break upon upgrading if there is something that now causes an error in node_modules.

packages/openapi-generator/test/externalModule.test.ts Outdated Show resolved Hide resolved
@@ -34,7 +35,7 @@
"@types/resolve": "1.20.6",
"c8": "9.1.0",
"memfs": "4.9.2",
"typescript": "4.7.4"
"typescript": "^4.7.4"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What necessitated this change? I think we can support this but would need to incorporate the patch here (or a version of io-ts with that patch upstreamed to 2.1.3)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I don't think we need this either, must've been something I introduced when trying to get everything working locally. We can remove this 👍🏽

@@ -0,0 +1 @@
sample-types/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this redundant with this entry? https://github.com/anshchaturvedi

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm yeah I agree, will check this and remove as necessary.

@anshchaturvedi
Copy link
Contributor Author

I'm wondering if this should count as a breaking change. Even though I haven't ran into it in testing, a package that previously didn't expect to have node_modules parsed may suddenly break upon upgrading if there is something that now causes an error in node_modules.

I gave myself the task of running all the current -types repos that use openapi-generator so far and I don't recall seeing any errors, but yeah I guess it could still break. Is there something special we do for releases that introduce breaking changes?

@bitgopatmcl
Copy link
Contributor

I gave myself the task of running all the current -types repos that use openapi-generator so far and I don't recall seeing any errors, but yeah I guess it could still break. Is there something special we do for releases that introduce breaking changes?

The way to do with with semantic-release is to add a line in a commit body containing BREAKING CHANGE: some description here. Since this PR has a bunch of commits, it only needs to go in one of them somewhere.

@anshchaturvedi anshchaturvedi force-pushed the DX-389-node-modules-generator branch from 24a7379 to b97074e Compare May 23, 2024 18:55
@anshchaturvedi
Copy link
Contributor Author

I gave myself the task of running all the current -types repos that use openapi-generator so far and I don't recall seeing any errors, but yeah I guess it could still break. Is there something special we do for releases that introduce breaking changes?

The way to do with with semantic-release is to add a line in a commit body containing BREAKING CHANGE: some description here. Since this PR has a bunch of commits, it only needs to go in one of them somewhere.

done! 17d919a

@bitgopatmcl bitgopatmcl merged commit 1163bd9 into master May 23, 2024
8 checks passed
@bitgopatmcl bitgopatmcl deleted the DX-389-node-modules-generator branch May 23, 2024 19:34
Copy link

🎉 This PR is included in version @api-ts/[email protected] 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

@anshchaturvedi anshchaturvedi restored the DX-389-node-modules-generator branch May 23, 2024 21:15
Copy link

github-actions bot commented Jun 4, 2024

🎉 This PR is included in version @api-ts/[email protected] 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

Copy link

github-actions bot commented Jun 4, 2024

🎉 This PR is included in version @api-ts/[email protected] 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

Copy link

github-actions bot commented Jun 4, 2024

🎉 This PR is included in version @api-ts/[email protected] 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

Copy link

github-actions bot commented Aug 5, 2024

🎉 This PR is included in version @api-ts/[email protected] 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

4 participants