Skip to main content

JSON:API support library.

Project description

kt.jsonapi supports generation of JSON:API responses using adaptation from application objects.

Input validation for JSON:API is not currently provided, but is planned for the future.

The current implementation works with the Flask web framework.

Release history

1.6.1 (2022-05-12)

  1. Add missing long_description package metadata.

1.6.0 (2022-05-03)

  1. First public release of kt.jsonapi.

  2. Added support for Python 3.10, 3.11.

1.5.0 (2021-09-20)

  1. Bug fix: The context methods created() and resource() could serialize the primary data into included as well as data if a circular relationship including the primary data passed into the call was included.

  2. Fix tests inherited from the resource tests to actually invoked the created method when run as part of the tests for created.

  3. Add response method related() to generate a serialized response for the target of a relationship. This is useful with regard to mutable to-one relationships because of the constraint that the related resource link not change because of changes to the referenced resource.

  4. Allow a Flask application to provide specialized context implementations that can provide appropriate JSON:API Object values.

  5. Support serialization of a JSON:API Object with all responses.

  6. Avoid unintended chained exceptions in context() and error_context() high-level functions.

1.4.0 (2021-05-24)

  1. Support JSON:API 1.1 enhancements to the link & error objects.

  2. Support include and fields as appropriate for responses where the primary data is a relationship. This reflects an extension of the relationship interfaces with the name attribute, which remains optional; if not present, include and fields continue to generate an error.

  3. Include content from relationships which were identified in the include query parameter even if the relationships themselves were excluded by a fields[...] parameter.

  4. Update to modern PyPA tooling recommendations.

1.3.0 (2021-03-26)

  1. Serialization of errors via adaptation is supported using a new context method. This includes support for multiple error objects in a single response. This does not cause JSON:API errors to be returned automatically from response methods on the context, since switching from a planned response to an error response should invoke content negotiation; this is left to integration layers.

  2. Support relationships that cannot be included in composite documents using the include query string parameter. A request for inclusion of resources from a non-includable relationship will cause an exception indicating a 400 Bad Request response will be raised. Otherwise, the relationship will be serialized without a data element; only links and meta will be included, as appropriate.

1.2.1 (2021-01-12)

  1. Support pagination links of None for collections and to-many relationships.

  2. Treat an empty include query parameter as an empty list of relationship paths. This was previously silently treated as an empty relationship path, though invalid. https://github.com/json-api/json-api/issues/1530

1.2.0 (2021-01-04)

  1. Manage query parameters for top-level self and pagination links. This can be a significant change for applications that deal with query parameters themselves. https://github.com/json-api/json-api/issues/1502

  2. Fix generation of links for a relationship to correctly deal with collection-oriented query parameters (filter, page, sort).

  3. Validate relationship paths passed to the include query parameter.

  4. Change constructor for Context object to accept both the Flask application and request objects, and update call sites to de-proxy those before passing them in. This (slightly) improves the resilience of the constructed context to be less dependent on the source thread.

  5. Change constructor signature for Link object to accept a meta parameter instead of assembling keyword parameters into the dictionary for arbitrary metadata. This will allow additional future flexibility for parameters with more specific interpretation.

1.1.0 (2020-10-27)

  1. Added created() method on the context object, for use in returning a response containing a newly created resource. Similar to resource(), it returns a 201 status code and a serialization of the created resource.

1.0.1 (2020-09-18)

  1. Support explicit request to receive no fields by resource type. This reflects a recent clarification added to the JSON:API specification.

  2. Provide included in response if request includes an include query parameter, even if the value is an empty list. Improves conformance with JSON:API 1.1. https://github.com/json-api/json-api/issues/1230

  3. Adapt source object to IResource in relationship implementations.

1.0.0 (2020-07-09)

First release, internal to Keeper Technology, LLC.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kt.jsonapi-1.6.1.tar.gz (21.2 kB view details)

Uploaded Source

Built Distribution

kt.jsonapi-1.6.1-py3-none-any.whl (22.6 kB view details)

Uploaded Python 3

File details

Details for the file kt.jsonapi-1.6.1.tar.gz.

File metadata

  • Download URL: kt.jsonapi-1.6.1.tar.gz
  • Upload date:
  • Size: 21.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.12

File hashes

Hashes for kt.jsonapi-1.6.1.tar.gz
Algorithm Hash digest
SHA256 f7fc072b45e5b04fded1f623b62ba320b09304f8082a45614bce7aa3ae654dc0
MD5 5797b0b4f271e8bf156b0de75312d943
BLAKE2b-256 773bf75d992871f02d56d72850ae9738bcc07ad48b97c63edfcb8de58a894e1f

See more details on using hashes here.

File details

Details for the file kt.jsonapi-1.6.1-py3-none-any.whl.

File metadata

  • Download URL: kt.jsonapi-1.6.1-py3-none-any.whl
  • Upload date:
  • Size: 22.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.12

File hashes

Hashes for kt.jsonapi-1.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 25eb02cd8420a8617ceaf315624687b6415a7f78d0439abf3530006cff8df6a2
MD5 0f130ec9fc42fff36480a7b5aba42443
BLAKE2b-256 bae1ad80e128b90bfb983f442db505c4febd1c3bca10d3e4346889532d721fc4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page