summaryrefslogtreecommitdiff
path: root/docs_oos/entity.schema.json
blob: 73011a70f9c746434600505d2ac334f226a379b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
{
	"$schema": "https://json-schema.org/draft/2020-12/schema",
	"$id": "forstio/docs_oos/entity.schema.json",
	"title": "forstio out of source api entity",
	"description": "One file per entity, written by hand instead of derived from doxygen. A primary template and each of its specializations are separate files with their own id; the primary links the specializations, which the tree renders as a sublist underneath it. The generator collects every file under docs_oos/data into one map keyed by id, which is the shape the rst templates consume.",
	"type": "object",
	"required": ["format", "id", "kind", "name", "namespace", "header"],
	"additionalProperties": false,
	"properties": {
		"format": {
			"const": 1
		},
		"id": {
			"type": "string",
			"pattern": "^[a-z0-9_]+(-[a-z0-9_]+)*$",
			"description": "Stable identifier. Becomes the rst file name, the label and the :ref: target, so it replaces the doxygen refid. Convention: namespace and name joined by a dash, with a slug for a specialization, e.g. saw-data_server and saw-data_server-loopback."
		},
		"kind": {
			"enum": ["class", "struct", "alias", "function", "variable", "enum", "concept", "namespace"]
		},
		"name": {
			"type": "string",
			"description": "Unqualified name without namespace and without template arguments. A specialization carries the same name as its primary."
		},
		"namespace": {
			"type": "string",
			"description": "Where it lives, e.g. saw or saw::rmt. Kept apart from the name so the heading stays readable and the namespace can still be shown."
		},
		"module": {
			"type": "string",
			"description": "Module directory, e.g. remote."
		},
		"header": {
			"type": "string",
			"description": "Declaring header, relative to the repository root."
		},
		"brief_description": {
			"type": "string"
		},
		"detailed_description": {
			"$ref": "#/$defs/paragraphs"
		},
		"templates": {
			"type": "array",
			"description": "Template parameters. A partial specialization lists the parameters it introduces, not the ones it binds.",
			"items": {"$ref": "#/$defs/template_parameter"}
		},
		"is_special": {
			"type": "boolean",
			"default": false,
			"description": "True on a specialization. The index skips these; they are reachable through their primary."
		},
		"specializes": {
			"type": "string",
			"description": "Only on a specialization: id of the primary."
		},
		"arguments": {
			"type": "array",
			"description": "Only on a specialization: the arguments it binds, in order, as written.",
			"items": {"type": "string"}
		},
		"specializations": {
			"type": "array",
			"description": "Only on a primary. Rendered as the sublist under the entity.",
			"items": {"$ref": "#/$defs/specialization_link"}
		},
		"aliases": {
			"type": "object",
			"description": "Member type aliases keyed by id. These carry weight here, e.g. DataServers or InterfaceT.",
			"additionalProperties": {"$ref": "#/$defs/alias"}
		},
		"attributes": {
			"type": "object",
			"description": "Data members keyed by id.",
			"additionalProperties": {"$ref": "#/$defs/attribute"}
		},
		"functions": {
			"type": "object",
			"description": "Member functions keyed by id. Overloads get distinct ids.",
			"additionalProperties": {"$ref": "#/$defs/function"}
		},
		"examples": {
			"type": "array",
			"description": "Usage examples for the entity as a whole.",
			"items": {"$ref": "#/$defs/example"}
		},
		"notes": {
			"type": "array",
			"description": "Remarks which don't belong to a single member.",
			"items": {"type": "string"}
		}
	},
	"$defs": {
		"example": {
			"type": "object",
			"required": ["code"],
			"additionalProperties": false,
			"properties": {
				"title": {"type": "string"},
				"language": {
					"type": "string",
					"default": "cpp",
					"description": "Rendered as the code block language."
				},
				"description": {"$ref": "#/$defs/paragraphs"},
				"code": {
					"type": "string",
					"description": "Source as a single string with newlines. Error handling may be left out for readability, but then the description has to say so."
				}
			}
		},
		"paragraphs": {
			"type": "array",
			"description": "A list of paragraphs. Each paragraph is a list of fragments: plain strings, or a reference object which renders as a link to another entity.",
			"items": {
				"type": "array",
				"items": {
					"oneOf": [
						{"type": "string"},
						{"$ref": "#/$defs/type_ref"}
					]
				}
			}
		},
		"type_ref": {
			"type": "object",
			"required": ["name", "id"],
			"additionalProperties": false,
			"properties": {
				"name": {"type": "string", "description": "Text to display."},
				"id": {"type": "string", "description": "id of the entity being linked."}
			}
		},
		"type_tuple": {
			"type": "array",
			"description": "A type as a sequence of fragments, so the parts which are entities link and the rest stays text.",
			"items": {
				"oneOf": [
					{"type": "string"},
					{"$ref": "#/$defs/type_ref"}
				]
			}
		},
		"template_parameter": {
			"type": "object",
			"required": ["name", "kind"],
			"additionalProperties": false,
			"properties": {
				"name": {"type": "string"},
				"kind": {
					"enum": ["type", "non_type", "template"],
					"description": "type for class/typename, non_type for a value parameter such as uint64_t N or string_literal Lit."
				},
				"type": {
					"type": "string",
					"description": "Required for non_type, e.g. uint64_t or string_literal."
				},
				"pack": {"type": "boolean", "default": false},
				"default": {"type": "string", "description": "Default argument as written."},
				"brief_description": {"type": "string"}
			}
		},
		"specialization_link": {
			"type": "object",
			"required": ["name", "id"],
			"additionalProperties": false,
			"properties": {
				"name": {
					"type": "string",
					"description": "Specialized name as it should read in the sublist, e.g. data_server< Schema, Encoding, rmt::Loopback >."
				},
				"id": {"type": "string"},
				"brief_description": {
					"type": "string",
					"description": "One line, so the sublist says what the specialization is for without opening it."
				}
			}
		},
		"alias": {
			"type": "object",
			"required": ["id", "name", "type"],
			"additionalProperties": false,
			"properties": {
				"id": {"type": "string"},
				"name": {"type": "string"},
				"type": {"$ref": "#/$defs/type_tuple"},
				"visibility": {"enum": ["public", "protected", "private"], "default": "public"},
				"brief_description": {"type": "string"},
				"detailed_description": {"$ref": "#/$defs/paragraphs"}
			}
		},
		"attribute": {
			"type": "object",
			"required": ["id", "name", "type"],
			"additionalProperties": false,
			"properties": {
				"id": {"type": "string"},
				"name": {"type": "string"},
				"type": {"$ref": "#/$defs/type_tuple"},
				"visibility": {"enum": ["public", "protected", "private"], "default": "private"},
				"static": {"type": "boolean", "default": false},
				"const": {"type": "boolean", "default": false},
				"constexpr": {"type": "boolean", "default": false},
				"initializer": {"type": "string", "default": ""},
				"brief_description": {"type": "string"},
				"detailed_description": {"$ref": "#/$defs/paragraphs"}
			}
		},
		"function": {
			"type": "object",
			"required": ["id", "name", "type"],
			"additionalProperties": false,
			"properties": {
				"id": {"type": "string"},
				"name": {"type": "string"},
				"type": {
					"$ref": "#/$defs/type_tuple",
					"description": "Return type. Empty for constructors and destructors."
				},
				"templates": {
					"type": "array",
					"description": "Template parameters of the function itself, e.g. the string_literal naming an interface member.",
					"items": {"$ref": "#/$defs/template_parameter"}
				},
				"parameters": {
					"type": "array",
					"items": {
						"type": "object",
						"required": ["name", "type"],
						"additionalProperties": false,
						"properties": {
							"name": {"type": "string"},
							"type": {"$ref": "#/$defs/type_tuple"},
							"default": {"type": "string"},
							"brief_description": {"type": "string"}
						}
					}
				},
				"visibility": {"enum": ["public", "protected", "private"], "default": "public"},
				"static": {"type": "boolean", "default": false},
				"const": {"type": "boolean", "default": false},
				"virtual": {"type": "boolean", "default": false},
				"override": {"type": "boolean", "default": false},
				"brief_description": {"type": "string"},
				"detailed_description": {"$ref": "#/$defs/paragraphs"},
				"examples": {
					"type": "array",
					"description": "Usage examples for this member.",
					"items": {"$ref": "#/$defs/example"}
				}
			}
		}
	}
}