Skip to content

Instantly share code, notes, and snippets.

@tyanko1
Created April 25, 2019 16:33
Show Gist options
  • Save tyanko1/0109a6f1413d0ec23318620e653efdc7 to your computer and use it in GitHub Desktop.
Save tyanko1/0109a6f1413d0ec23318620e653efdc7 to your computer and use it in GitHub Desktop.
Central API swagger doc
openapi: 3.0.0
info:
title: Central Repository API
version: 1.0.0
description: API for interfacing with Maven Central
security:
- bearerAuth: []
paths:
/orgs:
get:
description: Returns organization by slug name
parameters:
- in: query
name: slug
description: The slug property of an organization resource to filter by.
schema:
type: string
pattern: '^[a-zA-Z0-9-]+$'
minLength: 2
maxLength: 250
- in: query
name: page
description: The index of the page for the current list of records.
schema:
type: integer
minimum: 1
- in: query
name: pagesize
description: The number of records to load per page.
schema:
type: integer
minimum: 1
maximum: 100
- in: query
name: loadmembers
description: >-
The boolean value to indicate whether to load members as part of the
organization record.
schema:
type: boolean
default: false
responses:
'200':
description: array of organizations with paging
content:
application/json:
schema:
$ref: '#/components/schemas/OrganizationWithPaging'
'400':
$ref: '#/components/responses/BadRequestError'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
post:
description: Creates the organization by the groupId provided.
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
groupId:
type: string
pattern: '^[a-zA-Z0-9.&,-_ ]+$'
minLength: 2
maxLength: 250
responses:
'201':
description: organization
content:
application/json:
schema:
$ref: '#/components/schemas/Organization'
'400':
$ref: '#/components/responses/BadRequestError'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'/orgs/{orgId}':
get:
description: Returns a single organization by id
parameters:
- in: path
name: orgId
required: true
description: The unique identifier of an organization resource.
schema:
type: string
pattern: '^[a-zA-Z0-9-]+$'
minLength: 36
maxLength: 36
responses:
'200':
description: organization
content:
application/json:
schema:
$ref: '#/components/schemas/Organization'
'400':
$ref: '#/components/responses/BadRequestError'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
put:
description: Updates the organization's name or image.
parameters:
- in: path
name: orgId
required: true
description: The guid of the organization resource to update.
schema:
type: string
pattern: '^[a-zA-Z0-9-]+$'
minLength: 36
maxLength: 36
requestBody:
content:
application/json:
schema:
type: object
properties:
name:
type: string
pattern: '^[a-zA-Z0-9.&,-_ ]+$'
minLength: 2
maxLength: 250
image:
type: string
format: uri
minLength: 2
maxLength: 250
responses:
'200':
description: organization
content:
application/json:
schema:
$ref: '#/components/schemas/Organization'
'400':
$ref: '#/components/responses/BadRequestError'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
delete:
description: Deletes the organization.
parameters:
- in: path
name: orgId
required: true
description: The guid of the organization resource to delete.
schema:
type: string
pattern: '^[a-zA-Z0-9-]+$'
minLength: 36
maxLength: 36
responses:
'204':
description: The organization was deleted successfully.
'304':
description: The organization failed to delete.
'400':
$ref: '#/components/responses/BadRequestError'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
/users/me:
get:
description: Returns profile information for the current user.
responses:
'200':
description: user
content:
application/json:
schema:
$ref: '#/components/schemas/User'
'400':
$ref: '#/components/responses/BadRequestError'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
put:
description: Returns profile information for the current user.
requestBody:
content:
application/json:
schema:
type: object
properties:
firstName:
type: string
pattern: '^[a-zA-Z0-9.&,-_ ]+$'
minLength: 2
maxLength: 250
lastName:
type: string
pattern: '^[a-zA-Z0-9.&,-_ ]+$'
minLength: 2
maxLength: 250
email:
type: string
format: email
minLength: 2
maxLength: 250
image:
type: string
format: uri
minLength: 2
maxLength: 250
responses:
'200':
description: user
content:
application/json:
schema:
$ref: '#/components/schemas/User'
'400':
$ref: '#/components/responses/BadRequestError'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'/orgs/{orgId}/members':
post:
description: Adds a user to an organization and assigns them a specific role.
parameters:
- in: path
name: orgId
required: true
description: The guid of the organization resource to update.
schema:
type: string
pattern: '^[a-zA-Z0-9-]+$'
minLength: 36
maxLength: 36
requestBody:
content:
application/json:
schema:
type: object
properties:
email:
type: string
format: email
minLength: 2
maxLength: 250
required:
- email
responses:
'200':
description: user
content:
application/json:
schema:
$ref: '#/components/schemas/User'
'400':
$ref: '#/components/responses/BadRequestError'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'/orgs/{orgId}/members/{userId}':
put:
description: Updates a member role's status or role for an organization.
parameters:
- in: path
name: orgId
required: true
description: The guid of the organization.
schema:
type: string
pattern: '^[a-zA-Z0-9-]+$'
minLength: 36
maxLength: 36
- in: path
name: userId
required: true
description: The guid of the user.
schema:
type: string
pattern: '^[a-zA-Z0-9-]+$'
minLength: 36
maxLength: 36
requestBody:
content:
application/json:
schema:
type: object
properties:
status:
type: integer
enum:
- 0
- 1
- 2
role:
type: string
enum:
- admin
- owner
- member
responses:
'204':
description: The member role was updated successfully.
'304':
description: The member role failed to update.
'400':
$ref: '#/components/responses/BadRequestError'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
delete:
description: Removes a member from an organization.
parameters:
- in: path
name: orgId
required: true
description: The guid of the organization.
schema:
type: string
pattern: '^[a-zA-Z0-9-]+$'
minLength: 36
maxLength: 36
- in: path
name: userId
required: true
description: The guid of the user.
schema:
type: string
pattern: '^[a-zA-Z0-9-]+$'
minLength: 36
maxLength: 36
responses:
'204':
description: The member role was deleted successfully.
'304':
description: The member role failed to delete.
'400':
$ref: '#/components/responses/BadRequestError'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
components:
schemas:
Error:
type: object
required:
- statusCode
- message
- error
properties:
statusCode:
type: integer
minimum: 100
maximum: 600
error:
type: string
message:
type: string
detail:
type: array
items:
$ref: '#/components/schemas/ValidationError'
ValidationError:
type: object
required:
- keyword
- dataPath
- schemaPath
- params
- message
properties:
keyword:
type: string
dataPath:
type: string
schemaPath:
type: string
params:
type: object
additionalProperties:
type: string
message:
type: string
Organization:
required:
- id
- slug
- groupId
properties:
id:
type: string
slug:
type: string
groupId:
type: string
image:
type: string
role:
type: string
status:
type: integer
provisioningStatus:
type: string
example: new || validating || enabled
members:
type: array
items:
$ref: '#/components/schemas/OrgMember'
OrganizationWithPaging:
required:
- orgs
- page
- pageSize
- totalPages
- totalRecords
properties:
orgs:
type: array
items:
$ref: '#/components/schemas/Organization'
page:
type: integer
example: 1
pageSize:
type: integer
example: 10
totalPages:
type: integer
example: 3
totalRecords:
type: integer
example: 25
OrgMember:
properties:
id:
type: string
email:
type: string
firstName:
type: string
lastName:
type: string
username:
type: string
provisioningStatus:
type: string
example: new || validating || enabled
User:
required:
- id
- email
- firstName
- lastName
- username
properties:
id:
type: string
email:
type: string
firstName:
type: string
lastName:
type: string
username:
type: string
image:
type: string
role:
type: string
status:
type: integer
orgs:
type: array
items:
$ref: '#/components/schemas/Organization'
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
responses:
Unauthorized:
description: Authorization information is missing or invalid.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
statusCode: 401
error: UnauthorizedError
message: string
BadRequestError:
description: A bad request was made on the requested resource
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
statusCode: 400
error: BadRequestError
message: string
ConflictError:
description: There is a conflict with the requested resource
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
statusCode: 409
error: ConflictError
message: string
ConfigurationError:
description: There is a configuration error with the application
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
Forbidden:
description: No permission to access or perform action on requested resource.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
statusCode: 403
error: ForbiddenError
message: string
InternalServerError:
description: Internal server error occurred
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
statusCode: 500
error: InternalServerError
message: string
NotFound:
description: The specified resource was not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
statusCode: 404
error: NotFoundError
message: string
tags: []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment