04Reference
Diagnostics
Every diagnostic code, what it means and, for many, an example the compiler ran with the fix.
Every problem is reported as a diagnostic with a stable code, a severity, a message, and when available a location (file, JSON pointer, line and column), the operation it relates to and a hint. Codes are stable across patch releases; --json output includes them for tooling.
- error — generation stops and nothing is written.
- warning — output is generated; something was ignored, interpreted or may not match the specification exactly.
- info (notes) — shown with
--verbose.
The CLI exits with 2 when an error is a configuration problem (config/*) and with 1 for other errors. Terminal output shows control characters from the specification or plugins as \xNN escapes; --json output contains the text unchanged (JSON-escaped).
Configuration
config/not-founderrorNo config file in the working directory
config/load-failederrorThe config file threw or could not be imported
config/plugin-load-failederrorA plugin reference (
'./plugin.mjs','package'or['package', options]) could not be resolved or imported, or did not produce a valid pluginconfig/invaliderrorUnknown option or wrong value (with a suggestion); in JSON and YAML configs with the line and column
Example: A misspelled option
openapi.yaml openapi: 3.1.0info:title: Exampleversion: '1.0'paths: {}swaggerz generate error config/invalid ouput: Unknown option.hint Did you mean "output"?Fix. Correct the option name; the hint suggests the closest valid one.
config/unsafe-outputerrorThe output directory contains the project, the config or the spec (symbolic links and letter case are resolved first); exit code 2
Specification
spec/load-failederrorThe document could not be read or parsed (with line and column)
spec/parse-errorerrorThe document could not be read or parsed (with line and column)
Example: Broken YAML
openapi.yaml openapi: 3.1.0info:title: [Exampleswaggerz generate error spec/parse-error Invalid YAML: Flow sequence in block collection must be sufficiently indented and end with a ] at line 4, column 1:at openapi.yaml:4:1Fix. Fix the syntax at the reported line and column.
spec/not-an-objecterrorNot a Swagger/OpenAPI document
spec/unknown-formaterrorNot a Swagger/OpenAPI document
spec/unsupported-versionerrorUnsupported or malformed
swagger/openapifieldspec/invalid-versionerrorUnsupported or malformed
swagger/openapifieldspec/version-mismatcherrorThe document's version differs from
spec.versionExample: The config expects 3.1, the document is 3.0
openapi.yaml openapi: 3.0.3info:title: Exampleversion: '1.0'paths: {}swaggerz generate error spec/version-mismatch The config expects OpenAPI 3.1 (spec.version: '3.1'), but the document declares OpenAPI 3.0 (3.0.3).at openapi.yaml:1:1 (#/openapi)hint Set spec.version to '3.0' if the document is correct, or use 'auto' to accept any supported version.Fix. Set
spec.versionto the version the document declares, or to'auto'.spec/unquoted-versionwarningopenapi,swaggerorinfo.versiongiven as a YAML number (quote it)Example: A version written as a YAML number
openapi.yaml openapi: 3.1.0info:title: Exampleversion: 1.0paths: {}swaggerz generate warning spec/unquoted-version `info.version` is the number 1; quote it to keep its exact text (for example '1').at openapi.yaml:4:3 (#/info/version)Fix. Quote the version (
version: '1.0'), otherwise YAML reads it as the number 1.spec/missing-fielderrorwarningRequired document fields are missing
spec/non-standard-refinfoA
$refwhere the specification allows none (an Operation Object in a description split into files); it is followedspec/invalid-patherrorwarningMalformed document parts
spec/invalid-operationerrorwarningMalformed document parts
spec/invalid-parametererrorwarningMalformed document parts
spec/invalid-parameterserrorwarningMalformed document parts
spec/invalid-responseerrorwarningMalformed document parts
spec/invalid-securityerrorwarningMalformed document parts
spec/unsupported-dialectwarningUnknown
jsonSchemaDialectspec/invalid-tag-parentwarningOpenAPI 3.2: a tag's
parentis not declared or makes a cycle; the tag is treated as top-level
Overlays
overlay/load-failederrorAn overlay in
spec.overlayscould not be read or parsedoverlay/unsupported-versionerrorwarningThe
overlayversion is not 1.x (error) or newer than 1.2 (warning: applied with the 1.2 rules)overlay/invaliderrorwarningThe overlay or an action is malformed (no actions, no
target, removing$), or an action does nothingoverlay/invalid-targeterrorAn action
targetis not RFC 9535 JSONPathExample: A target that is not RFC 9535 JSONPath
openapi.yaml openapi: 3.1.0info:title: Exampleversion: '1.0'paths: {}fixes.overlay.yaml overlay: 1.1.0info: { title: Fixes, version: 1.0.0 }actions:- target: $.paths[?@.summary =~ 'internal']remove: trueswaggerz generate error overlay/invalid-target Invalid JSONPath $.paths[?@.summary =~ 'internal']: Expected "]" (at character 20)at fixes.overlay.yaml:4:5 (#/actions/0/target)hint Overlays use RFC 9535 JSONPath: member names with special characters need brackets, e.g. $.paths['/pets'].Fix. Use RFC 9535's own functions instead of other dialects' operators:
$.paths[?search(@.summary, 'internal')].overlay/no-matchwarningAn action
targetselects nothing; the action changes nothingExample: An overlay action whose target matches nothing
openapi.yaml openapi: 3.1.0info:title: Exampleversion: '1.0'paths:/pets:get:operationId: listPetsresponses: { '204': { description: Empty } }fixes.overlay.yaml overlay: 1.1.0info: { title: Fixes, version: 1.0.0 }actions:- target: $.paths['/pet'].getupdate: { operationId: listAllPets }swaggerz generate warning overlay/no-match Overlay target $.paths['/pet'].get matches nothing; the action changes nothing.at fixes.overlay.yaml:4:5 (#/actions/0/target)hint The specification may have changed since the overlay was written.Fix. Update the target: the specification has probably changed since the overlay was written.
overlay/incompatible-updateerrorAn
updateorcopyvalue cannot be merged into the target (e.g. an object into a string)overlay/invalid-copyerrorA
copysource does not select exactly one nodeoverlay/invalid-referenceerrorAn Overlay 1.2 action
$refdoes not point tocomponents.actionsoverlay/appliedinfoHow many actions of an overlay were applied
References
ref/invaliderrorA
$refis malformed or points nowhereref/unresolvederrorA
$refis malformed or points nowhereref/missing-targeterrorA
$refis malformed or points nowhereExample: A reference to a schema that does not exist
openapi.yaml openapi: 3.1.0info:title: Exampleversion: '1.0'paths: {}components:schemas:Pet:type: objectproperties:category:$ref: '#/components/schemas/Categry'Category:type: objectswaggerz generate error ref/missing-target $ref "#/components/schemas/Categry" points to "/components/schemas/Categry", which does not exist in openapi.yaml.at openapi.yaml:11:9 (#/components/schemas/Pet/properties/category)Fix. Point the
$refat an existing component (here,Category).ref/circularerrorA chain of references never reaches a schema
Example: Two components that only refer to each other
openapi.yaml openapi: 3.1.0info:title: Exampleversion: '1.0'paths: {}components:schemas:A:$ref: '#/components/schemas/B'B:$ref: '#/components/schemas/A'swaggerz generate error ref/circular Circular $ref chain: these schemas only refer to each other.at openapi.yaml:8:5 (#/components/schemas/A)Fix. Give one of the schemas a definition of its own; recursion through properties is fine.
ref/too-deeperrorA chain of references never reaches a schema
ref/external-blockederrorBlocked by the reference policy (hint explains how to allow it)
Example: A remote reference with the default policy
openapi.yaml openapi: 3.1.0info:title: Exampleversion: '1.0'paths: {}components:schemas:Pet:$ref: 'https://schemas.example.com/pet.yaml'swaggerz generate error ref/external-blocked External reference to https://schemas.example.com/pet.yaml was blocked: remote references are disabled (spec.refs.external = "local").at openapi.yaml:8:5 (#/components/schemas/Pet)hint Set spec.refs.external to "remote" and add "schemas.example.com" to spec.refs.allowedHosts.Fix. Set
spec.refs.external: 'remote'and add the host tospec.refs.allowedHosts, or download the file next to the specification.ref/external-load-failederrorExternal document problems; the document limit is reported once and can be raised with
spec.refs.maxDocumentsref/too-many-documentserrorExternal document problems; the document limit is reported once and can be raised with
spec.refs.maxDocuments
Schemas
schema/invaliderrorMalformed schemas
schema/invalid-typeerrorMalformed schemas
schema/invalid-discriminatorerrorMalformed schemas
schema/too-deeperrorInline nesting beyond 512 levels
schema/foreign-keywordwarningKeyword from another version, honored
schema/unsupported-keywordwarning$dynamicRef,$recursiveRef, or a 3.1-only keyword (if,dependentSchemas, …) in a 3.0 document, ignoredExample: A 3.1 keyword in a 3.0 document
openapi.yaml openapi: 3.0.3info:title: Exampleversion: '1.0'paths: {}components:schemas:Shipping:type: objectproperties:country: { type: string }if:properties:country: { const: US }then:required: [zip]swaggerz generate warning schema/unsupported-keyword `if` is not supported and is ignored; the generated type may be wider than the schema.at openapi.yaml:8:5 (#/components/schemas/Shipping)warning schema/unsupported-keyword `then` is not supported and is ignored; the generated type may be wider than the schema.at openapi.yaml:8:5 (#/components/schemas/Shipping)Fix. Move the document to OpenAPI 3.1, or express the rule in the description.
schema/assertion-keywordinfonot,if/then/else,dependentSchemas,dependentRequired: not expressible in TypeScript types, enforced by generated Zod schemasExample: A rule TypeScript cannot express
openapi.yaml openapi: 3.1.0info:title: Exampleversion: '1.0'paths: {}components:schemas:NotEmpty:type: stringnot:const: ''swaggerz generate info schema/assertion-keyword `not` cannot be expressed in TypeScript types (they may be wider than the schema); generated Zod schemas enforce it.at openapi.yaml:8:5 (#/components/schemas/NotEmpty)Fix. Nothing to fix: enable
features.validationto enforce it at runtime.schema/validation-only-keywordinfoKeyword that only affects validation
schema/ref-siblings-ignoredwarningVersion-specific semantics applied
schema/nullable-31warningVersion-specific semantics applied
Example:
nullablein an OpenAPI 3.1 documentopenapi.yaml openapi: 3.1.0info:title: Exampleversion: '1.0'paths: {}components:schemas:Name:type: stringnullable: trueswaggerz generate warning schema/nullable-31 `nullable` is not part of OpenAPI 3.1 and is ignored.at openapi.yaml:8:5 (#/components/schemas/Name)hint Use `type: [<type>, "null"]` or `oneOf` with `{ type: "null" }`.Fix. Use
type: [string, 'null'], the JSON Schema 2020-12 spelling of a nullable type.schema/null-typewarningVersion-specific semantics applied
schema/type-arraywarningVersion-specific semantics applied
schema/tuple-itemswarningVersion-specific semantics applied
schema/exclusive-booleanwarningVersion-specific semantics applied
schema/empty-enumwarningQuestionable schemas
schema/enum-type-mismatchwarningQuestionable schemas
Example: Enum values of the wrong type
openapi.yaml openapi: 3.1.0info:title: Exampleversion: '1.0'paths: {}components:schemas:Status:type: stringenum: [active, 2]swaggerz generate warning schema/enum-type-mismatch Enum values 2 do not match type "string".at openapi.yaml:10:7 (#/components/schemas/Status/enum)Fix. Make every value match the declared
type.schema/empty-compositionwarningQuestionable schemas
schema/discriminator-ignoredwarningQuestionable schemas
schema/array-without-itemsinfoArray elements typed as
unknownExample: An array without
itemsin OpenAPI 3.0openapi.yaml openapi: 3.0.3info:title: Exampleversion: '1.0'paths: {}components:schemas:Tags:type: arrayswaggerz generate info schema/array-without-items Array schema without `items`; elements are typed as unknown.at openapi.yaml:8:5 (#/components/schemas/Tags)Fix. Declare
itemsso the elements get a type instead ofunknown.
Operations
operation/duplicate-idwarningDuplicate
operationId; names are disambiguatedExample: Two operations with the same operationId
openapi.yaml openapi: 3.1.0info:title: Exampleversion: '1.0'paths:/pets:get:operationId: listPetsresponses: { '204': { description: Empty } }/cats:get:operationId: listPetsresponses: { '204': { description: Empty } }swaggerz generate warning operation/duplicate-id operationId "listPets" is used by GET /pets, GET /cats; generated names are disambiguated.at openapi.yaml:11:5 (#/paths/~1cats/get)Fix. Give every operation its own
operationId; an overlay can do it for specifications you do not own.operation/missing-path-parameterwarningPath template and parameters disagree
Example: A path template without its parameter
openapi.yaml openapi: 3.1.0info:title: Exampleversion: '1.0'paths:/pets/{petId}:get:operationId: getPetresponses: { '204': { description: Empty } }swaggerz generate warning operation/missing-path-parameter Path parameter "petId" is used in the path but not declared; it is typed as string.at openapi.yaml:7:5 (#/paths/~1pets~1{petId}/get)in GET /pets/{petId} (getPet)Fix. Declare
petIdas anin: pathparameter of the path or the operation.operation/unused-path-parameterwarningPath template and parameters disagree
operation/optional-path-parameterwarningPath template and parameters disagree
operation/duplicate-parametererrorInvalid parameter combinations
operation/multiple-bodieserrorInvalid parameter combinations
operation/body-and-formerrorInvalid parameter combinations
operation/invalid-statuswarningIgnored or adjusted operation parts
operation/invalid-stylewarningIgnored or adjusted operation parts
operation/invalid-collection-formatwarningIgnored or adjusted operation parts
operation/empty-request-bodywarningIgnored or adjusted operation parts
operation/file-without-multipartwarningIgnored or adjusted operation parts
operation/body-on-getwarningIgnored or adjusted operation parts
operation/ignored-headerinfoAccept,Content-TypeorAuthorizationheader parameter ignored, as OpenAPI 3 requiresExample: An
Acceptheader parameteropenapi.yaml openapi: 3.1.0info:title: Exampleversion: '1.0'paths:/pets:get:operationId: listPetsparameters:- name: Acceptin: headerschema: { type: string }responses: { '204': { description: Empty } }swaggerz generate info operation/ignored-header Header parameter "Accept" is ignored; it is controlled by the request content or authentication.at openapi.yaml:10:11 (#/paths/~1pets/get/parameters/0)in GET /pets (listPets)Fix. Remove the parameter: OpenAPI 3 describes
Acceptthrough the response content types.operation/invalid-querystringerrorOpenAPI 3.2: more than one
in: querystringparameter, or one combined within: queryparametersoperation/reserved-methoderrorOpenAPI 3.2: an
additionalOperationskey is a method with its own Path Item field (GET,QUERY, …) or not a valid HTTP methodoperation/invalid-methoderrorOpenAPI 3.2: an
additionalOperationskey is a method with its own Path Item field (GET,QUERY, …) or not a valid HTTP methodoperation/querystring-credentialswarningOpenAPI 3.2: an API key sent
in: querycannot be added to a JSON or textquerystring; requirements that need it are skippedoperation/item-schemainfoOpenAPI 3.2: content described only by
itemSchema(JSON Lines, server-sent events) is typed and read as text
Security
security/invalid-schemeerrorwarningSecurity problems
security/unknown-schemeerrorwarningSecurity problems
Example: A security requirement naming no scheme
openapi.yaml openapi: 3.1.0info:title: Exampleversion: '1.0'paths:/pets:get:operationId: listPetssecurity:- apiKey: []responses: { '204': { description: Empty } }swaggerz generate warning security/unknown-scheme Security requirement references unknown scheme "apiKey"; it is ignored.at openapi.yaml:10:11 (#/paths/~1pets/get/security/0/apiKey)Fix. Declare the scheme under
components.securitySchemes, or correct its name.
Naming
naming/collisionwarningA name was taken; a suffix was added
Example: Two operationIds that become the same function name
openapi.yaml openapi: 3.1.0info:title: Exampleversion: '1.0'paths:/pets:get:operationId: list-petsresponses: { '204': { description: Empty } }/pets/all:get:operationId: listPetsresponses: { '204': { description: Empty } }swaggerz generate warning naming/collision Operation name "listPets" (GET /pets/all) is already taken; it is exported as "listPets2".Fix. Rename one of the operations, or choose names with the
operationNameplugin hook.
Data fetching
query/invalid-page-paramerrorThe configured infinite query parameter does not exist
Example: An infinite query on a parameter that does not exist
openapi.yaml openapi: 3.1.0info:title: Exampleversion: '1.0'paths:/pets:get:operationId: listPetsparameters:- name: pagein: queryschema: { type: integer }responses: { '204': { description: Empty } }swaggerz generate error query/invalid-page-param Infinite query for GET /pets: "cursor" is not a query parameter of the operation.hint Use one of: page.Fix. Name the query parameter that carries the page (here
page).query/unknown-operationwarningA key of
infiniteorinvalidatesnames no operation, or one of the wrong kind (a mutation ininfinite, a query ininvalidates)query/unknown-targetwarningAn
invalidatestarget is neither a query (name oroperationId) nor a tag, or names a tag without queriesExample: Invalidating a query that does not exist
openapi.yaml openapi: 3.1.0info:title: Exampleversion: '1.0'paths:/pets:get:operationId: listPetsresponses: { '204': { description: Empty } }post:operationId: createPetresponses: { '204': { description: Empty } }swaggerz generate warning query/unknown-target features.query.invalidates.createPet: "listPet" is neither a query operation nor a tag; it is ignored.hint Did you mean "listPets"?Fix. Name a query operation or a tag; the hint suggests the closest one.
Mocks
mock/invalid-examplewarningfeatures.mocks: anexampleordefaultdoes not match its schema; the fixture uses a generated value insteadExample: An example its own schema rejects
openapi.yaml openapi: 3.1.0info:title: Exampleversion: '1.0'paths: {}components:schemas:Pet:type: objectproperties:age:type: integerminimum: 0example: -1swaggerz generate warning mock/invalid-example The example of `Pet.age` does not match its schema; the fixture uses a generated value instead.at openapi.yaml:8:5 (#/components/schemas/Pet)hint Correct the example.Fix. Correct the example: documentation and fixtures both show it.
mock/unsatisfiablewarningfeatures.mocks: no generated value satisfies the schema (a model that requires itself, contradictory constraints,never); the fixture may not validateExample: A model that requires itself
openapi.yaml openapi: 3.1.0info:title: Exampleversion: '1.0'paths: {}components:schemas:Node:type: objectrequired: [next]properties:next:$ref: '#/components/schemas/Node'swaggerz generate warning mock/unsatisfiable `Node` has no finite value: it requires itself, so its fixture cannot be generated.at openapi.yaml:8:5 (#/components/schemas/Node)Fix. Make the reference optional or nullable, so that a chain of values can end.
mock/unsupported-patterninfofeatures.mocks: no string matching apatternwas found (not a valid ECMAScript pattern, no match within the length bounds, or the matcher's step budget ran out); the fixture does not match itExample: A pattern no string of the allowed length matches
openapi.yaml openapi: 3.1.0info:title: Exampleversion: '1.0'paths: {}components:schemas:Code:type: stringmaxLength: 4pattern: '^[A-Z]{3}-[0-9]{4}$'swaggerz generate info mock/unsupported-pattern No string matching the pattern of `Code` could be generated; the fixture does not match it.at openapi.yaml:8:5 (#/components/schemas/Code)hint Add an `example` that matches the pattern.Fix. Add an
examplethat matches the pattern; the fixture uses it.
Output
output/user-fileerrorA file the generator does not own is in the way, or a directory where a file goes (or a file where a directory goes)
output/edited-stale-filewarningHand-edited generated files were kept
output/edited-file-keptwarningHand-edited generated files were kept
output/invalid-patherrorA plugin produced an unsafe or duplicate path (not relative and normalized, or containing
\,:or empty,.or..segments)output/duplicate-patherrorA plugin produced an unsafe or duplicate path (not relative and normalized, or containing
\,:or empty,.or..segments)output/write-failederrorWriting or deleting failed, or would go through a symbolic link that leaves the output directory.
generateleaves the previous output intact;cleandeletes nothing when a file is refused
Plugins
plugin/hook-failederrorA plugin hook threw
Dashboard
dashboard/network-accesserrorThe dashboard was asked to listen on a non-loopback interface
Internal
internal/errorerrorUnexpected failure; please report it
Lint findings
lint/operation-idwarningAn operation has no
operationId: its function name is derived from the method and path and changes with themExample: An operation without an operationId
openapi.yaml openapi: 3.1.0info:title: Exampleversion: '1.0'servers: [{ url: 'https://api.example.com' }]tags: [{ name: pets }]paths:/pets:post:summary: Add a pettags: [pets]responses: { '204': { description: Created } }swaggerz lint warning lint/operation-id POST /pets has no operationId: its function is named "postPets" after the method and path.at openapi.yaml:9:5 (#/paths/~1pets/post)in POST /petshint Add an operationId (an overlay can add it to a specification you do not own).Fix. Add an
operationId, so the function keeps its name when the path changes.lint/operation-id-styleinfoAn
operationIdis not an identifier in thenaming.operationsstyle: the exported function has another namelint/operation-tagsinfoAn operation has no tags: it is generated into the
defaultgrouplint/undeclared-taginfoA tag used by operations is not declared in the top-level
tagslint/operation-summaryinfoAn operation has neither a summary nor a description for its JSDoc
lint/success-responsewarningAn operation documents no 2xx or
defaultresponse: it resolves withvoidlint/response-schemawarningA JSON success response has no schema: the operation resolves with
unknownExample: A JSON response without a schema
openapi.yaml openapi: 3.1.0info:title: Exampleversion: '1.0'servers: [{ url: 'https://api.example.com' }]tags: [{ name: pets }]paths:/pets:get:operationId: listPetssummary: List petstags: [pets]responses:'200':description: The petscontent:application/json: {}swaggerz lint warning lint/response-schema The 200 response of GET /pets (application/json) has no schema: "listPets" resolves with unknown.at openapi.yaml:14:9 (#/paths/~1pets/get/responses/200)in GET /pets (listPets)Fix. Describe the body with a schema; until then the function resolves with
unknown.lint/inline-schemainfoA JSON request or response body is an inline object schema, named after the operation and not reusable
Example: An inline request body
openapi.yaml openapi: 3.1.0info:title: Exampleversion: '1.0'servers: [{ url: 'https://api.example.com' }]tags: [{ name: pets }]paths:/pets:post:operationId: addPetsummary: Add a pettags: [pets]requestBody:content:application/json:schema:type: objectproperties:name: { type: string }responses: { '204': { description: Created } }swaggerz lint info lint/inline-schema The request body of POST /pets (application/json) is an inline object schema: its type is named after "addPet" and cannot be reused.at openapi.yaml:13:7 (#/paths/~1pets/post/requestBody)in POST /pets (addPet)hint Move it to components/schemas and reference it.Fix. Move the schema to
components.schemasand reference it, so other operations can share the type.lint/untyped-schemainfoA named schema has no type, properties or composition: it is generated as
unknownlint/duplicate-schemainfoNamed schemas are structurally identical: the client contains duplicate types
lint/unused-modelinfoA named schema is not used by any operation (still generated unless
output.models: 'used')lint/missing-serversinfoNo server is declared and
client.baseUrlis not set: the client has no default base URLExample: No server and no base URL
openapi.yaml openapi: 3.1.0info:title: Exampleversion: '1.0'tags: [{ name: pets }]paths:/pets:get:operationId: listPetssummary: List petstags: [pets]responses: { '204': { description: Empty } }swaggerz lint info lint/missing-servers The specification declares no server: the client has no default base URL.at openapi.yamlhint Add a server, set client.baseUrl, or call client.setConfig({ baseUrl }) at runtime.Fix. Declare
servers, setclient.baseUrl, or callclient.setConfig({ baseUrl })at startup.