Does Apollo-iOS support SDL schemas?

I have existing web project with auto-generated SDL schema. Everywhere in docs and third-party tutorials the only way to make iOS Swift code generator work is to feed it with json schema. I don’t have json schema, only graphql one.

"${SCRIPT_PATH}"/run-bundled-codegen.sh codegen:generate --target=swift --includes=./**/*.graphql --localSchemaFile="schema.json" API.swift

Removing json or providing empty one leads to random errors. Is there any way to make it work with .graphql schema?

You may need to change the extension to graphqls (since it’s SDL and not the query language) for it to pick up correctly, but if you pass in --localSchemaFile="schema.graphqls" that should work just fine.

1 Like

It works, thank you.

Would be nice to have this in the docs. Or make it work with both .graphql and .graphqls extension.

Yes, definitely need to update the docs - it could conceivably work with graphql as well, but then we’d have to do quite a bit of extra work to determine on a file by file basis which files with a graphql extension are Schema Definition Language vs the actual query language. Using a different extension makes that an awful lot clearer.