ApiDocRequest apiDocRequest = new ApiDocRequest();
ApiDocAttribute reqServiceId = new ApiDocAttribute();
reqServiceId.setFieldName(ServiceConfigurationAPI.API_SERVICE_ID);
reqServiceId.addFieldValues(new ApiDocFieldValue("[identifier]",
"A valid service identifier."));
reqServiceId.setExample("123");
apiDocRequest.addAttribute(reqServiceId);
ApiDocAttribute reqServiceName = new ApiDocAttribute();
reqServiceName
.setFieldName(ServiceConfigurationAPI.API_SERVICE_NAME);
reqServiceName.addFieldValues(new ApiDocFieldValue("[string]",
"A valid service name."));
reqServiceName.setExample("My Service Name");
apiDocRequest.addAttribute(reqServiceName);
// SCHEMA
ApiDocAttribute reqServiceSchema = new ApiDocAttribute();
reqServiceSchema
.setFieldName(ServiceConfigurationAPI.API_SERVICE_SCHEMA);
reqServiceSchema.addFieldValues(new ApiDocFieldValue("[string]",
"A valid JSON Schema definition."));
reqServiceSchema
.setExample("{\"type\":\"object\",\"$schema\": \"http://json-schema.org/draft-03/schema\",\"id\": \"#\",\"required\":false,\"properties\":{ \"address\": { \"type\":\"object\", \"id\": \"address\", \"required\":false, \"properties\":{ \"streetAddress\": { \"type\":\"string\", \"id\": \"streetAddress\", \"required\":false } } } }}");
apiDocRequest.addAttribute(reqServiceSchema);
ApiDocAttribute reqServiceSchemaEnableFlag = new ApiDocAttribute();
reqServiceSchemaEnableFlag
.setFieldName(ServiceConfigurationAPI.API_SERVICE_SCHEMA_ENABLE_FLAG);
reqServiceSchemaEnableFlag
.addFieldValues(new ApiDocFieldValue(
"[boolean]",
"Set to true for the service to validate each Service Scenario JSON response with the provided JSON Schema."));
reqServiceSchemaEnableFlag.setExample("true");
apiDocRequest.addAttribute(reqServiceSchemaEnableFlag);
// REQUEST INSPECTOR RULES
ApiDocAttribute reqInspectorRules = new ApiDocAttribute();
reqInspectorRules
.setFieldName(ServiceConfigurationAPI.API_SERVICE_REQUEST_INSPECTOR_RULES);
reqInspectorRules.addFieldValues(new ApiDocFieldValue("[string]",
"Request evaluation rules in JSON. "));
reqInspectorRules.setExample("");
apiDocRequest.addAttribute(reqInspectorRules);
ApiDocAttribute reqInspectorRulesEnableFlag = new ApiDocAttribute();
reqInspectorRulesEnableFlag
.setFieldName(ServiceConfigurationAPI.API_SERVICE_REQUEST_INSPECTOR_RULES_ENABLE_FLAG);
reqInspectorRulesEnableFlag
.addFieldValues(new ApiDocFieldValue(
"[boolean]",
"Set to true for the service to validate each incoming request to ensure the appropriate parameters are being passed."));
reqInspectorRulesEnableFlag.setExample("true");
apiDocRequest.addAttribute(reqInspectorRulesEnableFlag);
ApiDocAttribute reqScenarioId = new ApiDocAttribute();
reqScenarioId
.setFieldName(ServiceConfigurationAPI.API_SERVICE_SCENARIO_ID);
reqScenarioId.addFieldValues(new ApiDocFieldValue("[identifier]",
"A valid service scenario identifier."));
reqScenarioId.setExample("123");
apiDocRequest.addAttribute(reqScenarioId);
ApiDocAttribute reqScenarioName = new ApiDocAttribute();
reqScenarioName
.setFieldName(ServiceConfigurationAPI.API_SERVICE_NAME);
reqScenarioName.addFieldValues(new ApiDocFieldValue("[string]",
"A valid service scenario name."));
reqScenarioName.setExample("My Service Scenario Name");
apiDocRequest.addAttribute(reqScenarioName);
ApiDocAttribute reqHangtime = new ApiDocAttribute();
reqHangtime
.setFieldName(ServiceConfigurationAPI.API_SERVICE_HANGTIME);
reqHangtime.addFieldValues(new ApiDocFieldValue("[int]",
"Hang time in milliseconds."));
reqHangtime.setExample("500");
apiDocRequest.addAttribute(reqHangtime);
ApiDocAttribute transientSet = new ApiDocAttribute();
transientSet
.setFieldName(ServiceConfigurationAPI.API_TRANSIENT_STATE);
transientSet
.addFieldValues(new ApiDocFieldValue(
"[boolean]",
"If available and set to 'true', then all settings in this call will be in-memory only, not persisted to the file system. Otherwise, state settings will be written to the file system."));
transientSet.setExample("true");
apiDocRequest.addAttribute(transientSet);
ApiDocAttribute reqAttributeAction = new ApiDocAttribute();
reqAttributeAction
.setFieldName(ServiceConfigurationAPI.API_SERVICE_RESPONSE_TYPE);
reqAttributeAction
.addFieldValues(new ApiDocFieldValue(
ServiceConfigurationAPI.API_SERVICE_RESPONSE_TYPE_VALUE_DYNAMIC,
"Sets service to respond as dynamic."));
reqAttributeAction
.addFieldValues(new ApiDocFieldValue(
ServiceConfigurationAPI.API_SERVICE_RESPONSE_TYPE_VALUE_PROXY,
"Sets service to act as a proxy."));
reqAttributeAction
.addFieldValues(new ApiDocFieldValue(
ServiceConfigurationAPI.API_SERVICE_RESPONSE_TYPE_VALUE_STATIC,
"Sets service to respond with a static response"));
apiDocRequest.addAttribute(reqAttributeAction);
apiDocService.setApiRequest(apiDocRequest);