Skip to content

Commit

Permalink
chore: publish 0.2.0 🎉
Browse files Browse the repository at this point in the history
  • Loading branch information
ifiokjr committed Dec 11, 2022
1 parent 5e2b7e0 commit 387e152
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "package_json_schema"
version = "0.1.2"
version = "0.2.0"
authors = ["Ifiok Jr. <ifiokotung@gmail.com>"]
categories = ["encoding", "config"]
documentation = "https://docs.rs/package_json_schema"
Expand Down
6 changes: 5 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

## [Unreleased]

> [Compare](https://github.com/ifiokjr/package_json_schema/compare/0.1.2...HEAD)
> [Compare](https://github.com/ifiokjr/package_json_schema/compare/0.2.0...HEAD)
## 0.2.0

> [2022-12-11](https://github.com/ifiokjr/package_json_schema/compare/0.1.2...0.2.0)
- Make versions of dependencies less strict, for better compatibility with other packages.
- Re-export the `validator` crate when the `validate` feature is enabled as requested in [#1](https://github.com/ifiokjr/package_json_schema/issues/1).
Expand Down
10 changes: 5 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ You want to load a `package.json` file and interact with it as a struct.
Add this line to the `[dependencies]` section of your `Cargo.toml`:

```toml
package_json_schema = "0.1.0"
package_json_schema = "0.2.0"
```

If you would like to include validation then add the `validate` feature.

```toml
package_json_schema = { version = "0.1.0", features = ["validate"] }
package_json_schema = { version = "0.2.0", features = ["validate"] }
```

This adds the `validator` crate as a dependency and adds the `.validate()` method to the `PackageJson` struct. The fields are validated according to the [JSON schema specification](https://json.schemastore.org/package.json).
Expand All @@ -46,7 +46,7 @@ use package_json_schema::PackageJson;
let contents = r###"
{
"name": "my-package",
"version": "0.1.0",
"version": "0.2.0",
"dependencies": {
"@sveltejs/kit": "1.0.0-next.396"
},
Expand All @@ -58,7 +58,7 @@ let contents = r###"

let package_json = PackageJson::try_from(contents).unwrap();
assert_eq!(package_json.name.unwrap(), "my-package");
assert_eq!(package_json.version.unwrap(), "0.1.0");
assert_eq!(package_json.version.unwrap(), "0.2.0");
```

This crate leaves it to the user to load the `package.json` content from the filesystem. Here is an example of loading the file contents and parsing the contents into a struct.
Expand Down Expand Up @@ -100,7 +100,7 @@ assert_eq!(
To validate the `package.json` fields, enable the `validate` feature.

```toml
package_json_schema = { version = "0.1.0", features = ["validate"] }
package_json_schema = { version = "0.2.0", features = ["validate"] }
```

And then use the `validate` method.
Expand Down

0 comments on commit 387e152

Please sign in to comment.