View
In preparation. This page describes the target interface to gather your feedback; nothing is usable yet.
Generated APIs are in preparation: this manifest is not accepted by sng apply yet.
apiVersion | apibuilder.stackngo.io/v1alpha1 |
kind | View |
| Applied by | sng apply (upcoming) |
What it is for
A View exposes a Model on an HTTP path, for reading (get) and/or writing (post), in JSON, text, or file format.
A Model or a View is attached to its GeneratedAPI by spec.application, which carries the name of the GeneratedAPI of the same tenant (application: blog). Without spec.application, a resource is only picked by a GeneratedAPI that selects it by its labels (selector).
Minimal example
apiVersion: apibuilder.stackngo.io/v1alpha1
kind: View
metadata:
name: posts-json
spec:
application: blog
path: /posts
model: posts
get:
application: json
Complete annotated example
apiVersion: apibuilder.stackngo.io/v1alpha1
kind: View
metadata:
name: posts-json
spec:
application: blog # name of the GeneratedAPI that serves this view
path: /posts # required
model: posts # required: modelName of an attached Model
get:
application: json # json | text | file
post:
application: json
Fields
View
View déclare une route HTTP de votre API générée.
| Champ | Description | Défaut | Validation |
|---|---|---|---|
apiVersion string | apibuilder.stackngo.io/v1alpha1 | ||
kind string | View | ||
metadata ObjectMeta | Seul metadata.name est à renseigner (nom de la ressource dans votre tenant). | ||
spec ViewSpec | |||
status ViewStatus |
ViewSpec
ViewSpec décrit le chemin, le modèle servi et les méthodes HTTP acceptées.
| Champ | Description | Défaut | Validation |
|---|---|---|---|
application string | Application est le nom de l'API générée (GeneratedAPI) du même tenant qui utilise cette vue. | MaxLength: 253 Optional: {} | |
path string | Path est le chemin de la route (ex. "/posts", "/api/users"). | ||
model string | Model est le nom du modèle servi par la route (ModelName du Model). | ||
get ViewVerb | Get active la méthode GET (facultatif). | ||
post ViewVerb | Post active la méthode POST (facultatif). |
ViewStatus
ViewStatus est l'état constaté par la plateforme.
| Champ | Description | Défaut | Validation |
|---|---|---|---|
observedGeneration integer | ObservedGeneration est la dernière version du manifeste prise en compte. |
ViewVerb
ViewVerb règle une méthode HTTP de la route.
| Champ | Description | Défaut | Validation |
|---|---|---|---|
application string | Application est le format de la réponse : json, text ou file. |
Status and conditions
status.observedGeneration shows the last version taken into account. Two views on the same path make the merge fail on the GeneratedAPI.
What happens when you apply
Changing a View regenerates the API it is attached to.