Skip to content

Commit 5c8e098

Browse files
committed
remove registry query parameters and update swagger
1 parent 2533bf4 commit 5c8e098

File tree

11 files changed

+342
-276
lines changed

11 files changed

+342
-276
lines changed

api-docs/openapi.json

Lines changed: 51 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1974,18 +1974,12 @@
19741974
},
19751975
"post": {
19761976
"tags": [
1977-
"Organization"
1977+
"Registry Organization"
19781978
],
1979-
"summary": "Retrieves all organizations (accessible to Secretariat)",
1980-
"description": " <h2>Access Control</h2> <p>User must belong to an organization with the <b>Secretariat</b> role</p> <h2>Expected Behavior</h2> <p><b>Secretariat:</b> Retrieves information about all organizations</p>",
1981-
"operationId": "orgAll",
1979+
"summary": "Creates an organization (accessible to Secretariat)",
1980+
"description": " <h2>Access Control</h2> <p>User must belong to an organization with the <b>Secretariat</b> role</p> <h2>Expected Behavior</h2> <p><b>Secretariat:</b> Creates a new organization</p>",
1981+
"operationId": "orgCreateSingle",
19821982
"parameters": [
1983-
{
1984-
"$ref": "#/components/parameters/pageQuery"
1985-
},
1986-
{
1987-
"$ref": "#/components/parameters/registry"
1988-
},
19891983
{
19901984
"$ref": "#/components/parameters/apiEntityHeader"
19911985
},
@@ -2057,6 +2051,29 @@
20572051
}
20582052
}
20592053
}
2054+
},
2055+
"requestBody": {
2056+
"required": true,
2057+
"content": {
2058+
"application/json": {
2059+
"schema": {
2060+
"anyOf": [
2061+
{
2062+
"$ref": "../schemas/registry-org/SecretariatOrg.json"
2063+
},
2064+
{
2065+
"$ref": "../schemas/registry-org/CNAOrg.json"
2066+
},
2067+
{
2068+
"$ref": "../schemas/registry-org/ADPOrg.json"
2069+
},
2070+
{
2071+
"$ref": "../schemas/registry-org/BulkDownloadOrg.json"
2072+
}
2073+
]
2074+
}
2075+
}
2076+
}
20602077
}
20612078
}
20622079
},
@@ -2597,9 +2614,6 @@
25972614
{
25982615
"$ref": "#/components/parameters/active_roles_remove"
25992616
},
2600-
{
2601-
"$ref": "#/components/parameters/registry"
2602-
},
26032617
{
26042618
"$ref": "#/components/parameters/apiEntityHeader"
26052619
},
@@ -2887,10 +2901,14 @@
28872901
"operationId": "orgAll",
28882902
"parameters": [
28892903
{
2890-
"$ref": "#/components/parameters/pageQuery"
2904+
"name": "registry",
2905+
"in": "query",
2906+
"schema": {
2907+
"type": "string"
2908+
}
28912909
},
28922910
{
2893-
"$ref": "#/components/parameters/registry"
2911+
"$ref": "#/components/parameters/pageQuery"
28942912
},
28952913
{
28962914
"$ref": "#/components/parameters/apiEntityHeader"
@@ -2980,9 +2998,6 @@
29802998
"description": " <h2>Access Control</h2> <p>User must belong to an organization with the <b>Secretariat</b> role</p> <h2>Expected Behavior</h2> <p><b>Secretariat:</b> Creates an organization</p> ",
29812999
"operationId": "orgCreateSingle",
29823000
"parameters": [
2983-
{
2984-
"$ref": "#/components/parameters/registry"
2985-
},
29863001
{
29873002
"$ref": "#/components/parameters/apiEntityHeader"
29883003
},
@@ -3067,14 +3082,7 @@
30673082
"content": {
30683083
"application/json": {
30693084
"schema": {
3070-
"oneOf": [
3071-
{
3072-
"$ref": "../schemas/org/create-org-request.json"
3073-
},
3074-
{
3075-
"$ref": "../schemas/registry-org/create-registry-org-request.json"
3076-
}
3077-
]
3085+
"$ref": "../schemas/org/create-org-request.json"
30783086
}
30793087
}
30803088
}
@@ -3099,9 +3107,6 @@
30993107
},
31003108
"description": "The shortname or UUID of the organization"
31013109
},
3102-
{
3103-
"$ref": "#/components/parameters/registry"
3104-
},
31053110
{
31063111
"$ref": "#/components/parameters/apiEntityHeader"
31073112
},
@@ -3118,14 +3123,7 @@
31183123
"content": {
31193124
"application/json": {
31203125
"schema": {
3121-
"oneOf": [
3122-
{
3123-
"$ref": "../schemas/org/get-org-response.json"
3124-
},
3125-
{
3126-
"$ref": "../schemas/registry-org/get-registry-org-response.json"
3127-
}
3128-
]
3126+
"$ref": "../schemas/org/get-org-response.json"
31293127
}
31303128
}
31313129
}
@@ -3201,6 +3199,13 @@
32013199
},
32023200
"description": "The shortname of the organization"
32033201
},
3202+
{
3203+
"name": "registry",
3204+
"in": "query",
3205+
"schema": {
3206+
"type": "string"
3207+
}
3208+
},
32043209
{
32053210
"$ref": "#/components/parameters/id_quota"
32063211
},
@@ -3216,9 +3221,6 @@
32163221
{
32173222
"$ref": "#/components/parameters/active_roles_remove"
32183223
},
3219-
{
3220-
"$ref": "#/components/parameters/registry"
3221-
},
32223224
{
32233225
"$ref": "#/components/parameters/apiEntityHeader"
32243226
},
@@ -3235,14 +3237,7 @@
32353237
"content": {
32363238
"application/json": {
32373239
"schema": {
3238-
"oneOf": [
3239-
{
3240-
"$ref": "../schemas/org/update-org-response.json"
3241-
},
3242-
{
3243-
"$ref": "../schemas/registry-org/update-registry-org-response.json"
3244-
}
3245-
]
3240+
"$ref": "../schemas/org/update-org-response.json"
32463241
}
32473242
}
32483243
}
@@ -3318,9 +3313,6 @@
33183313
},
33193314
"description": "The shortname of the organization"
33203315
},
3321-
{
3322-
"$ref": "#/components/parameters/registry"
3323-
},
33243316
{
33253317
"$ref": "#/components/parameters/apiEntityHeader"
33263318
},
@@ -3337,14 +3329,7 @@
33373329
"content": {
33383330
"application/json": {
33393331
"schema": {
3340-
"oneOf": [
3341-
{
3342-
"$ref": "../schemas/org/get-org-quota-response.json"
3343-
},
3344-
{
3345-
"$ref": "../schemas/registry-org/get-registry-org-quota-response.json"
3346-
}
3347-
]
3332+
"$ref": "../schemas/org/get-org-quota-response.json"
33483333
}
33493334
}
33503335
}
@@ -3421,10 +3406,14 @@
34213406
"description": "The shortname of the organization"
34223407
},
34233408
{
3424-
"$ref": "#/components/parameters/pageQuery"
3409+
"name": "registry",
3410+
"in": "query",
3411+
"schema": {
3412+
"type": "string"
3413+
}
34253414
},
34263415
{
3427-
"$ref": "#/components/parameters/registry"
3416+
"$ref": "#/components/parameters/pageQuery"
34283417
},
34293418
{
34303419
"$ref": "#/components/parameters/apiEntityHeader"
@@ -3442,14 +3431,7 @@
34423431
"content": {
34433432
"application/json": {
34443433
"schema": {
3445-
"oneOf": [
3446-
{
3447-
"$ref": "../schemas/user/list-users-response.json"
3448-
},
3449-
{
3450-
"$ref": "../schemas/registry-user/list-registry-users-response.json"
3451-
}
3452-
]
3434+
"$ref": "../schemas/user/list-users-response.json"
34533435
}
34543436
}
34553437
}
@@ -3525,9 +3507,6 @@
35253507
},
35263508
"description": "The shortname of the organization"
35273509
},
3528-
{
3529-
"$ref": "#/components/parameters/registry"
3530-
},
35313510
{
35323511
"$ref": "#/components/parameters/apiEntityHeader"
35333512
},
@@ -3765,9 +3744,6 @@
37653744
{
37663745
"$ref": "#/components/parameters/orgShortname"
37673746
},
3768-
{
3769-
"$ref": "#/components/parameters/registry"
3770-
},
37713747
{
37723748
"$ref": "#/components/parameters/apiEntityHeader"
37733749
},

