Compare commits
2 Commits
8acb2157ab
...
4fa02a4962
Author | SHA1 | Date | |
---|---|---|---|
4fa02a4962 | |||
38b477e0ad |
@ -12,6 +12,7 @@ _default:
|
|||||||
|
|
||||||
PYTHON := if os_family() == "windows" { "py -3" } else { "python3" }
|
PYTHON := if os_family() == "windows" { "py -3" } else { "python3" }
|
||||||
GEN_MODELS := "datamodel-codegen"
|
GEN_MODELS := "datamodel-codegen"
|
||||||
|
GEN_MODELS_DOCUMENTATION := "openapi-generator"
|
||||||
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
# Macros
|
# Macros
|
||||||
@ -56,6 +57,16 @@ _generate-models path name:
|
|||||||
--input {{path}}/{{name}}-schema.yaml \
|
--input {{path}}/{{name}}-schema.yaml \
|
||||||
--output {{path}}/generated/{{name}}.py
|
--output {{path}}/generated/{{name}}.py
|
||||||
|
|
||||||
|
_generate-models-documentation path name:
|
||||||
|
@- just _delete-if-folder-exists "docs/{{name}}"
|
||||||
|
@- just _create-folder-if-not-exists "docs/{{name}}"
|
||||||
|
@- {{GEN_MODELS_DOCUMENTATION}} generate \
|
||||||
|
--input-spec {{path}}/{{name}}-schema.yaml \
|
||||||
|
--generator-name markdown \
|
||||||
|
--output "docs/{{name}}"
|
||||||
|
@- just _clean-all-files .openapi-generator*
|
||||||
|
@- just _clean-all-folders .openapi-generator*
|
||||||
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
# TARGETS
|
# TARGETS
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
@ -68,12 +79,23 @@ build: _build-requirements _build-skip-requirements
|
|||||||
_build-skip-requirements: build-models
|
_build-skip-requirements: build-models
|
||||||
_build-requirements:
|
_build-requirements:
|
||||||
@{{PYTHON}} -m pip install --disable-pip-version-check -r requirements.txt
|
@{{PYTHON}} -m pip install --disable-pip-version-check -r requirements.txt
|
||||||
build-models: _check-system-requirements _build-models-nochecks
|
build-models:
|
||||||
_build-models-nochecks:
|
@just _check-system-requirements
|
||||||
|
@just _build-models
|
||||||
|
@just _build-models-documentation
|
||||||
|
_build-models:
|
||||||
@echo "Generate data models from schemata."
|
@echo "Generate data models from schemata."
|
||||||
|
@just _delete-if-folder-exists "models/generated"
|
||||||
@just _create-folder-if-not-exists "models/generated"
|
@just _create-folder-if-not-exists "models/generated"
|
||||||
@- just _generate-models "models" "config"
|
@- just _generate-models "models" "config"
|
||||||
@- just _generate-models "models" "commands"
|
@- just _generate-models "models" "commands"
|
||||||
|
_build-models-documentation:
|
||||||
|
@echo "Generate documentations data models from schemata."
|
||||||
|
@just _delete-if-folder-exists "docs"
|
||||||
|
@just _create-folder-if-not-exists "docs"
|
||||||
|
@- just _generate-models-documentation "models" "config"
|
||||||
|
@- just _generate-models-documentation "models" "commands"
|
||||||
|
|
||||||
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
# TARGETS: run
|
# TARGETS: run
|
||||||
@ -172,3 +194,7 @@ _check-system-requirements:
|
|||||||
echo "Command '{{GEN_MODELS}}' did not work. Ensure that the installation of 'datamodel-code-generator' worked and that system paths are set." \
|
echo "Command '{{GEN_MODELS}}' did not work. Ensure that the installation of 'datamodel-code-generator' worked and that system paths are set." \
|
||||||
exit 1; \
|
exit 1; \
|
||||||
fi
|
fi
|
||||||
|
@if ! ( {{GEN_MODELS_DOCUMENTATION}} --help >> /dev/null 2> /dev/null ); then \
|
||||||
|
echo "Command '{{GEN_MODELS_DOCUMENTATION}}' did not work. Ensure that the installation of 'datamodel-code-generator' worked and that system paths are set." \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
@ -2,7 +2,8 @@ openapi: 3.0.3
|
|||||||
info:
|
info:
|
||||||
version: 0.1.0
|
version: 0.1.0
|
||||||
title: Schemata for command instructions
|
title: Schemata for command instructions
|
||||||
servers: []
|
servers:
|
||||||
|
- url: "."
|
||||||
paths: {}
|
paths: {}
|
||||||
components:
|
components:
|
||||||
schemas:
|
schemas:
|
||||||
@ -22,9 +23,10 @@ components:
|
|||||||
Command:
|
Command:
|
||||||
description: |-
|
description: |-
|
||||||
Instructions for command to call
|
Instructions for command to call
|
||||||
|
type: object
|
||||||
required:
|
required:
|
||||||
- name
|
- name
|
||||||
properties: &ref_command_properties
|
properties:
|
||||||
name:
|
name:
|
||||||
$ref: '#/components/schemas/EnumAlgorithmNames'
|
$ref: '#/components/schemas/EnumAlgorithmNames'
|
||||||
additionalProperties: true
|
additionalProperties: true
|
||||||
@ -40,16 +42,26 @@ components:
|
|||||||
- nodes
|
- nodes
|
||||||
- edges
|
- edges
|
||||||
properties:
|
properties:
|
||||||
<<: *ref_command_properties
|
name:
|
||||||
|
$ref: '#/components/schemas/EnumAlgorithmNames'
|
||||||
nodes:
|
nodes:
|
||||||
type: array
|
type: array
|
||||||
|
items:
|
||||||
|
anyOf:
|
||||||
|
- type: integer
|
||||||
|
- type: number
|
||||||
|
- type: string
|
||||||
edges:
|
edges:
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
# $ref: '#/components/schemas/Edge'
|
|
||||||
type: array
|
type: array
|
||||||
minItems: 2
|
minItems: 2
|
||||||
maxItems: 2
|
maxItems: 2
|
||||||
|
items:
|
||||||
|
anyOf:
|
||||||
|
- type: integer
|
||||||
|
- type: number
|
||||||
|
- type: string
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
# Command - Algorithm: TSP
|
# Command - Algorithm: TSP
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
@ -62,7 +74,8 @@ components:
|
|||||||
- optimise
|
- optimise
|
||||||
- dist
|
- dist
|
||||||
properties:
|
properties:
|
||||||
<<: *ref_command_properties
|
name:
|
||||||
|
$ref: '#/components/schemas/EnumAlgorithmNames'
|
||||||
dist:
|
dist:
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
@ -83,7 +96,8 @@ components:
|
|||||||
- word1
|
- word1
|
||||||
- word2
|
- word2
|
||||||
properties:
|
properties:
|
||||||
<<: *ref_command_properties
|
name:
|
||||||
|
$ref: '#/components/schemas/EnumAlgorithmNames'
|
||||||
word1:
|
word1:
|
||||||
description: Word that gets placed vertically in algorithm.
|
description: Word that gets placed vertically in algorithm.
|
||||||
type: string
|
type: string
|
||||||
|
@ -2,7 +2,8 @@ openapi: 3.0.3
|
|||||||
info:
|
info:
|
||||||
version: 0.1.0
|
version: 0.1.0
|
||||||
title: Schemata for config models
|
title: Schemata for config models
|
||||||
servers: []
|
servers:
|
||||||
|
- url: "."
|
||||||
paths: {}
|
paths: {}
|
||||||
components:
|
components:
|
||||||
schemas:
|
schemas:
|
||||||
@ -10,7 +11,7 @@ components:
|
|||||||
# Config
|
# Config
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
Config:
|
Config:
|
||||||
descripton: |-
|
description: |-
|
||||||
Data model for all parts of the configuration.
|
Data model for all parts of the configuration.
|
||||||
type: object
|
type: object
|
||||||
required:
|
required:
|
||||||
|
@ -23,6 +23,7 @@ lazy-load>=0.8.2
|
|||||||
pyyaml>=6.0
|
pyyaml>=6.0
|
||||||
pydantic>=1.9.0
|
pydantic>=1.9.0
|
||||||
datamodel-code-generator>=0.13.0
|
datamodel-code-generator>=0.13.0
|
||||||
|
openapi-generator-cli>=4.3.1
|
||||||
|
|
||||||
# misc
|
# misc
|
||||||
lorem>=0.1.1
|
lorem>=0.1.1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user