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

mozilla-releng / balrog / #4856

30 Jul 2025 09:13AM UTC coverage: 89.391%. First build
#4856

Pull #3502

circleci

jcristau
Revert "update to connexion 3.x (#3426)"

This reverts commit 3884fe228, reversing
changes made to db1579a66.
Pull Request #3502: Revert update to connexion 3.x

3075 of 3593 branches covered (85.58%)

Branch coverage included in aggregate %.

65 of 70 new or added lines in 3 files covered. (92.86%)

5671 of 6191 relevant lines covered (91.6%)

0.92 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.12
/src/auslib/web/admin/views/validators.py
1
import logging
1✔
2
from typing import AnyStr, Union
1✔
3

4
import jsonschema
1✔
5
from connexion.decorators.validation import RequestBodyValidator
1✔
6
from connexion.exceptions import BadRequestProblem
1✔
7
from connexion.lifecycle import ConnexionResponse
1✔
8
from connexion.utils import is_null
1✔
9

10
# To enable shared jsonschema validators
11
import auslib.util.jsonschema_validators  # noqa
1✔
12
from auslib.util.timestamp import getMillisecondTimestamp
1✔
13

14
logger = logging.getLogger(__name__)
1✔
15

16

17
class BalrogRequestBodyValidator(RequestBodyValidator):
1✔
18
    def validate_schema(self, data: dict, url: AnyStr) -> Union[ConnexionResponse, None]:
1✔
19
        """This function is largely based on https://github.com/zalando/connexion/blob/master/connexion/decorators/validation.py
20
        and should largely be kept in line with it."""
21
        if self.is_null_value_valid and is_null(data):
1!
NEW
22
            return None
×
23
        try:
1✔
24
            self.validator.validate(data)
1✔
25
        except jsonschema.ValidationError as exception:
1✔
26
            # Add field name to the error response
27
            exception_field = ""
1✔
28
            for i in exception.path:
1✔
29
                exception_field = i + ": "
1✔
30
            if exception.__cause__ is not None:
1✔
31
                exception_message = exception.__cause__.message + " " + exception_field + exception.message
1✔
32
            else:
33
                exception_message = exception_field + exception.message
1✔
34
            # Some exceptions could contain unicode characters - if we don't replace them
35
            # we could end up with a UnicodeEncodeError.
36
            logger.error("{url} validation error: {error}".format(url=url, error=exception_message.encode("utf-8", "replace")))
1✔
37
            raise BadRequestProblem(detail=exception_message)
1✔
38

39
        return None
1✔
40

41

42
def is_when_present_and_in_past_validator(what):
1✔
43
    """Validates if scheduled_change_time value i.e. 'when' field value is present in
44
    input dictionary/object and if its value is in past or not"""
45
    return what.get("when", None) and int(what.get("when")) < getMillisecondTimestamp()
1✔
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