Skip to content

Commit

Permalink
Merge pull request #5 from typst-community/next
Browse files Browse the repository at this point in the history
Version 0.2.0
  • Loading branch information
jamesrswift authored May 27, 2024
2 parents 0f57af2 + 65eba30 commit 1a0a7fd
Show file tree
Hide file tree
Showing 65 changed files with 1,769 additions and 1,097 deletions.
31 changes: 28 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,42 @@
# [unreleased](https://github.com/jamesxX/valakyrie/releases/tags/)
# [v0.2.0](https://github.com/typst-community/valakyrie/releases/tags/v0.2.0)

`Valkyrie` is now a community-lead project and is now homed on the typst-community organisation.

## Added
- `Boolean` validation type
- `Content` validation type. Also accepts strings which are coerced into content types.
- `Color` validation type.
- `Optional` validation type. If a schema yields a validation error, the error is suppressed and the returned value is 'auto'
- `Choice` validation type. Tested value must be contained within the listed choices.
- `Date` validation type.
- Dictionaries can now provide a list of aliases for members.
- Dictionaries can now be coerced from values
- Arrays can be coerced from singular values.

## Removed

## Changed
- **(Breaking)** Schema generator function arguments are now uniform. Types are all now effectively a curried form of `base-type`. A table is provided in the manual to document these arguments.
- **(Breaking)** `transform` argument has been replaced with `pre-transform` (applied prior to validation), and `post-transform` (applied after validation).
- **(Breaking)** Dictionaries now take the schema definition of members as a dictionary in the first positional argument rather than a sink of named arguments.
- **(Breaking)** `strict` contextual flag is now applied on the type level rather than directly in the parse function. It is currently only applied in the dictionary type, and will cause an assertion to fail if s
- **(Breaking)** Dictionaries default to empty dictionaries rather than none.
- **(Potentially breaking)** Dictionaries that don't have a member that is present in the schema no longer produce an error outside of `strict` contexts.
- **(Potentially breaking)** `strict` contextual flag is now applied on the type level rather than directly in the parse function. It is currently only applied in the dictionary type, and will cause an assertion to fail if set to `true` when object being validated contains keys unknown to the schema.
- **(Breaking)** Assertions on values have been moved from named arguments to assertion generator functions.

## Migration guide from v0.1.X
- Dictionary schema definitions will need additional braces to account for a change in the API layout
- `transform` is now `pre-transform`, and can be used to coerce values into types
- Assertions regarding the value being validated (length, magnitude, regex match) have now been moved from being named arguments to being passed in the `assertions` argument as an array.

---

# [v0.1.1](https://github.com/jamesxX/valakyrie/releases/tags/v0.1.1)
# [v0.1.1](https://github.com/typst-community/valakyrie/releases/tags/v0.1.1)
## Changed
- fixed syntax error in Typst 0.11+ because of internal context type

---

# [v0.1.0](https://github.com/jamesxX/valakyrie/releases/tags/v0.1.0)
# [v0.1.0](https://github.com/typst-community/valakyrie/releases/tags/v0.1.0)
Initial Release
8 changes: 6 additions & 2 deletions Justfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
set windows-powershell := true
root := justfile_directory()

export TYPST_ROOT := root

[private]
Expand All @@ -16,7 +16,11 @@ test *args:

# update test cases
update *args:
typst-test run {{ args }}
typst-test update {{ args }}

# run ci suite
ci: test doc

# Typstyle
style:
typstyle -i format-all
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# The `Valkyrie` Package
<div align="center">Version 0.1.1</div>
<div align="center">Version 0.2.0</div>

This package implements type validation, and is targetted mainly at package and template developers. The desired outcome is that it becomes easier for the programmer to quickly put a package together without spending a long time on type safety, but also to make the usage of those packages by end-users less painful by generating useful error messages.
This package implements type validation, and is targeted mainly at package and template developers. The desired outcome is that it becomes easier for the programmer to quickly put a package together without spending a long time on type safety, but also to make the usage of those packages by end-users less painful by generating useful error messages.

## Example Usage
```typ
#import "@preview/valkyrie:0.1.1" as z
#import "@preview/valkyrie:0.2.0" as z
#let my-schema = z.dictionary(
should-be-string: z.string(),
Expand Down Expand Up @@ -33,3 +33,7 @@ This package implements type validation, and is targetted mainly at package and
my-schema,
)
```

## Community-lead

As of version 0.2.0, `valkyrie` now resides in the typst-community organisation. Typst users are encouraged to submit additional types, assertions, coercions, and schemas that they believe are already used widely, or should be widely adopted for the health of the ecosystem.
Binary file modified docs/manual.pdf
Binary file not shown.
Loading

0 comments on commit 1a0a7fd

Please sign in to comment.