openapi-glossary

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

OpenAPI Glossary

OpenAPI术语表

To avoid confusion in the creation of educational material, tooling, and other content, having a shared vocabulary is important. A lot of people in the OpenAPI community call a lot of things a lot of different things, so let's take a swing at unification here.
为避免在制作教学材料、工具及其他内容时产生混淆,拥有一套共享词汇至关重要。OpenAPI社区中很多人对同一事物的称呼各不相同,因此我们在此尝试统一术语。

API

API

The general definition "Application Program Interface" can mean a lot of things, with different types of interface. OpenAPI is specifically talking about HTTP-based APIs, which in general is anything REST, RESTish, and many generic types of RPC.
“应用程序编程接口(Application Program Interface)”的通用定义涵盖多种类型的接口。OpenAPI特指基于HTTP的API,通常包括REST、类REST以及许多通用类型的RPC。

API-First

API优先

When APIs first started getting popular, a lot of companies started flopping them out as a marketing ploy. These APIs were generally not particularly useful, rarely performant, and frustrating to work with.
"API First" is a concept that teams should build the APIs first, and make them something they would want to work with, therefore solving useability issues, performance issues, etc. and supposedly creating a better experience for their customers.
API刚开始流行时,很多公司将其作为营销手段仓促推出。这些API通常实用性不强、性能低下且使用起来令人沮丧。
“API优先”是指团队应优先构建API,打造出自己愿意使用的API,从而解决可用性、性能等问题,为客户带来更优质的体验。

API Description

API描述

Aliases include: "API Definition" or "API Contract".
An API Description is meta-data about an API, explaining what endpoints, resources, HTTP methods, headers, query parameters, etc. exist.
Descriptions are written in a particular "API Description Format" (e.g.: OpenAPI, JSON Schema, RAML, WSDL, etc.) and will usually be contained in an "API Description Document" (e.g.:
openapi.yaml
,
schemas/payment.json
) unless the authors decided to use annotations instead.
别名包括:“API定义”或“API契约”。
API描述是关于API的元数据,说明API包含哪些端点、资源、HTTP方法、请求头、查询参数等。
描述需采用特定的“API描述格式”(例如:OpenAPI、JSON Schema、RAML、WSDL等),通常会包含在“API描述文档”中(例如:
openapi.yaml
、
schemas/payment.json
),除非作者选择使用注解形式。

API Design

API设计

Planning an API specifically using API Descriptions, or a tool which generates / exports API descriptions. When done before coding begins, it is known as API Design First, which is conceptually different to API First but not mutually exclusive.
More on API Design First vs Code First.
专门使用API描述或可生成/导出API描述的工具来规划API。如果在编码开始前进行,这被称为API设计优先,它在概念上与API优先不同,但二者并不互斥。
更多内容请查看API设计优先 vs 代码优先。

API Specification

API规范

In the past the term API Specification was one of many terms to describe what most major tooling vendors call an API Description Document. It was the file that users would write to describe their API.
Ask 100 people and you will get 100 answers, but consensus is forming around API Specifications being an umbrella term for various Specifications involved with API development, and more specific categories exist within the umbrella term.
Message Formats like JSON-API, HAL, Siren, etc. all have a specification. Data Formats like JSON, YAML, etc all have a specification. Transfer Protocols like SPDY, HTTP/2, HTTP/3, etc have a specification. Authentication Strategies like OAuth 2, OpenID, etc all have a specification.
Seeing as there as so many types of API specification floating around, to disambiguate its best to just avoid the term and use one of the more specific categories, or if talking about your own
openapi.yaml
just call it the description document.
过去,“API规范”是众多术语之一,用来描述大多数主流工具厂商所称的API描述文档,即用户用来描述自己API的文件。
询问100个人会得到100种答案,但目前已形成共识:API规范是API开发中涉及的各类规范的总称,其下包含更具体的分类。
像JSON-API、HAL、Siren等消息格式都有各自的规范;JSON、YAML等数据格式也有规范;SPDY、HTTP/2、HTTP/3等传输协议同样有规范;OAuth 2、OpenID等认证策略也都有规范。
鉴于存在如此多类型的API规范,为避免歧义,最好避免使用该术语,而是使用更具体的分类,或者如果指代自己的
openapi.yaml
,直接称其为描述文档即可。

Bundle

打包

