Skip to content

Commit

Permalink
fixup! API refactor to make it harder to ignore errors
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonSapin committed Nov 23, 2023
1 parent f33645a commit 64610dd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion crates/apollo-compiler/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
On success they return the schema or document (unmodified) wrapped in a `Valid<_>` marker type,
which is **immutable**.
- Change `ExecutableDocument` to require a `&Valid<Schema>` instead of `&Schema`,
forcing callers to either run validation or opt out explicitly with `Valid::assert_valid`.
forcing callers to either run validation or opt out explicitly with `Valid::assume_valid`.
- Make `parse_mixed` and `to_mixed` validate both the schema and document.
Rename them with a `_validate` suffix.
- Corresponding changes to all of the above in `Parser` method signatures
Expand Down
4 changes: 2 additions & 2 deletions crates/apollo-compiler/src/validation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub use crate::node::NodeLocation;
/// * [`ExecutableDocument::parse_and_validate`]
/// * [`ExecutableDocument::validate`]
///
/// … or by explicitly skipping it with [`Valid::assert_valid`].
/// … or by explicitly skipping it with [`Valid::assume_valid`].
///
/// The schema or document inside `Valid<T>` is immutable (`&mut T` is not given out).
/// It can be extracted with [`into_inner`][Self::into_inner],
Expand All @@ -62,7 +62,7 @@ impl<T> Valid<T> {
/// the document is known through some other means to be valid.
/// For example, if it was loaded from some external storag
/// where it was only stored after validation.
pub fn assert_valid(document: T) -> Self {
pub fn assume_valid(document: T) -> Self {
Self(document)
}

Expand Down

0 comments on commit 64610dd

Please sign in to comment.