Code being generated for NodeJS is too old and not correct
Describe the bug
The code that is being generated for NodeJS use deprecated packages (requests, unirest ) Also under Native code the code require fs which is not being used at all. I couldn't find a way to hide those tabs
Expected behavior
Those tabs shouldn't appear at all.
Screenshots
Ok so i found a solution to one of the problems
To remove the deprecated packages under node you need to do the following
-
Swizzle the ApiExplorer/CodeSnippets
yarn swizzle docusaurus-theme-openapi-docs ApiExplorer/CodeSnippets -- --eject -
Edit the file ../src/theme/ApiExplorer/CodeSnippets/index.js to remove the deprecated variants ( requests and unirest) https://github.com/PaloAltoNetworks/docusaurus-openapi-docs/blob/f6641c0ce01e3247a06ef8ddde7bafbe749d4ed1/packages/docusaurus-theme-openapi-docs/src/theme/ApiExplorer/CodeSnippets/index.tsx#L74
-
Edit the file ../src/theme/ApiExplorer/CodeSnippets/languages.json to remove the deprecated node packages parameters https://github.com/PaloAltoNetworks/docusaurus-openapi-docs/blob/f6641c0ce01e3247a06ef8ddde7bafbe749d4ed1/packages/docusaurus-theme-openapi-docs/src/theme/ApiExplorer/CodeSnippets/languages.json#L639 https://github.com/PaloAltoNetworks/docusaurus-openapi-docs/blob/f6641c0ce01e3247a06ef8ddde7bafbe749d4ed1/packages/docusaurus-theme-openapi-docs/src/theme/ApiExplorer/CodeSnippets/languages.json#L687
-
Build the website
yarn build -
Start the website
yarn start
Regarding the second issue with the require('fs'); which is not needed it is related to the package paloaltonetworks/postman-code-generators.
Unfortunately its repo is not public so i cant offer a fix for it. I was able to watch the code on npmjs.com and in file codegens/nodejs-native/lib/request.js line 42 ( snippet += "fs = require('fs');\n\n"; ) need to be remove
Here is link to the relevant file
@sserrata can you help with the second issue?