schemas/registry-org/ADPOrg.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "ADPOrg",
4+
"type": "object",
5+
"title": "CVE ADP Organization",
6+
"description": "Schema for a CVE ADP Organization",
7+
"allOf": [
8+
{ "$ref": "./BaseOrg.json" },
9+
{
10+
"properties": {
11+
"authority": {
12+
"const": ["ADP"]
13+
}
14+
}
15+
}
16+
]
17+
}

schemas/registry-org/BaseOrg.json

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "./BaseOrg.json",
4+
"type": "object",
5+
"title": "CVE Base Organization",
6+
"description": "Base schema for a CVE Organization",
7+
"definitions": {
8+
"uuidType": {
9+
"description": "A version 4 (random) universally unique identifier (UUID) as defined by [RFC 4122](https://tools.ietf.org/html/rfc4122#section-4.1.3).",
10+
"type": "string",
11+
"format": "uuid",
12+
"pattern": "^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$"
13+
},
14+
"uriType": {
15+
"description": "A universal resource identifier (URI), according to [RFC 3986](https://tools.ietf.org/html/rfc3986).",
16+
"type": "string",
17+
"format": "uri",
18+
"pattern": "^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?",
19+
"minLength": 1,
20+
"maxLength": 2048
21+
},
22+
"shortName": {
23+
"description": "A 2-32 character name that can be used to complement an organization's UUID.",
24+
"type": "string",
25+
"minLength": 2,
26+
"maxLength": 32
27+
},
28+
"longName": {
29+
"description": "A 1-256 character name that can be used to complement an organization's short_name.",
30+
"type": "string",
31+
"minLength": 1,
32+
"maxLength": 256
33+
},
34+
"authority": {
35+
"description": "The authority (role) of this organization within the CVE program",
36+
"type": "string",
37+
"enum": ["CNA", "SECRETARIAT", "BULK_DOWNLOAD", "ADP"]
38+
}
39+
},
40+
"properties": {
41+
"UUID": {
42+
"$ref": "#/definitions/uuidType"
43+
},
44+
"short_name": {
45+
"$ref": "#/definitions/shortName"
46+
},
47+
"long_name": {
48+
"$ref": "#/definitions/longName"
49+
},
50+
"aliases": {
51+
"type": "array",
52+
"uniqueItems": true,
53+
"items": {
54+
"type": "string"
55+
}
56+
},
57+
"authority": {
58+
"type": "array",
59+
"uniqueItems": true,
60+
"items": {
61+
"$ref": "#/definitions/authority"
62+
}
63+
},
64+
"root_or_tlr": {
65+
"type": "boolean"
66+
},
67+
"reports_to": {
68+
"$ref": "#/definitions/uuidType"
69+
},
70+
"users": {
71+
"type": "array",
72+
"uniqueItems": true,
73+
"items": {
74+
"$ref": "#/definitions/uuidType"
75+
}
76+
},
77+
"admins": {
78+
"type": "array",
79+
"uniqueItems": true,
80+
"items": {
81+
"$ref": "#/definitions/uuidType"
82+
}
83+
},
84+
"contact_info": {
85+
"type": "object",
86+
"properties": {
87+
"additional_contact_users": {
88+
"type": "array",
89+
"uniqueItems": true,
90+
"items": {
91+
"$ref": "#/definitions/uuidType"
92+
}
93+
},
94+
"poc": {
95+
"type": "string"
96+
},
97+
"poc_email": {
98+
"type": "string",
99+
"format": "email"
100+
},
101+
"poc_phone": {
102+
"type": "string"
103+
},
104+
"org_email": {
105+
"type": "string",
106+
"format": "email"
107+
},
108+
"website": {
109+
"type": "string",
110+
"format": "uri",
111+
"description": "Organization's website URL"
112+
}
113+
},
114+
"additionalProperties": false
115+
}
116+
},
117+
"required": [
118+
"short_name",
119+
"long_name"
120+
]
121+
}

0 commit comments

Comments
 (0)