Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Draft WASM validation logic #269

Closed
wants to merge 2 commits into from

Conversation

nicholascioli
Copy link

This commit adds a partial implementation of validation of a string schema, which will be useful in WASM contexts where operating on Rust types does not work.

This implementation is partial as it can still trigger a panic if a directive is invalid.

}

// First we need to create an actul schema from the provided one
let schema = apollo_compiler::Schema::parse(subgraph_schema, "")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can use parse_and_validate i think

// Process the @source directives
let sources = schema
.referencers()
.get_directive(&SOURCE_DIRECTIVE_NAME_IN_SPEC)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will error if it can't find any sources — before we do anything, we should first check to see if the @link is present using schema.metadata() (and return early if it's not), and we should ignore the Err case for sources since they're optional.

@nicholascioli
Copy link
Author

This is no longer needed, as it is out of date and will be made anew.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants