Skip to content

Commit

Permalink
Update package name & add dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
Floris272 committed Jan 29, 2025
1 parent b024b5a commit a0c408c
Show file tree
Hide file tree
Showing 17 changed files with 442 additions and 24 deletions.
1 change: 1 addition & 0 deletions requirements/base.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ django-localflavor
django-celery-beat
flower
django-timeline-logger
django-json-schema-model

# waiting for > 2.0.1
commonground-api-common==1.13.4
7 changes: 6 additions & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ django==4.2.17
# django-csp
# django-filter
# django-formtools
# django-json-schema-model
# django-jsonform
# django-localflavor
# django-log-outgoing-requests
Expand Down Expand Up @@ -137,6 +138,8 @@ django-filter==24.3
# open-api-framework
django-formtools==2.5.1
# via django-two-factor-auth
django-json-schema-model==0.1.0
# via -r requirements/base.in
django-jsonform==2.23.1
# via
# mozilla-django-oidc-db
Expand Down Expand Up @@ -249,7 +252,9 @@ jinja2==3.1.4
josepy==1.14.0
# via mozilla-django-oidc
jsonschema==4.23.0
# via drf-spectacular
# via
# django-json-schema-model
# drf-spectacular
jsonschema-specifications==2024.10.1
# via jsonschema
kombu==5.4.2
Expand Down
6 changes: 6 additions & 0 deletions requirements/ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ django==4.2.17
# django-csp
# django-filter
# django-formtools
# django-json-schema-model
# django-jsonform
# django-localflavor
# django-log-outgoing-requests
Expand Down Expand Up @@ -228,6 +229,10 @@ django-formtools==2.5.1
# -c requirements/base.txt
# -r requirements/base.txt
# django-two-factor-auth
django-json-schema-model==0.1.0
# via
# -c requirements/base.txt
# -r requirements/base.txt
django-jsonform==2.23.1
# via
# -c requirements/base.txt
Expand Down Expand Up @@ -478,6 +483,7 @@ jsonschema==4.23.0
# via
# -c requirements/base.txt
# -r requirements/base.txt
# django-json-schema-model
# drf-spectacular
jsonschema-specifications==2024.10.1
# via
Expand Down
6 changes: 6 additions & 0 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ django==4.2.17
# django-extensions
# django-filter
# django-formtools
# django-json-schema-model
# django-jsonform
# django-localflavor
# django-log-outgoing-requests
Expand Down Expand Up @@ -259,6 +260,10 @@ django-formtools==2.5.1
# -c requirements/ci.txt
# -r requirements/ci.txt
# django-two-factor-auth
django-json-schema-model==0.1.0
# via
# -c requirements/ci.txt
# -r requirements/ci.txt
django-jsonform==2.23.1
# via
# -c requirements/ci.txt
Expand Down Expand Up @@ -532,6 +537,7 @@ jsonschema==4.23.0
# via
# -c requirements/ci.txt
# -r requirements/ci.txt
# django-json-schema-model
# drf-spectacular
jsonschema-specifications==2024.10.1
# via
Expand Down
2 changes: 1 addition & 1 deletion src/open_producten/conf/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"localflavor",
"markdownx",
"django_celery_beat",
"django_json_schema",
"django_json_schema_model",
"open_producten.accounts",
"open_producten.logging",
"open_producten.utils",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Generated by Django 5.1.4 on 2025-01-10 10:17
# Generated by Django 4.2.17 on 2025-01-19 20:50

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("producten", "0008_alter_product_eind_datum_alter_product_start_datum"),
("producten", "0003_product_status_alter_product_aanmaak_datum_and_more"),
]

operations = [
Expand Down
6 changes: 4 additions & 2 deletions src/open_producten/producten/tests/api/test_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from django.urls import reverse
from django.utils.translation import gettext as _

from django_json_schema.models import JsonSchema
from django_json_schema_model.models import JsonSchema
from freezegun import freeze_time
from rest_framework import status
from rest_framework.exceptions import ErrorDetail
Expand Down Expand Up @@ -151,7 +151,9 @@ def test_create_product_with_invalid_verbruiksobject(self):
{
"verbruiksobject": [
ErrorDetail(
string=_("Het verbruiksobject komt niet overeen met het schema gedefinieerd op het product type."),
string=_(
"Het verbruiksobject komt niet overeen met het schema gedefinieerd op het product type."
),
code="invalid",
)
]
Expand Down
7 changes: 5 additions & 2 deletions src/open_producten/producten/tests/test_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from django.test import TestCase
from django.utils.translation import gettext as _

from django_json_schema.models import JsonSchema
from django_json_schema_model.models import JsonSchema
from freezegun import freeze_time

from open_producten.producttypen.tests.factories import ProductTypeFactory
Expand Down Expand Up @@ -151,7 +151,9 @@ def test_verbruiksobject_is_invalid(self):

with self.assertRaisesMessage(
ValidationError,
_("Het verbruiksobject komt niet overeen met het schema gedefinieerd op het product type."),
_(
"Het verbruiksobject komt niet overeen met het schema gedefinieerd op het product type."
),
):
product.clean()

Expand Down Expand Up @@ -183,6 +185,7 @@ def test_verbruiksobject_with_schema_without_object(self):

product.clean()


@freeze_time("2024-1-1")
class TestProductStateTask(TestCase):
def setUp(self):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# Generated by Django 5.1.4 on 2025-01-09 12:52
# Generated by Django 4.2.17 on 2025-01-19 20:50

import django.db.models.deletion
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
("django_json_schema", "0001_initial"),
("producttypen", "0006_alter_producttype_aanmaak_datum_and_more"),
("django_json_schema_model", "0001_initial"),
(
"producttypen",
"0005_producttype_code_producttype_toegestane_statussen_and_more",
),
]

operations = [
Expand All @@ -21,7 +24,7 @@ class Migration(migrations.Migration):
null=True,
on_delete=django.db.models.deletion.PROTECT,
related_name="product_typen",
to="django_json_schema.jsonschema",
to="django_json_schema_model.jsonschema",
verbose_name="verbruiksobject schema",
),
),
Expand Down
2 changes: 1 addition & 1 deletion src/open_producten/producttypen/models/producttype.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from django.db import models
from django.utils.translation import gettext_lazy as _

