Skip to main content

View

Coming soon

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.

apiVersionapibuilder.stackngo.io/v1alpha1
kindView
Applied bysng 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.

Attaching to an API

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.

ChampDescriptionDéfautValidation
apiVersion stringapibuilder.stackngo.io/v1alpha1
kind stringView
metadata ObjectMetaSeul 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.

ChampDescriptionDéfautValidation
application stringApplication est le nom de l'API générée (GeneratedAPI) du même tenant qui utilise cette vue.MaxLength: 253
Optional: {}
path stringPath est le chemin de la route (ex. "/posts", "/api/users").
model stringModel est le nom du modèle servi par la route (ModelName du Model).
get ViewVerbGet active la méthode GET (facultatif).
post ViewVerbPost active la méthode POST (facultatif).

ViewStatus​

ViewStatus est l'état constaté par la plateforme.

ChampDescriptionDéfautValidation
observedGeneration integerObservedGeneration est la dernière version du manifeste prise en compte.

ViewVerb​

ViewVerb règle une méthode HTTP de la route.

ChampDescriptionDéfautValidation
application stringApplication 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.

See also​