-
Notifications
You must be signed in to change notification settings - Fork 27
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
[#3688] Phase 1 - Implement Objecttypes API client #3847
Conversation
...forms/js/components/admin/form_design/registrations/objectsapi/ObjectsApiOptionsFormField.js
Outdated
Show resolved
Hide resolved
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #3847 +/- ##
==========================================
+ Coverage 96.33% 96.35% +0.01%
==========================================
Files 707 711 +4
Lines 22172 22247 +75
Branches 2541 2554 +13
==========================================
+ Hits 21359 21435 +76
+ Misses 568 565 -3
- Partials 245 247 +2 ☔ View full report in Codecov by Sentry. |
5cdc1e9
to
856f8e5
Compare
src/openforms/js/components/admin/form_design/registrations/objectsapi/utils.js
Outdated
Show resolved
Hide resolved
856f8e5
to
775a0cc
Compare
...orms/js/components/admin/form_design/registrations/objectsapi/ObjectsApiOptionsFormFields.js
Outdated
Show resolved
Hide resolved
...orms/js/components/admin/form_design/registrations/objectsapi/ObjectsApiOptionsFormFields.js
Outdated
Show resolved
Hide resolved
...orms/js/components/admin/form_design/registrations/objectsapi/ObjectsApiOptionsFormFields.js
Outdated
Show resolved
Hide resolved
...orms/js/components/admin/form_design/registrations/objectsapi/ObjectsApiOptionsFormFields.js
Outdated
Show resolved
Hide resolved
src/openforms/js/components/admin/form_design/registrations/objectsapi/utils.js
Outdated
Show resolved
Hide resolved
99a05e6
to
b7625c6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to see this PR broken up in smaller PRs, there's too much going on all at once now 😬
The UI code could've been a separate PR limited to storybook, the additional endpoints could've been a separate PR.
db: | ||
image: postgres | ||
environment: | ||
- POSTGRES_USER=${DB_USER:-objecttypes} | ||
- POSTGRES_PASSWORD=${DB_PASSWORD:-objecttypes} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's pin this to the same version of postgres as our main docker-compose.yml
and apply the same environment settings:
db: | |
image: postgres | |
environment: | |
- POSTGRES_USER=${DB_USER:-objecttypes} | |
- POSTGRES_PASSWORD=${DB_PASSWORD:-objecttypes} | |
db: | |
image: postgres:${PG_VERSION:-14} | |
environment: | |
- POSTGRES_HOST_AUTH_METHOD=trust | |
volumes: | |
# update with appropriate initialize SQL to create the DB for objecttypes and objects each | |
- ./docker-init-db.sql:/docker-entrypoint-initdb.d/init_db.sql | |
- objects-apis-db:/var/lib/postgresql/data | |
networks: | |
- open-forms-dev | |
volumes: | |
objects-apis-db |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Objecttypes API doesn't have a init-db.sql script so I'm keeping it as is for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd take the same structure/set up like in our root docker-init-db.sql
- the reason for this is that you'll be created a database for objects and objecttypes each, but in the same DB cluster. You really don't want both django apps to look for the same tables in the same DB, that will cause problems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created the init script but still got some weird errors (FATAL: role "user" does not exist
)
I'm also unsure what the open-forms-dev
network does and how it relates to the one in our docker compose.
I'm leaving this for now it takes too much of my time and I don't have all the knowledge so I'll come back to this later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay - some information:
FATAL: role "user" does not exist
- in docker-compose, I basically tend to enable TRUST mode, it's not for prod anyway. So we let all the SQL be executed by the postgres superuser. That init script then ensures a DB user exists and creates the necessary database(s) owned by that user.
So in compose you typically want to have:
environment:
- POSTGRES_HOST_AUTH_METHOD=trust
The open-forms-dev
network is so that we can spin up multiple compose files each from their own shell but all the services are on the same network. That way, we can make the root docker-compose.yml
talk to the camunda from docker/docker-compose.camunda.yml
etc. That essentially allows you to spin up all the services and have them be connected to use all of OF's features at once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah so it's an error but doesn't block anything. PR was updated
|
||
def get_objects(self) -> list[dict[str, Any]]: | ||
with get_objecttypes_client() as client: | ||
return client.list_objecttype_versions(self.kwargs["submission_uuid"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm interested to see how this handles 404s for bogus UUIDs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Objecttypes API raises a ValidationError
but for some reason a 500 is returned. Should we validate on our side that it is a correct UUID?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, a 500 is never an intended/deliberate outcome. Create an issue in the objecttypes API for this case, and I think a 404 is more appropriate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened: maykinmedia/objects-api#361
src/openforms/registrations/contrib/objects_api/tests/test_objecttypes_client.py
Outdated
Show resolved
Hide resolved
src/openforms/registrations/contrib/objects_api/tests/test_objecttypes_client.py
Outdated
Show resolved
Hide resolved
5e7c8a5
to
15aaf51
Compare
15aaf51
to
c60a0ef
Compare
…es-api-endpoints [#3688] Phase 1 - Add Objecttypes API endpoints
Part of #3688