Aliases include: "External Inlining".
Bundling pulls in external
$refs
from different files, or URLs, and puts them into the
components
object.
This is done to create a single OpenAPI file, which is easier to share, especially with tooling that does not support resolving external files. If tooling does not support
$ref
at all, then an alternative to bundling is required: dereferencing.
别名包括:“外部内联”。
打包会将来自不同文件或URL的外部
$refs
引入,并放入
components
对象中。
这样做是为了生成单个OpenAPI文件,便于共享,尤其是对于不支持解析外部文件的工具。如果工具完全不支持
$ref
,则需要采用打包的替代方案:解引用。

Callbacks

回调

Most programming languages have a concept of a callback which is a function passed as an argument to another function, which is run after another function has finished. The exact same concept exists in APIs, where a URL can be passed to be alerted when an action is complete.
This is usually performed via a Webhook, so the term Webhook would be more common than Callabck, but OpenAPI specifically talks about Callbacks.
For example, your API provides a
POST /subscribe
operation that expects a callback URL in the request body:
POST /subscribe
Host: my.example.com
Content-Type: application/json
{
  "callbackUrl": "https://myserver.com/send/callback/here"
}
A Webhook will then be sent to that URL.
More about OpenAPI callbacks on Swagger Docs: Callbacks.
大多数编程语言中都有回调的概念,即作为参数传递给另一个函数的函数,会在另一个函数执行完成后运行。API中也存在完全相同的概念,即可以传递一个URL,当某个操作完成时会向该URL发送通知。
这通常通过Webhook实现,因此Webhook这个术语比Callback更常用,但OpenAPI中明确使用Callbacks这一术语。
例如,你的API提供
POST /subscribe
操作,请求体中需包含回调URL:
POST /subscribe
Host: my.example.com
Content-Type: application/json
{
  "callbackUrl": "https://myserver.com/send/callback/here"
}
随后会向该URL发送Webhook。
更多关于OpenAPI回调的内容请查看Swagger Docs: Callbacks。

Code Generation

代码生成

Contract Testing

契约测试

Confirming that an API is accepting and outputting what it says it is can take many forms. Most commonly, when you hear the term Contract Testing in relation to OpenAPI, people are talking about producer contract testing. This means the API development team (or some test/QA team nearby) have implemented a test suite that will take an API description and compare it to the actual data.
Conceptually contract testing is the same thing as data validation, but done for different purposes at different parts of the life-cycle. The same tools could be used under the hood.
There is also client-side contract testing, where you write out the contract in a client test suite then make calls to the API to see if it matches.
验证API是否如其所述接收和输出数据有多种形式。在OpenAPI相关语境中,提及契约测试时,大多数情况下指的是生产者契约测试。这意味着API开发团队(或附近的测试/QA团队)已实现一套测试套件,将API描述与实际数据进行对比。
从概念上讲,契约测试与数据验证是同一回事,但在生命周期的不同阶段出于不同目的进行。底层可能使用相同的工具。
还有客户端契约测试,即在客户端测试套件中编写契约,然后调用API查看是否匹配。

Converter

转换器

A set of tools that allow you to convert OpenAPI descriptions to another description format, such as API Blueprint, HAR, RAML, etc., or vice versa! Some will also convert to HTML which is usually for making reference documentation.
一组工具,可将OpenAPI描述转换为其他描述格式,如API Blueprint、HAR、RAML等,反之亦然!有些工具还可以转换为HTML,通常用于生成参考文档。

Data Instance

数据实例

Data Validation

数据验证

Often referred to simple as "validation" when there are many types of validation. Data validation is basically taking some real data (maybe an entire HTTP Message with a body, or just the body) and comparing it to the API description.
This is then used to power things like contract testing, gateway validation, and server-side validation.
当存在多种类型的验证时,通常简称为“验证”。数据验证基本上是将一些真实数据(可能是包含请求体的完整HTTP消息,也可能只是请求体)与API描述进行对比。
这可用于支持契约测试、网关验证和服务端验证等功能。

Dereference

解引用

Aliases include: "Dereferencing", "Internal Inlining" or "Transclusion".
All
$ref
s and replaced with their values à la copy & paste. No more
$ref
's exist in the file/object representation. If you have 10 operations referencing the same model 10 times, you now have 10 different models.
别名包括:“解引用”、“内部内联”或“包含”。
所有
$ref
都会被其值替换,就像复制粘贴一样。文件/对象表示中不再存在
$ref
。如果有10个操作引用同一个模型10次,现在会得到10个不同的模型。

Description Validation

描述验证

