@@ -4,6 +4,17 @@ use crate::util::{bool_option_case_insensitive, from_str};
44use serde:: { Deserialize , Serialize } ;
55use utoipa:: { IntoParams , ToSchema } ;
66
7+ #[ derive( Debug , Clone , Deserialize , ToSchema ) ]
8+ #[ serde( rename_all = "PascalCase" ) ]
9+ #[ allow( clippy:: enum_variant_names) ]
10+ pub enum WmsRequest {
11+ GetCapabilities ,
12+ GetMap ,
13+ GetFeatureInfo ,
14+ GetStyles ,
15+ GetLegendGraphic ,
16+ }
17+
718#[ derive( PartialEq , Eq , Debug , Deserialize , Serialize , ToSchema ) ]
819pub enum WmsService {
920 #[ serde( rename = "WMS" ) ]
@@ -23,13 +34,15 @@ pub struct GetCapabilities {
2334 #[ serde( alias = "SERVICE" ) ]
2435 pub service : WmsService ,
2536 #[ serde( alias = "FORMAT" ) ]
26- pub format : Option < GetCapabilitiesFormat > ,
37+ pub format : Option < WmsResponseFormat > ,
2738}
2839
2940#[ derive( PartialEq , Eq , Debug , Deserialize , Serialize , ToSchema ) ]
30- pub enum GetCapabilitiesFormat {
41+ pub enum WmsResponseFormat {
3142 #[ serde( rename = "text/xml" ) ]
32- TextXml , // TODO: remaining formats
43+ TextXml ,
44+ #[ serde( rename = "image/png" ) ]
45+ ImagePng , // TODO: remaining formats
3346}
3447
3548// TODO: remove serde aliases and use serde-aux and case insensitive keys
@@ -52,7 +65,7 @@ pub struct GetMap {
5265 #[ param( example = "-90,-180,90,180" ) ]
5366 pub bbox : OgcBoundingBox ,
5467 #[ serde( alias = "FORMAT" ) ]
55- pub format : GetMapFormat ,
68+ pub format : WmsResponseFormat ,
5669 #[ serde( alias = "LAYERS" ) ]
5770 #[ param( example = "<Workflow Id>" ) ]
5871 pub layers : String ,
@@ -94,12 +107,6 @@ pub enum GetMapExceptionFormat {
94107 Json , // UNSUPPORTED: INIMAGE, BLANK
95108}
96109
97- #[ derive( PartialEq , Eq , Debug , Deserialize , Serialize , ToSchema ) ]
98- pub enum GetMapFormat {
99- #[ serde( rename = "image/png" ) ]
100- ImagePng , // TODO: remaining formats
101- }
102-
103110#[ derive( PartialEq , Eq , Debug , Deserialize , Serialize , IntoParams ) ]
104111pub struct GetFeatureInfo {
105112 pub version : String ,
@@ -161,7 +168,7 @@ mod tests {
161168 elevation : Some ( "elevation" . into ( ) ) ,
162169 bbox : OgcBoundingBox :: new ( 1. , 2. , 3. , 4. ) ,
163170 height : 2 ,
164- format : GetMapFormat :: ImagePng ,
171+ format : WmsResponseFormat :: ImagePng ,
165172 exceptions : Some ( GetMapExceptionFormat :: Json ) ,
166173 } ;
167174
@@ -188,7 +195,7 @@ mod tests {
188195 elevation : None ,
189196 bbox : OgcBoundingBox :: new ( 1. , 2. , 3. , 4. ) ,
190197 height : 2 ,
191- format : GetMapFormat :: ImagePng ,
198+ format : WmsResponseFormat :: ImagePng ,
192199 exceptions : None ,
193200 } ;
194201
0 commit comments