| 693 | } |
| 694 | |
| 695 | std::optional<std::string> DataProcessorService::transformRecipeJson(std::string_view namespaced_key) const { |
| 696 | const auto it = transform_recipes_.find(std::string(namespaced_key)); |
| 697 | if (it == transform_recipes_.end()) { |
| 698 | return std::nullopt; |
| 699 | } |
| 700 | const TransformRecipe& recipe = it->second; |
| 701 | nlohmann::json doc; |
| 702 | doc["inputs"] = recipe.inputs; |
| 703 | doc["outputs"] = recipe.outputs; |
| 704 | doc["backend"] = recipe.backend; |
| 705 | // params is structured; embed it as an object (fall back to {} on malformed input). |
| 706 | nlohmann::json params = nlohmann::json::parse(recipe.params_json, nullptr, /*allow_exceptions=*/false); |
| 707 | doc["params"] = params.is_discarded() ? nlohmann::json::object() : params; |
| 708 | return doc.dump(); |
| 709 | } |
| 710 | |
| 711 | std::vector<DataProcessorService::TransformRecipe> DataProcessorService::transformRecipes() const { |
| 712 | std::vector<TransformRecipe> out; |