See lazy val getCustomersForUser in /src/main/scala/code/api/v3_0_0/APIMethods300.scala as a code example
Note: If you want to maintain a fork of OBP-API, we suggest you place your custom code in folders named "custom" e.g. /src/main/scala/code/api/custom to reduce the possibility of merge conflicts Please make sure you follow the terms of the AGPL or obtain a proprietary license from TESOBE or our partners.
In summary, we:
- Check if the Version should be enabled by looking at the Props file.
- Check which endpoints are included in each Version. (Probably contains endpoints that are also available in previous Versions).
- Check which endpoints from this list should be enabled by looking at the Props.
- Serve them
In more detail:
-
At boot time,
Boot.scalainitialises Lift Mapper (the database / ORM layer) and OBP configuration. It no longer registers any HTTP routes — endpoint dispatch is served entirely by native http4s. -
For each API version,
enableVersionIfAllowed(ApiVersion.v3_0_0)gates the version against the Props (api_enabled_versions/api_disabled_versions). This now only records and logs whether the version is enabled. -
Each version's endpoints are defined as native http4s
HttpRoutes[IO]incode.api.vX.Http4sXxx(e.g.Http4s300) and exposed viawrappedRoutesVXxxServices. These are wired, in priority order, intoHttp4sApp.baseServices(seeobp-api/src/main/scala/code/api/util/http4s/Http4sApp.scala). Each version's routes are wrapped byHttp4sApp.gate, which returnsHttpRoutes.emptywhen the version is disabled.
The matching Lift OBPAPI3_0_0.scala / APIMethods300.scala files are retained only as commented-out source-of-truth and as the allResourceDocs registry used by the resource-docs aggregation — they no longer serve requests.
-
Per-endpoint enable/disable is enforced at request time by
ResourceDocMiddleware, which reads the Props for explicitly enabled/disabled endpoints (api_enabled_endpoints/api_disabled_endpoints) and also performs authentication, role checks, and entity resolution. -
Any request that matches no route falls through to
notFoundCatchAll, which returns a JSON 404. There is no Lift fallback.