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

geo-engine / geoengine / 22768045047

06 Mar 2026 02:37PM UTC coverage: 88.134%. First build
22768045047

Pull #1116

github

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

258 of 373 new or added lines in 4 files covered. (69.17%)

112637 of 127802 relevant lines covered (88.13%)

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

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

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

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

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

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

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

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