Skip to main content

mockql_core/
lib.rs

1// Copyright 2026 Expedia, Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! `mockql-core` provides the building blocks behind `mockql`.
16//!
17//! It analyzes GraphQL operations for `@mock` directives, builds provider prompts,
18//! optionally executes upstream GraphQL requests, and merges partial mock responses
19//! back into standard GraphQL Response.
20#![deny(missing_docs)]
21
22mod planner;
23
24mod graphql;
25mod llm_provider;
26mod schema;
27mod service;
28mod upstream;
29
30/// A typed HTTP header pair.
31pub type Header = (reqwest::header::HeaderName, reqwest::header::HeaderValue);
32
33pub use graphql::GraphQLRequest;
34pub use graphql::GraphQLResponse;
35pub use graphql::SchemaTypes;
36pub use graphql::minify::MinifyExt;
37pub use graphql::mock_response_prompt::DEBUG_KEY;
38pub use graphql::mock_response_prompt::MOCK_RESPONSE_EXTENSION_KEY;
39pub use graphql::mock_response_prompt::MockResponsePrompt;
40pub use graphql::mock_response_prompt::REASONING_KEY;
41pub use graphql::mock_response_prompt::SCHEMA_EXTENSION_KEY;
42pub use graphql::mock_response_prompt::SerializationFormat;
43pub use graphql::response_merger::ResponseMerger;
44pub use graphql::response_merger::ResponseMergerError;
45pub use graphql::response_validator::ResponseValidationError;
46pub use graphql::schema_filter::SchemaFilter;
47pub use graphql::schema_filter::SchemaFilterError;
48pub use llm_provider::ProviderConfig;
49pub use llm_provider::ProviderError;
50pub use llm_provider::cli::ClaudeCliProvider;
51pub use llm_provider::cli::CliProvider;
52pub use llm_provider::cli::CodexCliProvider;
53pub use llm_provider::cli::OpenCodeCliProvider;
54pub use llm_provider::generate_mock_response;
55pub use llm_provider::http::HttpProvider;
56pub use llm_provider::http::gemini::GeminiCompatibleHttpProvider;
57pub use llm_provider::http::github_copilot::GithubCopilotHttpProvider;
58pub use planner::SplitError;
59pub use schema::IntrospectionError;
60pub use schema::SchemaLoadError;
61pub use schema::load_schema;
62pub use schema::to_schema_with_mock_directive;
63pub use service::MockPlan;
64pub use service::MockService;
65pub use service::MockServiceRequest;
66pub use service::ServiceError;
67pub use upstream::UpstreamError;