Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.11
python-version: 3.13
architecture: x64

- name: Ensure Nexus mirror configuration is not committed
Expand Down
2 changes: 1 addition & 1 deletion app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,6 @@ async def http_exception(request: Request, exc: StarletteHTTPException):
@app.exception_handler(InvalidPayloadError)
async def invalid_payload_exception(request: Request, exc: InvalidPayloadError):
return JSONResponse(
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
status_code=status.HTTP_422_UNPROCESSABLE_CONTENT,
content=jsonable_encoder(exc.response()),
)
42 changes: 21 additions & 21 deletions app/model/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ class ResponseType(StrEnum):


class LineError(BaseModel):
line: Union[int, str] = Field(..., example="5")
group: str = Field(..., example="TRAN")
desc: str = Field(..., example="Blah blah")
line: Union[int, str] = Field(..., json_schema_extra={'example': "5"})
group: str = Field(..., json_schema_extra={'example': "TRAN"})
desc: str = Field(..., json_schema_extra={'example': "Blah blah"})

@field_validator("line")
@classmethod
Expand All @@ -105,18 +105,18 @@ def line_if_string_must_be_hyphen(cls, line):


class Validation(BaseModel):
filename: str = Field(..., example="example.ags")
filesize: int = Field(None, example="1024")
checkers: List[str] = Field(None, example=["python_ags4 v1.1.0"])
dictionary: str = Field(None, example="Standard_dictionary_v4_1_1.ags")
time: datetime = Field(None, example="2021-08-18 09:23:29")
message: str = Field(None, example="7 error(s) found in file!")
errors: Dict[str, List[LineError]] = Field(..., example="Rule 1a")
valid: bool = Field(..., example="false")
filename: str = Field(..., json_schema_extra={'example': "example.ags"})
filesize: int = Field(None, json_schema_extra={'example': "1024"})
checkers: List[str] = Field(None, json_schema_extra={'example': ["python_ags4 v1.1.0"]})
dictionary: str = Field(None, json_schema_extra={'example': "Standard_dictionary_v4_1_1.ags"})
time: datetime = Field(None, json_schema_extra={'example': "2021-08-18 09:23:29"})
message: str = Field(None, json_schema_extra={'example': "7 error(s}) found in file!"})
errors: Dict[str, List[LineError]] = Field(..., json_schema_extra={'example': "Rule 1a"})
valid: bool = Field(..., json_schema_extra={'example': "false"})
additional_metadata: dict = Field(...)
error_count: int = Field(None, example="50")
warnings_count: int = Field(None, example="0")
fyi_count: int = Field(None, example="5")
error_count: int = Field(None, json_schema_extra={'example': "50"})
warnings_count: int = Field(None, json_schema_extra={'example': "0"})
fyi_count: int = Field(None, json_schema_extra={'example': "5"})
geojson: dict = dict()
geojson_error: str | None = None

Expand All @@ -129,15 +129,15 @@ def errors_keys_must_be_known_rules(cls, errors):


class Error(BaseModel):
error: str = Field(..., example="error")
propName: str = Field(None, example="error")
desc: str = Field(..., example="Error message")
error: str = Field(..., json_schema_extra={'example': "error"})
propName: str = Field(None, json_schema_extra={'example': "error"})
desc: str = Field(..., json_schema_extra={'example': "Error message"})


class MinimalResponse(BaseModel):
msg: str = Field(..., example="Example response")
type: str = Field(..., example="success")
self: str = Field(..., example="http://example.com/apis/query")
msg: str = Field(..., json_schema_extra={'example': "Example response"})
type: str = Field(..., json_schema_extra={'example': "success"})
self: str = Field(..., json_schema_extra={'example': "http://example.com/apis/query"})


class ErrorResponse(MinimalResponse):
Expand All @@ -149,4 +149,4 @@ class ValidationResponse(MinimalResponse):


class BoreholeCountResponse(MinimalResponse):
count: int = Field(..., example=4)
count: int = Field(..., json_schema_extra={'example': 4})
2 changes: 1 addition & 1 deletion app/routes/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
error_responses = {
status.HTTP_400_BAD_REQUEST: {"model": ErrorResponse},
status.HTTP_404_NOT_FOUND: {"model": ErrorResponse},
status.HTTP_422_UNPROCESSABLE_ENTITY: {"model": ErrorResponse},
status.HTTP_422_UNPROCESSABLE_CONTENT: {"model": ErrorResponse},
status.HTTP_500_INTERNAL_SERVER_ERROR: {"model": ErrorResponse},
}

Expand Down
Loading
Loading