Skip to content

Factor out common types that don't depend on the exact schema into schema-dts-lib#213

Merged
Eyas merged 1 commit intogoogle:mainfrom
Eyas:newlib
Mar 22, 2026
Merged

Factor out common types that don't depend on the exact schema into schema-dts-lib#213
Eyas merged 1 commit intogoogle:mainfrom
Eyas:newlib

Conversation

@Eyas
Copy link
Copy Markdown
Collaborator

@Eyas Eyas commented Mar 22, 2026

This will be a breaking change for schema-dts-gen since the output of the generator will no longer be self contained, and will start referencing schema-dts-lib which needs to be imported by the user.

schema-dts itself is updated to start importing the library, so this is self contained for it.

We can't move WithContext, Graph, or SchemaValue out of our helper types though:

  • WithContext and Graph define the context specifically as "https://schema.org" which is not true for all schemas
  • SchemaValue depends on Role<> when Role is available/emitted

…hema-dts-lib.

This will be a breaking change for schema-dts-gen since the output of the generator will no longer be self contained, and will start referencing schema-dts-lib which needs to be imported by the user.

schema-dts itself is updated to start importing the library, so this is self contained for it.

We can't move WithContext, Graph, or SchemaValue out of our helper types though:

- WithContext and Graph define the context specifically as "https://schema.org" which is not true for all schemas
- SchemaValue depends on Role<> when Role is available/emitted
@Eyas
Copy link
Copy Markdown
Collaborator Author

Eyas commented Mar 22, 2026

@cochinescu this is basically what I have in mind.

The new merging utils would go here as well. WDYT?

@cochinescu
Copy link
Copy Markdown
Contributor

Yes, keeping WithContext, Graph, and SchemaValue in helper_types.ts while moving the schema-agnostic pieces into schema-dts-lib seems like the right split. The new merge utilities should fit there as well.

Once #213 lands, I can update #210 to move MergeLeafTypes and its internal helpers into schema-dts-lib while keeping the leaf export change in the generator. If you’d prefer, I can also stack that work on top of newlib before this merges, please lmk.

@Eyas Eyas merged commit 007eae2 into google:main Mar 22, 2026
5 checks passed
cochinescu added a commit to cochinescu/schema-dts that referenced this pull request Mar 23, 2026
Switch helper_types.ts back to SyntaxKind.TypeKeyword to match google#213.

Also run npm run fix:prettier to apply the requested TS/MD formatting updates.
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