Schema / Document how to introduce jsonSchema
annotation type constraints in user-space.
#2726
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Type
Description
This PR tries to address the points discussed in #2663;
Context
The outcome of the discussion and decision in n2663 is that
@effect/schema
will not extend nor maintain its internal typings forJSONSchema7
. Instead, it will push such responsibility to the user space; the reasons are sound, and you can explore them by following the discussion.However, it has also been decided to update the docs to showcase one possible technique and provide an example of how to achieve the same results that n2663 aimed to solve (better type safety and improved DX).
Changes
The
README.md
file in the schema package has been updated to provide detailed guidance on managing type constraints when dealing with non-standard extensions via thejsonSchema
property. The update includes a code example demonstrating how to apply type constraints using the@types/json-schema
package for TypeScript definitions.Related