OpenAPI docs

This commit is contained in:
David Bomba 2023-02-18 15:08:56 +11:00
parent 9f997e9bc4
commit aef722e0f8
11 changed files with 1875 additions and 6604 deletions

View File

@ -79,9 +79,18 @@ class OpenApiYaml extends Command
} }
} }
Storage::disk('base')->append('/openapi/api-docs.yaml', file_get_contents($path.'/components.yaml')); Storage::disk('base')->append('/openapi/api-docs.yaml', file_get_contents($path.'/components.yaml'));
Storage::disk('base')->append('/openapi/api-docs.yaml', file_get_contents($path.'/components/responses.yaml'));
$directory = new DirectoryIterator($path . '/components/responses/');
foreach ($directory as $file) {
if ($file->isFile() && ! $file->isDot()) {
Storage::disk('base')->append('/openapi/api-docs.yaml', file_get_contents("{$path}/components/responses/{$file->getFilename()}"));
}
}
Storage::disk('base')->append('/openapi/api-docs.yaml', file_get_contents($path.'/components/schemas.yaml')); Storage::disk('base')->append('/openapi/api-docs.yaml', file_get_contents($path.'/components/schemas.yaml'));
//iterate schemas //iterate schemas
@ -94,6 +103,7 @@ class OpenApiYaml extends Command
} }
} }
// Storage::disk('base')->append('/openapi/api-docs.yaml', file_get_contents($path.'/components/schemas/account.yaml')); // Storage::disk('base')->append('/openapi/api-docs.yaml', file_get_contents($path.'/components/schemas/account.yaml'));
Storage::disk('base')->append('/openapi/api-docs.yaml', file_get_contents($path.'/misc/misc.yaml')); Storage::disk('base')->append('/openapi/api-docs.yaml', file_get_contents($path.'/misc/misc.yaml'));
} }

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
responses:

View File

@ -1,5 +1,6 @@
description: 'Authentication error' 401:
content: description: 'Authentication error'
application/json: content:
schema: application/json:
$ref: '#components/schemas/AuthenticationError' schema:
$ref: '#components/schemas/AuthenticationError'

View File

@ -1,5 +1,6 @@
description: 'Authorization error' 403:
content: description: 'Authorization error'
application/json: content:
schema: application/json:
$ref: '#components/schemas/AuthorizationError' schema:
$ref: '#components/schemas/AuthorizationError'

View File

@ -1,5 +1,6 @@
description: 'Validation error' 422:
content: description: 'Validation error'
application/json: content:
schema: application/json:
$ref: '#/components/schemas/ValidationError' schema:
$ref: '#/components/schemas/ValidationError'

View File

@ -1,5 +1,6 @@
description: 'Unexpected Error' default:
content: description: 'Unexpected Error'
application/json: content:
schema: application/json:
$ref: '#/components/schemas/Error' schema:
$ref: '#/components/schemas/Error'

View File

@ -1,5 +1,4 @@
schemas: schemas:
BankTransactionRule: BankTransactionRule:
properties: properties:
id: id:

File diff suppressed because it is too large Load Diff

View File

