The nature of GraphQL is that you can't write code without an up to date schema.
You could enforce this in a REST JSON API, of course.
Same with some rest backends, FastAPI for example.