View Source AutoDocPackage.Requests (auto_doc_package v0.1.1)
The AutoDocPackage.Requests
module is used for generating the example_data.json
file
and the API Docs files based on the data provided by the example_data.json
file.
The module is used for the communication between the AutoDoc
microservice and your Elixir project.
More information about the AutoDoc
microservice can be found at:
Summary
Functions
Generate the API Docs files based on the data provided by the example_data.json
file.
Used for generating the API Docs files for the Params, Response, and Operations. (+ Errors)
Generate the example_data.json
file containing the special keys(__documentation_path__
, __controller_path__
)
and the keys corresponding to the API actions which do not yet have Documentation.
Functions
Generate the API Docs files based on the data provided by the example_data.json
file.
Used for generating the API Docs files for the Params, Response, and Operations. (+ Errors)
Parameters
type
- The type of the API Docs file to be generated. Must be one of [:params, :response, :operations, "params", "response", "operations"].
Returns
{:ok, "File formatted successfully."}
- If the file is successfully generated (since it's formatted in the end){:error, reason}
- If the file fails to be generated (reason
here could be format failure or http response body/reason)
Example
iex> AutoDocPackage.Requests.gen_api_spex(:params)
{:ok, "File formatted successfully."}
Generate the example_data.json
file containing the special keys(__documentation_path__
, __controller_path__
)
and the keys corresponding to the API actions which do not yet have Documentation.
Extra Info:
example_data.json
is located under/lib
directory of the project.- the special keys MUST NOT be changed.
- the keys corresponding to the API actions are empty upon creation
{}
but they should be filled by you(the user) with their respective HTTP Request/Response payload data. - The data stored inside the
example_data.json
file is used for generating the API Docs files by thegen_api_spex
function.
Parameters
documentation_path
- The relative path to the documentation folder.controller_path
- The relative path to the controller file.
Returns
{:ok, "File formatted successfully."}
- If the file is successfully generated (since it's formatted in the end){:error, reason}
- If the file fails to be generated (reason
here could be format failure or http response body/reason)
Example
iex> documentation_path = "auto_doc/lib/auto_doc_web/documentation"
iex> controller_path = "lib/auto_doc_web/controllers/page_controller.ex"
iex> AutoDocPackage.Requests.gen_example_data_file(documentation_path, controller_path)
{:ok, "File formatted successfully."}