• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

geo-engine / geoengine / 22862568816

09 Mar 2026 04:05PM UTC coverage: 88.245%. First build
22862568816

Pull #1116

github

web-flow
Merge 002d2c647 into 6d70b3157
Pull Request #1116: feat: Operators in OpenAPI

429 of 561 new or added lines in 25 files covered. (76.47%)

112866 of 127901 relevant lines covered (88.24%)

506361.68 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

80.0
/services/src/api/model/processing_graphs/mod.rs
1
#![allow(clippy::needless_for_each)] // TODO: remove when clippy is fixed for utoipa <https://github.com/juhaku/utoipa/issues/1420>
2

3
// use crate::api::model::processing_graphs::{
4
//     processing::{Expression, ExpressionParameters, RasterVectorJoin, RasterVectorJoinParameters},
5
//     source::{GdalSource, GdalSourceParameters, MockPointSource, MockPointSourceParameters},
6
// };
7
use geoengine_operators::{
8
    engine::{
9
        RasterOperator as OperatorsRasterOperator, TypedOperator as OperatorsTypedOperator,
10
        VectorOperator as OperatorsVectorOperator,
11
    },
12
    mock::MockPointSource as OperatorsMockPointSource,
13
    processing::{
14
        Expression as OperatorsExpression, RasterVectorJoin as OperatorsRasterVectorJoin,
15
    },
16
    source::GdalSource as OperatorsGdalSource,
17
};
18
use serde::{Deserialize, Serialize};
19
use utoipa::{OpenApi, ToSchema};
20

21
mod parameters;
22
mod processing;
23
mod source;
24

25
// TODO: avoid exporting them to outside of API module
26
#[cfg(test)]
27
pub(crate) use crate::api::model::processing_graphs::parameters::SpatialBoundsDerive;
28
pub(crate) use crate::api::model::processing_graphs::{
29
    processing::{Expression, ExpressionParameters, RasterVectorJoin, RasterVectorJoinParameters},
30
    source::{GdalSource, GdalSourceParameters, MockPointSource, MockPointSourceParameters},
31
};
32

33
/// Operator outputs are distinguished by their data type.
34
/// There are `raster`, `vector` and `plot` operators.
35
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, ToSchema)]
36
#[serde(tag = "type", content = "operator")]
37
pub enum TypedOperator {
38
    Vector(VectorOperator),
39
    Raster(RasterOperator),
40
    Plot(PlotOperator),
41
}
42

43
/// An operator that produces raster data.
44
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, ToSchema)]
45
#[serde(rename_all = "camelCase", untagged)]
46
#[schema(discriminator = "type")]
47
pub enum RasterOperator {
48
    Expression(Expression),
49
    GdalSource(GdalSource),
50
}
51

52
/// An operator that produces vector data.
53
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, ToSchema)]
54
#[serde(rename_all = "camelCase", untagged)]
55
#[schema(discriminator = "type")]
56
pub enum VectorOperator {
57
    MockPointSource(MockPointSource),
58
    RasterVectorJoin(RasterVectorJoin),
59
}
60

61
/// An operator that produces plot data.
62
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, ToSchema)]
63
#[serde(rename_all = "camelCase", untagged)]
64
// #[schema(discriminator = "type")]
65
pub enum PlotOperator {
66
    // Currently no plot operators are defined
67
}
68

69
impl TryFrom<RasterOperator> for Box<dyn OperatorsRasterOperator> {
70
    type Error = anyhow::Error;
71
    fn try_from(operator: RasterOperator) -> Result<Self, Self::Error> {
25✔
72
        match operator {
25✔
NEW
73
            RasterOperator::Expression(expression) => {
×
NEW
74
                OperatorsExpression::try_from(expression).map(OperatorsRasterOperator::boxed)
×
75
            }
76
            RasterOperator::GdalSource(gdal_source) => {
25✔
77
                OperatorsGdalSource::try_from(gdal_source).map(OperatorsRasterOperator::boxed)
25✔
78
            }
79
        }
80
    }
25✔
81
}
82

83
impl TryFrom<VectorOperator> for Box<dyn OperatorsVectorOperator> {
84
    type Error = anyhow::Error;
85
    fn try_from(operator: VectorOperator) -> Result<Self, Self::Error> {
4✔
86
        match operator {
4✔
87
            VectorOperator::MockPointSource(mock_point_source) => {
4✔
88
                OperatorsMockPointSource::try_from(mock_point_source)
4✔
89
                    .map(OperatorsVectorOperator::boxed)
4✔
90
            }
NEW
91
            VectorOperator::RasterVectorJoin(rvj) => {
×
NEW
92
                OperatorsRasterVectorJoin::try_from(rvj).map(OperatorsVectorOperator::boxed)
×
93
            }
94
        }
95
    }
4✔
96
}
97

98
impl TryFrom<TypedOperator> for OperatorsTypedOperator {
99
    type Error = anyhow::Error;
100
    fn try_from(operator: TypedOperator) -> Result<Self, Self::Error> {
26✔
101
        match operator {
26✔
102
            TypedOperator::Raster(raster_operator) => Ok(Self::Raster(raster_operator.try_into()?)),
23✔
103
            TypedOperator::Vector(vector_operator) => Ok(Self::Vector(vector_operator.try_into()?)),
3✔
104
        }
105
    }
26✔
106
}
107

108
#[derive(OpenApi)]
109
#[openapi(components(schemas(
110
    Expression,
111
    ExpressionParameters,
112
    GdalSource,
113
    GdalSourceParameters,
114
    MockPointSource,
115
    MockPointSourceParameters,
116
    RasterOperator,
117
    RasterVectorJoin,
118
    RasterVectorJoinParameters,
119
    TypedOperator,
120
    VectorOperator,
121
    PlotOperator,
122
)))]
123
pub struct OperatorsApi;
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc