Goal

The end goal is to have the stability of the dynamic_page_cache and big_pipe modules, which thanks to their rigorous test coverage have seen barely any bug reports over the course of more than a year. To achieve that, we may need a level of functional test coverage similar to the REST module (as added in #2737719: EntityResource: Provide comprehensive test coverage: for every entity type, every format, every method).

Plan

Roughly in order of sensible execution, but many things can be done in parallel.

  1. Confidence: validate all JSON API responses against the spec: #2840677: Validate responses against the JSON API specification
  2. Confidence: validate all JSON API responses against the resource-specific JSON Schema: #2917260: Validate against specific JSON Schemas if Schemata is present
  3. Complexity: route handling (see details of current pain points described in #2841591: Remove EntityResource, move its logic into RequestHandler, clean up routes).
  4. Complexity: refactor away the following classes:
    1. Drupal\jsonapi\Resource\EntityCollection
    2. Drupal\jsonapi\Resource\JsonApiDocumentTopLevel
    3. Drupal\jsonapi\RequestCacheabilityDependency, issue: #2846659: Remove \Drupal\jsonapi\RequestCacheabilityDependency, use \Drupal\jsonapi\JsonApiSpec::getReservedQueryParameters() instead
  5. Confidence + complexity: simplify + add strict, comprehensive tests + add architectural documentation to the following subnamespaces in the JSON API module:
    1. src/Access, issue: #2829328: Clean up Drupal\jsonapi\Access\CustomParameterNames and make it follow the spec more closely
    2. src/Context, issues: #2842145: Add comprehensive unit test coverage for \Drupal\jsonapi\Context\FieldResolver + #2930228: Refactor CurrentContext away
    3. src/Error, issue: #2829977: SerializableHttpException and Drupal\jsonapi\Error\* are not necessary
    4. src/FieldResolver
    5. src/Normalizer, issue: #2860350: Document why JSON API only supports @DataType-level normalizers (will likely need more issues)
    6. src/Query, issue: #2874601: refactor(QueryBuilder): Improve testability/maintainability (will likely need more issues)
    7. src/Routing/Param
  6. Complexity: remove the following subnamesapces in the JSON API module, because they should be addressed in core
    1. src/Field, blocked on #2825487: Fix normalization of File entities: file entities should expose the file URL as a computed property on the 'uri' base field, issue: #2926463: [>=8.5] Remove JSON API's "file URL" field work-around now that Drupal core 8.5 fixed it
    2. src/LinkManager, blocked on #2854830: Move rest/serialization module's "link manager" services to HAL module, issue: #2829746: Clean up \Drupal\jsonapi\LinkManager\LinkManager(Interface)
    3. src/ParamConverter, blocked on #2353611: Make it possible to link to an entity by UUID
    4. src/ResourceResponseInterface, fixed in #2857658: Get rid of ResourceResponseInterface
  7. Confidence: correctness verification + regression guards by implementing comprehensive functional tests, similar to REST module's test coverage: #2930028: Comprehensive JSON API integration test coverage phase 1: for every entity type, individual resources only
  8. Ecosystem wrt Typed Data & Normalizers, to ensure core REST + JSON API + GraphQL + OpenAPI all stay consistent:
    1. #2921257: On Drupal 8.5, JSON API should respect Typed Data's new ::isInternal(), and JSON API Extras should use ::setInternal()
    2. #2860350: Document why JSON API only supports @DataType-level normalizers
    3. #2929932: Work around core's ill-designed @FieldType-level TimestampItemNormalizer normalization until #2926508 lands
    4. #2929935: Remove JSON API's ScalarNormalizer: it's no longer necessary thanks to #2751325's PrimitiveDataNormalizer
  9. DX:
    1. #2930231: JSON API 403 errors don't tell the user *why* access is not granted: requires deep Drupal understanding to figure out
    2. #2853066: Spec Compliance: Inaccessible collection/related resources surface errors: should be 200 with hypermedia + metadata
  10. Security:
    1. #2887313: JSON API indicates it supports POST/PATCH/DELETE of config entity types, but that's impossible
  11. JSON API spec compliance:
    1. #2888132: JSON API spec compliance: Throw error if relationships are not stored under data
    2. #2888889: JSON API spec compliance: Throw error if the "type" attribute is missing in write operations

Comments

Wim Leers created an issue. See original summary.

wim leers’s picture

Issue summary: View changes

#2353611: Make it possible to link to an entity by UUID would allow JSON API to remove \Drupal\jsonapi\ParamConverter\EntityUuidConverter.

wim leers’s picture

dawehner’s picture

src/ResourceResponseInterface

I'm really wondering how useful is to have this interface in the first place

a) Why would anyone want to have a different implementation of that
b) This class seems to be mostly handled internally. Maybe we don't need an interface in the first place?

