Skip to content

Java Projection Classes express an explicit Schema Type#184

Merged
berngp merged 1 commit intomasterfrom
feature/optional-entity-type-projection
Jun 30, 2021
Merged

Java Projection Classes express an explicit Schema Type#184
berngp merged 1 commit intomasterfrom
feature/optional-entity-type-projection

Conversation

@berngp
Copy link
Contributor

@berngp berngp commented Jun 30, 2021

The Java Projection classes will now reflect an explicit GraphQL Schema
Type via their optional getSchemaType method. This is used to help
the DGS GraphQL Client resolve the Schema Type required to express the
projection in the GraphQL Query.

The Java Projection classes will now reflect an explicit GraphQL Schema
Type via their optional `getSchemaType` method. This is used to help
the DGS GraphQL Client resolve the Schema Type required to express the
projection in the GraphQL Query.
val iMovie = interfaces[0]
assertThat(iMovie.typeSpec.name).isEqualTo("IMovie")
assertThat(iMovie.typeSpec.methodSpecs).extracting("name").containsExactly("getId", "getTitle", "getGenre", "getLanguage", "getTags", "getRating")
assertThat(iMovie.typeSpec.methodSpecs[0].returnType).extracting("simpleName").containsExactly("String")
Copy link
Contributor Author

@berngp berngp Jun 30, 2021

Choose a reason for hiding this comment

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

Had to change from containsExactly to isEqualTo due that the API is not available anymore after the dependencies were updated.

import java.util.*
import javax.tools.JavaFileObject

internal class CodegenTestClassLoader(private val compilation: Compilation, parent: ClassLoader?) : ClassLoader(parent) {
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 test Classloader can be used when interacting with any of the classes available in the given compilation. Even if the class depend on others defined in codegen. This is not the case with the compileAndGetClass method in ClientApiGenTest.

Copy link
Contributor

Choose a reason for hiding this comment

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

Very cool, you got the classloader test set up!

@berngp berngp merged commit 23413b1 into master Jun 30, 2021
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