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

geo-engine / geoengine / 21708644652

05 Feb 2026 10:51AM UTC coverage: 88.327%. First build
21708644652

Pull #1116

github

web-flow
Merge 9d1255a7a into 078c12706
Pull Request #1116: feat: Operators in OpenAPI

270 of 385 new or added lines in 4 files covered. (70.13%)

116139 of 131487 relevant lines covered (88.33%)

493767.15 hits per line

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

80.0
/api/src/processes/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::processes::{
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 processing;
22
mod source;
23

24
/// Operator outputs are distinguished by their data type.
25
/// There are `raster`, `vector` and `plot` operators.
26
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, ToSchema)]
27
#[serde(tag = "type", content = "operator")]
28
pub enum TypedOperator {
29
    Vector(VectorOperator),
30
    Raster(RasterOperator),
31
    Plot(PlotOperator),
32
}
33

34
/// An operator that produces raster data.
35
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, ToSchema)]
36
#[serde(rename_all = "camelCase", untagged)]
37
#[schema(discriminator = "type")]
38
pub enum RasterOperator {
39
    Expression(Expression),
40
    GdalSource(GdalSource),
41
}
42

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

52
/// An operator that produces plot data.
53
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, ToSchema)]
54
#[serde(rename_all = "camelCase", untagged)]
55
// #[schema(discriminator = "type")]
56
pub enum PlotOperator {
57
    // Currently no plot operators are defined
58
}
59

60
impl TryFrom<RasterOperator> for Box<dyn OperatorsRasterOperator> {
61
    type Error = anyhow::Error;
62
    fn try_from(operator: RasterOperator) -> Result<Self, Self::Error> {
3✔
63
        match operator {
3✔
NEW
64
            RasterOperator::Expression(expression) => {
×
NEW
65
                OperatorsExpression::try_from(expression).map(OperatorsRasterOperator::boxed)
×
66
            }
67
            RasterOperator::GdalSource(gdal_source) => {
3✔
68
                OperatorsGdalSource::try_from(gdal_source).map(OperatorsRasterOperator::boxed)
3✔
69
            }
70
        }
71
    }
3✔
72
}
73

74
impl TryFrom<VectorOperator> for Box<dyn OperatorsVectorOperator> {
75
    type Error = anyhow::Error;
76
    fn try_from(operator: VectorOperator) -> Result<Self, Self::Error> {
2✔
77
        match operator {
2✔
78
            VectorOperator::MockPointSource(mock_point_source) => {
2✔
79
                OperatorsMockPointSource::try_from(mock_point_source)
2✔
80
                    .map(OperatorsVectorOperator::boxed)
2✔
81
            }
NEW
82
            VectorOperator::RasterVectorJoin(rvj) => {
×
NEW
83
                OperatorsRasterVectorJoin::try_from(rvj).map(OperatorsVectorOperator::boxed)
×
84
            }
85
        }
86
    }
2✔
87
}
88

89
impl TryFrom<TypedOperator> for OperatorsTypedOperator {
90
    type Error = anyhow::Error;
91
    fn try_from(operator: TypedOperator) -> Result<Self, Self::Error> {
2✔
92
        match operator {
2✔
93
            TypedOperator::Raster(raster_operator) => Ok(Self::Raster(raster_operator.try_into()?)),
1✔
94
            TypedOperator::Vector(vector_operator) => Ok(Self::Vector(vector_operator.try_into()?)),
1✔
95
        }
96
    }
2✔
97
}
98

99
#[derive(OpenApi)]
100
#[openapi(components(schemas(
101
    Expression,
102
    ExpressionParameters,
103
    GdalSource,
104
    GdalSourceParameters,
105
    MockPointSource,
106
    MockPointSourceParameters,
107
    RasterOperator,
108
    RasterVectorJoin,
109
    RasterVectorJoinParameters,
110
    TypedOperator,
111
    VectorOperator,
112
    PlotOperator,
113
)))]
114
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