The madek-api2 is a JSON API for Madek.
-
Schemas:
-
incomplete and too unspecific in many places
-
There are 2 ways of defining schema (see COERCION.md)
- reitit.coercion.schema (simple description of types)
- reitit.coercion.spec (more options to define swagger-ui-fields concerning default-values/description/..)
-
⚠️ WARNING: Keep in mind to use request.parameters/body/path, not request.params (attributes won't be casted)
-
-
Permissions:
Some resources for public and signed in users leak to much information.
Pagination over all entities, in particular for
users
andpeople
must be prevented. How can we do this? Enforce query params and return only a fixed limit?A lot of open discussions here.
We could make it part of a Madek release with per default only
/admin
beeing enabled and other resources only per configuration? That could bring us timewiese nearer a to release of the API v2.
Requirements:
- PostgreSQL 15 Database
asdf
https://asdf-vm.com/- system build tools and libaries; e.g.
sudo apt-get install build-essential
on ubuntu; on MacOS you will need Xcode with command line tools and further packages either from MacPorts or Homebrew ⚠️ WARNING: local tests can fail caused by wrong order of results (see terms_for_sorting_shared_context.rb)
./bin/clj-run
OpenApi: http://localhost:3104/api-v2/api-docs/index.html
This will show admin-endpoints only
# options: ALL|ADMIN|USER
./bin/clj-run --http-resources-scope ADMIN
# or by env: CAUTION: snake-case
export http_resources_scope=ADMIN
Rspec should be invoked from ./bin/rspec
./bin/rspec ./spec/resources/groups/index_spec.rb:11
Clojure-tests can be triggered manually by: (not integrated in CI)
clojure -M:test
clojure -M:test madek.api.pagination-test.pagination-test.clj
clojure -M:test test/*
Use ./bin/cljfmt check
and ./bin/cljfmt fix
.
From vim you can use :! ./bin/cljfmt fix %
to format the current file.
Use standardrb
and standardrb --fix
.
Swagger resource documentation http://localhost:3104/api-docs/index.html
- BasicAuth by login/email & password (db::auth_systems_users.data)
- Distinguish between user/admin-endpoints (db:admin)
- Token
- Distinguish between user OR admin-endpoints (db:admin)
- Distinguish between read OR modifiable-endpoints (db:token.scope_read/scope_write)
NOTE: whilst switching to jdbc-next the database must be configuration both in
the config file config/settings.local.yml
and via environment variables (or cli
arguments).
Set PG environment variables like PGPORT, PGDATABASE, PGUSER, etc.
Create a config/settings.local.yml with content similar like:
database:
url: postgresql://localhost:5415/madek?pool=3
ZERO_BASED_PAGINATION
Pagination: used to definezero-based
ORone-based pagination
The tests need a rails like configuration:
cp datalayer/config/database_dev.yml spec/config/database.yml
should be sufficient.