@ -83,11 +83,7 @@
schema: schema:
$ref: '#/components/schemas/Client' $ref: '#/components/schemas/Client'
401: 401:
description: 'Authentication error' $ref: '#/components/responses/401'
content:
application/json:
schema:
$ref: '#components/schemas/AuthenticationError'
403: 403:
$ref: '#/components/responses/403' $ref: '#/components/responses/403'
422: 422:
@ -119,11 +115,7 @@
schema: schema:
$ref: '#/components/schemas/Client' $ref: '#/components/schemas/Client'
401: 401:
description: 'Authentication error' $ref: '#/components/responses/401'
content:
application/json:
schema:
$ref: '#components/schemas/AuthenticationError'
403: 403:
$ref: '#/components/responses/403' $ref: '#/components/responses/403'
422: 422:
@ -164,11 +156,7 @@
schema: schema:
$ref: '#/components/schemas/Client' $ref: '#/components/schemas/Client'
401: 401:
description: 'Authentication error' $ref: '#/components/responses/401'
content:
application/json:
schema:
$ref: '#components/schemas/AuthenticationError'
403: 403:
$ref: '#/components/responses/403' $ref: '#/components/responses/403'
422: 422:
@ -208,11 +196,7 @@
schema: schema:
$ref: '#/components/schemas/Client' $ref: '#/components/schemas/Client'
401: 401:
description: 'Authentication error' $ref: '#/components/responses/401'
content:
application/json:
schema:
$ref: '#components/schemas/AuthenticationError'
403: 403:
$ref: '#/components/responses/403' $ref: '#/components/responses/403'
422: 422:
@ -248,11 +232,7 @@
X-RateLimit-Limit: X-RateLimit-Limit:
$ref: '#/components/headers/X-RateLimit-Limit' $ref: '#/components/headers/X-RateLimit-Limit'
401: 401:
description: 'Authentication error' $ref: '#/components/responses/401'
content:
application/json:
schema:
$ref: '#components/schemas/AuthenticationError'
403: 403:
$ref: '#/components/responses/403' $ref: '#/components/responses/403'
422: 422:
@ -293,11 +273,7 @@
schema: schema:
$ref: '#/components/schemas/Client' $ref: '#/components/schemas/Client'
401: 401:
description: 'Authentication error' $ref: '#/components/responses/401'
content:
application/json:
schema:
$ref: '#components/schemas/AuthenticationError'
403: 403:
$ref: '#/components/responses/403' $ref: '#/components/responses/403'
422: 422:
@ -330,11 +306,7 @@
schema: schema:
$ref: '#/components/schemas/Client' $ref: '#/components/schemas/Client'
401: 401:
description: 'Authentication error' $ref: '#/components/responses/401'
content:
application/json:
schema:
$ref: '#components/schemas/AuthenticationError'
403: 403:
$ref: '#/components/responses/403' $ref: '#/components/responses/403'
422: 422:
@ -378,11 +350,7 @@
schema: schema:
$ref: '#/components/schemas/Client' $ref: '#/components/schemas/Client'
401: 401:
description: 'Authentication error' $ref: '#/components/responses/401'
content:
application/json:
schema:
$ref: '#components/schemas/AuthenticationError'
403: 403:
$ref: '#/components/responses/403' $ref: '#/components/responses/403'
422: 422:
@ -438,11 +406,7 @@
schema: schema:
$ref: '#/components/schemas/Client' $ref: '#/components/schemas/Client'
401: 401:
description: 'Authentication error' $ref: '#/components/responses/401'
content:
application/json:
schema:
$ref: '#components/schemas/AuthenticationError'
403: 403:
$ref: '#/components/responses/403' $ref: '#/components/responses/403'
422: 422:
@ -479,11 +443,7 @@
X-RateLimit-Limit: X-RateLimit-Limit:
$ref: '#/components/headers/X-RateLimit-Limit' $ref: '#/components/headers/X-RateLimit-Limit'
401: 401:
description: 'Authentication error' $ref: '#/components/responses/401'
content:
application/json:
schema:
$ref: '#components/schemas/AuthenticationError'
403: 403:
$ref: '#/components/responses/403' $ref: '#/components/responses/403'
422: 422:
@ -528,11 +488,7 @@
X-RateLimit-Limit: X-RateLimit-Limit:
$ref: '#/components/headers/X-RateLimit-Limit' $ref: '#/components/headers/X-RateLimit-Limit'
401: 401:
description: 'Authentication error' $ref: '#/components/responses/401'
content:
application/json:
schema:
$ref: '#components/schemas/AuthenticationError'
403: 403:
$ref: '#/components/responses/403' $ref: '#/components/responses/403'
422: 422:

View File

