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

introspection: format resulting schema from GraphQLClientSchema #180

Closed
lrlna opened this issue Jan 14, 2021 · 0 comments · Fixed by #283
Closed

introspection: format resulting schema from GraphQLClientSchema #180

lrlna opened this issue Jan 14, 2021 · 0 comments · Fixed by #283
Labels
feature 🎉 new commands, flags, functionality, and improved error messages
Milestone

Comments

@lrlna
Copy link
Member

lrlna commented Jan 14, 2021

Description

To be able to display SDL ergonomically, we will need to make sure all types created by GraphQLClientSchema in #171 have a self.to_string method and Display, Debug trait implementations.

Detailed design

GraphQL Javascript reference implementation has specific printing requirements for each individual type, here is Scalar type, for example:

function printScalar(type: GraphQLScalarType, options): string {
  return (
    printDescription(options, type) +
    `scalar ${type.name}` +
    printSpecifiedByUrl(type)
  );
}

Rust implementation should then have something like this for it's Display trait impl:

impl fmt::Display for ScalarType {
    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
        write!(fmt, "{}", self.to_string())
    }
}

ScalarType can then implement a to_string() that resembles its JavaScript counterpart outlined above.

This work is dependent on #171 to be completed first.

This issue is part of introspection work discussed in this internal scope document.

@lrlna lrlna added the feature 🎉 new commands, flags, functionality, and improved error messages label Jan 14, 2021
@lrlna lrlna added this to the 🐣 0.1.0 milestone Jan 14, 2021
@lrlna lrlna modified the milestones: 0.0.2, 0.0.4 Feb 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 🎉 new commands, flags, functionality, and improved error messages
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants