SAService Architect Back to designer
SAService ArchitectDocumentation
Python DSL reference project.generate_code() -> GeneratedProjectArchive

Generate and download project code

Send the complete topology to the authorized generation endpoint and receive a validated ZIP archive.

When to use

Call this after constructing and validating the Project when target-language source and deployment assets are required.

Behavior

  • Serializes the Project to YAML, converts it to the designer-compatible API JSON model, and POSTs it to /service_architect/generateCode.
  • Authenticates from .env unless id_token, username, and password overrides are supplied.
  • Decodes the API Gateway base64 body, derives the filename from Content-Disposition, and verifies the ZIP container.
  • Returns archive bytes without extracting or executing generated files.

Project.generate_code parameters properties

All parameters are keyword-only.

PropertyTypeDescription
id_tokenoptional string

Use an existing Cognito ID token.

username / passwordoptional strings

Override credentials loaded from .env.

env_filepath

Credentials file; default .env.

base_urloptional URL

Override Service Architect API root.

timeoutseconds

Network timeout; default 120.

GeneratedProjectArchive properties

Validated successful response.

PropertyTypeDescription
filenamestring

Safe basename from Content-Disposition or download.zip.

contentbytes

ZIP archive bytes.

save(path)Path

Create parent directories and write the archive.

Python example

from pathlib import Path
from processorder import project

diagnostics = project.validate()
if diagnostics:
    raise RuntimeError(diagnostics)

archive = project.generate_code()
output = archive.save(Path("dist") / archive.filename)
print(output)