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/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'));
//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.'/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'
content:
application/json:
schema:
$ref: '#components/schemas/AuthenticationError'
401:
description: 'Authentication error'
content:
application/json:
schema:
$ref: '#components/schemas/AuthenticationError'

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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