@ -27,29 +27,13 @@
schema: schema:
$ref: "#/components/schemas/Product" $ref: "#/components/schemas/Product"
401: 401:
description: "Authentication error" $ref: '#/components/responses/401'
content:
application/json:
schema:
$ref: "#components/schemas/AuthenticationError"
403: 403:
description: "Authorization error" $ref: '#/components/responses/403'
content:
application/json:
schema:
$ref: "#components/schemas/AuthorizationError"
422: 422:
description: "Validation error" $ref: '#/components/responses/422'
content:
application/json:
schema:
$ref: "#/components/schemas/ValidationError"
default: default:
description: "Unexpected Error" $ref: '#/components/responses/default'
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
post: post:
tags: tags:
- products - products
@ -74,18 +58,14 @@
application/json: application/json:
schema: schema:
$ref: "#/components/schemas/Product" $ref: "#/components/schemas/Product"
401:
$ref: '#/components/responses/401'
403:
$ref: '#/components/responses/403'
422: 422:
description: "Validation error" $ref: '#/components/responses/422'
content:
application/json:
schema:
$ref: "#/components/schemas/ValidationError"
default: default:
description: "Unexpected Error" $ref: '#/components/responses/default'
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"/api/v1/products/{id}": "/api/v1/products/{id}":
get: get:
tags: tags:
@ -120,29 +100,13 @@
schema: schema:
$ref: "#/components/schemas/Product" $ref: "#/components/schemas/Product"
401: 401:
description: "Authentication error" $ref: '#/components/responses/401'
content:
application/json:
schema:
$ref: "#components/schemas/AuthenticationError"
403: 403:
description: "Authorization error" $ref: '#/components/responses/403'
content:
application/json:
schema:
$ref: "#components/schemas/AuthorizationError"
422: 422:
description: "Validation error" $ref: '#/components/responses/422'
content:
application/json:
schema:
$ref: "#/components/schemas/ValidationError"
default: default:
description: "Unexpected Error" $ref: '#/components/responses/default'
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
put: put:
tags: tags:
- products - products
@ -176,29 +140,13 @@
schema: schema:
$ref: "#/components/schemas/Product" $ref: "#/components/schemas/Product"
401: 401:
description: "Authentication error" $ref: '#/components/responses/401'
content:
application/json:
schema:
$ref: "#components/schemas/AuthenticationError"
403: 403:
description: "Authorization error" $ref: '#/components/responses/403'
content:
application/json:
schema:
$ref: "#components/schemas/AuthorizationError"
422: 422:
description: "Validation error" $ref: '#/components/responses/422'
content:
application/json:
schema:
$ref: "#/components/schemas/ValidationError"
default: default:
description: "Unexpected Error" $ref: '#/components/responses/default'
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
delete: delete:
tags: tags:
- products - products
@ -228,29 +176,13 @@
X-RateLimit-Limit: X-RateLimit-Limit:
$ref: "#/components/headers/X-RateLimit-Limit" $ref: "#/components/headers/X-RateLimit-Limit"
401: 401:
description: "Authentication error" $ref: '#/components/responses/401'
content:
application/json:
schema:
$ref: "#components/schemas/AuthenticationError"
403: 403:
description: "Authorization error" $ref: '#/components/responses/403'
content:
application/json:
schema:
$ref: "#components/schemas/AuthorizationError"
422: 422:
description: "Validation error" $ref: '#/components/responses/422'
content:
application/json:
schema:
$ref: "#/components/schemas/ValidationError"
default: default:
description: "Unexpected Error" $ref: '#/components/responses/default'
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"/api/v1/products/{id}/edit": "/api/v1/products/{id}/edit":
get: get:
tags: tags:
@ -285,29 +217,13 @@
schema: schema:
$ref: "#/components/schemas/Product" $ref: "#/components/schemas/Product"
401: 401:
description: "Authentication error" $ref: '#/components/responses/401'
content:
application/json:
schema:
$ref: "#components/schemas/AuthenticationError"
403: 403:
description: "Authorization error" $ref: '#/components/responses/403'
content:
application/json:
schema:
$ref: "#components/schemas/AuthorizationError"
422: 422:
description: "Validation error" $ref: '#/components/responses/422'
content:
application/json:
schema:
$ref: "#/components/schemas/ValidationError"
default: default:
description: "Unexpected Error" $ref: '#/components/responses/default'
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"/api/v1/products/create": "/api/v1/products/create":
get: get:
tags: tags:
@ -334,29 +250,13 @@
schema: schema:
$ref: "#/components/schemas/Product" $ref: "#/components/schemas/Product"
401: 401:
description: "Authentication error" $ref: '#/components/responses/401'
content:
application/json:
schema:
$ref: "#components/schemas/AuthenticationError"
403: 403:
description: "Authorization error" $ref: '#/components/responses/403'
content:
application/json:
schema:
$ref: "#components/schemas/AuthorizationError"
422: 422:
description: "Validation error" $ref: '#/components/responses/422'
content:
application/json:
schema:
$ref: "#/components/schemas/ValidationError"
default: default:
description: "Unexpected Error" $ref: '#/components/responses/default'
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/api/v1/products/bulk: /api/v1/products/bulk:
post: post:
@ -395,29 +295,13 @@
schema: schema:
$ref: "#/components/schemas/Product" $ref: "#/components/schemas/Product"
401: 401:
description: "Authentication error" $ref: '#/components/responses/401'
content:
application/json:
schema:
$ref: "#components/schemas/AuthenticationError"
403: 403:
description: "Authorization error" $ref: '#/components/responses/403'
content:
application/json:
schema:
$ref: "#components/schemas/AuthorizationError"
422: 422:
description: "Validation error" $ref: '#/components/responses/422'
content:
application/json:
schema:
$ref: "#/components/schemas/ValidationError"
default: default:
description: "Unexpected Error" $ref: '#/components/responses/default'
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"/api/v1/products/{id}/upload": "/api/v1/products/{id}/upload":
put: put:
@ -467,26 +351,10 @@
schema: schema:
$ref: "#/components/schemas/Product" $ref: "#/components/schemas/Product"
401: 401:
description: "Authentication error" $ref: '#/components/responses/401'
content:
application/json:
schema:
$ref: "#components/schemas/AuthenticationError"
403: 403:
description: "Authorization error" $ref: '#/components/responses/403'
content:
application/json:
schema:
$ref: "#components/schemas/AuthorizationError"
422: 422:
description: "Validation error" $ref: '#/components/responses/422'
content:
application/json:
schema:
$ref: "#/components/schemas/ValidationError"
default: default:
description: "Unexpected Error" $ref: '#/components/responses/default'
content:
application/json:
schema:
$ref: "#/components/schemas/Error"