Skip to content

fix(data-format): ajv warnings#1732

Merged
alexandre-abrioux-rf merged 1 commit into
masterfrom
ajv-strict-pattern-string
Jun 5, 2026
Merged

fix(data-format): ajv warnings#1732
alexandre-abrioux-rf merged 1 commit into
masterfrom
ajv-strict-pattern-string

Conversation

@alexandre-abrioux-rf
Copy link
Copy Markdown
Contributor

@alexandre-abrioux-rf alexandre-abrioux-rf commented Jun 4, 2026

This fixes AJV's warnings when initializing the library:

  console.warn
    strict mode: missing type "string" for keyword "pattern" at "#/properties/invoiceItems/items/properties/tax/else/properties/amount" (strictTypes)

      at checkStrictMode (node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/lib/compile/util.ts:212:18)
      at strictTypesError (node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/lib/compile/validate/index.ts:331:18)
      at checkKeywordTypes (node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/lib/compile/validate/index.ts:305:9)
      ...

AJV warns that regex patterns only apply to strings, so they should be explicitly specified in the schema, as we already do for other patterns.

@alexandre-abrioux-rf alexandre-abrioux-rf marked this pull request as ready for review June 4, 2026 17:39
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Jun 4, 2026

Greptile Summary

This PR adds explicit "type": "string" declarations alongside the "pattern" keywords in the tax.amount conditional (if/then/else) branches of the invoice schema, silencing AJV v8 strict-mode warnings that fire because regex patterns are only meaningful on strings.

  • The two additions are in the then and else branches of the invoiceItems[].tax.amount conditional validator, mirroring the style already used for every other pattern-bearing property in the schema.
  • No other pattern occurrences in the file were missing their type, so the fix is complete within this schema version.

Confidence Score: 5/5

Safe to merge — the change adds missing type annotations to a JSON schema without altering any validation logic or accepted values.

Both additions simply co-locate "type": "string" next to existing "pattern" keywords. Every other pattern in the schema already had this annotation; the change brings the two conditional branches in line with the rest of the file. Validation behavior is unchanged for valid inputs; the only effect is that AJV strict-mode no longer emits warnings on initialisation.

No files require special attention.

Important Files Changed

Filename Overview
packages/data-format/src/format/rnf_invoice/rnf_invoice-0.0.3.json Added "type": "string" to both then and else branches of the tax.amount conditional — all pattern keywords in the file now have an explicit type, eliminating AJV strict-mode warnings.

Reviews (1): Last reviewed commit: "fix(data-format): ajv warnings" | Re-trigger Greptile

@alexandre-abrioux-rf alexandre-abrioux-rf merged commit ada584b into master Jun 5, 2026
19 checks passed
@alexandre-abrioux-rf alexandre-abrioux-rf deleted the ajv-strict-pattern-string branch June 5, 2026 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants