Skip to content

feat(types): add basic pattern types - #41

Merged
nfroidure merged 2 commits into
mainfrom
feat/pattern_types
Jun 8, 2026
Merged

nfroidure merged 2 commits into
mainfrom
feat/pattern_types

Conversation

@nfroidure

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces pattern-aware TypeScript type generation for JSON Schema pattern constraints, aiming to produce more specific string types (notably via template literal types) instead of plain string.

Changes:

  • Added a new generateTypeFromPattern() utility to convert regex patterns into TypeScript TypeNodes.
  • Integrated pattern handling into JSON Schema string type generation.
  • Added Jest tests and updated existing snapshots/output expectations; introduced regexpp as a dependency.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/utils/patterns.ts New utility for deriving TypeScript types from regex patterns.
src/utils/patterns.test.ts New Jest test coverage for the pattern-to-type generator.
src/utils/jsonSchema.ts Hooks pattern-derived types into JSON Schema string handling.
src/index.test.ts Snapshot/output updates affected by new type generation behavior.
src/snapshots/index.test.ts.snap Updated snapshots showing refined string/template literal types.
package.json Adds regexpp dependency.
package-lock.json Locks regexpp dependency version and metadata.

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

Comment thread src/utils/patterns.ts Resolved
Comment thread src/utils/patterns.ts Resolved
Comment thread src/utils/patterns.test.ts Resolved
Comment thread src/utils/jsonSchema.ts Resolved
Comment thread src/utils/patterns.ts Resolved
Comment thread src/utils/patterns.ts Resolved
Comment thread src/utils/patterns.test.ts Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated 7 comments.

Comment thread src/utils/patterns.ts Resolved
Comment thread src/utils/patterns.ts Resolved
Comment thread src/utils/patterns.ts Resolved
Comment thread src/utils/patterns.ts Resolved
Comment thread src/utils/jsonSchema.ts Resolved
Comment thread src/utils/patterns.test.ts Resolved
Comment thread src/utils/patterns.test.ts Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated 20 comments.

Comment thread src/utils/jsonSchema.ts Resolved
Comment thread src/index.ts Resolved
Comment thread src/index.ts Resolved
Comment thread src/index.ts Resolved
Comment thread src/index.ts Resolved
Comment thread src/index.ts Resolved
Comment thread README.md Resolved
Comment thread README.md Resolved
Comment thread API.md Resolved
Comment thread API.md Resolved
@nfroidure
nfroidure force-pushed the feat/pattern_types branch from 0245159 to d23b1a3 Compare June 5, 2026 11:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread src/utils/patterns.ts Resolved
Comment thread src/utils/patterns.test.ts Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated 8 comments.

Comment thread src/index.ts Resolved
Comment thread src/index.ts Resolved
Comment thread src/index.ts Resolved
Comment thread README.md Resolved
Comment thread README.md Resolved
Comment thread API.md Resolved
Comment thread API.md Resolved
Comment thread src/utils/patterns.ts Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated 8 comments.

Comment thread src/utils/patterns.ts Resolved
Comment thread src/index.ts Resolved
Comment thread src/index.ts Resolved
Comment thread README.md Resolved
Comment thread API.md Resolved
Comment thread fixtures/openapi/diagrams.json Resolved
Comment thread fixtures/openapi/diagrams.json Resolved
Comment thread fixtures/openapi/diagrams.json Resolved
@nfroidure
nfroidure force-pushed the feat/pattern_types branch from ac99e74 to 969919a Compare June 8, 2026 08:01
@nfroidure
nfroidure merged commit 69322b4 into main Jun 8, 2026
1 check passed
@nfroidure
nfroidure deleted the feat/pattern_types branch June 8, 2026 08:03
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.

2 participants