|
1 | 1 | from datetime import datetime |
2 | 2 | from typing import Optional |
3 | 3 |
|
4 | | -from pydantic import BaseModel |
| 4 | +from pydantic import BaseModel, Field |
5 | 5 |
|
6 | 6 | from app.schemas.enum import ProcessingStatusEnum, ProcessTypeEnum |
7 | 7 |
|
8 | 8 |
|
9 | 9 | class ServiceDetails(BaseModel): |
10 | | - endpoint: str |
11 | | - application: str |
| 10 | + endpoint: str = Field( |
| 11 | + ..., |
| 12 | + description="URL to the endpoint where the service is hosted. For openEO, this is the " |
| 13 | + "openEO backend. For OGC API Processes, this field should include the base URL of the " |
| 14 | + "platform API", |
| 15 | + ) |
| 16 | + application: str = Field( |
| 17 | + ..., |
| 18 | + description="Path to the application that needs to be executed. For openEO this is " |
| 19 | + "referring to the public URL of the UDP (JSON) to execute. For OGC API Processes, this " |
| 20 | + "field should include the URL path pointing to the hosted service.", |
| 21 | + ) |
12 | 22 |
|
13 | 23 |
|
14 | 24 | class ProcessingJobSummary(BaseModel): |
15 | | - id: int |
16 | | - title: str |
17 | | - label: ProcessTypeEnum |
18 | | - status: ProcessingStatusEnum |
| 25 | + id: int = Field(..., description="Unique identifier of the processing job") |
| 26 | + title: str = Field(..., description="Title of the job") |
| 27 | + label: ProcessTypeEnum = Field( |
| 28 | + ..., |
| 29 | + description="Label that is representing the type of the service that will be executed", |
| 30 | + ) |
| 31 | + status: ProcessingStatusEnum = Field( |
| 32 | + ..., description="Current status of the processing job" |
| 33 | + ) |
19 | 34 |
|
20 | 35 |
|
21 | 36 | class ProcessingJobDetails(BaseModel): |
22 | | - service: ServiceDetails |
23 | | - parameters: dict |
24 | | - result_link: Optional[str] |
25 | | - created: datetime |
26 | | - updated: datetime |
| 37 | + service: ServiceDetails = Field( |
| 38 | + ..., description="Details of the service to be executed" |
| 39 | + ) |
| 40 | + parameters: dict = Field( |
| 41 | + ..., description="JSON representing the parameters for the service execution" |
| 42 | + ) |
| 43 | + result_link: Optional[str] = Field( |
| 44 | + ..., description="URL to the results of the processing job" |
| 45 | + ) |
| 46 | + created: datetime = Field(..., description="Creation time of the processing job") |
| 47 | + updated: datetime = Field( |
| 48 | + ..., |
| 49 | + description="Timestamp representing the last time that the job details were updated", |
| 50 | + ) |
27 | 51 |
|
28 | 52 |
|
29 | 53 | class ProcessingJob(ProcessingJobSummary, ProcessingJobDetails): |
30 | 54 | pass |
31 | 55 |
|
32 | 56 |
|
33 | 57 | class BaseJobRequest(BaseModel): |
34 | | - title: str |
35 | | - label: ProcessTypeEnum |
36 | | - service: ServiceDetails |
37 | | - parameters: dict |
| 58 | + title: str = Field(..., description="Title of the job to execute") |
| 59 | + label: ProcessTypeEnum = Field( |
| 60 | + ..., |
| 61 | + description="Label that is representing the type of the service that will be executed", |
| 62 | + ) |
| 63 | + service: ServiceDetails = Field( |
| 64 | + ..., description="Details of the service to be executed" |
| 65 | + ) |
| 66 | + parameters: dict = Field( |
| 67 | + ..., description="JSON representing the parameters for the service execution" |
| 68 | + ) |
0 commit comments