OpenAPI Generator and the JSON:api MIME type

I’ve been down the rabbit hole on this, and extracted the templates for Spring, i.e., open-api-generator author template -g spring and combed though the mustache files.

What I’m trying to do is get OpenAPI to recognize application/vnd.api+json as a superset of application/json in the generation of examples, instead of getting:

...
if (mediaType.isCompatibleWith(MediaType.valueOf("application/vnd.api+json"))) {
  String exampleString = "Custom MIME type example not yet supported: application/vnd.api+json";
  ApiUtil.setExampleResponse(request, "application/vnd.api+json", exampleString);
...

Where the exampleString = "Custom MIME type example not yet supported: application/vnd.api+json", yet the OpenAPI Spec defines a JSON structure:

components:
  responses:
    Echo:
      description: Test operation for pipelines
      content:
        'application/vnd.api+json':
          schema:
            $ref: '#/components/schema/Echo'
          example:
            data:
              type: echo
              id: 17d39399-c08c-499f-9e2c-d8b6e467e6aa
              attributes:
                message: Echo cho ho o

This feels to me something that has been encountered and my Google-fu is failing me. When I use application/json the example is parsed as expected and used in the exampleString. This seems to me something to configure or provide to the templates as a “Hey, when you see application/vnd.api+json parse the example as application/json like you would normally.”

A quick search for the code snippet in question suggests you’re using GitHub - OpenAPITools/openapi-generator: OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3) - have you tried opening an issue there? This isn’t particularly a spec issue.

Of course. I’m specifically seeking experience here with JSON:api and Java. I’m working to fix this myself as well digging into the code and customizing templates per the project documentation, but it’s a bit opaque.