Using Gostly
Code models
Turn a service's recorded API examples into a reviewable model you can keep in version control. Compile that model into a service definition and WireMock fixtures for development or CI.
What a code model contains
A gostly.service-model.v1 document describes one service: endpoint templates, request and response shapes, example exchanges, field and array profiles, and the decisions used to prepare synthetic values. Its model digest identifies the content being compiled.
This is separate from the code generator in Agent Studio. Code models start from service recordings and compile API fixtures. Studio proposes a check program against an authored draft.
Build and review a model
- Capture the representative exchanges for the selected service and review the retained data.
- In the dashboard, open the service and choose Build code model on its Overview; the card then offers Download model and Compile, which gives the outputs described under Compile for development or CI. Or use the code-model build API for that service. Building requires service-write access.
- Inspect both returned objects: the model and its operator report. Review the reported field decisions, retained values, omissions and changes.
- Resolve the decisions that need operator input. When refreshing an existing model, supply the previous model so its reviewed decisions can be considered.
- Commit the reviewed model. Keep the operator report private: it can contain recorded candidate values and retained values.
Compile for development or CI
The compile API takes the selected models and a definition identity. It returns a gostly.services.v1 service definition, model and definition digests, their recorded pairs, and WireMock mapping files for the services.
Compilation validates the inputs and creates those outputs. It does not apply the definition or run an application test. Apply or load the reviewed outputs separately, then check a representative request and the application assertion it supports.
| Operation | API | Access |
|---|---|---|
| Build | POST /v1/services/{service_id}/code-model | Member with services:write. |
| Compile | POST /v1/code-model:compile | Definition-read access; a definition:apply CI credential may also compile. |
Review data and fidelity
Synthetic-value preparation has explicit limits. Some vocabulary, route words, field names and values can remain unchanged by rule. Structural and distribution information also has its own disclosure boundaries. A generated model is not a promise that every recorded detail was anonymized.
Read the operator report before sharing the model or fixtures. Confirm that relationships, response distinctions and values needed by your assertions remain useful after generation. A successful compile does not prove those business expectations.
Related documentation
- CI integration: plan and apply definitions, then run your existing tests.
- Record & Replay: prepare and inspect the source exchanges.
- Studio code generator: review a generated check program for an authored draft.