Skip to content

API cleanup

Pre-release
Pre-release
Compare
Choose a tag to compare
@mattpolzin mattpolzin released this 15 Mar 22:25
3f770ab

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).