Reference
Exceptions
The exceptions the library throws, when, and how to fix each one.
Every exception is in Ark4ne\OpenApiWriter\Exceptions, implements OpenApiWriterException, and extends the matching
SPL exception. Catch OpenApiWriterException to catch them all.
use Ark4ne\OpenApiWriter\Exceptions\OpenApiWriterException;
try {
$json = $document->toJson();
} catch (OpenApiWriterException $exception) {
// …
}
MissingObjectIdException
InvalidArgumentException
A map entry has no key:
Components::create()->schemas(Schema::string()).
Message: Components::schemas: an entry has no objectId. Give the objectId: Schema::string('Name').DuplicateObjectIdException
InvalidArgumentException
Two entries of a map share a key, or an
add method adds an existing key.
Message: Components::schemas: an entry with the objectId "A" already exists. Rename the entry, or use the replacing
method.InvalidArgumentException
InvalidArgumentException
A value no version accepts: a status code out of range, an unknown enum value, exclusive fields set together.
Message:
License::identifier: url and identifier are mutually exclusive. Thrown by the method call.UnsupportedFeatureException
RuntimeException
Strict writing of features the target version cannot express;
diagnostics() lists them. Remove them, target a newer
version, or use the lenient mode.MissingDependencyException
LogicException
toYaml() without symfony/yaml, or OpisJsonSchemaValidator without opis/json-schema. The message gives the
composer require command.