Skip to content

Commit

Permalink
Use changelog-version-notes-action@main
Browse files Browse the repository at this point in the history
  • Loading branch information
theory committed Sep 9, 2024
1 parent b51d1a5 commit 02c499b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ jobs:
if: matrix.toolchain == 'stable' && startsWith( github.ref, 'refs/tags/v' )
- name: Generate Release Notes
id: notes
uses: theory/changelog-version-notes-action@v0
uses: theory/changelog-version-notes-action@main
with: { version: "${{ env.VERSION }}" }
- name: Publish GitHub Release
uses: softprops/action-gh-release@v2
Expand Down
9 changes: 9 additions & 0 deletions src/valid/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ impl fmt::Display for ValidationError {
}
}
}

/// The base URL for all JSON schemas.
const SCHEMA_BASE: &str = "https://pgxn.org/meta/v";

impl Default for Validator {
Expand All @@ -91,6 +93,11 @@ impl Validator {
///
/// new creates and returns a new Validator with the schemas loaded from
/// `dir`.
///
/// ``` rust
/// use pgxn_meta::valid::*;
/// let validator = Validator::new();
/// ```
pub fn new() -> Validator {
Validator {
compiler: compiler::new(),
Expand All @@ -103,6 +110,8 @@ impl Validator {
/// Load a `META.json` file into a serde_json::value::Value and pass it
/// for validation. Returns a the Meta spec version on success and a
/// validation error on failure.
///
/// See the [module docs](crate::valid) for an example.
pub fn validate<'a>(&'a mut self, meta: &'a Value) -> Result<u8, Box<dyn Error + '_>> {
let v = util::get_version(meta).ok_or(ValidationError::UnknownSpec)?;
let id = format!("{SCHEMA_BASE}{v}/distribution.schema.json");
Expand Down

0 comments on commit 02c499b

Please sign in to comment.