Serve OpenAPI 3.0 spec at /openapi.v1.json (#37038)

Add a build-time conversion step that transforms the existing Swagger
2.0 spec into an OpenAPI 3.0 spec. The OAS3 spec is served alongside the
existing Swagger 2.0 spec, enabling API clients that require OAS3 to
generate code directly from Gitea's API.

This is not to be an answer to how gitea handles OAS3 long term,
but a way to use what we have to move a step forward.

---------

Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Claude (Opus 4.7) <noreply@anthropic.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Myers Carpenter
2026-04-29 08:47:52 -04:00
committed by GitHub
parent 18762c7748
commit 9e031eb3df
39 changed files with 34700 additions and 99 deletions

View File

@@ -22299,12 +22299,14 @@
"type": "object",
"properties": {
"permission": {
"description": "Permission level to grant the collaborator\nread RepoWritePermissionRead\nwrite RepoWritePermissionWrite\nadmin RepoWritePermissionAdmin",
"type": "string",
"enum": [
"read",
"write",
"admin"
],
"x-go-enum-desc": "read RepoWritePermissionRead\nwrite RepoWritePermissionWrite\nadmin RepoWritePermissionAdmin",
"x-go-name": "Permission"
}
},
@@ -24031,13 +24033,14 @@
"x-go-name": "UserName"
},
"visibility": {
"description": "possible values are `public` (default), `limited` or `private`",
"description": "possible values are `public` (default), `limited` or `private`\npublic UserVisibilityPublic\nlimited UserVisibilityLimited\nprivate UserVisibilityPrivate",
"type": "string",
"enum": [
"public",
"limited",
"private"
],
"x-go-enum-desc": "public UserVisibilityPublic\nlimited UserVisibilityLimited\nprivate UserVisibilityPrivate",
"x-go-name": "Visibility"
},
"website": {
@@ -24322,12 +24325,13 @@
"x-go-name": "Name"
},
"object_format_name": {
"description": "ObjectFormatName of the underlying git repository, empty string for default (sha1)",
"description": "ObjectFormatName of the underlying git repository, empty string for default (sha1)\nsha1 ObjectFormatSHA1\nsha256 ObjectFormatSHA256",
"type": "string",
"enum": [
"sha1",
"sha256"
],
"x-go-enum-desc": "sha1 ObjectFormatSHA1\nsha256 ObjectFormatSHA256",
"x-go-name": "ObjectFormatName"
},
"private": {
@@ -24480,6 +24484,7 @@
"write",
"admin"
],
"x-go-enum-desc": "read RepoWritePermissionRead\nwrite RepoWritePermissionWrite\nadmin RepoWritePermissionAdmin",
"x-go-name": "Permission"
},
"units": {
@@ -24574,8 +24579,14 @@
"x-go-name": "Username"
},
"visibility": {
"description": "User visibility level: public, limited, or private",
"description": "User visibility level: public, limited, or private\npublic UserVisibilityPublic\nlimited UserVisibilityLimited\nprivate UserVisibilityPrivate",
"type": "string",
"enum": [
"public",
"limited",
"private"
],
"x-go-enum-desc": "public UserVisibilityPublic\nlimited UserVisibilityLimited\nprivate UserVisibilityPrivate",
"x-go-name": "Visibility"
}
},
@@ -25200,13 +25211,14 @@
"x-go-name": "RepoAdminChangeTeamAccess"
},
"visibility": {
"description": "possible values are `public`, `limited` or `private`",
"description": "possible values are `public`, `limited` or `private`\npublic UserVisibilityPublic\nlimited UserVisibilityLimited\nprivate UserVisibilityPrivate",
"type": "string",
"enum": [
"public",
"limited",
"private"
],
"x-go-enum-desc": "public UserVisibilityPublic\nlimited UserVisibilityLimited\nprivate UserVisibilityPrivate",
"x-go-name": "Visibility"
},
"website": {
@@ -25570,6 +25582,7 @@
"write",
"admin"
],
"x-go-enum-desc": "read RepoWritePermissionRead\nwrite RepoWritePermissionWrite\nadmin RepoWritePermissionAdmin",
"x-go-name": "Permission"
},
"units": {
@@ -25700,8 +25713,14 @@
"x-go-name": "SourceID"
},
"visibility": {
"description": "User visibility level: public, limited, or private",
"description": "User visibility level: public, limited, or private\npublic UserVisibilityPublic\nlimited UserVisibilityLimited\nprivate UserVisibilityPrivate",
"type": "string",
"enum": [
"public",
"limited",
"private"
],
"x-go-enum-desc": "public UserVisibilityPublic\nlimited UserVisibilityLimited\nprivate UserVisibilityPrivate",
"x-go-name": "Visibility"
},
"website": {
@@ -27652,8 +27671,14 @@
"x-go-name": "UserName"
},
"visibility": {
"description": "The visibility level of the organization (public, limited, private)",
"description": "The visibility level of the organization (public, limited, private)\npublic UserVisibilityPublic\nlimited UserVisibilityLimited\nprivate UserVisibilityPrivate",
"type": "string",
"enum": [
"public",
"limited",
"private"
],
"x-go-enum-desc": "public UserVisibilityPublic\nlimited UserVisibilityLimited\nprivate UserVisibilityPrivate",
"x-go-name": "Visibility"
},
"website": {
@@ -28637,8 +28662,16 @@
"type": "object",
"properties": {
"permission": {
"description": "Permission level of the collaborator",
"description": "Permission level of the collaborator\nnone AccessLevelNameNone\nread AccessLevelNameRead\nwrite AccessLevelNameWrite\nadmin AccessLevelNameAdmin\nowner AccessLevelNameOwner",
"type": "string",
"enum": [
"none",
"read",
"write",
"admin",
"owner"
],
"x-go-enum-desc": "none AccessLevelNameNone\nread AccessLevelNameRead\nwrite AccessLevelNameWrite\nadmin AccessLevelNameAdmin\nowner AccessLevelNameOwner",
"x-go-name": "Permission"
},
"role_name": {
@@ -28915,12 +28948,13 @@
"x-go-name": "Name"
},
"object_format_name": {
"description": "ObjectFormatName of the underlying git repository",
"description": "ObjectFormatName of the underlying git repository\nsha1 ObjectFormatSHA1\nsha256 ObjectFormatSHA256",
"type": "string",
"enum": [
"sha1",
"sha256"
],
"x-go-enum-desc": "sha1 ObjectFormatSHA1\nsha256 ObjectFormatSHA256",
"x-go-name": "ObjectFormatName"
},
"open_issues_count": {
@@ -29294,6 +29328,7 @@
"admin",
"owner"
],
"x-go-enum-desc": "none AccessLevelNameNone\nread AccessLevelNameRead\nwrite AccessLevelNameWrite\nadmin AccessLevelNameAdmin\nowner AccessLevelNameOwner",
"x-go-name": "Permission"
},
"units": {
@@ -29840,8 +29875,14 @@
"x-go-name": "StarredRepos"
},
"visibility": {
"description": "User visibility level option: public, limited, private",
"description": "User visibility level option: public, limited, private\npublic UserVisibilityPublic\nlimited UserVisibilityLimited\nprivate UserVisibilityPrivate",
"type": "string",
"enum": [
"public",
"limited",
"private"
],
"x-go-enum-desc": "public UserVisibilityPublic\nlimited UserVisibilityLimited\nprivate UserVisibilityPrivate",
"x-go-name": "Visibility"
},
"website": {

File diff suppressed because it is too large Load Diff