Skip to content

feat: expose True() and False() constructors#27

Open
cnaples79 wants to merge 1 commit into
google:mainfrom
cnaples79:feat-true-false-constructors
Open

feat: expose True() and False() constructors#27
cnaples79 wants to merge 1 commit into
google:mainfrom
cnaples79:feat-true-false-constructors

Conversation

@cnaples79

Copy link
Copy Markdown

Summary

Expose two small convenience constructors in the public API:

  • : equivalent to the empty schema, validates any instance (marshals as ).
  • : equivalent to , validates no instance (marshals as ).

Rationale

When constructing schemas programmatically, it’s common to set fields (e.g. ) to JSON Schema booleans. Today this requires non-obvious patterns like . Public helpers improve readability and avoid duplicating these helpers across downstream codebases.

Changes

  • Add and in .
  • Tests: marshal behavior (/) and basic validate behavior using .

Fixes #13

@mrsimonemms

Copy link
Copy Markdown

Is there any prospect of this being merged in the near future? I'd like this for my JSON schema project too.

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.

Proposal/Request: Expose False() and True() constructors

2 participants