Skip to content

Commit

Permalink
Add endpoint to download Transmodel GraphQL Schema
Browse files Browse the repository at this point in the history
  • Loading branch information
t2gran committed Dec 10, 2024
1 parent e0422cd commit 7266bdf
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

import com.fasterxml.jackson.databind.ObjectMapper;
import graphql.schema.GraphQLSchema;
import graphql.schema.idl.SchemaPrinter;
import io.micrometer.core.instrument.Tag;
import jakarta.ws.rs.BadRequestException;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
Expand Down Expand Up @@ -138,6 +140,12 @@ public Response getGraphQL(String query, @Context HttpHeaders headers) {
);
}

@GET
@Path("schema.graphql")
public Response getGraphQLSchema() {
return Response.ok().encoding("UTF-8").entity(new SchemaPrinter().print(schema)).build();
}

private static Iterable<Tag> getTagsFromHeaders(HttpHeaders headers) {
return tracingHeaderTags
.stream()
Expand Down

0 comments on commit 7266bdf

Please sign in to comment.