openapi-enforcer
Advanced tools
Changelog
1.23.0
You Can Ignore Undefined Property Values
The default implementation complains of objects where a property is defined but set to undefined
.
This will cause Schema instances to fail validations, serialization, and deserialization.
Now you have the option to set the global Enforcer.config.ignoreUndefinedPropertyValues
to true
or false
(default)
or when calling a Schema instance's validate
function you can specify the ignoreUndefinedPropertyValues
as an option property.
Serialization and deserialization will now ignore undefined values in all cases.
Changelog
1.22.3
Update Dependencies
Updated some dependencies to address security vulnerabilities.
Changelog
1.22.2
Fix Validation of not
Sub Schema
Any time a schema had the property not
, it was not validating correctly.
This code for this fix, including tests, is thanks to
gaetano-guerriero.
Changelog
1.22.1
Exception Skip Codes Bug Fix
The exception skip codes that were defined via the options were not being carried through to child components. This fix allows those settings to be carried. Exception skip codes defined by an instance (see change 1.22.0) are still limited to just the component.
Changelog
1.22.0
You Can Now Skip Instances of an Exception
Being able to skip a specific type of exception has been around for a while, but if you want to skip just a single
instance of an exception, that is now possible. Find the nearest component to where your exception is occurring and
add the extension x-enforcer-exception-skip-codes
followed by a space seperated list of all exceptions that should
be skipped in that component. This will not affect child components of this component, only the exceptions that
specifically belong to this component.
MySchema:
x-enforcer-exception-skip-codes: WSCH001 WSCH002
type: string
format: tacos
Changelog
1.21.1
Default Values Can Be Specified with allOf and anyOf Schemas
Schemas that use the allOf
or anyOf
property can now specify a default value at the shared schema level. For example:
MySchema:
default: false
anyOf:
- type: boolean
- type: number
Changelog
1.21.0
You Can Use Non-Spec Properties and Skip Exception
Using a property that is not defined in the OpenAPI specification will generally result in an exception. Now there is an
exceptionSkipCode EDEV001
that will allow you to use properties
that are not part of the OpenAPI specification.
Warn of Required Properties that are Not Specified
In the scenario where you define an object with a required property but do not include that property
in the properties
list, the object is valid, according to the OpenAPI specification because additionalProperties
defaults to true
.
MySchema:
type: object
required:
- "a"
- "b"
properties:
a:
type: string
description: field a
c:
type: string
description: field c
With this change, when you specify a required property without also specifying the schema attached
to that property a warning will now be produced that can either be escalated or skipped using
exceptionSkipCode WSCH007
.
Changelog
1.20.0
Replaced Dynamic Imports with Static Imports
The index.js
file was using dynamic imports via the Super
function. That has been replaced with static imports
which may allow this library to run on Deno. Thanks to mattiasrunge for the PR.
Changelog
1.19.0
exceptionSkipCodes and exceptionEscalateCodes for Invalid Example
Add the escalate / skip code WSCH006 to better manage invalid examples that don't match schemas.
Normalized Invalid Example Severity
Previously invalid examples would be warnings in some cases and errors in other places. Now all invalid examples are warnings, but you can convert those to errors or ignore them entirely now by using exceptionSkipCodes and exceptionEscalateCodes. See documentation on Component Options in the documentation.
Changelog
1.18.0
Case Sensitivity Optional For Paths
The default behavior is for paths to be case sensitive. There is now an option Enforcer.config.useCaseSensitivePaths
(defaulting to true
) that when set to false
will change how paths duplicates are validated and how paths are looked up when attempting to match a path to a request.