forked from spruceid/linked-data-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move main package to workspace's toplevel.
Bump `rdf-types` to version 0.22.0 Update `README.md` (add badges) Add CI workflow.
- Loading branch information
1 parent
1ad96c2
commit 2afead7
Showing
42 changed files
with
912 additions
and
970 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Continuous Integration | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
env: | ||
CARGO_TERM_COLORS: always | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Retrieve MSRV | ||
id: msrv | ||
run: echo "MSRV=$(cat Cargo.toml | grep -Po '(?<=rust-version = ")([\d\.]+)')" >> $GITHUB_OUTPUT | ||
- name: Install Rust | ||
uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: ${{ steps.msrv.outputs.MSRV }} | ||
- name: Build | ||
run: cargo build --all-features --verbose | ||
- name: Run tests | ||
run: cargo test --all-features --verbose | ||
|
||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Install Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
components: rustfmt | ||
- name: Check formatting | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: fmt | ||
args: --all -- --check | ||
- name: Clippy | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: clippy | ||
args: --all-features -- -D warnings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,47 @@ | ||
[package] | ||
name = "linked-data" | ||
authors = ["Spruce Systems, Inc."] | ||
license = "MIT/Apache-2.0" | ||
description = "Linked-Data dateset serialization/deserialization traits" | ||
categories = ["encoding", "web-programming"] | ||
keywords = ["semantic-web", "linked-data", "rdf", "serialization"] | ||
repository = "https://github.com/spruceid/linked-data-rs" | ||
edition = "2021" | ||
rust-version = "1.71.1" | ||
version = "0.1.0" | ||
|
||
[features] | ||
default = ["derive", "serde"] | ||
derive = ["linked-data-derive"] | ||
|
||
[dependencies] | ||
rdf-types = "0.22.0" | ||
xsd-types = "0.9.2" | ||
static-iref = "3.0" | ||
json-syntax = { version = "0.12.2", features = ["canonicalize"] } | ||
educe = "0.4.22" | ||
im = "15.1.0" | ||
iref.workspace = true | ||
thiserror.workspace = true | ||
linked-data-derive = { workspace = true, optional = true } | ||
serde = { version = "1.0", features = ["derive"], optional = true } | ||
|
||
[dev-dependencies] | ||
json-syntax = { version = "0.12.2", features = ["serde"] } | ||
|
||
[[example]] | ||
name = "derive" | ||
required-features = ["derive"] | ||
|
||
[workspace] | ||
members = [ | ||
"linked-data", | ||
"linked-data-derive" | ||
"derive" | ||
] | ||
|
||
resolver = "2" | ||
|
||
[workspace.dependencies] | ||
linked-data = { version = "0.1", path = "linked-data" } | ||
linked-data-derive = { version = "0.1", path = "linked-data-derive" } | ||
linked-data-derive = { version = "0.1", path = "derive" } | ||
iref = "3.0" | ||
static-iref = "3.0" | ||
thiserror = "1.0.47" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
# Linked-Data serialization and deserialization primitives | ||
|
||
[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/spruceid/linked-data-rs/ci.yml?style=flat-square&logo=github)](https://github.com/spruceid/linked-data-rs/actions) | ||
[![Crate informations](https://img.shields.io/crates/v/linked-data.svg?style=flat-square)](https://crates.io/crates/linked-data) | ||
[![Crates.io MSRV](https://img.shields.io/crates/msrv/linked-data?style=flat-square)](https://crates.io/crates/linked-data) | ||
[![License](https://img.shields.io/crates/l/linked-data.svg?style=flat-square)](https://github.com/spruceid/linked-data-rs#license) | ||
[![Documentation](https://img.shields.io/badge/docs-latest-blue.svg?style=flat-square)](https://docs.rs/linked-data) | ||
|
||
<!-- cargo-rdme start --> | ||
|
||
This library provides primitive traits to serialize and deserialize | ||
|
@@ -11,9 +17,8 @@ feature) that can automatically implement those primitives for you. | |
```rust | ||
use iref::IriBuf; | ||
use static_iref::iri; | ||
use linked_data::LinkedData; | ||
|
||
#[derive(LinkedData)] | ||
#[derive(linked_data::Serialize, linked_data::Deserialize)] | ||
#[ld(prefix("ex" = "http://example.org/"))] | ||
struct Foo { | ||
#[ld(id)] | ||
|
@@ -32,7 +37,9 @@ let value = Foo { | |
email: "[email protected]".to_owned() | ||
}; | ||
|
||
let quads = linked_data::to_quads(rdf_types::generator::Blank::new(), &value).expect("RDF serialization failed"); | ||
let quads = linked_data::to_quads(rdf_types::generator::Blank::new(), &value) | ||
.expect("RDF serialization failed"); | ||
|
||
for quad in quads { | ||
use rdf_types::RdfDisplay; | ||
println!("{} .", quad.rdf_display()) | ||
|
@@ -46,3 +53,18 @@ This should print the following: | |
``` | ||
|
||
<!-- cargo-rdme end --> | ||
|
||
## License | ||
|
||
Licensed under either of | ||
|
||
* Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) | ||
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) | ||
|
||
at your option. | ||
|
||
### Contribution | ||
|
||
Unless you explicitly state otherwise, any contribution intentionally submitted | ||
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any | ||
additional terms or conditions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
[changelog] | ||
header = """ | ||
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
""" | ||
|
||
body = """ | ||
{% if version %}\ | ||
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} | ||
{% else %}\ | ||
## [unreleased] | ||
{% endif %}\ | ||
{% for group, commits in commits | group_by(attribute="group") %} | ||
### {{ group | upper_first }} | ||
{% for commit in commits %} | ||
- [{{ commit.id | truncate(length=7, end="") }}] {{ commit.message }}\ | ||
{% endfor %} | ||
{% endfor %}\n | ||
""" | ||
# Remove the leading and trailing whitespace. | ||
trim = true | ||
|
||
[git] | ||
# Ignore conventional commits. | ||
conventional_commits = false | ||
filter_unconventional = false | ||
|
||
# Process each line of a commit as an individual commit. | ||
split_commits = true | ||
|
||
# Regex for parsing and grouping commits. | ||
commit_parsers = [ | ||
{ message = "^[aA]dd( |ed)", group = "Added"}, | ||
{ message = "^[iI]mpl", group = "Added"}, | ||
{ message = "^[fF]ix( |ed)", group = "Fixed"}, | ||
{ message = "^[cC]hange( |ed)", group = "Changed"}, | ||
{ message = "^[mM]ove( |d)", group = "Changed"}, | ||
{ message = "^[rR]estructure( |d)", group = "Changed"}, | ||
{ message = "^[rR]efactor( |ed)", group = "Changed"}, | ||
{ message = "^[rR]emove( |d)", group = "Removed"}, | ||
{ message = "^[uU]pgrade( |d)", group = "Build"}, | ||
{ message = "^[bB]ump( |ed)", group = "Build"} | ||
] | ||
|
||
# Protect breaking changes from being skipped due to matching a skipping commit_parser. | ||
protect_breaking_commits = false | ||
|
||
# Filter out the commits that are not matched by commit parsers. | ||
filter_commits = true | ||
|
||
# Glob pattern for matching git tags | ||
tag_pattern = "[0-9\\.]*" | ||
|
||
# Sort the commits inside sections by oldest/newest order | ||
sort_commits = "oldest" |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.