-
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.
- Loading branch information
Showing
5 changed files
with
152 additions
and
2 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,31 @@ | ||
name: cargo publish | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
crate: | ||
description: "Crate" | ||
required: true | ||
type: choice | ||
options: | ||
- litho-diagnostics | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install Rust Stable | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
components: rustfmt | ||
- name: Publish | ||
run: cargo publish | ||
working-directory: ${{ inputs.crate }}/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Litho Diagnostics | ||
|
||
This crate implements all diagnostics that [Litho](https://litho.dev) (a GraphQL | ||
framework) can emit. | ||
|
||
Within Litho, these diagnostics are emitted by the lexer, parser, type checker | ||
and compiler. Typically, each of those can emit multiple diagnostics without | ||
bailing out after the first diagnostic, but the compiler will only advance to | ||
the next phase if there are no errors in the previous phase. | ||
|
||
## Usage | ||
|
||
All diagnostics are generated by a DSL Macro (see source code), implement | ||
`DiagnosticInfo<S>` and are generic with respect to the span that triggered | ||
the diagnostic. Diagnostics consist of an error code, name, message and zero or | ||
more labels. Labels are additional hints that refer to a separate span in the | ||
source code. | ||
|
||
### Example | ||
|
||
Below is an example of a diagnostic that Litho generates: | ||
`MissingArgumentsClosingParentheses`. It starts with the `code` in square | ||
brackets, followed by a `message`. It shows a snippet of the lines that caused | ||
the diagnostic along with the primary span that starts at `graphql:6:20`. And | ||
finally, it also shows two more spans (`first` and `second`) with additional | ||
hints. | ||
|
||
```graphql | ||
[E0006] Error: Arguments are missing closing parenthesis. | ||
|
||
╭─[graphql:6:20] | ||
│ | ||
6 │ field(arg: true | ||
· ┬ ┬ | ||
· ╰──────────── This `(` here ... | ||
· │ | ||
· ╰── ... should have a matching `)` here. | ||
───╯ | ||
``` | ||
|
||
## License | ||
|
||
Copyright 2022-2024 Glacyr B.V. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
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