The pgxn_meta crate provides PGXN Meta Spec validation
The PGXN Meta Spec defines the requirements for the metadata file
(META.json
) file for PGXN source distribution packages. This project
provides Rust a crates for working with spec META.json
files.
Click to show `Cargo.toml`.
[dependencies]
serde_json = "1.0"
pgxn_meta = "0.1"
use serde_json::json;
use pgxn_meta::*;
func main() {
// Parse the contents of a META.json file into a serde_json Value
let meta = json!({
"name": "pair",
"abstract": "A key/value pair data type",
"version": "0.1.8",
"maintainer": "theory <theory@pgxn.org>",
"license": "postgresql",
"provides": {
"pair": {
"file": "sql/pair.sql",
"version": "0.1.8"
}
},
"meta-spec": { "version": "1.0.0" }
});
// Validate the META.json contents.
let mut validator = Validator::new();
if let Err(e) = validator.validate(&meta) {
panic!("Validation failed: {e}");
};
}
See the pgxn_meta
docs on docs.rs for complete details.
There are several ways to install pgxn_meta
.
Install the universal binary installer (ubi) and use it to install
pgxn_meta
and many other tools.
ubi --project pgxn/meta --in ~/bin
Grab the appropriate binary release, untar or unzip it, and put the
pgxn_meta
executable somewhere in your path.
Compile and install pgxn_meta
via cargo
by running:
cargo install pgxn_meta
See the cargo docs to learn where the binary will be installed.
Simply execute pgxn_meta
to validate the PGXN META.json
file in the
current directory:
pgxn_meta
If the file has a different name, simply pass it:
pgxn_meta widget.json
We welcome community contributions to this project. All contributors must abide by the PostgresSQL Code of Conduct.
- Create Issues to submit bug reports and feature requests
- Submit Pull Requests to fix issues or add features
This project is distributed under the PostgreSQL License.