Skip to content

Releases: mattpolzin/OpenAPIKit

Fix error reporting on Path decoding

03 May 05:13
5c18f9c
Compare
Choose a tag to compare
Pre-release

Fixes errors on Path where nested Either decoding errors are involved.

Adding specification extension support

28 Apr 03:06
84ac940
Compare
Choose a tag to compare
Pre-release

Added specification extensions for:

  • Document
  • Document.Info
  • PathItem
  • Components
  • Operation
  • Server
  • Contact
  • License
  • Parameter

Added Parameter.location to expose a raw representable enum that just represents location (query, header, path, cookie).

⚠️ Breaking Changes ⚠️

  • Rename Parameter.Location to Parameter.Context.
  • Rename Parameter.parameterLocation to Parameter.context.

Fixes a bug with decoding whole number floats as integers

23 Apr 00:33
3c7e9f4
Compare
Choose a tag to compare

Decoding was inadvertently strict w/r/t whole number floats (like "1.0") being parsable as the Int type, specifically when using certain decoders.

Fixes #56.

Better JsonSchema allOf support

22 Apr 02:07
abbfc11
Compare
Choose a tag to compare
Pre-release
  1. Added .other case to OpenAPI.ContentType.
  2. Added PathItem.endpoints to get an array of all endpoints defined for the particular path.
  3. Added validation that security schemes referenced from PathItem.Operations can be found in the Components.
  4. Added JSONSchemaFragment to allow JSONSchema.all(of:) case to represent less than whole JSONSchemas.
  5. Fixed bug where JSONSchema would not parse anything without an explicit type specified -- upon further reading of the JSON Schema specification, it is fine to omit the type property. Now JSONSchema is happy as long as it has some way to infer the type.

⚠️ Breaking Changes ⚠️

  1. Renamed the wildcard ContentTypes to be "any" instead of "all":
  • all -> any
  • applicationAll -> anyApplication
  • audioAll -> anyAudio
  • imageAll -> anyImage
  • textAll -> anyText
  • videoAll -> anyVideo
  1. JSONSchema.all(of:) used to store an array of JSONSchema whereas now it stores an array of JSONSchemaFragment.

Better JSONSchema examples and minor OrderedDictionary error improvements

30 Mar 02:20
ff8b447
Compare
Choose a tag to compare
  • OrderedDictionary produces better error output when it fails to decode OpenAPI.ComponentKey (the keys of components in the Components Object).
  • JSONSchema is aligned with OpenAPI.Example in using AnyCodable for examples.

⚠️ Breaking Changes ⚠️
JSONSchema example properties switched from String to AnyCodable. This aligns with the examples of the Example Object (OpenAPI.Example). AnyCodable is preferable here because it will get encoded as a JSON structure instead of a String and that will be presented more favorably in UIs such as ReDoc. Any Encodable thing can still be turned into a String, wrapped in AnyCodable, and passed in to produce the result that you used to get, the work to do so is just a bit more exposed.

Change `openAPISchema()` function to property.

20 Mar 23:35
fe38a01
Compare
Choose a tag to compare

⚠️ Breaking Changes ⚠️
The throwing openAPISchema() function has been changed to the openAPISchema property (which is, naturally, non-throwing) because this function never needed to throw anyway in the end. It has been quite a few versions since any code relied on a throwing variant of it.

Bring dependencies into project

20 Mar 22:49
9a66f0f
Compare
Choose a tag to compare
Pre-release

⚠️ Breaking Changes ⚠️
Brings Poly, OrderedDictionary, and AnyCodable dependencies into project, additionally making small tweaks and (in the case of Either) substantial additions to the available interface.

Either

Support now offered by the in-library Either type instead of the Poly2 type.

Adds OpenAPI.Component.dereference() function and named accessors for all existing types OpenAPIKit wraps in Either.

OrderedDictionary and AnyCodable

No changes to interface except for only adding the AnyCodable type (no need for the AnyEncodable or AnyDecodable types).

0.25.0: Merge pull request #34 from mattpolzin/bugfix/components-object-keys

18 Mar 00:59
6526ceb
Compare
Choose a tag to compare

Fixes #28

⚠️ Breaking Changes ⚠️
Changes keys in Components Object dictionaries from String to OpenAPI.ComponentKey in order to provide validation. ComponentKey has String raw values and is ExpressibleByStringLiteral so this is a pretty small breaking change.

API cleanup

15 Mar 22:25
3f770ab
Compare
Choose a tag to compare
API cleanup Pre-release
Pre-release

Additions:

  • Retrieve referenced components with OpenAPI.Components.subscript()
  • Construct references from components object with OpenAPI.Components.reference(named:ofType:)

⚠️ Breaking Changes ⚠️

JSON References

JSONReference has structurally changed substantially, as has the individual dictionaries in OpenAPI.Components. The latter does not break any public APIs except for Components.init taking a bunch of OrderedDictionary parameters instead of the old RefDict type.

JSONReference internal construction has changed as follows:

Old: JSONReference.internal(\.schemas, named: "hello_world")
New: JSONReference.component(named: "hello_world")

Old: JSONReference.internal(.unsafe("#/hello/world"))
New: JSONReference.internal(path: "/hello/world")

JSONReference external construction has changed as follows:

Old: JSONReference.external("hello.json", .unsafe("#/hello/world"))
New: JSONReference.external(URL(string: "hello.json#/hello/world")!)

Misc.

  • Rename OpenAPI.ExternalDoc -> OpenAPI.ExternalDocumentation
  • Rename OpenAPI.PathComponents -> OpenAPI.Path
  • Rename OpenAPI.Response.StatusCode.Range cases:
    • _100 -> information
    • _200 -> success
    • _300 -> redirect
    • _400 -> clientError
    • _500 -> serverError
  • Remove AnyCodable export (must now be explicitly imported by other libraries if they wish to interact with the AnyCodable API directly).

Move Reflection Code

05 Mar 07:55
7386355
Compare
Choose a tag to compare
Move Reflection Code Pre-release
Pre-release

⚠️ Breaking Changes ⚠️
Moved reflection code and some code that takes Swift types to OpenAPISchema using a JSONEncoder into a new library at mattpolzin/OpenAPIReflection.