Skip to content

Just do your best

Pre-release
Pre-release

Choose a tag to compare

@mattpolzin mattpolzin released this 24 Dec 07:55
0c66811

Among the other changes listed below, this release swaps out some errors that used to cause decoding to fail for warnings so that more documents can be decoded even if they don't quite follow the specification. The warnings are stored and you can get at them all easily by calling document.validate(strict: false) which returns all warnings that were produced. By default, validate() will be strict and all warnings will become validation failures, so validation still serves to determine whether a document really follows the spec. to the letter.

Big thanks to @kean for both the direct contributions to the code in this release and also the immensely helpful suggestions and bug reports.

Enhancements

  • A few parsing errors have been turned into warnings when there is still some way to finish parsing a document despite a problem being found.
  • OpenAPI 3.1 support (the OpenAPIKit module) for multiple examples on JSONSchema as specified by JSON Schema.
  • You can disable VendorExtensions from being decoded or encoded (which can be a big boost to performance) by setting VendorExtensionsConfiguration.isEnabled = false. (@kean)
  • OpenAPIKit retains the order of more decoded objects (including properties in JSONSchema objects). (@kean)

Bug Fixes

  • Fix mistaken decoding of AnyCodable values that aren't strings when a JSONSchema's type is specified to be string. (@kean)

⚠️ Breaking Changes ⚠️

  • The OpenAPIKit module (but not the OpenAPIKit30 module) now exposes only an examples property on JSONSchemas and their contexts. This is backwards compatible with example when decoding, but code that references example will need to be updated to use the new examples array instead.
  • The externally available ContentType is changing from an enum to a struct. Equality checks for all of the previous enum's cases will still work against new static constructors but switch statements will no longer be possible.
  • Code that works with the newly converted OrderedDictionary properties will likely work without modification, but there are some methods supported by Dictionary but not OrderedDictionary so some code may need to be tweaked. See #233 if you are curious what properties have changed.
  • Response.StatusCode is changing from an enum to a struct. Code won't necessarily need to change, but switching on it will need to instead switch on its value property.
  • JSONSchema is changing from an enum to a struct (as usual, to facilitate storage of warnings). For most code, use will not change, but if you switch over any JSONSchemas, you should change to switching over the newly exposed value property of JSONSchema instead.