-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
Ability to dynamically fetch API spec definition from a URL or a built file #2572
Comments
Yeah allowing to load the definition from a url is something we would like to implement too. But I would prefer to reuse the location processors for this: It would be useful to load the definition from locations like GitHub repositories, files, or other locations too. I hope this is something we can completely implement in the processors, so that we load the definition into the entity. We had some discussion here already: #2001 (comment) |
Yeah my initial rough idea was that you could define that API as something along the lines of apiVersion: backstage.io/v1alpha1
kind: API
metadata:
name: my-federated-service
annotations:
backstage.io/graphql-schema-source: https://my-federated-service.my-cloud.com/graphql
spec:
type: graphql-federated-service Note the annotation. And then a processor would inject the actual definition based on what was introspected from that endpoint. For schemas that are next to the |
Edit: Nevermind, I think I read that point the wrong way |
@freben your suggestion above sounds like it could work well. Is this something that we could implement now or are there blockers? |
That can be implemented today. What isn't there is
|
I think that's the biggest issue right now. |
That was not the "cancel" button 😆 |
Does it require auth or so? I was hoping that it was directly reachable (from the deployed catalog backend's point of view) so you could just call it directly from the processor :) |
In our particular situation, introspection doesn't require authentication. |
Cool. Otherwise, as I mentioned I wouldn't be averse to adding a new |
(but maybe that doesn't help specifically the graphql introspection thing, that's a more complex request chain isn't it) |
Where is this?
|
I guess in this graphql case it's planned to load the spec directly from the running service. But in our case we would like to load them from GitHub, so having the same flexibility as for normal entity loading (I mean locations) would be nice here. But if one don't need it, a custom processor should be possible already and easy to implement.
You can pass them here: Which would be here in your backend: https://github.com/spotify/backstage/blob/master/packages/backend/src/plugins/catalog.ts#L34 |
they are given to LocationProcessors https://github.com/spotify/backstage/blob/master/plugins/catalog-backend/src/ingestion/LocationReaders.ts#L97 (order is important, you want yours to be after reading but before validation) |
too slow! |
I drafted a PR for this here #2597 |
…definition from another location Resolves backstage#2572
Our organization uses GraphQL federation. We have a bunch of services that are federated into a single gateway.
We would like to show schema from these services in the catalog. We use Nexus to express schema as TypeScript and compile the TypeScript to GraphQL SDL.
Feature Suggestion
We need a way to get the schema from the result of a build. In our case, the schema for each service is available on the service running in QA, inside of the GitHub Action while preparing tests and in Jenkins when building docker images. We need a way to use schema from one of these methods.
Possible Implementation
One challenge that I see with this approach is that we're not going to have a clear relationship between schema in QA and Git commit that schema was built from.
We could not change anything and update the catalog whenever we build the service in GitHub Actions or Jenkins. This seems less preferable because it'll require configuring each service per repository. This mechanism could become fragile because it might stop updating and no one will know.
Have some way to build the code while fetching schema updates. I'm not sure how this would work.
The text was updated successfully, but these errors were encountered: