FlyingFish
FlyingFish on GitHub
  • FlyingFish
    • About the project
    • Screenshots
    • Installation
      • Quick Setup
      • Quick Update
      • Create Backup
      • Long setup
        • Env
        • Docker compose
          • Ports
          • Network
      • Storage management
      • FAQ
    • Configurations
      • Which user type am I
      • Listen
        • Port forwarding
        • Proxy protocol
        • IP Access
        • Gateway identifiers
        • UPnP Nat
      • Domains
        • DynDns Clients
        • Own DNS Server
        • Discussions Subdomains
        • DynDns Server
      • Routes
    • Examples
      • SSH hidden on HTTPS
      • FlyingFish to other reverse proxy
      • Backup Server, SSH to Nas
      • Own DynDNS Server - Fritzbox
      • Inventree - Route
    • Developer
      • Ideas, requests and bugs
      • Project structure
        • Under the hood
        • Service structure
        • Schema
        • Object name rules
      • Image build
      • Plugins
    • Contribution
Powered by GitBook
On this page
Edit on GitHub
  1. FlyingFish
  2. Developer
  3. Project structure

Schema

Creation and use of schemas

PreviousService structureNextObject name rules

Last updated 1 year ago

Schemas are an important part of FlyingFish. It must always be checked which data is transferred externally. It is always checked whether the types and structure of the data are correct and only then can proper processing be guaranteed. FlyingFish must/is a stable service that must not crash due to incorrect data transfer!

The is used to create schemes. The company has dedicated itself to the topic because there was no satisfactory solution in TypeScript.

When creating a scheme, note the !

All these schemas are collected in the "schemas" library. These are used in several FlyingFish part programs or in the API.

Definition

/**
 * SchemaDomainRecord
 */
export const SchemaDomainRecord = Vts.object({
    id: Vts.number(),
    type: Vts.number(),
    class: Vts.number(),
    ttl: Vts.number(),
    value: Vts.string(),
    update_by_dnsclient: Vts.boolean(),
    last_update: Vts.number()
});

/**
 * DomainRecord
 */
export type DomainRecord = ExtractSchemaResultType<typeof SchemaDomainRecord>;

Validation

const errors: SchemaErrors = [];

if (SchemaDomainRecord.validate(data, errors)) {
    console.log('Check is successful!')
}
VTS library
Pegenau GmbH & Co. KG
creation of the name