Add a gulp command to generate OpenAPI schema

This commit is contained in:
Christopher C. Wells 2022-01-12 16:11:07 -08:00 committed by Christopher Charbonneau Wells
parent 4ce498a14f
commit 5964eed601
3 changed files with 19 additions and 4 deletions

View File

@ -160,6 +160,7 @@ management commands.
- [`gulp docs:watch`](#docswatch)
- [`gulp extras`](#extras)
- [`gulp fake`](#fake)
- [`gulp generatescheme`](#generatescheme)
- [`gulp lint`](#lint)
- [`gulp makemessages`](#makemessages)
- [`gulp makemigrations`](#makemigrations)
@ -237,6 +238,11 @@ Adds some fake data to the database. By default, ``fake`` creates one child and
default values, e.g. `gulp fake --children 5 --days 7` to generate five fake
children and seven days of data for each.
#### `generateschema`
Updates the [`openapi-schema.yml`](/openapi-schema.yml) file in the project root
based on current API functionality.
#### `lint`
Executes Python and SASS linting for all relevant source files.

View File

@ -305,9 +305,6 @@ gulp.task('makemigrations', function(cb) {
_runInPipenv(['python', 'manage.py', 'makemigrations'], cb);
});
/**
* Runs the custom "reset" command to start a fresh database with fake data.
*/
gulp.task('reset', function(cb) {
_runInPipenv(['python', 'manage.py', 'reset', '--no-input'], cb);
});
@ -341,6 +338,18 @@ gulp.task('runserver', function(cb) {
spawn('pipenv', command, { stdio: 'inherit' }).on('exit', cb);
});
gulp.task('generateschema', function(cb) {
_runInPipenv([
'python',
'manage.py',
'generateschema',
'--title',
'Baby Buddy API',
'--file',
'openapi-schema.yml'
], cb);
});
/**
* Gulp commands.
*/

View File

@ -1,6 +1,6 @@
openapi: 3.0.2
info:
title: ''
title: Baby Buddy API
version: ''
paths:
/api/children/: