Skip to Content
Apso is in public beta. Get started
ArchitectureGenerated code

Generated code

Generated code is the framework implementation of .apsorc. Treat it as reviewable source with a replaceable ownership boundary.

Ownership map

AreaOwnerChange method
.apsorcProduct and backend teamEdit and review as the generation contract.
autogen/Apso generatorChange .apsorc, then regenerate.
extensions/Application teamEdit directly and cover with tests.
migrationsApplication teamGenerate, inspect, test, and commit.
framework configSharedPreserve template conventions and review generation impact.
testsApplication teamTest generated contracts and custom behavior.

Framework structures

src/ ├── autogen/ │ ├── Project/ │ │ ├── Project.entity.ts │ │ ├── Project.controller.ts │ │ ├── Project.service.ts │ │ └── Project.module.ts │ └── index.ts ├── extensions/ ├── config/ ├── migrations/ ├── app.module.rest.ts └── main.ts

The exact filenames can change with template versions. Use the generated repository as the source for its current layout.

HTTP surface

For an entity named Project, the current REST templates expose a plural resource:

GET /Projects POST /Projects GET /Projects/:id PATCH /Projects/:id DELETE /Projects/:id

Open /_docs to inspect request types, status codes, auth headers, filters, joins, and the actual route casing.

Relationship output

A single top-level relationship can create a foreign key and inverse collection. For example:

{ "from": "Task", "to": "Project", "type": "ManyToOne" }

The Task side owns projectId, and the Project side receives the inverse task collection where the generator supports it. Define the conceptual relationship once.

Suppressing generated HTTP

Set http: false on an entity when a custom route must own the resource boundary:

{ "name": "Payment", "http": false, "fields": [ { "name": "amount", "type": "decimal", "precision": 12, "scale": 2 } ] }

NestJS and Gin need controller or route suppression to avoid collisions. FastAPI can register a custom router before generated routes, so its override behavior differs.

Regeneration review

  1. Commit or stash the current working state.
  2. Run apso schema validate.
  3. Run apso generate.
  4. Review changes under .apsorc and autogen/.
  5. Run apso migrate for persisted changes.
  6. Run framework tests and the production build.
  7. Exercise the changed HTTP contract.

Generated source has no required Apso runtime after generation. The framework, ORM, database configuration, and extension code remain visible in the repository.

Last updated on