An OpenAPI specification describes API data structures and rules in a standardized, machine-readable format. In prompts, it provides explicit constraints for generating structured test data instead of requiring custom field definitions. section 6.2.1
Using OpenAPI in data-generation prompts provides:
- Ready-made structure for names, types, required fields, patterns, and numeric limits. section 6.2.1
- A widely adopted format that can improve an LLM’s chance of producing useful output. section 6.2.1
- A basis for checking generated objects against schema rules before using them. section 6.2.1
Schema-driven JSON generation
A prompt can request three randomized JSON objects based on a delimited OpenAPI 3.0 schema and require confirmation that every object matches its rules. A Room schema can constrain accessibility, room types, features, required properties, and room-price bounds. section 6.2.1
###
openapi: 3.0.0
components:
schemas:
Room:
title: Room
type: object
properties:
accessible:
type: boolean
description:
type: string
type:
type: string
pattern: Single|Double|Twin|Family|Suite
features:
type: array
items:
type: string
pattern: WiFi|TV|Radio|Refreshments|Safe|
image:
type: string
roomNumber:
type: string
roomPrice:
type: integer
format: int32
minimum: 0
maximum: 999
exclusiveMinimum: true
exclusiveMaximum: false
roomid:
type: integer
format: int32
required:
- accessible
- description
- features
- image
- roomNumber
- roomPrice
###
Inspect a concrete Room schema showing required properties, enumerated patterns, arrays, and numeric constraints. section 6.2.1











