I'm working on the implementation of the TMF 629 Customer API and I am struggling to understand how should the code generator use the
official swagger.json file.
Currently based on that swagger.json the two methods that implement Filtered Search (listCustomer and retrieveCustomer) include only the parameters described in the swagger.json, this code is autogenerated from the OpenAPI code generator:
listCustomer(String fields, Integer offset, Integer limit) - defined in swagger.json as:
"paths" : {
"/customer" : {
"get" : {
"tags" : [ "customer" ],
"summary" : "List or find Customer objects",
"description" : "This operation list or find Customer entities",
"operationId" : "listCustomer",
"parameters" : [ {
"name" : "fields",
"in" : "query",
"description" : "Comma-separated properties to be provided in response",
"required" : false,
"type" : "string"
}, {
"name" : "offset",
"in" : "query",
"description" : "Requested index for start of resources to be provided in response",
"required" : false,
"type" : "integer"
}, {
"name" : "limit",
"in" : "query",
"description" : "Requested number of resources to be provided in response",
"required" : false,
"type" : "integer"
} ],
retrieveCustomer(String id, String fields) - defined in swagger.json as:
"/customer/{id}" : {
"get" : {
"tags" : [ "customer" ],
"summary" : "Retrieves a Customer by ID",
"description" : "This operation retrieves a Customer entity. Attribute selection is enabled for all first level attributes.",
"operationId" : "retrieveCustomer",
"parameters" : [ {
"name" : "id",
"in" : "path",
"description" : "Identifier of the Customer",
"required" : true,
"type" : "string"
}, {
"name" : "fields",
"in" : "query",
"description" : "Comma-separated properties to provide in response",
"required" : false,
"type" : "string"
} ],
The code generator uses the swagger.json to create the methods signature, and their signatures seem correct.
The documentation (and the conformance tests CTK) request the implementation of the Filtered Search functionality so that any field of the customer can be used to search for a specific customer, ex:
{{Customer}}customer?name=mike <-- Searches for customers with 'name' field equals to 'mike'.
Documented as:
"Filtered Search: : A filtered search can be applied using query parameters in order to obtain only the resource entities that meet the criteria defined by the filtering parameters included in the query request. Several elements can be applied to the filtered search. In that case logic, a logical AND is applied to combine the criteria (e.g.:?category=<value> &state=<value>)"
In the documentation is not clear if this Filtered Search is mandatory or optional (I assume is mandatory since is part of the CTK):
"Filtering may be available depending on the compliance level supported by an implementation"Could somebody clarify if the Filtered Search is mandatory? In case of being mandatory it would be useful to know how can this be implemented using the swagger.json and the code generator.
Thanks for the help!
------------------------------
Eduardo Sanchez
MATRIXX Software
------------------------------