2024-02-09 - Per Service Schemas Docs

From Izara Wiki
Revision as of 14:42, 17 November 2024 by Sven the Barbarian (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Per Service Schemas
Describe object schema design and workflow.

Schema Description

  • objectSchema is an object that shows data models in service.
  • relationshipSchema is an object that describes a relation between objectSchema.
  • refRelationshipSchema is an object that references to relationshipSchema in another service

Creating schema's rules

  • See schema pattern in Per Service Schemas
  • If not follow rules when creating schema in service. This will cause the developer to not generate code or upload schema to s3.
  • When finished create schema should run npm scripts: npm run validateSchema. This script is used to validate schema inside the service.

Rules for creating objectSchema

  • Don’t have duplicate fieldName
  • FieldName in identifier should exist in objectSchema.fieldNames
  • fieldName that used in identifiers should set canUpdate = false
  • Don’t have duplicate tableName in storageResources.type dynamoDB of objectSchema

Rules for creating addOnDatastructure:versionedData

  • Don’t have duplicate versionedData.versionedDataLabel in addOnDataStructure
  • Don’t have duplicate fieldName with objectSchema and other versionedData

Per service scripts and lambda for schema

  • scripts: npm run generateCode
    • generate lambda in the local computer
  • scripts: npm run validateSchema
    • validate schema in the local computer
  • lambda: UploadSchemaHdrInv
    • use to upload schema to s3 after deploy.