Skip to content

Commit

Permalink
Merge pull request #10605 from eduardoj/document_attribute_routes_wit…
Browse files Browse the repository at this point in the history
…h_openapi

Document '/attribute' API routes with OpenAPI
  • Loading branch information
eduardoj committed Jan 20, 2021
2 parents 3f372cf + 2b6c6af commit cc9879e
Show file tree
Hide file tree
Showing 10 changed files with 575 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/api/public/apidocs-new/OBS-v2.10.50.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ tags:
- name: General Information
- name: Groups
- name: Person
- name: Attribute Namespaces
- name: Attributes

info:
description: Open Build Service API
Expand All @@ -25,13 +27,23 @@ paths:

/architectures:
$ref: 'paths/architectures.yaml'

/architectures/{architecture_name}:
$ref: 'paths/architectures_architecture_name.yaml'

/attribute:
$ref: 'paths/attribute.yaml'
/attribute/{namespace}:
$ref: 'paths/attribute_namespace.yaml'
/attribute/{namespace}/_meta:
$ref: 'paths/attribute_namespace_meta.yaml'

/attribute/{namespace}/{attribute_name}:
$ref: 'paths/attribute_namespace_attribute_name.yaml'
/attribute/{namespace}/{attribute_name}/_meta:
$ref: 'paths/attribute_namespace_attribute_name_meta.yaml'

/group:
$ref: 'paths/group.yaml'

/group/{group_title}:
$ref: 'paths/group_group_title.yaml'

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
in: path
name: attribute_name
schema:
type: string
required: true
description: The name of the attribute
example: OwnerRootProjectTest
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
in: path
name: namespace
schema:
type: string
required: true
description: The namespace
example: OBS_TEST
40 changes: 40 additions & 0 deletions src/api/public/apidocs-new/components/schemas/attribute.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
type: object
properties:
name:
type: string
example: 'OBS_TEST'
xml:
attribute: true
namespace:
type: string
example: 'OwnerRootProjectTest'
xml:
attribute: true
description:
type: string
example: 'An example description for an attribute.'
allowed:
type: object
properties:
value:
type: array
items:
type: string
example:
- 'DisableDevelTest'
- 'BugownerOnlyTest'
count:
type: integer
example: 0
modifiable_by:
type: array
items:
type: object
properties:
user:
type: string
example: 'user_login_name'
xml:
attribute: true
xml:
name: definition
19 changes: 19 additions & 0 deletions src/api/public/apidocs-new/components/schemas/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
type: object
properties:
name:
type: string
example: 'OBS_TEST'
xml:
attribute: true
modifiable_by:
type: array
items:
type: object
properties:
user:
type: string
example: 'user_login_name'
xml:
attribute: true
xml:
name: namespace
24 changes: 24 additions & 0 deletions src/api/public/apidocs-new/paths/attribute.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
get:
summary: List all attribute namespaces.
description: List all attribute namespaces.
security:
- basic_authentication: []
responses:
'200':
description: |
OK. The request has succeeded.
XML Schema used for body validation: [directory.xsd](../schema/directory.xsd)
content:
application/xml; charset=utf-8:
schema:
$ref: '../components/schemas/directory.yaml'
example:
count: '2'
entry:
- name: 'OBS'
- name: 'openSUSE'
'401':
$ref: '../components/responses/unauthorized.yaml'
tags:
- Attribute Namespaces
53 changes: 53 additions & 0 deletions src/api/public/apidocs-new/paths/attribute_namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
get:
summary: List all attributes below a namespace.
description: List all attributes under a given attribute namespace.
security:
- basic_authentication: []
parameters:
- $ref: '../components/parameters/namespace.yaml'
responses:
'200':
description: |
OK. The request has succeeded.
XML Schema used for body validation: [directory.xsd](../schema/directory.xsd)
content:
application/xml; charset=utf-8:
schema:
$ref: '../components/schemas/directory.yaml'
example:
count: '2'
entry:
- name: 'AutoCleanup'
- name: 'OwnerRootProject'
'401':
$ref: '../components/responses/unauthorized.yaml'
'404':
description: Not Found.
content:
application/xml; charset=utf-8:
schema:
$ref: '../components/schemas/api_response.yaml'
example:
code: not_found
summary: Couldn't find AttribNamespace
tags:
- Attribute Namespaces

delete:
summary: Delete an attribute namespace and all attributes below.
description: |
Delete an attribute namespace and all attributes below.
This operation is the same as the one defined with [DELETE /attribute/{namespace}/_meta](#/Attributes/delete_attribute__namespace___meta).
security:
- basic_authentication: []
parameters:
- $ref: '../components/parameters/namespace.yaml'
responses:
'200':
$ref: '../components/responses/succeeded.yaml'
'401':
$ref: '../components/responses/unauthorized.yaml'
tags:
- Attribute Namespaces
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
delete:
summary: Delete an attribute and all its values in projects or packages.
description: |
Delete an attribute and all its values in projects or packages.
This operation is the same as the one defined with [DELETE /attribute/{namespace}/{attribute_name}/_meta](#/Attributes/delete_attribute__namespace___attribute_name___meta)
security:
- basic_authentication: []
parameters:
- $ref: '../components/parameters/namespace.yaml'
- $ref: '../components/parameters/attribute_name.yaml'
responses:
'200':
$ref: '../components/responses/succeeded.yaml'
'401':
$ref: '../components/responses/unauthorized.yaml'
'404':
description: Not Found.
content:
application/xml; charset=utf-8:
schema:
$ref: '../components/schemas/api_response.yaml'
examples:
namespace:
value:
code: not_found
summary: Couldn't find AttribNamespace
summary: Not Found (Namespace)
tags:
- Attributes
Loading

0 comments on commit cc9879e

Please sign in to comment.