-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attributes containing keywords can't be parsed with 0.20 #238
Comments
Attempting to repro this, I discovered something interesting. This errors: let _attr: syn::Attribute = syn::parse_quote!(#[type = false]); But this doesn't: let _attr: syn::Attribute = syn::parse_quote!(#[hello(type = false)]); It seems like it may matter to Alternatively, the issue is in |
I've filed dtolnay/syn#1458 to request that |
I can take another look next week, but it looks a bit like dtolnay/syn#1414 |
As noted in #1414 it seems that keyword identifiers are fine as long as they're inside the |
let nm: darling::ast::NestedMeta = syn::parse_quote!(myderive(type = "a")); You just cannot expect that the inside is a well-formed meta again. Probably |
It's possible to hand-construct a If so, then would a |
I am not sure if that is true, but yes if it is, then copying and adapting the Instead of using |
Is there a current hack to get around this issue? |
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [async-graphql](https://github.com/async-graphql/async-graphql) | dependencies | major | `5.0.10` -> `6.0.4` | | [async-graphql-axum](https://github.com/async-graphql/async-graphql) | dependencies | major | `5.0.10` -> `6.0.4` | --- ### Release Notes <details> <summary>async-graphql/async-graphql (async-graphql)</summary> ### [`v6.0.4`](https://github.com/async-graphql/async-graphql/blob/HEAD/CHANGELOG.md#604-2023-08-18) - Parse "repeatable" in directive definitions. [#​1336](https://github.com/async-graphql/async-graphql/pull/1336) - add support `multipart/mixed` request. [#​1348](https://github.com/async-graphql/async-graphql/issues/1348) - async-graphql-actix-web: add `GraphQL` handler. - async-graphql-axum: add `GraphQL` service. ### [`v6.0.3`](https://github.com/async-graphql/async-graphql/blob/HEAD/CHANGELOG.md#603-2023-08-15) - dynamic: fix the error that some methods of `XXXAccessor` return reference lifetimes that are smaller than expected. - dynamic: no longer throws an error if the Query object does not contain any fields but the schema contains entities. - chore: make accessors public and reexport indexmap [#​1329](https://github.com/async-graphql/async-graphql/pull/1329) - feat: added `OutputType` implementation for `std::sync::Weak` [#​1334](https://github.com/async-graphql/async-graphql/pull/1334) ### [`v6.0.1`](https://github.com/async-graphql/async-graphql/blob/HEAD/CHANGELOG.md#601-2023-08-02) - dynamic: remove `TypeRefInnner` - update MSRV to `1.67.0` ### [`v6.0.0`](https://github.com/async-graphql/async-graphql/blob/HEAD/CHANGELOG.md#600-2023-07-29) - Bump `syn` from `1.0` to `2.0` - Bump `darling` from `0.14` to `0.20` - Bump `indexmap` from `1.6.2` to `2` - Attributes `guard`, `process_with`, `complexity` support expression or string as value [#​1295](https://github.com/async-graphql/async-graphql/issues/1295) - Schema (type) level directive support with optional support of federation composeDirective [#​1308](https://github.com/async-graphql/async-graphql/pull/1308) - Add support for generic structs derriving InputObject and SimpleObject [#​1313](https://github.com/async-graphql/async-graphql/pull/1313) - chore: trim up some unnecessary code [#​1324](https://github.com/async-graphql/async-graphql/pull/1324) - Adds `Dataloader::get_cached_values` method to the dataloader cache so that callers can access the contents of the cache without knowing the keys. [#​1326](https://github.com/async-graphql/async-graphql/pull/1326) #### Breaking Changes - Since `syn 2.0` no longer supports keywords as meta path, rename the parameter used to specify interface field types from `type` to `ty`. [https://github.com/dtolnay/syn/issues/1458](https://github.com/dtolnay/syn/issues/1458) [https://github.com/TedDriggs/darling/issues/238](https://github.com/TedDriggs/darling/issues/238)/238 ```rust #[derive(Interface)] #[graphql(field(name = "id", ty = "&i32"))] // rename from type to ty enum Node { MyObj(MyObj), } ``` - Change the parameter `location` of the macro `Directive` to *PascalCase* ```rust // #[Directive(location = "field")] #[Directive(location = "Field")] pub fn lowercase() -> impl CustomDirective { LowercaseDirective } ``` </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/apollographql/subgraph-template-rust-async-graphql). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi42OC4xIiwidXBkYXRlZEluVmVyIjoiMzYuNjguMSIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
due to syn issue, keywords can't be used in MetaList, as it parse it as keyword instead of identifier. this causes compilation error when the "as" param is being used. workaround it similar to the approach used by serde_with, in order to avoid breaking existing users. TedDriggs/darling#238 jonasbb/serde_with@c22f165 Signed-off-by: Eliad Peller <eliad.peller@wiz.io>
The code below worked in 0.14.2. It uses
type
inside a derive macro attribute.As of 0.20 this yields:
The text was updated successfully, but these errors were encountered: