Contract Views & Editors
Contracts describe how the parts of a system talk to each other: the HTTP API, the events, the data and the database. Genexy recognises contract files and opens them in a visual editor next to their text.
| Contract | Recognised by | Editor |
|---|---|---|
| OpenAPI | openapi: or swagger: at the top of a YAML or JSON file | OpenAPI Editor |
| AsyncAPI | asyncapi: at the top of a YAML or JSON file | AsyncAPI Editor |
| JSON Schema | $schema with a JSON Schema URL, or a typical schema shape | JSON Schema Editor |
| SQL schema | .sql, .ddl | SQL Schema Editor |
| GraphQL | .graphql, .graphqls, .gql | GraphQL Editor |
| Protobuf | .proto | Protobuf Editor |
A file that was not recognised can still be opened in any of them with Open as in the editor toolbar or in the Files context menu.
Visual, Split and Source
The toolbar switches between three views:
- Visual: the contract as forms and cards.
- Split: the visual editor beside the text (not on phones).
- Source: only the text, in the Text Editor.
The text of the file is the single source of truth. A change in the visual editor rewrites only the part of the text it
concerns, so comments and the formatting of everything else stay as they were. Every visual change is one undo step:
Ctrl+Z and Ctrl+Y, or the arrows in the toolbar, undo and redo it, also in the text. Code intelligence keeps
working on the text while you edit visually. If the text does not parse, the visual editor says so and waits until you
fix it in Source.
Without PRO, contract files open in the Text Editor, where they can be read and edited as text.
Contracts and code generation
A component points to its contract files in its .genexy/component.yaml; Add as Contract in the Files context menu
also names a file as a contract of the project. The code generators build backends
from the contracts, and regenerate them when they change.