OpenAPI support

Created on 25 September 2020, over 4 years ago
Updated 15 May 2024, 11 months ago

Problem/Motivation

Currently, the Commerce API module swaps the JsonApiGenerator (See \Drupal\commerce_api\Plugin\openapi\OpenApiGenerator\AdjustedJsonApiGenerator), and basically filters out the JSON API routes provided by the Commerce API module.

The reason for that is that our resource types are incorrect.

@mglaman: Can't we update our resource type repository (i.e RenamableResourceTypeRepository) to provide resource types for our routes so that the resource type upcasting works? We should be able to do that no? By specifying the entity type ID both for the entity type and the bundle.

I've also noticed we currently have the following code:

$routes->addDefaults([JsonapiRoutes::RESOURCE_TYPE_KEY => 'orders--virtual']);

For example, the cart add, cart remove/update items routes actually return order items... Shouldn't we fix that? Same thing with the coupons resources.

Feature request
Status

Active

Version

1.0

Component

Code

Created by

🇮🇱Israel jsacksick

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇩🇪Germany Anybody Porta Westfalica

    Yes indeed very sad. OpenAPI is super helpful for developers using the API, but currently doesn't work correctly in combination with commerce_api or jsonapi_extras

    I there's a clear plan how to fix that correctly, we'd like to help getting things done! :)

  • 🇮🇱Israel jsacksick

    I there's a clear plan how to fix that correctly, we'd like to help getting things done! :)

    Nope, this is sad indeed... Haven't looked into it recently, but the last time I did (probably years ago already) it seemed quite complicated to fix lol.
    Also the OpenAPI module itself seems minimally maintained...

  • 🇺🇸United States bradjones1 Digital Nomad Life

    (New) OpenAPI maintainer here.

    Schema generation will be much easier in core (and hopefully also contrib) once Introduce "schematic" normalizers Active goes in. I have opened new major versions for OpenAPI and also OpenAPI for JSON:API so you can take a look at what's going on there. I'd be happy to 1) have some help getting all that over the finish line and 2) talk about how we could integrate this in to Commerce since I have a lot of history in this space as well.

Production build 0.71.5 2024