wim leers’s picture

#6++, exactly :)

e0ipso’s picture

+1 to #6.

dawehner’s picture

Issue summary: View changes
wim leers’s picture

wim leers’s picture

Title: Next steps: the path to stability for the JSON API module » [PP-2] Next steps: the path to stability for the JSON API module
Issue summary: View changes
Related issues: +#2825487: Fix normalization of File entities: file entities should expose the file URL as a computed property on the 'uri' base field

Removing src/Field is blocked on #2825487: Fix normalization of File entities: file entities should expose the file URL as a computed property on the 'uri' base field. And removing src/ParamConverter is blocked on #2353611: Make it possible to link to an entity by UUID.

That means at least two things in this Plan issue are blocked on core issues.

wim leers’s picture

#2829327: Review JSON API module for core-readiness is done! That means this is now the most important remaining plan issue.

wim leers’s picture

Issue summary: View changes

It seems that I was right in wanting to review more of the architecture of the JSON API module, because if I'd gotten to

Confidence + complexity: simplify + add strict, comprehensive tests + add architectural documentation to the following subnamespaces in the JSON API module: […] src/Normalizer

I'd definitely have found #2860350: Document why JSON API only supports @DataType-level normalizers. This is probably the most critical bug since we started tagging stable releases.

wim leers’s picture

Issue summary: View changes

#2874601: refactor(QueryBuilder): Improve testability/maintainability is tackling Confidence + complexity: simplify + add strict, comprehensive tests + add architectural documentation to the following subnamespaces in the JSON API module: for the src/Query subnamespace! 🎉

wim leers’s picture

Issue summary: View changes

#2874601: refactor(QueryBuilder): Improve testability/maintainability landed, which makes the situation/status of src/Query a lot better! 🎉

wim leers’s picture

Issue summary: View changes

Added #2921257: On Drupal 8.5, JSON API should respect Typed Data's new ::isInternal(), and JSON API Extras should use ::setInternal(), because it's so important for the API-First ecosystem of modules (REST + JSON API + GraphQL).

e0ipso’s picture

Agreed with #16.

wim leers’s picture

wim leers’s picture

wim leers’s picture

Issue summary: View changes

We've had Confidence: correctness verification + regression guards by implementing comprehensive functional tests, similar to #2737719: EntityResource: Provide comprehensive test coverage: for every entity type, every format, every method in the issue summary since the creation of this issue.

As described in https://wimleers.com/blog/api-first-drupal-really, this is finally complete for core REST as of 1.5 week ago. So now we can do the same for JSON API. Created #2930028: Comprehensive JSON API integration test coverage phase 1: for every entity type, individual resources only.

wim leers’s picture

wim leers’s picture

skyredwang’s picture

e0ipso’s picture

I am confused by the tendency in this issue. It seems that every open bug is added here. I'm unsure how that highlights stability.

wim leers’s picture

#28: I've not added a single minor bug. Only issues that are either important for BC/DX, or for architecture.

I believe all these issues are really important for the JSON API module to become really rock-solid and easy to maintain in core.

wim leers’s picture

Title: [PP-2] Next steps: the path to stability for the JSON API module » The path for JSON API to "super stability"
Status: Active » Postponed
Related issues: +#2931785: The path for JSON API to core

@e0ipso, you're right, the scope of this issue is now far beyond core-readiness. It's about getting the entire module's codebase to a super-maintainable point.

So, I opened a new issue specifically for core-readiness: #2931785: The path for JSON API to core.

This issue is therefore a superset of #2931785, and deserves to be postponed, because the highest priority issues can be found in #2931785: The path for JSON API to core.

gabesullice’s picture

Version: 8.x-1.x-dev » 8.x-2.x-dev
wim leers’s picture

Status: Postponed » Fixed

Actually, only one issue in the IS has not yet been completed: #2853066: Spec Compliance: Inaccessible collection/related resources surface errors: should be 200 with hypermedia + metadata. That's now one of a handful remaining (strict) spec compliance issues. This issue has served its purpose — marking it Fixed!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.