-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #778 from MetaCell/feature/ch-151
CH-151 Application generation improvements
- Loading branch information
Showing
8 changed files
with
674 additions
and
316 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
#!/bin/bash | ||
|
||
fastapi-codegen --input openapi.yaml --output app -t templates && mv app/main.py ../backend/ && mv app/models.py ../backend/openapi/ | ||
rm -rf app | ||
|
||
echo Generated new models and main.py | ||
ROOT_PATH=$(realpath "$(dirname "$BASH_SOURCE")/../../..") | ||
harness-generate servers --app-name "__APP_NAME__" "$ROOT_PATH" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
from dataclasses import dataclass | ||
from typing import Union | ||
|
||
|
||
try: | ||
from enum import StrEnum | ||
except ImportError: | ||
from strenum import StrEnum | ||
|
||
|
||
class TemplateType(StrEnum): | ||
BASE = 'base' | ||
FLASK_SERVER = 'flask-server' | ||
WEBAPP = 'webapp' | ||
DB_POSTGRES = 'db-postgres' | ||
DB_NEO4J = 'db-neo4j' | ||
DB_MONGO = 'db-mongo' | ||
DJANGO_APP = 'django-app' | ||
SERVER = 'server' | ||
|
||
@classmethod | ||
def database_templates(cls): | ||
return [cls.DB_POSTGRES, cls.DB_NEO4J, cls.DB_MONGO] | ||
|
||
|
||
@dataclass | ||
class CloudHarnessManifest(): | ||
app_name: str | ||
version: str | ||
inferred: bool | ||
templates: list[str] | ||
|
||
@classmethod | ||
def from_dict(cls, data: dict) -> 'CloudHarnessManifest': | ||
return cls( | ||
app_name=data['app-name'], | ||
version=data['version'], | ||
inferred=data['inferred'], | ||
templates=data['templates'], | ||
) | ||
|
||
def to_dict(self) -> dict: | ||
return { | ||
'app-name': self.app_name, | ||
'version': self.version, | ||
'inferred': self.inferred, | ||
'templates': [str(template) for template in self.templates], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.