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

Improve reference docs on how to find schema files acorss multiple modules #489

Closed
toinetoine opened this issue Sep 15, 2022 · 4 comments
Closed
Assignees
Labels
type: documentation A documentation task
Milestone

Comments

@toinetoine
Copy link

I couldn't find anywhere in the documentation (or examples) how to include schema file from imported maven modules.

Background: We have an external project with the entities (models) and pull it in as a maven dependency. The graphqls schema files with the type declarations for each entity lives in that project.

Using legacy GraphQL Java Kickstart it automatically picked up graphqls schema files from maven dependencies (imported jars). Is there a way to do this using new spring-boot-starter-graphql?

I uploaded a demo project showing what we are trying to do. Right now the schema file in the app module is being picked up (highlighted in green) but the schema in the app module's dependency animals module is not being picked up (highlighted in red).
Screenshot from 2022-09-15 16-46-39

When I move the the schema file in the animals module to the app module (renaming it to schema2.graphql) it works.
Screenshot from 2022-09-15 16-46-39_2

I tried using spring.graphql.schema.locations=classpath:/graphql/,BOOT-INF/lib/animals-0.0.1-SNAPSHOT.jar!/graphql/ using the path to the schema files from the jar but it didn't work.
Screenshot from 2022-09-15 16-44-35

Also tried using the default (not specifying in my application properties at all) but didn't work.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Sep 15, 2022
@bclozel
Copy link
Member

bclozel commented Sep 16, 2022

Does the following work for your application?

spring.graphql.schema.locations=classpath*:graphql/**/

@bclozel bclozel added the status: waiting-for-feedback We need additional information before we can continue label Sep 16, 2022
@toinetoine
Copy link
Author

Thank you! Adding spring.graphql.schema.locations=classpath*:graphql/**/ to application properties caused all schema from other modules to be picked up.

toinetoine added a commit to toinetoine/spring-graphql-schema-files-maven-depdencies-issue that referenced this issue Sep 19, 2022
@rstoyanchev
Copy link
Contributor

I think we can improve the Javadoc a bit.

@rstoyanchev rstoyanchev reopened this Sep 20, 2022
@rstoyanchev rstoyanchev self-assigned this Sep 20, 2022
@rstoyanchev rstoyanchev added type: documentation A documentation task and removed status: waiting-for-feedback We need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged labels Sep 20, 2022
@rstoyanchev rstoyanchev added this to the 1.0.2 milestone Sep 20, 2022
@rstoyanchev rstoyanchev changed the title Including schema files from imported modules Improve Javadoc on including schema files from multiple modules Sep 20, 2022
@rstoyanchev rstoyanchev changed the title Improve Javadoc on including schema files from multiple modules Improve reference docs on how to find schema files acorss multiple modules Sep 20, 2022
@bclozel
Copy link
Member

bclozel commented Sep 20, 2022

Thanks for reopening this issue @rstoyanchev - this has appeared again in the Spring Boot issue tracker as well, see spring-projects/spring-boot#31772. I'm thinking this happens often enough that we should reconsider the default property value in Spring Boot 3.0 to switch to using classpath*:. What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation A documentation task
Projects
None yet
Development

No branches or pull requests

4 participants