Add v4.0.1 support and PCRE pattern handling#299
Open
OBPeteS wants to merge 1 commit into
Open
Conversation
Add support for Open Banking UK v4.0.1: new OpenAPI spec files, conditionality entries and payment/account manifests. Introduce PCRE (regexp2) compilation/evaluation for OpenAPI `pattern` fields and related tests (regexp2 compiler and pcre support tests), and update openapi3 validators to use it. Bump dependencies (github.com/getkin/kin-openapi, github.com/stretchr/testify, add github.com/dlclark/regexp2, etc.). Fix failing negative standing-order consent tests by setting Content-Type: application/json in manifests, and update JWS b64 encoding handling and project version/docs to v1.9.8-beta1.
There was a problem hiding this comment.
Pull request overview
This pull request updates the conformance suite to support Open Banking UK v4.0.1 by adding the corresponding OpenAPI spec assets and wiring the suite’s OpenAPI validation to compile/evaluate pattern constraints using a PCRE-capable engine (regexp2). It also bumps key Go dependencies (notably kin-openapi), updates manifests/tests to satisfy stricter header validation, and refreshes versioning/release documentation for v1.9.8-beta1.
Changes:
- Add Open Banking UK v4.0.1 spec assets and register them in specification/conditionality metadata.
- Switch OpenAPI regex compilation/validation to
regexp2(PCRE support) and add targeted unit/integration tests. - Bump Go dependencies (incl.
kin-openapiandtestify), fix manifest Content-Type for negative standing order tests, and update version/docs.
Reviewed changes
Copilot reviewed 21 out of 26 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Adds a new repo-root Yarn lockfile. |
| README.md | Updates displayed version/tag and supported standard versions (incl. v4.0.1). |
| pkg/version/version.go | Bumps suite version to 1.9.8 with prerelease beta1. |
| pkg/schema/spec/v4.0.1/variable-recurring-payments-openapi.json | Adds v4.0.1 VRP OpenAPI spec asset. |
| pkg/schema/spec/v4.0.1/confirmation-funds-openapi.json | Adds v4.0.1 Confirmation of Funds OpenAPI spec asset. |
| pkg/schema/spec/v4.0.0/variable-recurring-payments-openapi.json | Adds x-idempotency-key pattern to align with OB spec (PCRE). |
| pkg/schema/spec/v4.0.0/payment-initiation-openapi.json | Adds x-idempotency-key pattern to align with OB spec (PCRE). |
| pkg/schema/spec/v4.0.0/cvrp-openapi.json | Adds x-idempotency-key pattern to align with OB spec (PCRE). |
| pkg/schema/spec/v4.0.0/confirmation-funds-openapi.json | Adds x-idempotency-key pattern to align with OB spec (PCRE) and adjusts formatting. |
| pkg/schema/spec/v4.0.0/account-info-openapi.json | Adds x-idempotency-key pattern to align with OB spec (PCRE). |
| pkg/schema/regexp2_compiler.go | Introduces a regexp2-backed RegexCompiler with a finite match timeout. |
| pkg/schema/pcre_support_test.go | Adds tests covering PCRE compilation/matching and spec load/validation for v4.0.0/v4.0.1. |
| pkg/schema/openapi3Validator.go | Wires regexp2 compiler into spec validation/router creation and response validation; adapts to openapi3.Types changes. |
| pkg/schema/openapi3Validator_test.go | Updates fixtures to include required response headers; adds nil-safety tests. |
| pkg/schema/openapi3ResponseValidator_test.go | Ensures required OB response headers are present in test fixtures under newer kin-openapi. |
| pkg/model/specification.go | Registers v4.0.1 spec metadata (identifiers, URLs, schema locations). |
| pkg/model/condition_static.go | Adds conditionality entries for v4.0.1 APIs. |
| pkg/authentication/jws.go | Treats v4.0.1 as equivalent to v4.0.0 for JWS b64 encoding selection. |
| manifests/ob_4.0_payment_fca.json | Sets Content-Type: application/json for failing standing order consent test. |
| manifests/ob_3.1_payment_fca.json | Sets Content-Type: application/json for failing standing order consent test. |
| go.sum | Updates checksums for bumped/new dependencies (incl. regexp2, kin-openapi, testify). |
| go.mod | Bumps kin-openapi/testify and adds regexp2 plus updated indirect deps. |
| docs/releases/v1.9.6.md | Corrects referenced v4 test case ID in historical release notes. |
| docs/releases/releases.md | Adds v1.9.8-beta1 release entry and fixes/corrects referenced test IDs; updates compare links. |
Comments suppressed due to low confidence (1)
pkg/schema/pcre_support_test.go:26
- Same as above: this test uses a raw string with
\\S, which changes the meaning of the regex compared to the spec pattern. Use a pattern string that results in\Sin the regex engine (e.g.^(?!\s)(.*)(\S)$).
func TestRegexp2CompilerSetsMatchTimeout(t *testing.T) {
m, err := regexp2Compiler(`^(?!\s)(.*)(\\S)$`)
require.NoError(t, err)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+15
to
+17
| func TestRegexp2CompilerPCREPattern(t *testing.T) { | ||
| _, err := regexp2Compiler(`^(?!\s)(.*)(\\S)$`) | ||
| require.NoError(t, err) |
|
|
||
| - Added support for Open Banking UK v4.0.1 OpenAPI schema files | ||
|
|
||
| ## Fixed |
| - Added tests `OB-301-DOP-1015003` and `OB-400-DOP-1015003` which validate the following: | ||
| - Added tests `OB-301-DOP-1015003` and `OB-400-DOP-101503` which validate the following: | ||
| - OB-301-DOP-1015003 (v3): validates that `NumberOfPayments` and `FinalPaymentDateTime` are correctly rejected when included in a consent payload at the same time. | ||
| - OB-400-DOP-101500 (v4): validates that `CountPerPeriod` and `FinalPaymentDateTime` are correctly rejected when included in a consent payload at the same time. |
| - Added tests `OB-301-DOP-1015003` and `OB-400-DOP-1015003` which validate the following: | ||
| - Added tests `OB-301-DOP-1015003` and `OB-400-DOP-101503` which validate the following: | ||
| - OB-301-DOP-1015003 (v3): validates that `NumberOfPayments` and `FinalPaymentDateTime` are correctly rejected when included in a consent payload at the same time. | ||
| - OB-400-DOP-101500 (v4): validates that `CountPerPeriod` and `FinalPaymentDateTime` are correctly rejected when included in a consent payload at the same time. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add support for Open Banking UK v4.0.1: new OpenAPI spec files, conditionality entries and payment/account manifests. Introduce PCRE (regexp2) compilation/evaluation for OpenAPI
patternfields and related tests (regexp2 compiler and pcre support tests), and update openapi3 validators to use it. Bump dependencies (github.com/getkin/kin-openapi, github.com/stretchr/testify, add github.com/dlclark/regexp2, etc.). Fix failing negative standing-order consent tests by setting Content-Type: application/json in manifests, and update JWS b64 encoding handling and project version/docs to v1.9.8-beta1.