use of org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.OpenAPIDefinitionValidationResponseInfoDTO in project carbon-apimgt by wso2.
the class APIMappingUtil method getOpenAPIDefinitionValidationResponseFromModel.
public static OpenAPIDefinitionValidationResponseDTO getOpenAPIDefinitionValidationResponseFromModel(APIDefinitionValidationResponse model, boolean returnContent) {
OpenAPIDefinitionValidationResponseDTO responseDTO = new OpenAPIDefinitionValidationResponseDTO();
responseDTO.setIsValid(model.isValid());
if (model.isValid()) {
APIDefinitionValidationResponse.Info modelInfo = model.getInfo();
if (modelInfo != null) {
OpenAPIDefinitionValidationResponseInfoDTO infoDTO = new OpenAPIDefinitionValidationResponseInfoDTO();
infoDTO.setOpenAPIVersion(modelInfo.getOpenAPIVersion());
infoDTO.setName(modelInfo.getName());
infoDTO.setVersion(modelInfo.getVersion());
infoDTO.setContext(modelInfo.getContext());
infoDTO.setDescription(modelInfo.getDescription());
infoDTO.setEndpoints(modelInfo.getEndpoints());
responseDTO.setInfo(infoDTO);
}
if (returnContent) {
responseDTO.setContent(model.getContent());
}
} else {
responseDTO.setErrors(getErrorListItemsDTOsFromErrorHandlers(model.getErrorItems()));
}
return responseDTO;
}
Aggregations