Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#513] Release 2.5.0 #514

Closed
wants to merge 65 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
21c1686
:construction_worker: add check OAF version action
Coperh Sep 3, 2024
6f66b35
:bug: [open-zaak/open-zaak#1780] Fix setting NOTIFICATIONS_DISABLED v…
stevenbal Sep 19, 2024
9de79f1
Merge pull request #443 from maykinmedia/feature/dependabot-autoupdate
Coperh Sep 24, 2024
5f74eee
Merge pull request #452 from maykinmedia/issue/notifications-disabled…
annashamray Sep 24, 2024
693d03c
:memo: update CHANGELOG with the forgotten change
annashamray Sep 24, 2024
f517900
Merge pull request #455 from maykinmedia/docs/update-changelog
joeribekker Sep 24, 2024
c465f53
:bug:[#449] support objecttypes API with pagination
Coperh Sep 24, 2024
439a9db
:wrench:[maykinmedia/open-api-framework#68] fix CSP errors
Coperh Sep 27, 2024
36f9c6f
:white_check_mark:[#449] change permission tests
Coperh Sep 27, 2024
e9a69ef
Merge pull request #454 from maykinmedia/feature/449-Permission-admin…
Coperh Sep 27, 2024
c15efcc
:wrench:[maykinmedia/open-api-framework#68] fix CSP errors
Coperh Sep 27, 2024
72712d3
:construction_worker: check OAF version on PRs
Coperh Oct 1, 2024
bc7aed7
Merge pull request #458 from maykinmedia/feature/oaf-68-csp-errors
Coperh Oct 1, 2024
40b71d2
:arrow_up: update pip tools
Coperh Oct 1, 2024
97f1424
Disable trivy image scan (#465)
SonnyBA Oct 4, 2024
7060252
Merge pull request #460 from maykinmedia/feature/check-oaf-on-pr
Coperh Oct 8, 2024
d565591
[#13] reuse open-api-workflows workflows (#447)
SonnyBA Oct 17, 2024
bd8f5a9
:arrow_up: [https://github.com/maykinmedia/open-api-framework/issues/…
annashamray Nov 25, 2024
d99401b
Add test to illustrate expected validation on object PATCH
swrichards Oct 9, 2024
7765330
:memo: [#403] Document Notificaties API retry behavior
stevenbal Oct 24, 2024
1988898
:recycle: [https://github.com/maykinmedia/open-api-framework/issues/6…
annashamray Nov 25, 2024
de30a6c
:bug: [#466] fix validation for merge PATCH
annashamray Oct 29, 2024
a194581
Merge pull request #468 from maykinmedia/issue/403-document-notificat…
stevenbal Oct 31, 2024
bd6e269
:test_tube: [#472] add regression tests if filter with icontains have…
annashamray Nov 29, 2024
2d2c797
:arrow_up: [https://github.com/maykinmedia/open-api-framework/issues/…
annashamray Nov 29, 2024
b770657
:arrow_up: update OAF to 0.9.0
Coperh Nov 15, 2024
a1bea2f
Merge pull request #469 from maykinmedia/issue/466-merge-patch
annashamray Nov 7, 2024
5bcb23a
:sparkles: [#472] add 'data_attr' query param
annashamray Dec 11, 2024
9c0f404
:ok_hand: [https://github.com/maykinmedia/open-api-framework/issues/6…
annashamray Nov 29, 2024
d0c6801
Merge pull request #476 from maykinmedia/update/oaf-0.9.0
Coperh Nov 18, 2024
ebfae92
:construction_worker: [#472] update OAS check GH workflow
annashamray Dec 12, 2024
c338307
Merge pull request #478 from maykinmedia/deps/zgw-consumers
annashamray Nov 29, 2024
e3f00f6
:memo: [#472] update OAS with 'data_attr' filter
annashamray Dec 12, 2024
dd54724
Bump open-api-framework to 0.9.1
swrichards Dec 18, 2024
5bd4a93
[#484] Notification channel setup config (#491)
SonnyBA Dec 13, 2024
4ab2875
:green_heart: [#472] fix new filter field widget
annashamray Dec 12, 2024
c2d5412
Regenerate envvar docs
swrichards Dec 18, 2024
91bb536
[#467] Setup objecttypes through django-setup-configuration (#492)
SonnyBA Dec 13, 2024
ed86dad
:sparkles: [#472] add validation for 'data_attr' filter
annashamray Dec 12, 2024
248aa21
[#495] Add envsubst to Docker deps
swrichards Dec 16, 2024
b97f3e4
[#483] add support for mozilla django OIDC db config (#490)
SonnyBA Dec 13, 2024
327735c
:white_check_mark: [#472] add more tests for 'data_attr' filter
annashamray Dec 12, 2024
8d3d5b6
Merge pull request #496 from maykinmedia/495-add-envsubst-to-docker-deps
swrichards Dec 18, 2024
030b012
:ok_hand: [#472] process PR feedback
annashamray Dec 18, 2024
e674625
[#485] tokenauth setup configuration (#494)
danielmursa-dev Dec 19, 2024
732a52a
Merge pull request #488 from maykinmedia/feature/472-data-attr-contai…
annashamray Dec 19, 2024
541a798
:construction_worker: [#501] Make sure docs are built in CI
stevenbal Dec 19, 2024
deda664
Feature/486 token permissions configuration (#497)
danielmursa-dev Dec 19, 2024
e933038
:construction_worker: [maykinmedia/open-api-framework#92] Ensure late…
stevenbal Dec 19, 2024
c7d1c73
Merge pull request #502 from maykinmedia/issue/fix-docs-build
swrichards Dec 19, 2024
1e3187d
:construction_worker: [#504] Pin to v3.0.1 of publish workflow
stevenbal Dec 20, 2024
c100246
Merge pull request #504 from maykinmedia/issue/fix-docker-latest-push
swrichards Dec 19, 2024
386dc08
:wrench: [maykinmedia/open-api-framework#81] Switch from pip-compile …
stevenbal Jan 2, 2025
e096bbf
:construction_worker: [maykinmedia/objects-api#463] Add trivy image scan
stevenbal Dec 24, 2024
78fa25c
Merge pull request #505 from maykinmedia/feature/pin-ci-job-to-version
stevenbal Dec 20, 2024
64b4a3e
:arrow_up: [maykinmedia/open-api-framework#93] Security updates
stevenbal Jan 2, 2025
12714bd
Merge pull request #506 from maykinmedia/feature/re-enable-trivy
stevenbal Dec 24, 2024
a9ca4fe
Update cryptography
SonnyBA Jan 8, 2025
9412723
:construction_worker: add OAF auto-update action
Coperh Jan 3, 2025
cac2ce2
Merge pull request #507 from maykinmedia/issue/security-updates
stevenbal Jan 3, 2025
c4c9c5b
Update NPM dependencies
SonnyBA Jan 8, 2025
5aff969
Merge pull request #511 from maykinmedia/feature/oaf-auto-update-action
Coperh Jan 6, 2025
50327f2
Merge pull request #515 from maykinmedia/security-updates
joeribekker Jan 8, 2025
ac66596
[#513] Update changelog & README
SonnyBA Jan 8, 2025
6edb01f
[#513] bump version for various files
SonnyBA Jan 8, 2025
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
Prev Previous commit
Next Next commit
👌 [#472] process PR feedback
  • Loading branch information
annashamray authored and SonnyBA committed Jan 8, 2025
commit 030b0122cf4393e752aec5b97ea5b93376679b52
79 changes: 44 additions & 35 deletions src/objects/api/v2/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,47 @@

"""

DATA_ATTRS_HELP_TEXT = (
_(
"""**DEPRECATED: Use 'data_attr' instead**.
Only include objects that have attributes with certain values.
Data filtering expressions are comma-separated and are structured as follows:

%(value_part_help_text)s

Example: in order to display only objects with `height` equal to 100, query `data_attrs=height__exact__100`
should be used. If `height` is nested inside `dimensions` attribute, query should look like
`data_attrs=dimensions__height__exact__100`

`value` may not contain comma, since commas are used as separator between filtering expressions.
If you want to use commas in `value` you can use `data_attr` query parameter.
"""
)
% {"value_part_help_text": DATA_ATTR_VALUE_HELP_TEXT}
)

DATA_ATTR_HELP_TEXT = (
_(
"""Only include objects that have attributes with certain values.

%(value_part_help_text)s

Example: in order to display only objects with `height` equal to 100, query `data_attr=height__exact__100`
should be used. If `height` is nested inside `dimensions` attribute, query should look like
`data_attr=dimensions__height__exact__100`

This filter is very similar to the old `data_attrs` filter, but it has two differences:

* `value` may contain commas
* only one filtering expression is allowed

If you want to use several filtering expressions, just use this `data_attr` several times in the query string.
Example: `data_attr=height__exact__100&data_attr=naam__icontains__boom`
"""
)
% {"value_part_help_text": DATA_ATTR_VALUE_HELP_TEXT}
)


def filter_data_attr_value_part(value_part: str, queryset: QuerySet) -> QuerySet:
"""
Expand Down Expand Up @@ -98,49 +139,17 @@ class ObjectRecordFilterSet(FilterSet):
"date would be between `registrationAt` attributes of different records"
),
)

data_attrs = filters.CharFilter(
method="filter_data_attrs",
validators=[validate_data_attrs],
help_text=_(
"""**DEPRECATED: Use 'data_attr' instead**.
Only include objects that have attributes with certain values.
Data filtering expressions are comma-separated and are structured as follows:

%(value_part_help_text)s

Example: in order to display only objects with `height` equal to 100, query `data_attrs=height__exact__100`
should be used. If `height` is nested inside `dimensions` attribute, query should look like
`data_attrs=dimensions__height__exact__100`

`value` may not contain comma, since commas are used as separator between filtering expressions.
If you want to use commas in `value` you can use `data_attr` query parameter.
"""
)
% {"value_part_help_text": DATA_ATTR_VALUE_HELP_TEXT},
help_text=DATA_ATTRS_HELP_TEXT,
)

data_attr = ManyCharFilter(
method="filter_data_attr",
validators=[validate_data_attr],
help_text=_(
"""Only include objects that have attributes with certain values.

%(value_part_help_text)s

Example: in order to display only objects with `height` equal to 100, query `data_attr=height__exact__100`
should be used. If `height` is nested inside `dimensions` attribute, query should look like
`data_attr=dimensions__height__exact__100`

This filter is very similar to the old `data_attrs` filter, but it has two differences:

* `value` may contain commas
* only one filtering expression is allowed

If you want to use several filtering expressions, just use this `data_attr` several times in the query string.
Example: `data_attr=height__exact__100&data_attr=naam__icontains__boom`
"""
)
% {"value_part_help_text": DATA_ATTR_VALUE_HELP_TEXT},
help_text=DATA_ATTR_HELP_TEXT,
)

data_icontains = filters.CharFilter(
Expand Down
2 changes: 2 additions & 0 deletions src/objects/api/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ paths:

If you want to use several filtering expressions, just use this `data_attr` several times in the query string.
Example: `data_attr=height__exact__100&data_attr=naam__icontains__boom`
explode: true
- in: query
name: data_attrs
schema:
Expand Down Expand Up @@ -157,6 +158,7 @@ paths:

`value` may not contain comma, since commas are used as separator between filtering expressions.
If you want to use commas in `value` you can use `data_attr` query parameter.
deprecated: true
- in: query
name: data_icontains
schema:
Expand Down
31 changes: 27 additions & 4 deletions src/objects/api/v2/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@
from django.db import models
from django.utils.dateparse import parse_date

from drf_spectacular.types import OpenApiTypes
from drf_spectacular.utils import OpenApiParameter, extend_schema, extend_schema_view
from drf_spectacular.utils import (
OpenApiParameter,
OpenApiTypes,
extend_schema,
extend_schema_view,
)
from rest_framework import mixins, viewsets
from rest_framework.decorators import action
from rest_framework.generics import get_object_or_404
Expand All @@ -28,13 +32,32 @@
PermissionSerializer,
)
from ..utils import is_date
from .filters import ObjectRecordFilterSet
from .filters import DATA_ATTR_HELP_TEXT, DATA_ATTRS_HELP_TEXT, ObjectRecordFilterSet

# manually override OAS because of "deprecated" attribute
data_attrs_parameter = OpenApiParameter(
name="data_attrs",
type=OpenApiTypes.STR,
location=OpenApiParameter.QUERY,
description=DATA_ATTRS_HELP_TEXT,
deprecated=True,
)

# manually override OAS because of "explode" attribute
data_attr_parameter = OpenApiParameter(
name="data_attr",
location=OpenApiParameter.QUERY,
type=OpenApiTypes.STR,
description=DATA_ATTR_HELP_TEXT,
explode=True,
)


@extend_schema_view(
list=extend_schema(
description="Retrieve a list of OBJECTs and their actual RECORD. "
"The actual record is defined as if the query parameter `date=<today>` was given."
"The actual record is defined as if the query parameter `date=<today>` was given.",
parameters=[data_attrs_parameter, data_attr_parameter],
),
retrieve=extend_schema(
description="Retrieve a single OBJECT and its actual RECORD. "
Expand Down
3 changes: 2 additions & 1 deletion src/objects/api/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ def validate_data_attr(value: list):
# check that comma can be only in the value part
if "," in value_part.rsplit("__", 1)[0]:
message = _(
"Filter expression '%(value_part)s' doesn't have the shape 'key__operator__value'"
"Filter expression '%(value_part)s' must have the shape 'key__operator__value', "
"commas can only be present in the 'value'"
) % {"value_part": value_part}
raise serializers.ValidationError(message, code=code)

Expand Down
7 changes: 6 additions & 1 deletion src/objects/tests/v2/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,10 @@ def test_filter_exact_date(self):
record = ObjectRecordFactory.create(
data={"date": "2000-11-01"}, object__object_type=self.object_type
)
ObjectRecordFactory.create(
data={"date": "2020-11-01"}, object__object_type=self.object_type
)
ObjectRecordFactory.create(data={}, object__object_type=self.object_type)

response = self.client.get(self.url, {"data_attr": "date__exact__2000-11-01"})
self.assertEqual(response.status_code, status.HTTP_200_OK)
Expand Down Expand Up @@ -814,7 +818,8 @@ def test_filter_comma_separated_invalid(self):
response.json(),
[
"Filter expression 'dimensions__diameter__exact__4,name__exact__demo' "
"doesn't have the shape 'key__operator__value'"
"must have the shape 'key__operator__value', commas can only be present in "
"the 'value'"
],
)

Expand Down