Skip to content

Commit 4e5a8c1

Browse files
committed
Sync open source content 🐝 (from 13647fe85f040995ab58ddb30b9345d20716f66e)
1 parent d881b22 commit 4e5a8c1

File tree

3 files changed

+91
-188
lines changed

3 files changed

+91
-188
lines changed
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
---
2+
description: "Manage your OpenAPI specs with Speakeasy."
3+
sidebar_label: "Publish specs to API Registry"
4+
---
5+
6+
import { Callout } from "@/mdx/components";
7+
8+
# Manage OpenAPI specs with Speakeasy
9+
10+
<Callout type="info" title="Use this guide only for managing OpenAPI specs independent of generating SDKs.">
11+
12+
For the quickstart to set up SDKs, see the [SDK Quickstart](/docs/sdks/create-client-sdks).
13+
14+
</Callout>
15+
16+
This guide walks through the process of managing OpenAPI specs using the Speakeasy API Registry and CLI. This is also known as a "source-only workflow" as it only uses the sources feature of [Speakeasy workflows](/docs/speakeasy-reference/workflow-file).
17+
18+
## Prerequisites
19+
20+
- A Speakeasy account and CLI installed. Log in [here](https://app.speakeasy.com/) to create an account.
21+
- An OpenAPI spec for the API
22+
23+
## Overview
24+
25+
To get started, create a GitHub repository. Something like `company-specs` or `company-openapi` are common repository names.
26+
27+
Initialize a new workflow file by running `speakeasy configure sources` and follow the prompts to add in the OpenAPI spec and any
28+
[overlays](/docs/prep-openapi/overlays/create-overlays). Make sure to give the `source` a meaningful name as this will be the name used for the API Registry in the workspace dashboard.
29+
30+
A common repository structure will look like the following:
31+
32+
```yaml
33+
company-specs
34+
├── .speakeasy/
35+
│ ├── workflow.yaml
36+
├── specs
37+
│ ├── openapi.yaml
38+
│ ├── ...
39+
├── overlays
40+
│ ├── overlay.yaml
41+
│ ├── ...
42+
├── overlayed_specs # This folder includes specs that have been modified by overlays
43+
│ ├── openapi_modified.yaml
44+
│ ├── ...
45+
└── .gitignore
46+
```
47+
48+
The workflow file will be generated in the `.speakeasy` folder and will look like the following:
49+
50+
```yaml
51+
workflowVersion: 1.0.0
52+
speakeasyVersion: latest
53+
sources:
54+
my-api: # This is the name of the source used in `speakeasy configure sources`
55+
inputs:
56+
- location: specs/openapi.yaml
57+
registry:
58+
location: registry.speakeasy.com/your-company/your-company/my-api
59+
outputs:
60+
- location: overlayed_specs/openapi_modified.yaml
61+
targets: {}
62+
```
63+
64+
## Publishing spec changes
65+
66+
Any time a new version of the OpenAPI spec should be published to the API Registry, run:
67+
68+
```bash
69+
speakeasy run -s target
70+
```
71+
72+
This will publish the spec to the API Registry as a new revision for the source `my-api`.
73+
74+
Optionally tag the revision of a spec by running:
75+
76+
```bash
77+
speakeasy tag apply -n v0.0.2
78+
```
79+
80+
This will tag the most recent revision of the spec with the tag `v0.0.2`.
81+
82+
## API Registry
83+
84+
This will show up as the latest revision in the API Registry tab in the dashboard.
85+
86+
![Registry Tab](/assets/guides/registry-tab.png)
87+
88+
The API Registry can be used to:
89+
- Track changes to specs, view detailed change reports, and download past versions of the spec.
90+
- Create a stable public URL for sharing a particular revision of the spec.
91+
- Use the registry URI as a source for generating SDKs, for example: `registry.speakeasy.com/your-company/your-company/my-api`.

guides/openapi/publish-specs-to-api-registry.mdx

Lines changed: 0 additions & 94 deletions
This file was deleted.

openapi/guides/publish-specs-to-api-registry.mdx

Lines changed: 0 additions & 94 deletions
This file was deleted.

0 commit comments

Comments
 (0)