Skip to content
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

EAS-2497 : Collect possible GraphQL queries during lowering #56

Merged
merged 1 commit into from
Dec 4, 2024

Conversation

gersbach
Copy link
Contributor

No description provided.

crates/fsrt/src/main.rs Show resolved Hide resolved
crates/fsrt/src/main.rs Outdated Show resolved Hide resolved
crates/fsrt/src/main.rs Outdated Show resolved Hide resolved
@@ -99,7 +103,69 @@ impl fmt::Display for Error {
}
}

impl std::error::Error for Error {}
fn check_graphql_and_perms(val: &Value) -> Vec<&str> {
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the string being returned here? And does it need to be a string in the first place?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This goes back to my internship, we decided on using string instead of enums for returning permissions.... I suppose we can swtich that. Let me know if we should.

Copy link
Contributor

Choose a reason for hiding this comment

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

The main reason I'm going on this now, is because you have to hardcode the permissions anyway with the mapping, which means that the permissions are known at compile time.

Though if that's a stand in for deserializing an actual permission map where the permissions aren't static, then you can leave it as str, though make sure to add a comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, i haven't completely decided on how I'll fetch them. I'll either be parsing the nadel files or just creating a map.... we can discuss this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Eventually, I want this to be enums, but I think we should make that change in a different task. Let me know if that sounds good :)

@gersbach gersbach marked this pull request as ready for review November 27, 2024 18:18
crates/fsrt/src/main.rs Outdated Show resolved Hide resolved
crates/fsrt/src/main.rs Outdated Show resolved Hide resolved
.collect()
}

fn parse_graphql(s: &str) -> Vec<(&str, &str)> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add a comment explaining what the (&str, &str) element is?

Also, does this need to return a Vec or can you just return an impl Iterator<Item = (&str, &str)>, since we end up just passing it to an extend()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I resolved this ????


// collect all fragments
if let std::result::Result::Ok(doc) = parse_query::<&str>(s) {
doc.definitions.clone().into_iter().for_each(|d| {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add a TODO: use collect + avoid clone comment here? You can also do that in this PR(let me know if you need help), but it isn't super important to get it done in this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed that ..... or so I hope

@jwong101
Copy link
Contributor

jwong101 commented Dec 3, 2024

LGTM. Clean up the commit history, and I'll merge it in.

@jwong101 jwong101 merged commit 8f8ab4c into atlassian-labs:main Dec 4, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants