Loading...
Loading...
This skill should be used when the user asks to "infer schemas", "generate schemas from examples", "add schemas", "bootstrap schemas", or mentions inferring, generating, or adding schemas to OpenAPI/OAS specifications that have examples but missing schema definitions.
npx skill4agent add mulesoft/mulesoft-dx api-schema-inferrerexampleexamplesschemaexamplesexampleschemapip install pyyamlpython3 skills/api-schema-inferrer/scripts/infer_schemas.py path/to/spec.yaml --dry-runpython3 skills/api-schema-inferrer/scripts/infer_schemas.py path/to/spec.yamlspec.yaml.backupexampleschema:components.requestBodiescomponents.responsesexampleschema:content:
application/json:
schema:
example:
foo: barexampleschemastringnumberintegerbooleanarrayobjectnullemailuridatepaths:
/users:
post:
requestBody:
content:
application/json:
examples:
createUser:
value:
name: "John Doe"
email: "john@example.com"
age: 30
responses:
'200':
description: Success
content:
application/json:
example:
id: "123"
status: "active"paths:
/users:
post:
requestBody:
content:
application/json:
schema:
type: object
required: [name, email, age]
properties:
name:
type: string
description: "Auto-generated from example. TODO: Add meaningful description for 'name'"
email:
type: string
format: email
description: "Auto-generated from example. TODO: Add meaningful description for 'email'"
age:
type: integer
description: "Auto-generated from example. TODO: Add meaningful description for 'age'"
examples:
createUser:
value:
name: "John Doe"
email: "john@example.com"
age: 30
responses:
'200':
description: Success
content:
application/json:
schema:
type: object
required: [id, status]
properties:
id:
type: string
description: "Auto-generated from example. TODO: Add meaningful description for 'id'"
status:
type: string
description: "Auto-generated from example. TODO: Add meaningful description for 'status'"
example:
id: "123"
status: "active"enumrequiredminLengthmaxLengthminimummaximum"Infer schemas from examples in my API spec at path/to/spec.yaml"
"Generate schemas from the examples in specs/my-api.yaml"
"My spec has examples but no schemas - can you add them?"