Reputation: 2773
Is there any tool or library available which can generate REST API from JSON file. Independent of language. On the basis of JSON object generate REST API.
for Example:
{
"name": "set",
"type":"function",
"inputs":[{"name":"num", "type":"int"}]
"output":[{"name":"value", "type":"int"}]
}
Clarification:
The JSON file will contain function and its detail like name, input argument and output(return) parameters.
So according to this JSON file, REST API methods should be generated for the function described in the JSON.
For ex: A function named set and it is accepting one argument num of int type and returning a value of int type.
Is it possible to generate REST API method for this function like GET and POST from the knowledge of JSON file only?
Hope it clears the question!
Upvotes: 3
Views: 7928
Reputation: 1776
You can use swagger (https://swagger.io/, https://generator.swagger.io/)
It can generate API (supports different languages) from openAPI spec file.
The spec file can be json or yaml.
You should transform your json to spec-specific json format.
Upvotes: 3