Questo contenuto non è disponibile nella lingua selezionata.
Chapter 3. Getting started with Apicurio Studio
3.1. What is Apicurio Studio?
Apicurio Studio enables you to design schemas and API definitions. It provides a web console to make it easy for API owners and developers to manage the content of event schemas and API definitions.
You can use Apicurio Studio to create a schema or API design from a simple template, use one of the detailed templates provided, or import an existing design to edit it. As you evolve your design, it is saved automatically to Apicurio Registry as DRAFT
. When you are happy with your content, you can promote your design to ENABLED
in Apicurio Registry.
Apicurio Studio is based on the Apicurio Studio open source community project.
Key concepts
To understand how Apicurio Studio works, it is important to understand the following key concepts:
- Apicurio Studio web console
The web environment where developers create, manage, and organize their API and schema designs.
You can use the Apicurio Studio web console to complete the following tasks:
- Browse and search the schema and API designs that are stored in Apicurio Studio
- Add new schema and API designs and versions
- Import content from a file, from a URL, or from a Apicurio Registry instance
- Show the changes that you have made in your current editing session
- Draft
An API design or schema design. When downloaded to a local project, or used in Apicurio Registry, designs are referred to as artifacts.
Apicurio Studio supports the following API types:
- AsyncAPI
- OpenAPI
Apicurio Studio supports the following schema types:
- Apache Avro
- JSON Schema
- Google Protocol Buffers (Protobuf)
Apicurio Studio use cases
The main use cases for Apicurio Studio are as follows:
Contract-first application development
You can use Apicurio Studio to visually design the API and data models (contracts) required by your applications, before you write any application code. After you define the contract, it is easier to create the application logic needed to satisfy the contract. You can generate Quarkus-based client and server applications from designs created in Apicurio Studio.
Population of Apicurio Registry
All API and schema designs are saved to Apicurio Registry. You can use Apicurio Registry features, for example:
- Creating rules for design change validation.
- Using the Apicurio Registry REST API to dereference complex JSON Schemas.
3.2. Creating an API draft
Use the Apicurio Studio web console to create an OpenAPI or AsyncAPI definition.
Prerequisites
- You’re logged in to the Apicurio Studio web console.
Procedure
- In the Apicurio Studio web console, click Create draft.
Complete the wizard to provide the following details for the new draft:
Specify the Draft Coordinates and click Next:
-
Group ID & Draft ID: Use the default empty settings to automatically generate an Draft ID and add the Draft to the
default
Draft group. Alternatively, you can enter an optional Group ID or Draft ID. - Version number: Optionally specify a version number.
- Type: Use the default Auto-Detect setting to automatically detect the Draft type (not allowed if creating an empty Draft), or select the Draft type from the list, for example, OpenAPI.
-
Group ID & Draft ID: Use the default empty settings to automatically generate an Draft ID and add the Draft to the
Specify the Draft Content and click Next:
From template: Choose from the list of templates.
-
From local file: Click Browse, and select a file, or drag and drop a file. For example,
my-openapi.json
ormy-schema.proto
. Alternatively, you can enter the file contents in the text box. -
From URL: Enter a valid and accessible URL, and click Fetch. For example:
https://petstore3.swagger.io/api/v3/openapi.json
.
-
From local file: Click Browse, and select a file, or drag and drop a file. For example,
Specify the Draft Metadata:
- Name: Enter an optional friendly name for the first artifact version.
- Description: Enter an optional description for the first artifact version.
- Click Create to create the draft. The Draft details view is displayed.
To edit the draft, click Edit draft.
Click the Design tab, and optionally edit the draft as follows:
- Provide a version number and a description.
- (AsyncAPI only) Define terms of service.
- Add your contact information: name, email address, and URL.
- Select a license.
- (OpenAPI only) Define tags.
- Define one or more servers.
- Configure a security scheme.
- (OpenAPI only) Specify security requirements.
- (OpenAPI only) Configure vendor extensions.
- Click the Source tab, and review the live preview of the draft. The content of the Source tab automatically updates when you edit values on the editor page.
- (Optional) To see the changes that you made since the last save, click Actions > Show draft changes.
(Optional) In the left pane of the draft editor, you can add the following items:
- (OpenAPI only) Resource paths, data types, and responses
- (AsyncAPI only) Channels, data types, messages, operation traits, and message traits
- Click Save.
- Use the breadcrumbs to navigate back to the Drafts page.
The new draft is listed on the Drafts page using the Group ID and Draft ID. You can use the options icon (three vertical dots) to view the draft details, edit the draft content, finalize the draft, view the draft in Apicurio Registry, or delete the draft.
Additional information
3.3. Creating a schema draft
Use the Apicurio Studio web console to create an Apache Avro, JSON Schema, or Google Protocol Buffers (Protobuf) event schema.
Prerequisites
- You’re logged in to the Apicurio Studio web console.
Procedure
- In the Apicurio Studio web console, click Create draft.
Complete the wizard to provide the following details for the new draft:
Specify the Draft Coordinates and click Next:
-
Group ID & Draft ID: Use the default empty settings to automatically generate an Draft ID and add the Draft to the
default
Draft group. Alternatively, you can enter an optional Group ID or Draft ID. - Version number: Optionally specify a version number.
- Type: Use the default Auto-Detect setting to automatically detect the Draft type (not allowed if creating an empty Draft), or select the Draft type from the list, for example, Apache Avro.
-
Group ID & Draft ID: Use the default empty settings to automatically generate an Draft ID and add the Draft to the
Specify the Draft Content and click Next:
From template: Choose from the list of templates.
-
From local file: Click Browse, and select a file, or drag and drop a file. For example,
my-openapi.json
ormy-schema.proto
. Alternatively, you can enter the file contents in the text box. -
From URL: Enter a valid and accessible URL, and click Fetch. For example:
https://petstore3.swagger.io/api/v3/openapi.json
.
-
From local file: Click Browse, and select a file, or drag and drop a file. For example,
Specify the Draft Metadata:
- Name: Enter an optional friendly name for the first artifact version.
- Description: Enter an optional description for the first artifact version.
- Click Create to create the draft. The Draft details view is displayed.
To edit the draft, click Edit draft.
- Click the Design tab, and edit the draft.
- (Optional) To see the changes that you made since the last save, click Actions > Show draft changes.
- (Optional) In the left pane of the draft editor, you can add the following items:
- Click Save.
- Use the breadcrumbs to navigate back to the Drafts page.
The new draft is listed on the Drafts page using the Group ID and Draft ID. You can use the options icon (three vertical dots) to view the draft details, edit the draft content, finalize the draft, view the draft in Apicurio Registry, or delete the draft.
Additional information
3.4. Finalizing a draft
Use the Apicurio Studio web console to finalize a draft. This action changes the status of the artifact in Apicurio Registry from DRAFT
to ENABLED
.
Prerequisites
- You’re logged in to the Apicurio Studio web console.
Procedure
Navigate to the draft in Apicurio Studio. For example:
- Set Filter by to Name
- Enter the name of the draft in the search field.
- Click the Search icon or press Return.
You can finalize a draft in two ways:
- From the search results, click the options icon (three vertical dots) and choose Finalize draft.
- Click on the draft coordinates listed in the search results to see the draft details page and then click the Finalize draft button.
The Final draft? modal is displayed.
Confirm that you want to finalize the draft.
A Dry run only option allows you to validate the draft before finalizing it.
A confirmation page appears with the details of the artifact.
ImportantAfter a draft is finalized, you can no longer view or edit that artifact in Apicurio Studio. You must use Apicurio Registry to perform further edits.
- Navigate to the artifact in Apicurio Registry. From the confirmation page, you can navigate to the artifact in Apicurio Registry by selecting View in Registry from the options menu (three vertical dots).