Skip to content

Commit 6a4914c

Browse files
committed
chore: describe more properties
1 parent 0e7747a commit 6a4914c

3 files changed

Lines changed: 123 additions & 28 deletions

File tree

packages/core/src/types/arazzo.ts

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ import { Oas3_2Types } from './oas3_2.js';
33

44
const Root: NodeType = {
55
properties: {
6-
arazzo: { type: 'string' },
6+
arazzo: {
7+
type: 'string',
8+
description: 'The version of the Arazzo specification that the document conforms to.',
9+
},
710
info: 'Info',
811
sourceDescriptions: 'SourceDescriptions',
912
workflows: 'Workflows',
@@ -106,9 +109,19 @@ const Parameters: NodeType = {
106109
};
107110
const Workflow: NodeType = {
108111
properties: {
109-
workflowId: { type: 'string' },
110-
summary: { type: 'string' },
111-
description: { type: 'string' },
112+
workflowId: {
113+
type: 'string',
114+
description: 'REQUIRED. The unique identifier of the workflow.',
115+
},
116+
summary: {
117+
type: 'string',
118+
description: 'A short summary of what the workflow does.',
119+
},
120+
description: {
121+
type: 'string',
122+
description:
123+
'A verbose explanation of the workflow behavior. CommonMark syntax MAY be used for rich text representation.',
124+
},
112125
parameters: 'Parameters',
113126
dependsOn: { type: 'array', items: { type: 'string' } },
114127
inputs: 'Schema',
@@ -142,6 +155,8 @@ const Step: NodeType = {
142155
required: ['stepId'],
143156
requiredOneOf: ['x-operation', 'operationId', 'operationPath', 'workflowId'],
144157
extensionsPrefix: 'x-',
158+
documentationLink: 'https://spec.openapis.org/arazzo/latest.html#step-object',
159+
description: 'A step in a workflow.',
145160
};
146161
const Outputs: NodeType = {
147162
properties: {},

packages/core/src/types/oas3.ts

Lines changed: 104 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ const Tag: NodeType = {
2626
name: {
2727
type: 'string',
2828
description: `The name of the tag.`,
29-
documentationLink: `https://spec.openapis.org/oas/v3.1.0#tag-object-name`,
3029
},
31-
description: { type: 'string' },
30+
description: {
31+
type: 'string',
32+
description: `A short description for the tag. CommonMark syntax MAY be used for rich text representation.`,
33+
},
3234
externalDocs: 'ExternalDocs',
3335
'x-traitTag': { type: 'boolean' },
3436
'x-displayName': { type: 'string' },
@@ -49,11 +51,20 @@ const TagGroup: NodeType = {
4951

5052
const ExternalDocs: NodeType = {
5153
properties: {
52-
description: { type: 'string' },
53-
url: { type: 'string' },
54+
description: {
55+
type: 'string',
56+
description:
57+
'A description of the target documentation. CommonMark syntax MAY be used for rich text representation.',
58+
},
59+
url: {
60+
type: 'string',
61+
description:
62+
'REQUIRED. The URL for the target documentation. This MUST be in the format of a URL.',
63+
},
5464
},
5565
required: ['url'],
5666
extensionsPrefix: 'x-',
67+
description: 'Additional external documentation for this operation.',
5768
};
5869

5970
const Server: NodeType = {
@@ -129,6 +140,8 @@ const Paths: NodeType = {
129140
properties: {},
130141
additionalProperties: (_value: any, key: string) =>
131142
key.startsWith('/') ? 'PathItem' : undefined,
143+
description: 'The available paths and operations for the API.',
144+
documentationLink: 'https://redocly.com/learn/openapi/openapi-visual-reference/paths',
132145
};
133146

134147
const WebhooksMap: NodeType = {
@@ -138,11 +151,23 @@ const WebhooksMap: NodeType = {
138151

139152
const PathItem: NodeType = {
140153
properties: {
141-
$ref: { type: 'string' }, // TODO: verify special $ref handling for Path Item
154+
$ref: {
155+
type: 'string',
156+
description:
157+
'Allows for a referenced definition of this path item. The referenced structure MUST be in the form of a Path Item Object. In case a Path Item Object field appears both in the defined object and the referenced object, the behavior is undefined. See the rules for resolving Relative References.',
158+
documentationLink: 'https://redocly.com/learn/openapi/openapi-visual-reference/reference',
159+
}, // TODO: verify special $ref handling for Path Item
142160
servers: 'ServerList',
143161
parameters: 'ParameterList',
144-
summary: { type: 'string' },
145-
description: { type: 'string' },
162+
summary: {
163+
type: 'string',
164+
description: 'An optional, string summary, intended to apply to all operations in this path.',
165+
},
166+
description: {
167+
type: 'string',
168+
description:
169+
'An optional, string description, intended to apply to all operations in this path. CommonMark syntax MAY be used for rich text representation.',
170+
},
146171

147172
get: 'Operation',
148173
put: 'Operation',
@@ -154,21 +179,57 @@ const PathItem: NodeType = {
154179
trace: 'Operation',
155180
},
156181
extensionsPrefix: 'x-',
182+
description:
183+
'Describes the operations available on a single path. A Path Item MAY be empty, due to ACL constraints. The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available.',
184+
documentationLink:
185+
'https://redocly.com/learn/openapi/openapi-visual-reference/path-item#path-item-object',
157186
};
158187

159188
const Parameter: NodeType = {
160189
properties: {
161-
name: { type: 'string' },
162-
in: { enum: ['query', 'header', 'path', 'cookie'] },
163-
description: { type: 'string' },
164-
required: { type: 'boolean' },
165-
deprecated: { type: 'boolean' },
166-
allowEmptyValue: { type: 'boolean' },
190+
name: {
191+
type: 'string',
192+
description: 'REQUIRED. The name of the parameter. Parameter names are case sensitive.',
193+
},
194+
in: {
195+
enum: ['query', 'header', 'path', 'cookie'],
196+
description:
197+
'REQUIRED. The location of the parameter. Possible values are "query", "header", "path", or "cookie".',
198+
},
199+
description: {
200+
type: 'string',
201+
description:
202+
'A brief description of the parameter. This could contain examples of use. CommonMark syntax MAY be used for rich text representation.',
203+
},
204+
required: {
205+
type: 'boolean',
206+
description:
207+
'Determines whether this parameter is mandatory. If the parameter location is "path", this property is REQUIRED and its value MUST be true. Otherwise, the property MAY be included and its default value is false.',
208+
},
209+
deprecated: {
210+
type: 'boolean',
211+
description:
212+
'Specifies that a parameter is deprecated and SHOULD be transitioned out of usage. Default value is false.',
213+
},
214+
allowEmptyValue: {
215+
type: 'boolean',
216+
description:
217+
'Sets the ability to pass empty-valued parameters. This is valid only for query parameters and allows sending a parameter with an empty value. Default value is false. If style is used, and if behavior is n/a (cannot be serialized), the value of allowEmptyValue SHALL be ignored. Use of this property is NOT RECOMMENDED, as it is likely to be removed in a later revision.',
218+
},
167219
style: {
168220
enum: ['form', 'simple', 'label', 'matrix', 'spaceDelimited', 'pipeDelimited', 'deepObject'],
221+
description:
222+
'Describes how the parameter value will be serialized depending on the type of the parameter value. Default values (based on value of in): for query - form; for path - simple; for header - simple; for cookie - form.',
223+
},
224+
explode: {
225+
type: 'boolean',
226+
description:
227+
'When this is true, parameter values of type array or object generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters this property has no effect. When style is form, the default value is true. For all other styles, the default value is false.',
228+
},
229+
allowReserved: {
230+
type: 'boolean',
231+
description: `Determines whether the parameter value SHOULD allow reserved characters, as defined by RFC3986 :/?#[]@!$&'()*+,;= to be included without percent-encoding. This property only applies to parameters with an in value of query. The default value is false.`,
169232
},
170-
explode: { type: 'boolean' },
171-
allowReserved: { type: 'boolean' },
172233
schema: 'Schema',
173234
example: { isExample: true },
174235
examples: 'ExamplesMap',
@@ -177,26 +238,41 @@ const Parameter: NodeType = {
177238
required: ['name', 'in'],
178239
requiredOneOf: ['schema', 'content'],
179240
extensionsPrefix: 'x-',
241+
description:
242+
'Describes a request parameter, which excludes the request body. A unique parameter is defined by a unique combination of the name and in values.',
243+
documentationLink: 'https://redocly.com/learn/openapi/openapi-visual-reference/parameter',
180244
};
181245

182246
const Operation: NodeType = {
183247
properties: {
184248
tags: {
185249
type: 'array',
186250
items: { type: 'string' },
251+
description:
252+
'A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier.',
253+
documentationLink: 'https://redocly.com/learn/openapi/openapi-visual-reference/operation',
187254
},
188255
summary: {
189256
type: 'string',
190-
description: `Optional short summary of what the operation does.`,
191-
documentationLink: `https://spec.openapis.org/oas/v3.1.0#operation-object`,
257+
description: 'A short summary of what the operation does.',
258+
documentationLink:
259+
'https://redocly.com/learn/openapi/openapi-visual-reference/operation#summary',
192260
},
193261
description: {
194262
type: 'string',
195-
description: `Optional description of the operation and its behavior. Supports Markdown formatting. Redocly tools support using $ref in this field to reuse or include content from other sources.`,
196-
documentationLink: `https://spec.openapis.org/oas/v3.1.0#operation-object`,
263+
description:
264+
'A verbose explanation of the operation behavior. CommonMark syntax MAY be used for rich text representation.',
265+
documentationLink:
266+
'https://redocly.com/learn/openapi/openapi-visual-reference/operation#description',
197267
},
198268
externalDocs: 'ExternalDocs',
199-
operationId: { type: 'string' },
269+
operationId: {
270+
type: 'string',
271+
description:
272+
'The operationId is path segment or path fragment in deep links to a specific operation.',
273+
documentationLink:
274+
'https://redocly.com/learn/openapi/openapi-visual-reference/operation#operationid',
275+
},
200276
parameters: 'ParameterList',
201277
security: 'SecurityRequirementList',
202278
servers: 'ServerList',
@@ -211,7 +287,7 @@ const Operation: NodeType = {
211287
required: ['responses'],
212288
extensionsPrefix: 'x-',
213289
description: `The Operation Object describes a single API operation on a path, including its parameters, responses, and request body (if applicable). Each path can support more than one operation, but those operations must be unique. A unique operation is a combination of a path and an HTTP method, so two GET or two POST methods for the same path are not allowed.`,
214-
documentationLink: `https://spec.openapis.org/oas/v3.1.0#operation-object`,
290+
documentationLink: 'https://redocly.com/learn/openapi/openapi-visual-reference/operation',
215291
};
216292

217293
const XCodeSample: NodeType = {
@@ -230,6 +306,8 @@ const RequestBody: NodeType = {
230306
},
231307
required: ['content'],
232308
extensionsPrefix: 'x-',
309+
description:
310+
'The request body applicable for this operation. The requestBody is fully supported in HTTP methods where the HTTP 1.1 specification [RFC7231] Section 4.3.1 has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague (such as GET, HEAD and DELETE), requestBody is permitted but does not have well-defined semantics and SHOULD be avoided if possible.',
233311
};
234312

235313
const MediaTypesMap: NodeType = {
@@ -299,6 +377,7 @@ const Responses: NodeType = {
299377
properties: { default: 'Response' },
300378
additionalProperties: (_v: any, key: string) =>
301379
responseCodeRegexp.test(key) ? 'Response' : undefined,
380+
description: 'The list of possible responses as they are returned from executing this operation.',
302381
};
303382

304383
const Response: NodeType = {
@@ -564,7 +643,10 @@ export const Oas3Types = {
564643
Paths,
565644
PathItem,
566645
Parameter,
567-
ParameterList: listOf('Parameter'),
646+
ParameterList: listOf('Parameter', {
647+
description:
648+
'A list of parameters that are applicable for this operation. If a parameter is already defined at the Path Item, the new definition will override it but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a name and location. The list can use the Reference Object to link to parameters that are defined at the OpenAPI Object’s components/parameters.',
649+
}),
568650
Operation,
569651
Callback: mapOf('PathItem'),
570652
CallbacksMap: mapOf('Callback'),

packages/core/src/types/oas3_1.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,10 @@ const Operation: NodeType = {
6969
summary: {
7070
type: 'string',
7171
description: `Optional short summary of what the operation does.`,
72-
documentationLink: `https://spec.openapis.org/oas/v3.1.0#operation-object`,
7372
},
7473
description: {
7574
type: 'string',
7675
description: `Optional description of the operation and its behavior. Supports Markdown formatting. Redocly tools support using $ref in this field to reuse or include content from other sources.`,
77-
documentationLink: `https://spec.openapis.org/oas/v3.1.0#operation-object`,
7876
},
7977
externalDocs: 'ExternalDocs',
8078
operationId: { type: 'string' },

0 commit comments

Comments
 (0)