19
19
from typing import Any , Dict , ForwardRef , List , Optional , Union , cast
20
20
21
21
import pydantic
22
+ import typing_extensions
22
23
23
24
24
25
class Metadata (pydantic .BaseModel ):
@@ -39,7 +40,7 @@ class JobControlOptions(enum.Enum):
39
40
40
41
41
42
class TransmissionMode (enum .Enum ):
42
- value : str = "value" # type:ignore
43
+ value : str = "value"
43
44
reference : str = "reference"
44
45
45
46
@@ -50,26 +51,36 @@ class PaginationQueryParameters(pydantic.BaseModel):
50
51
51
52
class Link (pydantic .BaseModel ):
52
53
href : str
53
- rel : Optional [str ] = pydantic .Field (None , example = "service" )
54
- type : Optional [str ] = pydantic .Field (None , example = "application/json" )
55
- hreflang : Optional [str ] = pydantic .Field (None , example = "en" )
54
+ rel : Optional [str ] = pydantic .Field (
55
+ default = None , json_schema_extra = {"example" : "service" }
56
+ )
57
+ type : Optional [str ] = pydantic .Field (
58
+ default = None , json_schema_extra = {"example" : "application/json" }
59
+ )
60
+ hreflang : Optional [str ] = pydantic .Field (
61
+ default = None , json_schema_extra = {"example" : "en" }
62
+ )
56
63
title : Optional [str ] = None
57
64
58
65
59
66
class LandingPage (pydantic .BaseModel ):
60
67
title : Optional [str ] = pydantic .Field (
61
- default = None , example = " Example processing server"
68
+ default = None , json_schema_extra = { "example" : " Example processing server"}
62
69
)
63
70
description : Optional [str ] = pydantic .Field (
64
71
default = None ,
65
- example = "Example server implementing the OGC API - Processes 1.0 Standard" ,
72
+ json_schema_extra = {
73
+ "example" : "Example server implementing the OGC API - Processes 1.0 Standard"
74
+ },
66
75
)
67
76
links : List [Link ]
68
77
69
78
70
79
class ConfClass (pydantic .BaseModel ):
71
80
conformsTo : List [str ] = pydantic .Field (
72
- example = "http://www.opengis.net/spec/ogcapi-processes-1/1.0/conf/core"
81
+ json_schema_extra = {
82
+ "example" : "http://www.opengis.net/spec/ogcapi-processes-1/1.0/conf/core"
83
+ }
73
84
)
74
85
75
86
@@ -94,11 +105,8 @@ class ProcessSummary(DescriptionType):
94
105
95
106
96
107
class ProcessList (pydantic .BaseModel ):
97
- class Config :
98
- underscore_attrs_are_private = True
99
-
100
108
processes : List [ProcessSummary ]
101
- links : Optional [ List [Link ]] = None
109
+ links : List [Link ]
102
110
_pagination_query_params : Optional [PaginationQueryParameters ] = None
103
111
104
112
@@ -116,22 +124,18 @@ class ObjectType(enum.Enum):
116
124
117
125
118
126
class Reference (pydantic .BaseModel ):
119
- class Config :
120
- extra = pydantic .Extra .forbid
121
-
122
- _ref : str = pydantic .Field (..., alias = "$ref" )
127
+ model_config = pydantic .ConfigDict (extra = "forbid" )
128
+ ref : str
123
129
124
130
125
- class PositiveInt (pydantic .ConstrainedInt ):
126
- ge = 0
131
+ PositiveInt = typing_extensions .Annotated [int , pydantic .Field (ge = 0 )]
127
132
128
133
129
134
SchemaItem = ForwardRef ("SchemaItem" )
130
135
131
136
132
137
class SchemaItem (pydantic .BaseModel ): # type: ignore
133
- class Config :
134
- extra = pydantic .Extra .forbid
138
+ model_config = pydantic .ConfigDict (extra = "forbid" )
135
139
136
140
title : Optional [str ] = None
137
141
multipleOf : Optional [pydantic .PositiveFloat ] = None
@@ -147,8 +151,8 @@ class Config:
147
151
uniqueItems : Optional [bool ] = False
148
152
maxProperties : Optional [PositiveInt ] = None
149
153
minProperties : Optional [PositiveInt ] = cast (PositiveInt , 0 )
150
- required : Optional [List [str ]] = pydantic .Field (None , min_items = 1 )
151
- enum : Optional [List [Any ]] = pydantic .Field (None , min_items = 1 )
154
+ required : Optional [List [str ]] = pydantic .Field (default = None , min_length = 1 )
155
+ enum : Optional [List [Any ]] = pydantic .Field (default = None , min_length = 1 )
152
156
type : Optional [ObjectType ] = None
153
157
description : Optional [str ] = None
154
158
format : Optional [str ] = None
@@ -165,27 +169,24 @@ class Config:
165
169
properties : Optional [Dict [str , Union [Reference , SchemaItem ]]] = None # type: ignore
166
170
167
171
168
- SchemaItem .update_forward_refs () # type: ignore
172
+ SchemaItem .model_rebuild () # type: ignore
169
173
170
174
171
175
class InputDescription (DescriptionType ):
172
- class Config :
173
- allow_population_by_field_name = True
176
+ model_config = pydantic .ConfigDict (populate_by_name = True )
174
177
175
178
minOccurs : Optional [int ] = 1
176
179
maxOccurs : Optional [Union [int , MaxOccur ]] = None
177
180
schema_ : Union [Reference , SchemaItem ] = pydantic .Field (..., alias = "schema" ) # type: ignore
178
181
179
182
180
183
class OutputDescription (DescriptionType ):
181
- class Config :
182
- allow_population_by_field_name = True
184
+ model_config = pydantic .ConfigDict (populate_by_name = True )
183
185
184
186
schema_ : Union [Reference , SchemaItem ] = pydantic .Field (..., alias = "schema" ) # type: ignore
185
187
186
188
187
- class BinaryInputValue (pydantic .BaseModel ):
188
- __root__ : str
189
+ BinaryInputValue = pydantic .RootModel [str ]
189
190
190
191
191
192
class Crs (enum .Enum ):
@@ -202,26 +203,29 @@ class Bbox(pydantic.BaseModel):
202
203
crs : Optional [Crs ] = Crs .http___www_opengis_net_def_crs_OGC_1_3_CRS84
203
204
204
205
205
- class InputValueNoObject (pydantic .BaseModel ):
206
- __root__ : Union [str , float , int , bool , List [Any ], BinaryInputValue , Bbox ]
206
+ InputValueNoObject = pydantic .RootModel [
207
+ Union [str , float , int , bool , List [Any ], BinaryInputValue , Bbox ]
208
+ ]
207
209
208
210
209
211
class Format (pydantic .BaseModel ):
210
212
mediaType : Optional [str ] = None
211
213
encoding : Optional [str ] = None
212
- schema_ : Optional [Union [str , Dict [str , Any ]]] = pydantic .Field (None , alias = "schema" )
214
+ schema_ : Optional [Union [str , Dict [str , Any ]]] = pydantic .Field (
215
+ default = None , alias = "schema"
216
+ )
213
217
214
218
215
- class InputValue (pydantic .BaseModel ):
216
- __root__ : Union [Dict [str , Any ], InputValueNoObject ]
219
+ InputValue = pydantic .RootModel [Union [Dict [str , Any ], InputValueNoObject ]]
217
220
218
221
219
222
class QualifiedInputValue (Format ):
220
223
value : InputValue
221
224
222
225
223
- class InlineOrRefData (pydantic .BaseModel ):
224
- __root__ : Union [InputValueNoObject , QualifiedInputValue , Link ]
226
+ InlineOrRefData = pydantic .RootModel [
227
+ Union [InputValueNoObject , QualifiedInputValue , Link ]
228
+ ]
225
229
226
230
227
231
class Output (pydantic .BaseModel ):
@@ -252,9 +256,7 @@ class ProcessDescription(ProcessSummary):
252
256
outputs : Optional [Dict [str , OutputDescription ]] = None
253
257
254
258
255
- class ConInt (pydantic .ConstrainedInt ):
256
- ge = 0
257
- le = 100
259
+ ConInt = typing_extensions .Annotated [int , pydantic .Field (ge = 0 , le = 100 )]
258
260
259
261
260
262
class StatusCode (str , enum .Enum ):
@@ -270,8 +272,7 @@ class JobType(enum.Enum):
270
272
271
273
272
274
class StatusInfo (pydantic .BaseModel ):
273
- class Config :
274
- extra = pydantic .Extra .allow
275
+ model_config = pydantic .ConfigDict (extra = "allow" )
275
276
276
277
processID : Optional [str ] = None
277
278
type : JobType
@@ -287,21 +288,17 @@ class Config:
287
288
288
289
289
290
class JobList (pydantic .BaseModel ):
290
- class Config :
291
- underscore_attrs_are_private = True
292
-
293
291
jobs : List [StatusInfo ]
294
292
links : Optional [List [Link ]] = None
295
293
_pagination_query_params : Optional [PaginationQueryParameters ] = None
296
294
297
295
298
- class Results (pydantic .BaseModel ):
299
- __root__ : Optional [Dict [str , InlineOrRefData ]] = None
296
+ class Results (pydantic .RootModel [ Optional [ Dict [ str , InlineOrRefData ]]] ):
297
+ root : Optional [Dict [str , InlineOrRefData ]] = None
300
298
301
299
302
300
class Exception (pydantic .BaseModel ):
303
- class Config :
304
- extra = pydantic .Extra .allow
301
+ model_config = pydantic .ConfigDict (extra = "allow" )
305
302
306
303
type : str
307
304
title : Optional [str ] = None
0 commit comments