vultr/vultr-node

Why are request objects in js files and not json?

j4qfrost opened this issue · 3 comments

If the objects are json objects they would be more easily migrated to different languages. Is there a particular reason why this is the case?

@j4qfrost I don't quite follow the question here, could you please clarify? If you're talking about the files in the src/ directory, those are .js files so we can just import them and access the properties instead of having to parse the JSON first.

So the objects are already being pulled into the index.js file with require, which also parses the json objects for you when you import them. The intention behind switching from js to json is that other languages can readily parse them since json parsers are more commonplace and ready to use than say js to golang parsers. The only reasons I can see for keeping your objects in js files is that you want to keep multiple objects in those files or you plan on placing functions in the objects.

@j4qfrost the objects could certainly be moved to JSON files, but then we'd also have to modify how all the jsdoc documentation is generated. There's no benefit for this library for moving them to JSON files since this is strictly a node library. While I understand that having JSON files with all the endpoint data in them could be useful, there would have to also exist an understanding that the application ingesting them has the same logic as this library since the keys in here are all specific to the library.

If you wish to have a list of endpoints and their parameters as a JSON file, please put in a feature request over on the vultr-docs repo (https://github.com/vultr/vultr-docs) as this repo will not be changing the format of our files.