Aliases include: "Schema Validation".
A very different type of validation to data validation. Description validation focuses on making sure the description is correct against the OpenAPI Specification itself.
When a validator moves beyond checking the document is valid, and into custom rules, design opinions, style, etc. the term "linting" is used.
A list of description validators is available on OpenAPI.Tools.
别名包括:“Schema验证”。
这与数据验证是完全不同类型的验证。描述验证侧重于确保描述符合OpenAPI规范本身的要求。
当验证器不仅检查文档是否有效,还检查自定义规则、设计观点、风格等时,就会使用“代码检查(linting)”这一术语。
描述验证器列表可在OpenAPI.Tools查看。

Documentation

文档

The most common meaning of documentation in OpenAPI-world is reference documentation, but there is a lot more to good API documentation than just that. Guides, tutorials, and other types of how-to content is often combined with reference documentation to provide the best developer experience. This combination along with "sign up for API tokens" type functionality is often referred to as a Developer Portal.
在OpenAPI领域,文档最常见的含义是参考文档,但优质的API文档远不止于此。指南、教程和其他类型的操作指南内容通常会与参考文档结合,以提供最佳的开发者体验。这种结合再加上“注册API令牌”等功能,通常被称为开发者门户。

Gateway Validation

网关验证

Data Validation leverages in an API Gateway is known as gateway validation, and it will stop invalid requests from wasting application resources. AWS, Tyk, Express Gateway, etc. support some level of OpenAPI or JSON Schema gateway validation.
在API网关中使用的数据验证称为网关验证,它可以阻止无效请求浪费应用资源。AWS、Tyk、Express Gateway等都支持一定程度的OpenAPI或JSON Schema网关验证。

Links

链接

Links can mean a lot of things in the concept of computing and APIs, but in OpenAPI there is a Link Object, which represents a possible design-time link for a response.
This can be handy for making API documentation a bit less RPC and a bit more REST, by giving hints as to next available actions for any response. It gets a bit more like Hypermedia Controls (a.k.a HATEOAS) if used at runtime, as once a client has a response, the headers, and data instance can be combined with the links to figure out next available actions.
在计算和API的概念中,链接有多种含义,但在OpenAPI中存在链接对象,代表响应在设计阶段的可能链接。
通过提示任何响应的后续可用操作,这有助于让API文档少一些RPC风格,多一些REST风格。如果在运行时使用,它会更像超媒体控件(即HATEOAS),因为客户端收到响应后,可以将请求头、数据实例与链接结合,找出后续可用操作。

Linting

代码检查(Linting)

OpenAPI linter like Spectral can confirm if API descriptions are valid, but also if they match predetermined rules, like a style guide. Style Guides can be defined by API Governance teams at larger companies, or be shared, like the ones on openapi-contrib/style-guides.
像Spectral这样的OpenAPI代码检查工具不仅可以确认API描述是否有效,还可以检查是否符合预设规则,如风格指南。风格指南可由大公司的API治理团队定义,也可以是共享的,比如openapi-contrib/style-guides中的风格指南。

Mocking

模拟(Mocking)

A fake server that takes a description document as input, then routes incoming HTTP requests to example responses or dynamically generates examples.
A list of mock servers is available on OpenAPI.Tools.
一个伪服务器,接收描述文档作为输入,然后将传入的HTTP请求路由到示例响应或动态生成示例。
模拟服务器列表可在OpenAPI.Tools查看。

OAS

OAS

This is just shorthand for the OpenAPI Specification, which is Markdown files on the internet defining how each version of OpenAPI should work.
这是OpenAPI规范的简写,该规范是互联网上的Markdown文件,定义了每个版本的OpenAPI的工作方式。

OpenAPI

OpenAPI

Aliases include "OpenAPI Specification".
The new name of the API Description Format, which is defined in an API Specification. It used to be called Swagger.
别名包括“OpenAPI规范”。
这是API描述格式的新名称,由API规范定义。它之前被称为Swagger。

The OpenAPI Initiative

OpenAPI倡议组织

The OpenAPI Initiative (OAI) are the group in control of the development of the OpenAPI Specification (OAS).
OpenAPI倡议组织(OAI)是负责开发OpenAPI规范(OAS)的组织。

Open API

Open API

An open API is a public API.
When referring to the OpenAPI Specification, community or the OpenAPI Initiative, there is no space in "OpenAPI".
Open API指的是公开API。
当指代OpenAPI规范、社区或OpenAPI倡议组织时,“OpenAPI”中间没有空格。

Parameters

参数

