Skip to content

#827 fix boolpredicate validation#828

Open
walker-sean wants to merge 2 commits intoopenapistack:mainfrom
walker-sean:fix/827
Open

#827 fix boolpredicate validation#828
walker-sean wants to merge 2 commits intoopenapistack:mainfrom
walker-sean:fix/827

Conversation

@walker-sean
Copy link

@walker-sean walker-sean commented Mar 2, 2026

Closes #827

  • OpenAPIBackend constructor fixed to properly assign the validate option as a member.
  • Also renamed BoolPredicate to the more precise, less redundant ContextPredicate
  • Added tests to verify use of predicates as validate value

Copilot AI review requested due to automatic review settings March 2, 2026 23:23
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes issue #827 where supplying a predicate function for OpenAPIBackend’s validate option was being coerced to true, preventing conditional validation from working.

Changes:

  • Rename BoolPredicate to ContextPredicate and update the validate option/member types accordingly.
  • Fix OpenAPIBackend constructor to preserve the validate option value (boolean or predicate) instead of coercing it.
  • Add tests covering predicate-based validation behavior (skip vs run validation).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/backend.ts Updates predicate type name and fixes validate assignment to avoid boolean coercion.
src/backend.test.ts Adds regression tests ensuring validate predicates are invoked and affect validation flow.
Comments suppressed due to low confidence (1)

src/backend.ts:75

  • Renaming the exported BoolPredicate type to ContextPredicate is a breaking public API change for TypeScript consumers (they may import BoolPredicate today), but the package version is still on the v5 minor line. Consider keeping a backward-compatible alias export (e.g. export type BoolPredicate = ContextPredicate with a @deprecated tag) so existing imports keep compiling while still steering users to the new name.
export type HandlerMap = { [operationId: string]: Handler | undefined };

export type ContextPredicate = (context: Context, ...args: any[]) => boolean;

/**
 * The different possibilities for set matching.
 *
 * @enum {string}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

BoolPredicate validate option does not work

2 participants