Commit Graph

14969 Commits

Author SHA1 Message Date
hongwei
30f83680a6 refactor/(api): replace hardcoded technology strings with constants
Use TECHNOLOGY_LIFTWEB and TECHNOLOGY_HTTP4S constants from Constant object
instead of inline string literals "lift" and "http4s" across codebase.
This improves maintainability and reduces risk of typos.
2026-01-29 14:50:07 +01:00
hongwei
747d761c9b feature/(http4s): handle errors in executeAndRespond and improve error parsing
Refactor executeAndRespond to properly handle exceptions from Future and convert them to HTTP responses using ErrorResponseConverter. This ensures consistent error handling across HTTP4S endpoints.

Simplify error response creation by parsing APIFailureNewStyle exceptions from JSON message instead of direct type matching, making error handling more robust.

Update API version validation in Http4s700 to use NewStyle.function.tryons and Helper.booleanToFuture for consistent error handling patterns.

Adjust test to use proper error message constant for invalid API version.
2026-01-28 16:00:57 +01:00
hongwei
b6c7360a2d Merge remote-tracking branch 'Simon/develop' into feature/addedTechnolegyField 2026-01-28 15:36:18 +01:00
hongwei
54a1552643 test/ add tests for http4s-only resource docs and version validation
Add integration tests to verify that the /resource-docs endpoint returns only http4s technology endpoints and rejects requests for non-v7 API versions. This ensures proper filtering and version handling in the http4s routes.
2026-01-28 15:23:44 +01:00
hongwei
b29f21232e refactor/(api): use ApiVersion constants instead of hardcoded strings
- Replace hardcoded API version strings with ApiVersion constants in JSON factories and API methods
- Add new ApiVersion constants for Bahrain OBF and AU Open Banking
- Update test to use ApiVersion constants for version strings
- Ensure consistency and maintainability across API version references
2026-01-28 14:49:40 +01:00
hongwei
8e52e20c86 refactor/(api): use ApiShortVersions constant for v7.0.0 version
Replace hardcoded "v7.0.0" string with ApiShortVersions.`v7.0.0`.toString in ResourceDocMiddleware and update test files accordingly to use the constant. This ensures consistency and easier maintenance when API version references need to be updated.
2026-01-28 14:25:06 +01:00
hongwei
558ee1d404 feature/(resource-docs): include technology field in API documentation
Add `technology` field to `implemented_by` JSON to indicate whether an endpoint is implemented using lift or http4s. The field is included only when `includeTechnologyInResponse` is true, which is set for API versions 6.0.0 and 7.0.0. This helps API consumers understand the underlying implementation technology.

Update tests to verify technology field presence/absence based on API version. Also improve test setup robustness by making user and account creation idempotent, and update build dependencies to support http4s and pekko.
2026-01-28 14:01:29 +01:00
karmaking
c365b6afb2 Merge branch 'develop' of https://github.com/OpenBankProject/OBP-API into develop 2026-01-28 11:50:09 +01:00
karmaking
31b7a3a3ce update build pipeline 2026-01-28 11:46:51 +01:00
Simon Redfern
ac1530fb2f
Merge pull request #2668 from hongwei1/refactor/tweakedActions
reafactor/ ci: expand branch pattern to include all branches
2026-01-28 10:54:56 +01:00
hongwei
a97c8d6ffb reafactor/ ci: expand branch pattern to include all branches
The previous branch pattern excluded some branches unintentionally. Adding '**' ensures all branches are matched except 'develop'.
2026-01-28 09:41:29 +01:00
Simon Redfern
a81e208cb1
Merge pull request #2665 from hongwei1/develop
test/added tests for V700
2026-01-27 16:30:40 +01:00
Simon Redfern
61c83581ac
Merge pull request #2659 from constantine2nd/develop
Merge conflicts resolved, HTTP4S
2026-01-27 16:25:50 +01:00
Simon Redfern
8ab316b492
Merge pull request #2666 from simonredfern/develop
Making dynamic entities more snake_case
2026-01-26 15:46:40 +01:00
hongwei
5ff7b299a6 refactor/(resource-docs): enforce canReadResourceDoc role via middleware
Move role-based authorization for resource-docs endpoint from endpoint implementation to ResourceDocMiddleware. This ensures consistent authentication handling across all endpoints and removes duplicate authorization logic.

The middleware now checks the `resource_docs_requires_role` property and enforces the `canReadResourceDoc` role when enabled. Tests are updated to verify proper 403 responses with missing role messages.
2026-01-26 14:29:54 +01:00
hongwei
73b9ecb591 Merge remote-tracking branch 'Marko/develop' into develop 2026-01-26 13:56:51 +01:00
simonredfern
e08d25520e Dynamic Entity Example id is snake case e.g. piano_id rather than
pianoId
2026-01-26 13:03:35 +01:00
Marko Milić
87b48fc71d feature/Tweak GitHub workflows 2026-01-26 12:54:28 +01:00
hongwei
897a6a1584 test/(http4s): improve error handling and request header extraction
- Safely extract request headers using `S.request.map(...).openOr(Nil)` instead of `openOrThrowException`
- Add proper error handling for resource-docs endpoint using `ErrorResponseConverter`
- Extract query parameters directly from URI instead of parsing URL string
- Add comprehensive test suite for Http4s700 routes
2026-01-26 12:47:14 +01:00
Marko Milić
18daf8dfb2 Revert "fix Github Action"
This reverts commit 3a264ed326.
2026-01-26 12:42:31 +01:00
simonredfern
26f2fd192b Docfix: Mentioning content=dynamic for resource docs 2026-01-26 10:51:33 +01:00
Marko Milić
0188ba61a0 refactor/Tweak variables names 2026-01-26 10:25:36 +01:00
Marko Milić
1534831ff4 refactor/Refactor ResourceDocMiddleware: integrate JSON content type and improve validation DSL
- Ensure all responses (errors and successful) have JSON Content-Type
- Replace repeated EitherT patterns with a clean Validation DSL (success/failure)
- Add ValidationContext to accumulate user, bank, account, view, and counterparty entities
- Add detailed comments for authentication, authorization, and entity validation steps
- Simplify middleware logic while preserving original validation order and behavior
2026-01-23 18:13:42 +01:00
Marko Milić
79ea9231a1 Merge upstream/develop into develop after conflict resolution 2026-01-23 12:41:26 +01:00
hongwei
493a7858e0 test/(http4s): add ResourceDocMatcher unit tests
- Add comprehensive test suite for ResourceDocMatcher with 545 lines of test coverage
- Test exact path matching for GET, POST, and multi-segment paths
- Test verb and path mismatch scenarios returning None
- Test BANK_ID variable matching and parameter extraction
- Test BANK_ID + ACCOUNT_ID variable matching and extraction
- Test BANK_ID + ACCOUNT_ID + VIEW_ID variable matching and extraction
- Test COUNTERPARTY_ID variable matching and extraction
- Test non-matching request scenarios
- Ensure ResourceDocMatcher correctly identifies and extracts path parameters for all variable types
- Use FeatureSpec with Given-When-Then style for clear test documentation
2026-01-23 12:37:21 +01:00
hongwei
f0eaedaf3a test/(http4s): add comprehensive Http4sCallContextBuilder unit tests
- Add Http4sCallContextBuilderTest with 454 lines of test coverage
- Test URL extraction including path, query parameters, and path parameters
- Test header extraction and conversion to HTTPParam format
- Test body extraction for POST, PUT, and GET requests
- Test correlation ID generation and extraction from X-Request-ID header
- Test IP address extraction from X-Forwarded-For and direct connection
- Test authentication header extraction for all supported auth types
- Test error handling and edge cases in CallContext building
- Ensure Http4sCallContextBuilder correctly processes http4s Request[IO] objects
2026-01-23 12:21:18 +01:00
Marko Milić
e0f747a64c Merge remote-tracking branch 'upstream/develop' into develop 2026-01-23 10:29:19 +01:00
simonredfern
7efbf6389a closing database connections after StoredProcedure calls and Migrations. 2026-01-22 18:41:01 +01:00
simonredfern
6ad3689fd3 Merge remote-tracking branch 'upstream/develop' into develop 2026-01-22 18:38:39 +01:00
simonredfern
3d4660ec0b added _links for dynamic entity CRUD endpoints. + adding GET system
database pool endpoint
2026-01-22 18:37:42 +01:00
Simon Redfern
3cb783affa
Merge pull request #2662 from hongwei1/develop
feature/addResourceDocsGuardsForHttp4s
2026-01-22 16:35:11 +01:00
hongwei
0415d13b1a refactor/(http4s): improve documentation and code clarity in error handling and support utilities
- Enhance ErrorResponseConverter documentation with detailed handler descriptions and response format details
- Add comprehensive comments explaining error type handling (APIFailureNewStyle, Box Failure, unknown exceptions)
- Document correlation-Id header inclusion and HTTP status code mapping in error responses
- Simplify error matching logic in toHttp4sResponse using pattern matching
- Improve Http4sSupport file documentation with clear component descriptions
- Add usage examples for RequestOps implicit class in endpoint implementations
- Clarify CallContext storage mechanism using http4s Vault (type-safe key-value store)
- Document validated entity storage (user, bank, bankAccount, view, counterparty) within CallContext
- Add inline comments explaining ResourceDocMatcher functionality and request matching process
- Improve code readability with consistent formatting and clearer method documentation
2026-01-22 16:19:53 +01:00
hongwei
83d90bfc44 Merge remote-tracking branch 'Simon/develop' into develop
# Conflicts:
#	.gitignore
2026-01-22 16:11:59 +01:00
hongwei
11e4a71cc4 feature(http4s): add EndpointHelpers for simplified endpoint implementations
- Add EndpointHelpers object with reusable endpoint execution patterns
- Implement executeAndRespond helper for Future-based business logic execution
- Implement withUser helper to extract and validate User from CallContext
- Implement withBank helper to extract and validate Bank from CallContext
- Implement withUserAndBank helper for endpoints requiring both User and Bank
- Add comprehensive documentation and usage examples for each helper
- Import EndpointHelpers in Http4s700 for endpoint implementation
- Reduce boilerplate in endpoint implementations by centralizing common patterns
- Improve code consistency and maintainability across http4s endpoints
2026-01-22 15:43:49 +01:00
hongwei
df54e60fd0 refactor(http4s): simplify CallContext access with implicit RequestOps extension
- Replace withCallContext helper method with implicit RequestOps extension class
- Add `req.callContext` syntax for cleaner CallContext extraction in endpoints
- Enhance Http4sRequestAttributes documentation with usage examples
- Update Http4s700 endpoints to use new implicit CallContext accessor pattern
- Remove nested callback pattern in favor of direct implicit CallContext availability
- Improve code readability by eliminating withCallContext wrapper boilerplate
- Add RequestOps import to Http4s700 for implicit extension method support
2026-01-22 15:26:59 +01:00
simonredfern
b4856ef2ac docfix: fixing dynamic-entity example response for list 2026-01-22 15:09:16 +01:00
hongwei
dbd046bf7c refactor(http4s): enhance CallContext extraction and validation chain
- Add withCallContext helper method to Http4sSupport for simplified endpoint code
- Document use of http4s Vault for type-safe request attributes storage
- Clarify that validated entities (bank, bankAccount, view, counterparty) are stored within CallContext
- Reorder validation chain in ResourceDocMiddleware to check roles before entity validation
- Add special handling for resource-docs endpoint with configurable role requirement
- Extract runValidationChain method to support both middleware and endpoint wrapping patterns
- Improve authentication error handling with better Box pattern matching
- Add comprehensive documentation and usage examples for CallContext extraction
- Enhance logging for validation chain execution and debugging
2026-01-22 14:36:58 +01:00
hongwei
e8999ba54c refactor(http4s): consolidate validated entities into CallContext
- Add bank, bankAccount, view, and counterparty fields to CallContext case class
- Remove individual Vault keys for User, Bank, BankAccount, View, and Counterparty from Http4sRequestAttributes
- Simplify Http4sRequestAttributes to store only CallContext in request attributes
- Update ResourceDocMiddleware to enrich CallContext with validated entities instead of storing them separately
- Remove ValidatedContext case class as validated entities are now part of CallContext
- Streamline request attribute management by centralizing all validated data in a single CallContext object
- Improves code maintainability and reduces complexity in the validation chain
2026-01-22 14:13:34 +01:00
Simon Redfern
f1a2915640
Merge pull request #2664 from simonredfern/develop
v6.0.0 versions of Dynamic Entities endpoints use entity_name rather than dynamic key
2026-01-22 11:46:58 +01:00
simonredfern
6466c8e9f7 Updating frozen metadata for Challenge Commons (added 3 new fields, not
a breaking change as long as Adapters are lenient on extra fields)
2026-01-22 11:05:47 +01:00
Marko Milić
c1a3d91db0 Merge upstream/develop into develop after conflict resolution 2026-01-22 09:21:48 +01:00
hongwei
baecbc110f Merge remote-tracking branch 'Simon/develop' into develop 2026-01-22 09:04:50 +01:00
simonredfern
3462363228 rebasefix: fixing errors introduced during rebase merging 2026-01-22 07:39:19 +01:00
simonredfern
b5282b4568 fixing merge rebase v6.0.0 of dynmaic endpoints with improved json 2026-01-22 07:39:19 +01:00
simonredfern
0b63bfcae3 Test isolation 2026-01-22 07:39:19 +01:00
simonredfern
191f867fd2 docfix: Added Connector.User.Authentication 2026-01-22 07:39:19 +01:00
karmaking
bb4e082160 add context lines to build failures 2026-01-22 07:39:19 +01:00
simonredfern
7a27d3ac0d Schema Validation tests 2026-01-22 07:39:19 +01:00
simonredfern
aaf04ee036 fixtest: GET my dynamic entity endpoint gets records the user created,
not just records with hasPersonalEntity=true. Previous behaviour was
confusing.
2026-01-22 07:39:19 +01:00
simonredfern
c0a0dfed0b fix tricky behaviour with personal dynamic endpoints. /my dynamic
entitity endpoints now return records created by user_id even if not via
/my endpoints (i.e. if created with another endpoint that requires a
role, the record is still yours)
2026-01-22 07:39:19 +01:00