-
Notifications
You must be signed in to change notification settings - Fork 112
feat: optional productSlugs param for all-docs-paths #93
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: optional productSlugs param for all-docs-paths #93
Conversation
Vercel Previews Deployed
|
|
What I believe is happening: Because we Vercel deploys it's API endpoints as "Node.js Functions" we have certain limitations. One specifically that I believe we are hitting is the 250mb size limit. In that when you use any Node FS module methods Vercel will try to bundle the required files into the Function so that the Function can run independently of your whole app. This is not possible for us as So to get around that limit we upload our content to the Vercel CDN by writing transformed content and assets out to So to get the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The API presented here for specifying only specific docs paths breaks URL conventions. In that in URL conventions after a / is a way to denote a child/deeper dive relationship.
e.g.
hashicorp.com/products/terraform
developer.hashicorp.com/packer/docs
developer.hashicorp.com/packer/docs/commands/init
So the API working by tacking on multiple products at the end of a URL path is confusing as not all of our products are linked in child/parent relationship to each other.
e.g.
/api/all-docs-paths/terraform/nomad
makes no sense, as nomad is not a part of terraform.
Rather we should use URL params to specify the change in the API we desire. I suggest something like:
/api/all-docs-paths?only=[terraform,nomad]
This way we keep with URL conventions and make it much easier to understand what the api is actually doing.
RubenSandwich
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works and looks great! Thanks for going through 2 rounds of reviews.
* feat: optional productSlugs param for all-docs-paths * add tests and fix type * generate docsPaths json file and serve data from there * testing WIP * add more tests * PR feedback: change to using url search params * PR feedback: add another test
Description
This PR adds support for passing products to the
api/all-docs-pathsroute. This is necessary so only the paths from product migrated to UDR are used in dev-portal. Nowapi/all-docs-pathswill return all the paths,api/all-docs-paths/terraformwill return only terraform paths, andapi/all-docs-paths/terraform/ptfe-releases/...will return paths for terraform, ptfe-releases, and any other products after that.EDIT: also this PR now changes the way that docsPaths data is retrieved. Now there is a script that runs during pre-build that creates a JSON file containing all the paths. The paths are then retrieved from that JSON file when the
/all-docs-pathsendpoint is hit.Testing