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

geo-engine / geoengine / 21632674478

03 Feb 2026 01:45PM UTC coverage: 88.884%. First build
21632674478

Pull #1116

github

web-flow
Merge 1b9d7208f into 0a5e73d64
Pull Request #1116: feat: Operators in OpenAPI

203 of 312 new or added lines in 4 files covered. (65.06%)

106766 of 120118 relevant lines covered (88.88%)

83951.9 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(Box<dyn 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
impl TryFrom<RasterOperator> for Box<dyn OperatorsRasterOperator> {
49
    type Error = anyhow::Error;
50
    fn try_from(operator: RasterOperator) -> Result<Self, Self::Error> {
1✔
51
        match operator {
1✔
52
            RasterOperator::GdalSource(gdal_source) => {
1✔
53
                OperatorsGdalSource::try_from(gdal_source).map(OperatorsRasterOperator::boxed)
1✔
54
            }
55
        }
56
    }
1✔
57
}
58

59
impl TryFrom<VectorOperator> for Box<dyn OperatorsVectorOperator> {
60
    type Error = anyhow::Error;
61
    fn try_from(operator: VectorOperator) -> Result<Self, Self::Error> {
1✔
62
        match operator {
1✔
63
            VectorOperator::MockPointSource(mock_point_source) => {
1✔
64
                OperatorsMockPointSource::try_from(mock_point_source)
1✔
65
                    .map(OperatorsVectorOperator::boxed)
1✔
66
            }
NEW
67
            VectorOperator::RasterVectorJoin(_rvj) => Err(anyhow::anyhow!(
×
NEW
68
                "conversion of RasterVectorJoin to runtime operator is not supported here"
×
NEW
69
            )),
×
70
        }
71
    }
1✔
72
}
73

74
impl TryFrom<TypedOperator> for OperatorsTypedOperator {
75
    type Error = anyhow::Error;
76
    fn try_from(operator: TypedOperator) -> Result<Self, Self::Error> {
2✔
77
        match operator {
2✔
78
            TypedOperator::Raster(raster_operator) => Ok(Self::Raster(raster_operator.try_into()?)),
1✔
79
            TypedOperator::Vector(vector_operator) => Ok(Self::Vector(vector_operator.try_into()?)),
1✔
80
        }
81
    }
2✔
82
}
83

84
#[derive(OpenApi)]
85
#[openapi(components(schemas(
86
    Expression,
87
    ExpressionParameters,
88
    GdalSource,
89
    GdalSourceParameters,
90
    MockPointSource,
91
    MockPointSourceParameters,
92
    RasterVectorJoin,
93
    RasterVectorJoinParameters,
94
    RasterOperator,
95
    TypedOperator,
96
    VectorOperator,
97
)))]
98
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