Parameters is a general catch-all term for headers, path parameters, query string parameters, and in OpenAPI v2 it also included the request body (like form data).
More about Parameters in the OpenAPI v3.0 specification.
参数是一个通用术语,涵盖请求头、路径参数、查询字符串参数,在OpenAPI v2中还包括请求体(如表单数据)。
更多关于参数的内容请查看OpenAPI v3.0规范。

Reference Documentation

参考文档

Very similar to the sort of "Classes, Methods, Constants" documentation you're used to seeing for code libraries, modules, packages, explaining the various inputs and outputs. Reference Documentation is a rendering of the API Description in HTML (or maybe a PDF) so slightly less technical people can figure out how to work with the API.
与你熟悉的代码库、模块、包的“类、方法、常量”文档非常相似,解释各种输入和输出。参考文档是将API描述渲染为HTML(或PDF),以便技术水平稍低的人员了解如何使用API。

Reference

引用(Reference)

A JSON Reference, which can point to a JSON structure in a different location. They may point to objects inside of the current file, but may also refer to other, possibly remote files. They live inside the Reference Object, with the key
$ref
. Here are some examples:
  • Reference Object:
    {"$ref": "https://example.com/api/openapi.yaml#/components/schemas/Pet"}
  • JSON Reference:
    https://example.com/api/openapi.yaml#/components/schemas/Pet
  • JSON Pointer (to the location in the referenced file):
    /components/schemas/Pet
JSON引用,可以指向不同位置的JSON结构。它们可能指向当前文件内的对象,也可能指向其他(可能是远程的)文件。它们存在于引用对象中,键为
$ref
。以下是一些示例:
  • 引用对象:
    {"$ref": "https://example.com/api/openapi.yaml#/components/schemas/Pet"}
  • JSON引用:
    https://example.com/api/openapi.yaml#/components/schemas/Pet
  • JSON指针(指向引用文件中的位置):
    /components/schemas/Pet

Resolve

解析(Resolve)

Looking for the value found at the end of a
$ref
, but no changes are made to the file or object being resolved.
查找
$ref
指向的最终值,但不会对正在解析的文件或对象进行任何更改。

Schema

Schema

Aliases include "Data Model".
A schema is metadata, which describes the data type, and other properties about the ata like a specific format, and validation rules. JSON Schema is one example of a schema, but OpenAPI has it's own flavour of JSON Schema which it uses for the various locations a
schema
keyword can exist.
Schema is most commonly associated with describing the body of a HTTP request or response, but it can also describe various parameters like headers or path parameters.
别名包括“数据模型”。
Schema是元数据,描述数据类型以及数据的其他属性,如特定格式和验证规则。JSON Schema是Schema的一个示例,但OpenAPI有自己的JSON Schema变体,用于
schema
关键字可以存在的各种位置。
Schema最常用于描述HTTP请求或响应的请求体,但也可以描述各种参数,如请求头或路径参数。

SDK

SDK

"Software Development Kits" are a generic term in computer-land but in the context of Web APIs and OpenAPI in particular, they usually mean some sort of client library for other developers to interact with an API at a programming language level, and not a HTTP library level.
A list of SDK generators is available on OpenAPI.Tools.
“软件开发工具包(Software Development Kits)”是计算机领域的通用术语,但在Web API和OpenAPI的语境中,通常指供其他开发者在编程语言层面(而非HTTP库层面)与API交互的客户端库。
SDK生成器列表可在OpenAPI.Tools查看。

Server-side Validation

服务端验证

Using the concept of data validation to
More on Server-side Validation.
使用数据验证的概念来...
更多内容请查看服务端验证。

Swagger

Swagger

Historically, "Swagger" was the original name of OpenAPI Specification (OAS). It was called Swagger when it was released in 2011, and when SmartBear acquired Swagger Specification they kept the name for a while, and made a bunch of tools with the name Swagger in it. Swagger Editor, Swagger Inspector, SwaggerHub, etc.
Once the Swagger specification was given to Open API Initiative in 2016, the name was changed to OpenAPI.
Now, the word "Swagger" is just part of the SwaggerHub brand of tooling. The specification is "OpenAPI" (not OpenAPI/Swagger).
历史上,“Swagger”是OpenAPI规范(OAS)的原名。它在2011年发布时被称为Swagger,当SmartBear收购Swagger规范后,暂时保留了该名称,并推出了一系列带有Swagger名称的工具,如Swagger Editor、Swagger Inspector、SwaggerHub等。
2016年,Swagger规范被移交给OpenAPI倡议组织后,名称改为OpenAPI。
现在,“Swagger”只是SwaggerHub品牌工具的一部分。规范的名称是“OpenAPI”(不是OpenAPI/Swagger)。