The TM Forum Open API mocker.
139
The TM Forum Open API mocker is crafted to enhance your testing and development journey by seamlessly simulating interactions. This tool boosts efficiency and precision in your projects, elevating your overall experience.
json-serverhttphttpspathfs_ as (lodash)router and sets up middleware for static file serving and request parsing.HTTP and HTTPS servers, listening on ports 9000 and 8000 respectively.port numbers. - function is designed to handle incoming
HTTP requests within application. Let's break down the functionality of this module:
req) to determine the version, API name, and ID.fields, limit, or neither.fields are included, it filters the response by specific fields using a helper function filterByFields.limit is included, it returns the response as is.fields nor limit is present, it filters the response by query parameters using another helper function filterByQueryParam.404 error.api and ID is list, it returns a list of API names from the database.404 error.req.query)."%20" with actual spaces.true and false to boolean values.400 error if not.db) based on the query parameter object and value.200 status code with the filtered data.500 error.204 status code indicating no content.req).apiName parameter is an array.400 error if not.apiName is empty or not provided, returning a 404 error.apiName array and filters the fields based on the constructed map.204 status code indicating no content.req), such as protocol, hostname, port, version, and apiName.reqBody) by adding a unique ID generated by the Faker library and constructing an API endpoint (href).v4 and v5) by modifying the request body accordingly.newData) to be written to the file.201 status code along with the modified request body if successful.
If any error occurs during file operations, it logs the error and returns a 404 status code along with the error message.204 status indicating no content has been modified.201 status along with the updated entry.404 status along with an error message indicating that the provided ID couldn't be found.204 status along with a success message indicating that the entry has been deleted.404 error indicating that no entry was found for the given ID.404 error along with a message indicating that the provided ID couldn't be found in the specified API.204 status indicating no content has been modified.
It constructs the updated entry by merging the existing entry with the updated data.200 status along with the updated entry.500 error indicating an internal server error.Ajv (JSON schema validator), fs (file system), path, and chokidar (file watcher).OptionsTypeEnum to represent different types of options.getFileData to read and parse JSON data from files.db.validate and the variable to check is all, it returns all APIs available.validate and a specific variable to check is provided, it returns the data corresponding to that variable.validate and a specific variable to check is provided, it validates the request body against the schema retrieved from the database.
validate but no specific variable to check is provided, or if the variable to check is not found, it returns a 404 error indicating an invalid variable. Please refrain from making any changes to this file.
Adjustments to the JSON file should adhere to the schema provided in the following example.
POST, PUT, PATCH or DELETE requests, changes will be automatically and safely saved using lowdb.GET output.{
"id": "db1d2ae3-5496-4040-8be9-6e3d4012ba0a",
"href": "http://localhost:9000/tmf-api/v4/getAPI/db1d2ae3-5496-4040-8be9-6e3d4012ba0a"
}
PUT or PATCH request will be ignored. Only a value set in a POST, PUT or PATCH request should include a Content-Type: application/json header to use the 2XX status code, but without changes being made to the data. Adjustments to the JSON file should adhere to the schema provided in the following example.
RESTful API structure.{
"/tmf-api/v4/*":"/$1",
"/tmf-api/v5/*":"/$1"
}
Please refrain from making any changes to this file.
Please refrain from making any changes to this file.
TM Forum Open API is licensed under MIT.
This is a self-developed project. There is no official tmforum support for this project.
Content type
Image
Digest
sha256:97d59f801…
Size
61.7 MB
Last updated
about 2 years ago
docker pull guna3006/tmfm:5.0.0