from django_json_schema.models import JsonSchema
from django_json_schema_model.models import JsonSchema
from markdownx.models import MarkdownxField

from open_producten.locaties.models import Contact, Locatie, Organisatie
Expand Down
2 changes: 1 addition & 1 deletion src/open_producten/producttypen/serializers/jsonschema.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django_json_schema.models import JsonSchema
from django_json_schema_model.models import JsonSchema
from jsonschema import Draft202012Validator
from jsonschema.exceptions import SchemaError
from rest_framework import serializers
Expand Down
2 changes: 1 addition & 1 deletion src/open_producten/producttypen/serializers/producttype.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.db import transaction
from django.utils.translation import gettext_lazy as _

from django_json_schema.models import JsonSchema
from django_json_schema_model.models import JsonSchema
from rest_framework import serializers

from open_producten.locaties.models import Contact, Locatie, Organisatie
Expand Down
13 changes: 9 additions & 4 deletions src/open_producten/producttypen/tests/api/test_jsonschema.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from django.urls import reverse
from django.utils.translation import gettext as _

from django_json_schema.models import JsonSchema
from django_json_schema_model.models import JsonSchema
from rest_framework import status
from rest_framework.exceptions import ErrorDetail
from rest_framework.test import APIClient
Expand Down Expand Up @@ -36,8 +37,12 @@ def test_required_fields(self):
self.assertEqual(
response.data,
{
"name": [ErrorDetail(string="Dit veld is vereist.", code="required")],
"schema": [ErrorDetail(string="Dit veld is vereist.", code="required")],
"name": [
ErrorDetail(string=_("This field is required."), code="required")
],
"schema": [
ErrorDetail(string=_("This field is required."), code="required")
],
},
)

Expand All @@ -60,7 +65,7 @@ def test_create_invalid_schema(self):
{
"schema": [
ErrorDetail(
string="[] is not valid under any of the given schemas",
string=_("[] is not valid under any of the given schemas"),
code="invalid",
)
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from django.urls import reverse
from django.utils.translation import gettext as _

from django_json_schema.models import JsonSchema
from django_json_schema_model.models import JsonSchema
from freezegun import freeze_time
from rest_framework import status
from rest_framework.exceptions import ErrorDetail
Expand Down
2 changes: 1 addition & 1 deletion src/open_producten/producttypen/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from django.utils.translation import gettext_lazy as _

from django_filters.rest_framework import DjangoFilterBackend
from django_json_schema.models import JsonSchema
from django_json_schema_model.models import JsonSchema
from drf_spectacular.utils import OpenApiExample, extend_schema, extend_schema_view
from rest_framework import status
from rest_framework.decorators import action
Expand Down
14 changes: 14 additions & 0 deletions src/producten-openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ paths:
gepubliceerd: false
bsn: '111222333'
status: gereed
verbruiksobject:
uren: 130
summary: Create product
required: true
security:
Expand Down Expand Up @@ -559,6 +561,10 @@ components:
pattern: ^[0-9]*$
maxLength: 8
minLength: 8
verbruiksobject:
nullable: true
description: Verbruiksobject van dit product. Wordt gevalideerd met het
`verbruiksobject_schema` uit het product type.
Product:
type: object
properties:
Expand Down Expand Up @@ -624,6 +630,10 @@ components:
pattern: ^[0-9]*$
maxLength: 8
minLength: 8
verbruiksobject:
nullable: true
description: Verbruiksobject van dit product. Wordt gevalideerd met het
`verbruiksobject_schema` uit het product type.
required:
- aanmaak_datum
- id
Expand Down Expand Up @@ -680,6 +690,10 @@ components:
pattern: ^[0-9]*$
maxLength: 8
minLength: 8
verbruiksobject:
nullable: true
description: Verbruiksobject van dit product. Wordt gevalideerd met het
`verbruiksobject_schema` uit het product type.
required:
- product_type_id
StatusEnum:
Expand Down
Loading

0 comments on commit a0c408c

Please sign in to comment.