GithubHelp home page GithubHelp logo

Comments (4)

cebe avatar cebe commented on September 25, 2024

You may use the following schema for testing:

#
# Database Schema file
#
# if you change this file, run
#
#   make cli
#   ./yii gii/api
#
# to generate migrations and update base model classes.
#
openapi: 3.0.3
info:
  title: 'Proxy-Service'
  description: ""
  version: 1.0.0
  contact:
    name: 'Carsten Brandt'
    email: [email protected]
servers:
  - url: 'http://localhost:8937'
    description: 'Local Dev API'
security:
  - BasicAuth: []
components:
  securitySchemes:
    BasicAuth:
      type: http
      scheme: basic
  schemas:
    Account:
      description: user account
      type: object
      required:
        - id
        - name
      properties:
        id:
          type: integer
        name:
          description: account name
          type: string
          maxLength: 40
          x-faker: 'substr($faker->userName(), 0, 40)'

    Domain:
      description: domain
      type: object
      required:
        - id
        - name
        - account
        - created_at
      properties:
        id:
          type: integer
        name:
          description: domain or sub-domain name, in DNS syntax, IDN are converted
          type: string
          maxLength: 128
          x-faker: '$faker->domainName'
        account:
          $ref: '#/components/schemas/Account'

        routings:
          type: array
          items:
            $ref: '#/components/schemas/Routing'

        created_at:
          readOnly: true
          type: string
          format: datetime
          x-db-type: datetime
          nullable: false

    Routing:
      description: rounting specification
      type: object
      required:
        - id
        - domain
      properties:
        id:
          type: integer
        domain:
          $ref: '#/components/schemas/Domain'
        path:
          type: string
          maxLength: 255
          x-faker: '$faker->randomElement(["/", "/", "/", "/", "/api", "/tools", "/assets/web"])'

        ssl:
          type: boolean
        redirect_to_ssl:
          type: boolean

        service:
          type: string
          maxLength: 255
          x-faker: '"http://tador.cebe.net/" . $faker->domainName'

        created_at:
          readOnly: true
          type: string
          format: datetime
          x-db-type: datetime
          nullable: true # todo check here: "nullable: false"


paths:
  /:
    get:
      responses: []
      description: none

from yii2-app-api.

SOHELAHMED7 avatar SOHELAHMED7 commented on September 25, 2024

The perfect implementation would event sort models by relation dependencies before generating fake data.

Can you please give more details about this?

from yii2-app-api.

cebe avatar cebe commented on September 25, 2024

In the above example: Routing depends on Domain, which itself depends on Account again.

So in order to generate fake data, you first need to generate Accounts, then Domains and then Routings, also faker needs to fill relations based on the existing items, e.g. for every domain it generates, attach a random account. For each Routing it generates, attach a random Domain.

from yii2-app-api.

SOHELAHMED7 avatar SOHELAHMED7 commented on September 25, 2024

I am starting to work on this task now

from yii2-app-api.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.