diff --git a/src/Plugin/openapi/OpenApiGenerator/JsonApiGenerator.php b/src/Plugin/openapi/OpenApiGenerator/JsonApiGenerator.php
index 587d9bd..2b7f87c 100644
--- a/src/Plugin/openapi/OpenApiGenerator/JsonApiGenerator.php
+++ b/src/Plugin/openapi/OpenApiGenerator/JsonApiGenerator.php
@@ -649,15 +652,15 @@ class JsonApiGenerator extends OpenApiGeneratorBase {
         if ($definition_ref = $this->getDefinitionReference($entity_type_id, $bundle_name)) {
           $definition_key = $this->getEntityDefinitionKey($entity_type_id, $bundle_name);
           $definition = $this->getDefinitions()[$definition_key];
-          $ref = NestedArray::getValue($definition, ['definitions', 'data'])
-            ? "$definition_ref/definitions/data"
+          $ref = NestedArray::getValue($definition, ['components', 'data'])
+            ? "$definition_ref/components/data"
             : "$definition_ref/properties/data";
           $schema = $definition;
           $schema['properties']['data'] = [
             'type' => 'array',
             'items' => ['$ref' => $ref],
           ];
-          $schema_response = ['schema' => $schema];
+          $schema_response = ['content' => ['application/vnd.api+json' => ['schema' => $schema]]];
         }
         $responses['200'] = [
             'description' => 'successful operation',
@@ -676,18 +679,18 @@ class JsonApiGenerator extends OpenApiGeneratorBase {
           return [
             200 => [
               'description' => 'successful operation',
-              'schema' => $schema
+              'content' => ['application/vnd.api+json' => ['schema' => $schema]],
             ],
           ];
         }
         elseif ($method === 'post') {
-          return [201 => ['description' => 'created', 'schema' => $schema]];
+          return [201 => ['description' => 'created', 'content' => ['application/vnd.api+json' => ['schema' => $schema]]]];
         }
         elseif ($method === 'patch') {
           return [
             200 => [
               'description' => 'successful operation',
-              'schema' => $schema,
+              'content' => ['application/vnd.api+json' => ['schema' => $schema]],
             ],
           ];
         }
@@ -726,7 +729,7 @@ class JsonApiGenerator extends OpenApiGeneratorBase {
             if ($this->includeEntityTypeBundle($entity_type->id(), $bundle_name)) {
               $definition_key = $this->getEntityDefinitionKey($entity_type->id(), $bundle_name);
               $json_schema = $this->getJsonSchema('api_json', $entity_type->id(), $bundle_name);
-              $json_schema = $this->fixReferences($json_schema, '#/definitions/' . $definition_key);
+              $json_schema = $this->fixReferences($json_schema, '#/components/' . $definition_key);
               $definitions[$definition_key] = $json_schema;
             }
           }
@@ -1031,4 +1034,28 @@ class JsonApiGenerator extends OpenApiGeneratorBase {
     return $field_definitions[$internal_field_name]->getFieldStorageDefinition()->getCardinality() !== 1;
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public function getSpecification() {
+    $basePath = $this->getBasePath();
+
+    $spec = parent::getSpecification();
+
+    unset($spec['swagger']);
+    unset($spec['schemes']);
+
+    $spec['openapi'] = "3.0.0";
+    $spec['servers'] = [
+      ['url' => $this->request->getSchemeAndHttpHost() . (empty($basePath) ? '/' : $basePath)],
+    ];
+    // Move definitions of 2.0 to components.schemas of 3.0.
+    $spec['components'] = ['schemas' => $spec['definitions']];
+    unset($spec['definitions']);
+
+    $this->moduleHandler->alter('openapi_jsonapi_get_specification', $spec);
+
+    return $spec;
+  }
+
 }
