Skip to content

Add products_controller API specification #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@
]
}
]
},
{
"title": "Products APIs",
"content": "specs/products_controller.yaml",
"type": "oas3"
}
]
},
Expand Down Expand Up @@ -190,4 +195,4 @@
]
}
]
}
}
339 changes: 339 additions & 0 deletions specs/products_controller.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,339 @@
openapi: 3.0.1
info:
title: products_controller
description: Controller for user and products
contact:
name: Fred
url: http://gigantic-server.com
email: [email protected]
license:
name: Apache 2.0
url: http://foo.bar
version: 40.0.0
servers:
- url: http://localhost:8090/v1
description: Generated server url
tags:
- name: User
description: Business User Services
- name: Sample Controller
description: Controller for sample operations
paths:
/poc/users:
put:
tags:
- Sample Controller
summary: Update user
description: API used for updating user
operationId: updateUserById
requestBody:
description: Created user object
content:
application/json:
schema:
$ref: '#/components/schemas/User'
example:
firstName: John
lastName: Doe
email: [email protected]
required: true
responses:
'204':
description: No content
headers:
TrackingId:
description: tracking
style: simple
schema:
allOf:
- type: string
Date:
description: date
style: simple
schema:
allOf:
- type: string
'400':
description: Bad request
headers:
TrackingId:
description: tracking
style: simple
schema:
allOf:
- type: string
Date:
description: date
style: simple
schema:
allOf:
- type: string
default:
description: Unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/GenericMessage'
example:
code: 500
message: Internal server error occurred
post:
tags:
- Sample Controller
summary: Save user information
description: API used for saving the users
operationId: createUser
requestBody:
description: Created user object
content:
application/json:
schema:
$ref: '#/components/schemas/User'
example:
firstName: Jane
lastName: Smith
email: [email protected]
required: true
responses:
'200':
description: success
headers:
TrackingId:
description: tracking
style: simple
schema:
allOf:
- type: string
Date:
description: date
style: simple
schema:
allOf:
- type: string
content:
application/json:
schema:
$ref: '#/components/schemas/GenericMessage'
example:
code: 200
message: User created successfully
'400':
description: Bad request
headers:
TrackingId:
description: tracking
style: simple
schema:
allOf:
- type: string
Date:
description: date
style: simple
schema:
allOf:
- type: string
content:
application/json:
schema:
$ref: '#/components/schemas/GenericMessage'
example:
code: 400
message: Invalid input parameters
delete:
tags:
- Sample Controller
summary: Delete user
description: API used for deleting users
operationId: deleteUserById
requestBody:
description: user id to delete
content:
application/json:
schema:
type: string
description: user id
example: user-123456
responses:
'204':
description: no content
headers:
TrackingId:
description: tracking
style: simple
schema:
allOf:
- type: string
Date:
description: date
style: simple
schema:
allOf:
- type: string
content:
application/json:
schema:
$ref: '#/components/schemas/GenericMessage'
example:
code: 204
message: User deleted successfully
'400':
description: Bad request
headers:
TrackingId:
description: tracking
style: simple
schema:
allOf:
- type: string
Date:
description: date
style: simple
schema:
allOf:
- type: string
content:
application/json:
schema:
$ref: '#/components/schemas/GenericMessage'
example:
code: 400
message: Invalid user id
/poc/secure/products:
get:
tags:
- Sample Controller
summary: Get products
description: Get information on product offerings
operationId: getSecureProducts
parameters:
- name: max
in: query
description: max param
required: true
schema:
type: integer
format: int32
responses:
'200':
description: success
headers:
TrackingId:
description: tracking
style: simple
schema:
allOf:
- type: string
Link:
description: link
style: simple
schema:
allOf:
- type: string
Date:
description: date
style: simple
schema:
allOf:
- type: string
content:
application/json:
schema:
$ref: '#/components/schemas/SecureProduct'
example:
products:
- Product A
- Product B
- Product C
'400':
description: Bad request
headers:
TrackingId:
description: tracking
style: simple
schema:
allOf:
- type: string
Date:
description: date
style: simple
schema:
allOf:
- type: string
content:
application/json:
schema:
$ref: '#/components/schemas/SecureProduct'
example:
products: []
/poc/ping:
get:
tags:
- Sample Controller
summary: API health check
description: API health check endpoint
operationId: ping
responses:
'200':
description: success
headers:
TrackingId:
description: tracking
style: simple
schema:
allOf:
- type: string
Date:
description: date
style: simple
schema:
allOf:
- type: string
content:
text/plain:
schema:
type: string
example: API is running
default:
description: Unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/GenericMessage'
example:
code: 500
message: API health check failed
components:
schemas:
User:
type: object
description: User data model representing a business user
properties:
firstName:
type: string
description: User's first name
lastName:
type: string
description: User's last name
email:
type: string
description: User's email address
GenericMessage:
type: object
description: Generic message model for API responses
properties:
code:
type: integer
format: int32
description: Error code
message:
type: string
description: Error message
SecureProduct:
type: object
description: Secure product data model for product listings
properties:
products:
type: array
items:
type: string
description: List of products