Skip to content

v3.0:

Latest

Choose a tag to compare

@snarfed snarfed released this 18 Oct 21:55
· 4 commits to main since this release
b8119a5

Breaking changes:

  • flask_server: ATProto-decode JSON input, so methods receive native CID and bytes values instead of $link and $bytes dicts. (Also encode methods' output the same way, as ATProto JSON, but that's backward compatible. Details below.)

Non-breaking changes:

  • Client, Server: new require_lexicons kwarg, defaults to True. If False, records with missing or unknown lexicons are skipped during validation instead of raising NotImplementedError.
  • Schema validation:
    • Base.validate: new ignore kwarg, a sequence of property names to skip validating or truncating, anywhere in the record.
    • Fix ref type validation to accept string values that match their ref, eg token refs inside arrays or unions.
    • Fix minimum/maximum schema constraint of 0.
    • truncate: truncate string values inside arrays.
    • Fix crash on values with unexpected types when truncate is on but validate is off, and on non-object parameters values.
    • Fail on float values, which aren't in the data model
    • Support the new space lexicon type and space-ref string format, and allow space at:// URIs in the at-uri format.
  • Base.decode_params: decode array values using their items type.
  • XrpcError: new status and headers kwargs. flask_server uses them in the HTTP response.
  • Server.method, Server.register: new override kwarg that allows replace an existing method.
  • flask_server:
    • init_flask: new fallback kwarg, a callable that handles methods the Server doesn't implement instead of returning MethodNotImplemented. Useful for ATProto service proxying.
    • Serve OPTIONS CORS preflight requests for methods without lexicons, and for subscriptions.
    • ATProto-encode JSON output, so methods can return native CID and bytes values, which are encoded as $link and $bytes.
  • Bundle new lexicons: