Skip to content

Configure specific GraphQL schema files #42792

@bjoernmayer

Description

@bjoernmayer

Heyho,

it seems like there is currently no way to specify schema files by their filename. Instead it is only possible to configure directories.

From GraphqlProperties.java:

private String[] appendSlashIfNecessary(String[] locations) {
			return Arrays.stream(locations)
				.map((location) -> location.endsWith("/") ? location : location + "/")
				.toArray(String[]::new);
		}

Hence this is impossible:

spring.graphql.schema:
    locations:
        # Subgraph's schema
        - classpath:schema/schema.graphqls
        # Federation-specific directives (shared across subgraphs)
        - classpath:schema/federation.graphqls
        # Common types (shared across subgraphs)
        - classpath:schema/Accommodation.graphqls
        - classpath:schema/AccommodationDeal.graphqls

I encountered this obstacle when trying to migrate from DGS to Spring GQL

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions