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

geo-engine / geoengine / 21674365160

04 Feb 2026 02:00PM UTC coverage: 88.437%. First build
21674365160

Pull #1116

github

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

227 of 335 new or added lines in 4 files covered. (67.76%)

116239 of 131437 relevant lines covered (88.44%)

493955.02 hits per line

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

84.21
/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
    source::GdalSource as OperatorsGdalSource,
14
};
15
use serde::{Deserialize, Serialize};
16
use utoipa::{OpenApi, ToSchema};
17

18
mod processing;
19
mod source;
20

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

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

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

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

56
impl TryFrom<RasterOperator> for Box<dyn OperatorsRasterOperator> {
57
    type Error = anyhow::Error;
58
    fn try_from(operator: RasterOperator) -> Result<Self, Self::Error> {
1✔
59
        match operator {
1✔
60
            RasterOperator::GdalSource(gdal_source) => {
1✔
61
                OperatorsGdalSource::try_from(gdal_source).map(OperatorsRasterOperator::boxed)
1✔
62
            }
63
        }
64
    }
1✔
65
}
66

67
impl TryFrom<VectorOperator> for Box<dyn OperatorsVectorOperator> {
68
    type Error = anyhow::Error;
69
    fn try_from(operator: VectorOperator) -> Result<Self, Self::Error> {
1✔
70
        match operator {
1✔
71
            VectorOperator::MockPointSource(mock_point_source) => {
1✔
72
                OperatorsMockPointSource::try_from(mock_point_source)
1✔
73
                    .map(OperatorsVectorOperator::boxed)
1✔
74
            }
NEW
75
            VectorOperator::RasterVectorJoin(_rvj) => Err(anyhow::anyhow!(
×
NEW
76
                "conversion of RasterVectorJoin to runtime operator is not supported here"
×
NEW
77
            )),
×
78
        }
79
    }
1✔
80
}
81

82
impl TryFrom<TypedOperator> for OperatorsTypedOperator {
83
    type Error = anyhow::Error;
84
    fn try_from(operator: TypedOperator) -> Result<Self, Self::Error> {
2✔
85
        match operator {
2✔
86
            TypedOperator::Raster(raster_operator) => Ok(Self::Raster(raster_operator.try_into()?)),
1✔
87
            TypedOperator::Vector(vector_operator) => Ok(Self::Vector(vector_operator.try_into()?)),
1✔
88
        }
89
    }
2✔
90
}
91

92
#[derive(OpenApi)]
93
#[openapi(components(schemas(
94
    Expression,
95
    ExpressionParameters,
96
    GdalSource,
97
    GdalSourceParameters,
98
    MockPointSource,
99
    MockPointSourceParameters,
100
    RasterOperator,
101
    RasterVectorJoin,
102
    RasterVectorJoinParameters,
103
    TypedOperator,
104
    VectorOperator,
105
    PlotOperator,
106
)))]
107
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