docs: add import from openAPI doc

This PR adds the documentation for the Import Action from OpenAPI feature

<img width="959" alt="image" src="https://user-images.githubusercontent.com/5709409/207611375-913d4eb2-9af0-4ac5-82e8-0a0709ce3b1a.png">

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7276
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Rob Dominguez <24390149+robertjdominguez@users.noreply.github.com>
GitOrigin-RevId: 981ab2e3df7d00fabd6963eb97ee477ca7bd2c5d
This commit is contained in:
Daniele Cammareri 2022-12-15 19:38:00 +01:00 committed by hasura-bot
parent 1d0b466954
commit 917d67154e
7 changed files with 23043 additions and 3465 deletions

View File

@ -0,0 +1,62 @@
---
sidebar_label: OpenAPI Spec Import
sidebar_position: 4
description: Import an Action from an OpenAPI spec
keywords:
- hasura
- docs
- actions
- import
- openapi
sidebar_class_name: cloud-and-enterprise-icon
---
import Thumbnail from '@site/src/components/Thumbnail';
# Import Action from OpenAPI Spec
<div className="badge badge--primary heading-badge">Available on: Cloud, Enterprise Edition</div>
## Overview
The most common use case for Actions is to expose an existing API as a GraphQL query. To make this easier, we have added
the ability to import an Action from an [OpenAPI spec](https://swagger.io/specification/). OpenAPI is a widely used
standard for describing REST APIs, and many APIs already have an OpenAPI spec available. This feature allows you to
upload an OpenAPI spec, select the operation you want to expose as an Action, and Hasura will automatically prepopulate
the Action definition for you.
:::caution Import Action from OpenAPI Spec availability
The Import Action from OpenAPI Spec feature is currently available in `alpha` for all Hasura Cloud offerings and for
Hasura Enterprise Edition (EE) customers. Once it is generally available (GA), it will be available only for Hasura
Cloud Enterprise and EE customers.
:::
## Enabling the feature
While the Import Action from OpenAPI Spec is in alpha, the feature can only be enabled by turning on the _Import from
OpenAPI_ under the _Feature Flags_ section of the Console configuration page.
Click the gear icon (1) in the top-right corner of your Cloud project; in the side navigation, click "Feature Flags"
(2); finally, toggle the "Import Action from OpenAPI" switch to enable (3).
<Thumbnail src="/img/actions/openapi-feature-flag.png" alt="Turning on experimental features." width="1000px" />
## Importing an Action from an OpenAPI spec
After enabling the feature, you can import an Action from an OpenAPI spec by clicking the "Create" button from the
Actions page of the Console. You should see a new option to `Import from OpenAPI`, click this to start the import:
<Thumbnail src="/img/actions/import-openapi.png" alt="Turning on experimental features." width="1000px" />
Either select a file (YAML or JSON) or paste the contents of an OpenAPI spec into the text box. Then, select an endpoint
and click `Generate Action`:
<Thumbnail src="/img/actions/generate-openapi.png" alt="Turning on experimental features." width="600px" />
From the Actions page, you can further customize the Action definition, and then click "Create" to create the Action:
<Thumbnail src="/img/actions/create-openapi.png" alt="Turning on experimental features." width="1000px" />
You can now use this imported Action in your GraphQL API!

22006
docs/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

File diff suppressed because it is too large Load Diff