Use this prompt when you are a documentation engineer, API designer, or platform reviewer who needs to verify that every example payload in an OpenAPI specification actually conforms to its declared schema. The job-to-be-done is automated conformance auditing: you have a spec that passes structural validation but you suspect—or need to prove—that the example objects inside request bodies, responses, and component schemas contain type errors, missing required fields, or enum violations that will break client code, mock servers, or contract tests. This prompt is ideal when you are preparing a spec for publication, running a pre-release documentation QA pass, or integrating spec validation into a CI pipeline that already checks for structural correctness but lacks semantic example validation.
Prompt
OpenAPI Example vs Schema Conformance Check Prompt

When to Use This Prompt
Identify the right conditions for running an automated schema conformance check on OpenAPI examples.
This prompt is not a replacement for a full OpenAPI structural linter like Spectral or Redocly CLI. Do not use it to check for missing $ref targets, invalid path templating, or spec-version rule compliance—those belong in a separate structural validation step. It is also not designed for generating new examples from scratch; use a dedicated example-generation prompt for that. The prompt works best when you provide a complete, structurally valid OpenAPI document and expect a per-example conformance report. If your spec is large, consider chunking it by path or schema component to stay within context windows and to make the failure report easier to act on. For high-risk APIs where example accuracy is a contractual or security boundary—such as payment, healthcare, or identity APIs—always pair the automated report with a human review step before publication.
Before running this prompt, ensure your OpenAPI document is structurally valid (passes standard OpenAPI 3.0/3.1 validation) and that all $ref pointers resolve correctly. The prompt will flag mismatches but cannot fix broken references. After receiving the conformance report, prioritize fixes for examples that appear in public documentation or client SDK generation paths, as these have the highest blast radius. If the report surfaces systemic issues—such as a pattern of missing required fields across multiple endpoints—consider updating your example-generation workflow or adding a schema-first example authoring step rather than fixing each instance manually. Store the conformance report alongside your spec version so downstream consumers can assess example reliability.
Use Case Fit
Where the OpenAPI Example vs Schema Conformance Check prompt delivers reliable audits and where it introduces risk.
Good Fit: Pre-Release Spec Audits
Use when: you are about to publish or version an OpenAPI spec and need to verify that every example payload in request bodies, responses, and named examples conforms to its declared schema. Guardrail: run the check as a CI gate before spec publication; block merges that introduce conformance failures.
Good Fit: Multi-Example Coverage Validation
Use when: a single schema has multiple named examples (happy path, edge case, error) and you need to confirm each one independently. Guardrail: treat each example as a separate test case; the prompt must return per-example pass/fail results, not a single aggregate score.
Bad Fit: Semantic Correctness Review
Avoid when: you need to judge whether an example value is semantically realistic or business-appropriate. Schema conformance only checks types, required fields, and enum membership. Guardrail: pair this prompt with a separate human review or LLM judge for semantic plausibility of example data.
Required Inputs: Complete Resolved Spec
Risk: the prompt fails silently if $ref references are not resolved before the check, or if the spec is split across multiple files. Guardrail: always resolve and bundle the OpenAPI spec into a single document before passing it to the prompt; validate that all $ref targets are reachable.
Operational Risk: Polymorphic Schema Blind Spots
Risk: oneOf, anyOf, and allOf schemas with discriminators can produce false positives or false negatives if the prompt does not correctly match the example to the right variant. Guardrail: add explicit test cases for each discriminator value; if the prompt misses a variant match, escalate to a manual review step.
Operational Risk: Large Spec Timeouts
Risk: specs with hundreds of endpoints and thousands of examples can exceed context windows or cause the model to skip examples. Guardrail: shard the audit by path or tag group; run multiple parallel checks and aggregate results. Set a hard limit of 50 examples per prompt invocation.
Copy-Ready Prompt Template
A reusable prompt with square-bracket placeholders for auditing OpenAPI example payloads against their declared schemas.
This prompt template performs a structured conformance audit of every example payload in an OpenAPI specification against its corresponding schema definition. It is designed to be dropped into an automated documentation pipeline, a CI check, or a manual review workflow. The template expects the full OpenAPI spec as input and produces a machine-readable conformance report that flags type mismatches, missing required fields, enum violations, and structural inconsistencies at the exact JSON path where they occur.
textYou are an OpenAPI specification auditor. Your task is to check every example payload in the provided OpenAPI specification against its declared schema and produce a conformance report. [INPUT] For each example found in the spec (request body examples, response examples, and schema-level examples), perform the following checks: 1. **Type conformance**: Verify that each value matches the declared type (string, integer, number, boolean, array, object). Flag implicit type coercion risks. 2. **Required field presence**: Confirm that all fields listed in the `required` array are present in the example. Flag missing required fields. 3. **Enum constraint**: Verify that any field with an `enum` constraint contains a value from the allowed set. Flag values outside the enum. 4. **Pattern constraint**: Check that string fields with a `pattern` constraint match the regex. Flag non-matching values. 5. **Nested schema conformance**: Recursively check all nested objects and array items against their sub-schemas. 6. **oneOf/anyOf/allOf resolution**: For polymorphic schemas, verify that the example matches at least one variant and identify which variant was matched. 7. **readOnly/writeOnly**: Flag examples that include `readOnly` fields in a request body or `writeOnly` fields in a response body. [OUTPUT_SCHEMA] Return a JSON object with this structure: { "spec_title": "string (from info.title)", "total_examples_checked": "integer", "conformant_examples": "integer", "non_conformant_examples": "integer", "findings": [ { "severity": "ERROR | WARNING | INFO", "location": "string (JSON path to the example, e.g., paths./users.get.responses.200.content.application/json.example)", "schema_ref": "string ($ref path or inline schema location)", "check_type": "TYPE_MISMATCH | MISSING_REQUIRED | ENUM_VIOLATION | PATTERN_VIOLATION | NESTED_SCHEMA_ERROR | POLYMORPHIC_MISMATCH | READONLY_IN_REQUEST | WRITEONLY_IN_RESPONSE", "field_path": "string (JSON path to the violating field within the example)", "expected": "string (description of what the schema requires)", "actual": "string (description of what the example contains)", "suggestion": "string (actionable fix recommendation)" } ], "summary_by_check_type": { "TYPE_MISMATCH": "integer", "MISSING_REQUIRED": "integer", "ENUM_VIOLATION": "integer", "PATTERN_VIOLATION": "integer", "NESTED_SCHEMA_ERROR": "integer", "POLYMORPHIC_MISMATCH": "integer", "READONLY_IN_REQUEST": "integer", "WRITEONLY_IN_RESPONSE": "integer" } } [CONSTRAINTS] - Do not skip any example in the spec. Check request body examples, response examples, and schema-level examples. - If an example references an external value via $ref, note it as an INFO finding and skip deep validation. - If a schema uses `additionalProperties: false`, flag any example fields not declared in `properties`. - If a schema has no example, do not fabricate one. Only audit existing examples. - For arrays, check every item in the example array against the `items` schema. - Report the exact JSON path for every finding so the result is machine-actionable. - If the spec is invalid or unparseable, return a single finding with severity ERROR and describe the parse failure.
To adapt this template, replace [INPUT] with the raw OpenAPI YAML or JSON content. If your pipeline already parses the spec into a structured object, you can replace [INPUT] with a pre-parsed representation and adjust the instructions accordingly. The [OUTPUT_SCHEMA] block defines the exact JSON structure the model must return; keep this strict to enable downstream automated remediation. The [CONSTRAINTS] block prevents common failure modes like skipping nested examples or fabricating data. For high-stakes API surfaces where example accuracy directly impacts developer integration success, wire the output into a CI check that blocks deployment on ERROR-severity findings and requires human review for WARNING-level findings before merging spec changes.
Prompt Variables
Required inputs for the OpenAPI Example vs Schema Conformance Check prompt. Every placeholder must be populated before the prompt is sent; missing or malformed inputs are the most common cause of false negatives in conformance reports.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[OPENAPI_SPEC] | The complete OpenAPI 3.0 or 3.1 specification document as a JSON or YAML string | {"openapi":"3.1.0","paths":{...},"components":{"schemas":{...}}} | Must parse as valid OpenAPI 3.x. Reject if missing openapi version field, paths, or components.schemas. Validate with an OpenAPI parser before prompt injection. |
[EXAMPLE_LOCATION] | JSONPath or dot-notation pointer to the example object within the spec to audit | $.paths./users.post.requestBody.content.application/json.examples.createUser | Must resolve to a valid example object inside the spec. Reject if the path returns null or points to a non-example node. Pre-resolve before prompt assembly. |
[SCHEMA_LOCATION] | JSONPath or dot-notation pointer to the schema that the example claims to conform to | $.components.schemas.CreateUserRequest | Must resolve to a valid JSON Schema object. Reject if the path returns null, a $ref loop, or a non-schema node. Dereference $ref inline or provide the resolved schema alongside the pointer. |
[CONFORMANCE_RULES] | List of specific conformance checks to apply beyond basic structural validation | ["type_match","required_fields","enum_values","nullable_vs_required","additionalProperties"] | Must be a non-empty array of known rule identifiers. Reject unknown rule names. Default rule set if omitted: type_match, required_fields, enum_values, format_match. |
[OUTPUT_SCHEMA] | JSON Schema describing the expected structure of the conformance report | {"type":"object","required":["conforms","violations"],"properties":{"conforms":{"type":"boolean"},"violations":{"type":"array","items":{"type":"object","required":["location","rule","expected","actual"]}}}} | Must be a valid JSON Schema. Reject if it does not parse. The prompt will use this to constrain output format; mismatched output schemas cause parse failures downstream. |
[ADDITIONAL_CONTEXT] | Optional notes about the API domain, data semantics, or known edge cases that affect conformance judgment | The createdAt field is set server-side and should be absent from request examples even though the schema marks it as optional. | Null allowed. If provided, must be a plain string under 2000 characters. Longer context should be summarized or split across multiple audit runs. |
Implementation Harness Notes
How to wire the conformance check prompt into a CI pipeline, API governance workflow, or documentation review tool.
This prompt is designed to be called programmatically, not used as a one-off chat interaction. The typical integration point is a CI check that runs after an OpenAPI spec is updated, or a pre-release documentation audit. The harness should extract each request body and response example from the spec, pair it with its resolved schema (following all $ref pointers), and invoke the prompt once per example. Batching multiple examples into a single prompt call is acceptable for latency reduction, but keep batches small (3–5 examples) to avoid the model losing precision on individual mismatches. The prompt expects a fully resolved schema object and a single example object as its two primary inputs.
Validation and retry logic: Parse the model's output as JSON and validate it against a strict schema: { example_path: string, conformance: "conformant"|"non-conformant", issues: [{ location: string, expected: string, actual: string, severity: "error"|"warning" }] }. If the output fails to parse or doesn't match this schema, retry once with a stronger constraint instruction appended to the prompt. If the retry also fails, log the raw output and flag the example for human review. Model choice: Use a model with strong JSON-following behavior (GPT-4o, Claude 3.5 Sonnet, or equivalent). Avoid smaller models for this task—schema conformance checking requires precise type comparison and enum validation that smaller models frequently hallucinate. Logging: Record every invocation with the spec version, example path, schema hash, model output, and final conformance verdict. This audit trail is essential when a false negative blocks a release.
Integration with governance tools: Wire the harness output into your existing linting pipeline (Spectral, vacuum, or custom validators). Treat the prompt's non-conformant verdict as a lint error with the location field mapped to a JSON Pointer for the offending example. What to avoid: Do not use this prompt as a replacement for structural schema validation—a standard OpenAPI validator should catch missing $ref targets and invalid schema keywords before this prompt runs. This prompt is specifically for semantic conformance: does the example value actually match what the schema declares? Also avoid running this on every commit if your spec is large; gate it on changes to examples or example fields, or run it only on the release branch.
Expected Output Contract
Fields, types, and validation rules for the per-example conformance report produced by the OpenAPI Example vs Schema Conformance Check Prompt.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
example_location | JSON Pointer (RFC 6901) | Must resolve to an example node within the OpenAPI spec. Parse check: valid JSON Pointer syntax. | |
schema_location | JSON Pointer (RFC 6901) | Must resolve to a schema node in the components/schemas section. Parse check: valid JSON Pointer syntax. | |
conformance_status | Enum: ['conformant', 'non-conformant'] | Must be exactly one of the two enum values. Schema check: enum membership. | |
mismatches | Array of Mismatch objects | If conformance_status is 'conformant', array must be empty. If 'non-conformant', array must contain at least one item. Schema check: array length constraint. | |
mismatches[].field_path | JSON Pointer (RFC 6901) | Must point to the specific property within the example that violates the schema. Parse check: valid JSON Pointer syntax. | |
mismatches[].rule_violated | String | Must name the JSON Schema keyword violated (e.g., 'type', 'required', 'enum', 'pattern'). Schema check: must match a known JSON Schema validation keyword. | |
mismatches[].expected | String | Human-readable description of what the schema requires at this field_path. Null allowed if the violation is an unexpected property. | |
mismatches[].actual | String | Human-readable description of the value found in the example at this field_path. Must quote the actual value if it is a scalar. |
Common Failure Modes
When checking example payloads against OpenAPI schemas, these failures surface first. Each card explains what breaks and how to catch it before the report reaches a reviewer.
Schema Drift from Code Changes
What to watch: The OpenAPI spec was updated but example payloads were not regenerated, causing false conformance failures. Guardrail: Pin example generation to the same CI step that publishes the spec. Reject any spec where examples and schemas come from different commits.
Enum Value Mismatch in Examples
What to watch: Example payloads use string literals that do not match the schema's enum array, often due to case sensitivity or deprecated values. Guardrail: Normalize enum comparison to be case-sensitive by default. Flag any example value not present in the enum array and suggest the closest match.
Missing Required Fields in Nested Objects
What to watch: Top-level required fields pass, but deeply nested required properties are absent from example payloads. Guardrail: Recursively validate all required arrays at every nesting level. Report the full JSON path to the missing field, not just the property name.
Type Confusion with Nullable and ReadOnly
What to watch: Examples include null for non-nullable fields or populate readOnly fields that the server should generate. Guardrail: Check nullable and readOnly/writeOnly annotations per schema. Reject examples that write to read-only fields or null non-nullable properties.
Polymorphic Discriminator Mismatch
What to watch: Examples for oneOf/anyOf schemas omit the discriminator property or use a value that maps to the wrong variant schema. Guardrail: Verify the discriminator property exists and its value matches a key in the mapping. Validate the rest of the payload against the resolved variant schema.
Format String Violations
What to watch: Examples pass type checks but violate format constraints such as date-time, email, or uri. Guardrail: Apply format-specific regex or parser validation. Flag any example where the value does not conform to the declared format, even if it is a valid string.
Evaluation Rubric
Use this rubric to test the OpenAPI Example vs Schema Conformance Check Prompt before shipping. Each criterion targets a specific failure mode in schema validation, error localization, or report structure.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Type mismatch detection | Report flags every example value whose type does not match the schema type (e.g., string in an integer field) | Report marks a type mismatch as conformant or omits it entirely | Provide an example with a known type error; verify the report entry includes the field path, expected type, and actual type |
Required field absence | Report lists every missing required field in the example payload with the exact field name and schema path | Report omits a missing required field or lists optional fields as required | Remove a required field from a valid example; confirm the report entry shows the field name, schema path, and 'missing required field' reason |
Enum value violation | Report identifies example values that are not in the schema's enum list and shows the allowed values | Report accepts an invalid enum value or fails to list the allowed alternatives | Set an example field to a value outside the enum; check that the report includes the invalid value, field path, and the full allowed enum list |
Nested object conformance | Report validates nested objects recursively and reports errors at the correct depth with dot-notation or JSONPath field paths | Report only checks top-level fields or reports nested errors with ambiguous paths | Introduce a type error three levels deep in a nested object; verify the report field path resolves to the exact nested location |
Array item validation | Report validates every item in an array against the items schema and flags individual array element errors by index | Report validates only the first array element or treats the whole array as a single value | Insert an invalid element at array index 2; confirm the report references index 2 and the specific violation |
Report structure completeness | Output contains a top-level summary (total examples checked, pass/fail counts) and a per-example breakdown with operationId, path, method, and error list | Output is missing the summary, omits operationId, or nests errors in an unparseable structure | Run the prompt against a spec with 3 examples (1 valid, 2 invalid); parse the output and assert summary counts match and every error has operationId and path |
False positive avoidance | Report marks a fully conformant example as 'pass' with zero errors | Report flags a valid example with spurious errors (e.g., claiming a correct type is wrong) | Provide a spec with a known-valid example that matches the schema exactly; assert the error list is empty and the pass flag is true |
Multi-spec example isolation | Report does not cross-contaminate errors between different endpoints or schemas; each example is checked against its own operation's schema only | An error from one endpoint's example appears in another endpoint's report entry | Use a spec with two endpoints where one example is invalid and the other is valid; confirm the valid endpoint's report shows no errors and the invalid endpoint's errors do not reference the wrong schema |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Add strict output schema, batch processing, and a validation harness that retries on malformed JSON. Include a confidence field per finding and require exact JSON Pointer paths.
codeFor each example-schema pair in [INPUT_LIST], produce: { "example_id": "string", "conforms": boolean, "findings": [ { "path": "/path/to/field", "expected": "type or constraint", "actual": "value found", "rule_violated": "type|required|enum|pattern|minLength|maxLength|minimum|maximum|additionalProperties", "confidence": 0.0-1.0 } ] } If conforms is true, findings must be an empty array.
Watch for
- Silent format drift in the JSON output under high concurrency
- Missing human review gate for specs that gate production deploys
oneOf/anyOfmismatches reported without identifying which variant failed

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us