Inspect
The inspect command helps you identify which resolvers marked with @resolver directive are not yet implemented or still contain stub implementations.
npx axolotl inspect -s ./schema.graphql -r ./lib/resolvers.jsWhat It Does
The inspect command:
- Finds all fields marked with
@resolverdirective in your schema - Checks implementation status of each resolver:
- Missing: Resolver doesn't exist in your resolvers object
- Stub: Resolver exists but throws
"Not implemented"error
- Reports only unimplemented resolvers - fully implemented resolvers are not reported
This is different from checking all schema fields - inspect only checks fields you've explicitly marked with @resolver, making it perfect for tracking your implementation progress.
Prerequisites
- Build your project before running
inspect(runnpm run buildortsc) - The resolvers file must export a default value created with
createResolvers - Schema must define the
@resolverdirective
Example
Schema with @resolver Directives
directive @resolver on FIELD_DEFINITION
type User {
_id: String!
username: String!
email: String
}
type Query {
me: User @resolver
users: [User!] @resolver
hello: String
}
type Mutation {
login(username: String!, password: String!): String! @resolver
register(username: String!, password: String!): String! @resolver
}
schema {
query: Query
mutation: Mutation
}Resolvers File
import { createResolvers } from '@/src/axolotl.js';
const resolvers = createResolvers({
Query: {
me: async ([, , context]) => {
return getUserById(context.userId);
},
users: async () => {
// This is a stub - not actually implemented
throw new Error('Not implemented: Query.users');
},
// Query.hello is NOT marked with @resolver, so it won't be checked
hello: () => 'Hello World!',
},
// Mutation resolvers are completely missing
});
export default resolvers;Running Inspect
npx axolotl inspect -s ./schema.graphql -r ./lib/resolvers.jsOutput
Resolvers that need implementation:
⚠️ Query.users - throws "Not implemented"
❌ Mutation.login - not found
❌ Mutation.register - not found
Total: 3 resolver(s) to implementOutput Explanation
The inspect command provides clear, actionable output:
-
✅ Success - If all
@resolverfields are implemented, you'll see:✓ All @resolver directive fields are implemented! -
⚠️ Stub Implementation - Resolver exists but throws "Not implemented" error
- These are typically generated by
npx axolotl resolverscommand - You need to replace the stub with actual implementation
- These are typically generated by
-
❌ Missing Resolver - No resolver function exists for this field
- The field is completely missing from your resolvers object
- You need to add the resolver function
Integration with Workflow
The inspect command integrates perfectly with the Axolotl development workflow:
-
Add @resolver directives to schema fields that need implementation:
type Query { users: [User!] @resolver } -
Run build to update TypeScript types:
npx @aexol/axolotl build -
Generate resolver stubs (optional):
npx @aexol/axolotl resolversThis creates placeholder files with
throw new Error('Not implemented') -
Implement resolvers - Replace stubs with actual logic
-
Run inspect to verify completion:
npx @aexol/axolotl inspect -
Repeat until inspect reports all resolvers are implemented ✅
Options
-s, --schema <path>- Path to schema file (default:./schema.graphql)-r, --resolvers <path>- Path to transpiled resolvers file (default:./lib/resolvers.js)
Note: The resolvers path should point to the compiled JavaScript file (e.g., ./lib/resolvers.js), not the TypeScript source (e.g., ./src/resolvers.ts).
Exit Codes
0- All@resolverfields are implemented1- Some resolvers are missing or stubbed
This makes inspect useful in CI/CD pipelines to enforce that all marked resolvers are implemented before deployment.
LLM-Friendly Output
The inspect command is designed to provide clear, structured output that's easy for both humans and AI assistants to parse and act upon. When an LLM encounters unimplemented resolvers, it can:
- Identify exactly which resolvers need implementation
- Distinguish between missing and stubbed resolvers
- Navigate directly to the relevant resolver files
- Implement the required functionality
Tips
- Use @resolver directive intentionally - Only mark fields that need custom resolver logic
- Fields without @resolver - These rely on default GraphQL resolution and won't be checked
- Combine with
resolverscommand - Generate stubs first, then implement them - Check before commits - Run inspect to ensure you haven't forgotten any implementations