Skip to content

Commit

Permalink
Add api_order_with_oauth_v3.yaml in 'io' package
Browse files Browse the repository at this point in the history
  • Loading branch information
yogeshnikam671 committed Jul 23, 2024
1 parent 2caa34f commit 30b0b92
Showing 1 changed file with 350 additions and 0 deletions.
350 changes: 350 additions & 0 deletions io/specmatic/examples/store/openapi/api_order_with_oauth_v3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,350 @@
openapi: 3.0.1
info:
title: Order API
version: "2.0"
servers:
- url: "http://localhost:3000"
paths:
"/products/{id}":
parameters:
- schema:
type: number
name: id
in: path
required: true
examples:
GET_DETAILS:
value: 10
UPDATE_DETAILS:
value: 10
DELETE_PRODUCT:
value: 20
INVALID_ID:
value: "344"
get:
summary: Fetch product details
tags: []
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "./common.yaml#/components/schemas/Product"
examples:
GET_DETAILS:
value:
name: "XYZ Phone"
type: "gadget"
inventory: 10
id: 10
"400":
$ref: "./common_responses.yaml#/components/responses/BadRequest"
"404":
description: "Not Found"
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponseBody"
examples:
INVALID_ID:
value:
timestamp: "2023-03-17T12:06:56.177+00:00"
status: 404
error: "Not Found"
message: "Not found"
operationId: get-product-id
post:
summary: Update product details
operationId: post-products-id
responses:
"200":
description: Update successful
content:
text/plain:
schema:
type: string
examples:
UPDATE_DETAILS:
value: "success"
"400":
$ref: "./common_responses.yaml#/components/responses/BadRequest"
requestBody:
content:
application/json:
schema:
$ref: "./common.yaml#/components/schemas/Product"
examples:
UPDATE_DETAILS:
value:
name: "XYZ Fone"
type: "gadget"
inventory: 10
id: 10
delete:
summary: Delete a product
operationId: delete-products-id
responses:
"200":
description: Deletion successful
content:
text/plain:
schema:
type: string
examples:
DELETE_PRODUCT:
value: "success"
"400":
$ref: "./common_responses.yaml#/components/responses/BadRequest"
/products:
get:
summary: GET Products based on type
parameters:
- name: type
in: query
schema:
type: string
enum:
- gadget
- book
- food
- other
responses:
"200":
description: List of products in the response
content:
application/json:
schema:
type: array
items:
$ref: "common.yaml#/components/schemas/Product"
post:
summary: POST /products
requestBody:
content:
application/json:
schema:
$ref: "common.yaml#/components/schemas/ProductDetails"
responses:
"200":
description: POST /products
content:
application/json:
schema:
$ref: "common.yaml#/components/schemas/ProductId"
"400":
$ref: "./common_responses.yaml#/components/responses/BadRequest"
/orders:
post:
summary: POST /orders
requestBody:
content:
application/json:
schema:
$ref: "common.yaml#/components/schemas/OrderDetails"
examples:
CREATE_ORDER:
value:
productid: 10
count: 2
status: pending
responses:
"200":
description: POST /orders
content:
application/json:
schema:
$ref: "common.yaml#/components/schemas/OrderId"
examples:
CREATE_ORDER:
value:
id: 10
"400":
$ref: "./common_responses.yaml#/components/responses/BadRequest"
get:
summary: Search for orders
operationId: get-orders
responses:
"200":
description: OK
content:
application/json:
schema:
type: array
items:
$ref: "./common.yaml#/components/schemas/Order"
examples:
200_OK:
value:
- productid: 10
count: 2
status: "pending"
id: 10
"400":
$ref: "./common_responses.yaml#/components/responses/BadRequest"
parameters:
- schema:
type: number
in: query
name: productid
examples:
200_OK:
value: 10
- schema:
type: string
in: query
name: status
examples:
200_OK:
value: fulfilled
description: ""
"/orders/{id}":
parameters:
- schema:
type: number
name: id
in: path
required: true
examples:
DETAILS:
value: 10
INVALID_ID:
value: 433
get:
summary: Fetch order details
tags: []
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "./common.yaml#/components/schemas/Order"
examples:
DETAILS:
value:
productid: 10
count: 2
status: "pending"
id: 10
"400":
$ref: "./common_responses.yaml#/components/responses/BadRequest"
"404":
description: "Not Found"
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponseBody"
examples:
INVALID_ID:
value:
timestamp: "2023-03-17T12:06:56.177+00:00"
status: 404
error: "Not Found"
message: "Product with id 344 was not found"
operationId: get-orders-id
parameters: []
post:
summary: Update order details
operationId: post-orders-id
responses:
"200":
description: Success
content:
text/plain:
schema:
type: string
examples:
UPDATE_ORDER:
value: "success"
"400":
$ref: "./common_responses.yaml#/components/responses/BadRequest"
requestBody:
content:
application/json:
schema:
$ref: "./common.yaml#/components/schemas/Order"
examples:
UPDATE_ORDER:
value:
productid: 10
id: 10
count: 1
status: pending
delete:
summary: Cancel an order
operationId: delete-orders-id
responses:
"200":
description: Cancel successful
content:
text/plain:
schema:
type: string
examples:
DELETE_ORDER:
value: "success"
"400":
$ref: "./common_responses.yaml#/components/responses/BadRequest"
components:
schemas:
Products_RequestBody:
required:
- inventory
- name
- type
properties:
name:
type: string
type:
type: string
enum:
- gadget
- book
- food
- other
inventory:
type: number
Orders_RequestBody:
required:
- count
- productid
- status
properties:
productid:
type: number
count:
type: number
status:
type: string
enum:
- pending
- fulfilled
- cancelled
ErrorResponseBody:
properties:
id:
type: number
timestamp:
type: string
status:
type: number
error:
type: string
message:
type: string

securitySchemes:
oAuth2AuthCode:
type: oauth2
description: keycloak based oauth security example
flows:
authorizationCode:
authorizationUrl: http://localhost:8083/realms/specmatic/protocol/openid-connect/auth
tokenUrl: http://localhost:8083/realms/specmatic/protocol/openid-connect/token
scopes:
email: email

security:
- oAuth2AuthCode: []

0 comments on commit 30b0b92

Please sign in to comment.