Compare commits

..

No commits in common. "4fa02a49628fb1b428202db4d3bd1db5127e7a0d" and "8acb2157aba22c11dd33f37066ab87c6f25999bb" have entirely different histories.

4 changed files with 10 additions and 52 deletions

View File

@ -12,7 +12,6 @@ _default:
PYTHON := if os_family() == "windows" { "py -3" } else { "python3" }
GEN_MODELS := "datamodel-codegen"
GEN_MODELS_DOCUMENTATION := "openapi-generator"
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Macros
@ -57,16 +56,6 @@ _generate-models path name:
--input {{path}}/{{name}}-schema.yaml \
--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
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -79,23 +68,12 @@ build: _build-requirements _build-skip-requirements
_build-skip-requirements: build-models
_build-requirements:
@{{PYTHON}} -m pip install --disable-pip-version-check -r requirements.txt
build-models:
@just _check-system-requirements
@just _build-models
@just _build-models-documentation
_build-models:
build-models: _check-system-requirements _build-models-nochecks
_build-models-nochecks:
@echo "Generate data models from schemata."
@just _delete-if-folder-exists "models/generated"
@just _create-folder-if-not-exists "models/generated"
@- just _generate-models "models" "config"
@- 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
@ -194,7 +172,3 @@ _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." \
exit 1; \
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

View File

@ -2,8 +2,7 @@ openapi: 3.0.3
info:
version: 0.1.0
title: Schemata for command instructions
servers:
- url: "."
servers: []
paths: {}
components:
schemas:
@ -23,10 +22,9 @@ components:
Command:
description: |-
Instructions for command to call
type: object
required:
- name
properties:
properties: &ref_command_properties
name:
$ref: '#/components/schemas/EnumAlgorithmNames'
additionalProperties: true
@ -42,26 +40,16 @@ components:
- nodes
- edges
properties:
name:
$ref: '#/components/schemas/EnumAlgorithmNames'
<<: *ref_command_properties
nodes:
type: array
items:
anyOf:
- type: integer
- type: number
- type: string
edges:
type: array
items:
# $ref: '#/components/schemas/Edge'
type: array
minItems: 2
maxItems: 2
items:
anyOf:
- type: integer
- type: number
- type: string
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Command - Algorithm: TSP
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -74,8 +62,7 @@ components:
- optimise
- dist
properties:
name:
$ref: '#/components/schemas/EnumAlgorithmNames'
<<: *ref_command_properties
dist:
type: array
items:
@ -96,8 +83,7 @@ components:
- word1
- word2
properties:
name:
$ref: '#/components/schemas/EnumAlgorithmNames'
<<: *ref_command_properties
word1:
description: Word that gets placed vertically in algorithm.
type: string

View File

@ -2,8 +2,7 @@ openapi: 3.0.3
info:
version: 0.1.0
title: Schemata for config models
servers:
- url: "."
servers: []
paths: {}
components:
schemas:
@ -11,7 +10,7 @@ components:
# Config
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Config:
description: |-
descripton: |-
Data model for all parts of the configuration.
type: object
required:

View File

@ -23,7 +23,6 @@ lazy-load>=0.8.2
pyyaml>=6.0
pydantic>=1.9.0
datamodel-code-generator>=0.13.0
openapi-generator-cli>=4.3.1
# misc
lorem>=0.1.1