Skip to content

Commit 9218401

Browse files
authored
Merge pull request #1512 from edgarrmondragon/direct_url.json-schema
Document the JSON schema of `direct_url.json`
2 parents 76e5a15 + 68304ce commit 9218401

File tree

1 file changed

+122
-0
lines changed

1 file changed

+122
-0
lines changed

source/specifications/direct-url-data-structure.rst

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,128 @@ vcs command
213213
this field is the Subversion revision number in the corresponding
214214
repository.
215215

216+
JSON Schema
217+
===========
218+
219+
The following JSON Schema can be used to validate the contents of ``direct_url.json``:
220+
221+
.. code-block::
222+
223+
{
224+
"$schema": "https://json-schema.org/draft/2019-09/schema",
225+
"title": "Direct URL Data",
226+
"description": "Data structure that can represent URLs to python projects and distribution artifacts such as VCS source trees, local source trees, source distributions and wheels.",
227+
"definitions": {
228+
"URL": {
229+
"type": "string",
230+
"format": "uri"
231+
},
232+
"DirInfo": {
233+
"type": "object",
234+
"properties": {
235+
"editable": {
236+
"type": ["boolean", "null"]
237+
}
238+
}
239+
},
240+
"VCSInfo": {
241+
"type": "object",
242+
"properties": {
243+
"vcs": {
244+
"type": "string",
245+
"enum": [
246+
"git",
247+
"hg",
248+
"bzr",
249+
"svn"
250+
]
251+
},
252+
"requested_revision": {
253+
"type": "string"
254+
},
255+
"commit_id": {
256+
"type": "string"
257+
},
258+
"resolved_revision": {
259+
"type": "string"
260+
}
261+
},
262+
"required": [
263+
"vcs",
264+
"commit_id"
265+
]
266+
},
267+
"ArchiveInfo": {
268+
"type": "object",
269+
"properties": {
270+
"hash": {
271+
"type": "string",
272+
"pattern": "^\\w+=[a-f0-9]+$",
273+
"deprecated": true
274+
},
275+
"hashes": {
276+
"type": "object",
277+
"patternProperties": {
278+
"^[a-f0-9]+$": {
279+
"type": "string"
280+
}
281+
}
282+
}
283+
}
284+
}
285+
},
286+
"allOf": [
287+
{
288+
"type": "object",
289+
"properties": {
290+
"url": {
291+
"$ref": "#/definitions/URL"
292+
}
293+
},
294+
"required": [
295+
"url"
296+
]
297+
},
298+
{
299+
"anyOf": [
300+
{
301+
"type": "object",
302+
"properties": {
303+
"dir_info": {
304+
"$ref": "#/definitions/DirInfo"
305+
}
306+
},
307+
"required": [
308+
"dir_info"
309+
]
310+
},
311+
{
312+
"type": "object",
313+
"properties": {
314+
"vcs_info": {
315+
"$ref": "#/definitions/VCSInfo"
316+
}
317+
},
318+
"required": [
319+
"vcs_info"
320+
]
321+
},
322+
{
323+
"type": "object",
324+
"properties": {
325+
"archive_info": {
326+
"$ref": "#/definitions/ArchiveInfo"
327+
}
328+
},
329+
"required": [
330+
"archive_info"
331+
]
332+
}
333+
]
334+
}
335+
]
336+
}
337+
216338
Examples
217339
========
218340

0 commit comments

Comments
 (0)