Generative Development Framework
GDF.ai
  • Intro to GDF-FSE
    • Generative AI, Large Language Models, ChatGPT?
    • Knowledge Areas
    • Access a Chat Based LLM
    • Why GDF?
    • Expectations
  • Limitations
  • Prompting
    • Prompt Patterns
    • Prompt Context
    • Prompt Stores
    • Prompt Operators
    • Prompt Chaining
  • Security
    • Protecting Data
    • Protecting Application Security
    • Protecting Intellectual Property
    • Protection Stores
    • AI Security Assessments and Penetration Testing
    • Social Engineering Testing with AI
  • Subject Knowledge Areas
    • Ideation
      • Identifying a Problem Statement
      • Plan and Prioritize Features
      • Develop User Stories
      • Requirement Gathering
      • Ideation Prompting
      • Ideation Template
    • Specification
      • Specifying Languages
      • Specifying Libraries
      • Specifying Project Structures
      • Specify Schemas
      • Specifying Elements
      • Specifying API Specs
    • Generation
      • Generating UI Elements
      • Generating Mock Data
      • Generating Schemas
      • Generating Parsers
      • Generating Databases
      • Generate Functions
      • Generate APIs
      • Generate Diagrams
      • Generating Documentation
    • Transformation
      • Converting Languages
      • Converting Libraries
    • Replacement
      • Replacing Functions
      • Replacing Data Types
    • Integration
      • Connecting UI Components
      • Connecting UI to Backend
      • Connecting Multiple Services Together
      • Connecting Cloud Infrastructure (AWS)
    • Separation
      • Abstraction
      • Model View Controller (MVC)
    • Consolidation
      • Combining UI Elements
      • Deduplicating Code Fragments
    • Templating
      • Layouts
      • Schemas
      • Project Structures
      • Content Management Systems
    • Visualization
      • General Styling
      • Visual Referencing
      • Visual Variations
    • Verification
      • Test Classes
      • Logging and Monitoring
      • Automated Testing
      • Synthetic Monitoring
    • Implementation
      • Infrastructure
      • DevOps / Deployment
    • Optimization
      • General Optimization
      • Performance Monitoring
      • Code Review
  • Guidance
    • Business Process
    • Regulatory Guidance
  • Generative Pipelines
  • Troubleshooting
    • Client Side Troubleshooting
    • Server Side Troubleshooting
    • Troubleshooting with AI
    • Documentation
    • Infrastructure Engineering
  • Terminology
Powered by GitBook
On this page
  • Example: Creating Schemas for a Bicycle Rental Application's Booking Feature
  • Prompt
  • Response
  • Discussion:

Was this helpful?

Export as PDF
  1. Subject Knowledge Areas
  2. Generation

Generating Schemas

Generating database schemas using generative AI

Schema in regards to generation is about creating the schemas that project structures client side forms, API services, and databases use to ensure data follows a certain pattern.

Example: Creating Schemas for a Bicycle Rental Application's Booking Feature

How schemas can be used to ensure consistent data patterns in a bicycle rental application's booking feature.

Prompt

prompt:
create a schema for a bike rental order form

Response

import { object, string, date, number, array } from 'yup';

const rentalSchema = object({
  name: string().required(),
  email: string().email().required(),
  startDate: date().required(),
  endDate: date().required(),
  bikeType: string().required(),
  quantity: number().integer().required(),
  options: array(string()),
  cardNumber: string().length(16).required(),
  cardExpiration: date().min(new Date()).required(),
  cardCvv: string().length(3).required(),
});

In this example, we're using the yup library to define a schema for the data that is collected when a customer books a bicycle rental. The object function creates an object schema, and the various string, date, number, and array functions are used to define the data types and validation rules for each field.

Discussion:

From an end-user perspective, this client-side validation ensure the customer a good experience when combined with some like react-hook-form that prevents customers from proceeding until the required fields are filled out correctly.

PreviousGenerating Mock DataNextGenerating Parsers

Last updated 3 months ago

Was this helpful?

The use of schemas in a bicycle rental application's booking feature can greatly improve the quality and consistency of data across the application. By using schemas to define data patterns and validation rules, developers can ensure that data is stored and used correctly, and that errors and bugs are caught early in the development process. This could also be used to analyze existing data in a bicycle rental application and a schema template based on the patterns and structure of that data. Developers could then refine and customize the schema as needed, saving time and effort compared to writing schema code from scratch.

generate