mirror of
https://github.com/Smaug123/gitea-repo-config
synced 2025-10-05 23:48:40 +00:00
Express discriminated union in JSON schema (#7)
This commit is contained in:
@@ -1,87 +1,12 @@
|
||||
{
|
||||
"definitions": {
|
||||
"Nullable<SerialisedNativeRepo>": {
|
||||
"description": "If this repo is to be created natively on Gitea, the information about the repo.",
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"defaultBranch": {
|
||||
"description": "The default branch name for this repository, e.g. 'main'",
|
||||
"type": "string"
|
||||
},
|
||||
"private": {
|
||||
"description": "Whether this repository is a Gitea private repo",
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"defaultBranch"
|
||||
]
|
||||
},
|
||||
"SerialisedRepo": {
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"description": {
|
||||
"description": "The text that will accompany this repository in the Gitea UI",
|
||||
"type": "string"
|
||||
},
|
||||
"gitHub": {
|
||||
"description": "If this repo is to sync from GitHub, the URI (e.g. 'https://github.com/Smaug123/nix-maui')",
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
"format": "uri"
|
||||
},
|
||||
"native": {
|
||||
"$ref": "#/definitions/Nullable<SerialisedNativeRepo>"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"description"
|
||||
]
|
||||
},
|
||||
"SerialisedUserInfo": {
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"isAdmin": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"website": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
"format": "uri"
|
||||
},
|
||||
"visibility": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"email"
|
||||
]
|
||||
}
|
||||
},
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"title": "SerialisedGiteaConfig",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"users",
|
||||
"repos"
|
||||
],
|
||||
"properties": {
|
||||
"users": {
|
||||
"type": "object",
|
||||
@@ -92,18 +17,102 @@
|
||||
"repos": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
],
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/SerialisedRepo"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"users",
|
||||
"repos"
|
||||
]
|
||||
"definitions": {
|
||||
"SerialisedUserInfo": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"email"
|
||||
],
|
||||
"properties": {
|
||||
"isAdmin": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"website": {
|
||||
"type": [
|
||||
"null",
|
||||
"string"
|
||||
],
|
||||
"format": "uri"
|
||||
},
|
||||
"visibility": {
|
||||
"type": [
|
||||
"null",
|
||||
"string"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"SerialisedRepo": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "string",
|
||||
"description": "The text that will accompany this repository in the Gitea UI"
|
||||
},
|
||||
"gitHub": {
|
||||
"type": [
|
||||
"null",
|
||||
"string"
|
||||
],
|
||||
"description": "If this repo is to sync from GitHub, the URI (e.g. 'https://github.com/Smaug123/nix-maui')",
|
||||
"format": "uri"
|
||||
},
|
||||
"native": {
|
||||
"description": "If this repo is to be created natively on Gitea, the information about the repo.",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "null"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/SerialisedNativeRepo"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"oneOf": [
|
||||
{
|
||||
"required": [
|
||||
"description",
|
||||
"gitHub"
|
||||
]
|
||||
},
|
||||
{
|
||||
"required": [
|
||||
"description",
|
||||
"native"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"SerialisedNativeRepo": {
|
||||
"type": "object",
|
||||
"description": "Information about a repo that is to be created on Gitea without syncing from GitHub.",
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"defaultBranch"
|
||||
],
|
||||
"properties": {
|
||||
"defaultBranch": {
|
||||
"type": "string",
|
||||
"description": "The default branch name for this repository, e.g. 'main'"
|
||||
},
|
||||
"private": {
|
||||
"type": "boolean",
|
||||
"description": "Whether this repository is a Gitea private repo"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user