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

rust harmonizer missing some implementations #12

Open
EverlastingBugstopper opened this issue Mar 17, 2021 · 0 comments
Open

rust harmonizer missing some implementations #12

EverlastingBugstopper opened this issue Mar 17, 2021 · 0 comments

Comments

@EverlastingBugstopper
Copy link
Contributor

The Rust API Guidelines list a bunch of common traits that are eagerly implemented for most library types. I think we should implement most of these for ServiceDefinition (and maybe rename it SubgraphDefinition) so it's easier to work with in tests.

I'd love to do this:

        let actual_film_subgraph = subgraph_definitions.get(0).unwrap();
        let actual_people_subgraph = subgraph_definitions.get(1).unwrap();

        let expected_film_subgraph = SubgraphDefinition::new(
            "films",
            "https://films.example.com",
            "there is something here",
        );
        let expected_people_subgraph = SubgraphDefinition::new(
            "people",
            "https://people.example.com",
            "there is also something here",
        );

        assert_eq!(actual_film_subgraph.clone(), expected_film_subgraph);
        assert_eq!(actual_people_subgraph.clone(), expected_people_subgraph);

Unfortunately I can't seem to compare these two quite like this because ServiceDefinition does not implement Clone and either Eq or PartialEq... or at least I think that's why I can't do the above. I've got something working but would be nice to add these implementations for sure!

This is what I'm doing for now:

        assert_eq!(actual_film_subgraph.name, "films");
        assert_eq!(actual_film_subgraph.url, "https://films.example.com");
        assert_eq!(actual_film_subgraph.type_defs, "there is something here");
        assert_eq!(actual_people_subgraph.name, "people");
        assert_eq!(actual_people_subgraph.url, "https://people.example.com");
        assert_eq!(actual_people_subgraph.type_defs, "there is also something here");
        ```
@EverlastingBugstopper EverlastingBugstopper transferred this issue from apollographql/federation Jan 27, 2022
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

No branches or pull requests

1 participant