Comments (4)
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.
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.
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.
I am starting to work on this task now
from yii2-app-api.
Related Issues (13)
- JSON-Schema validation HOT 3
- Add workflow Guide to the docs HOT 1
- ./yii gii/api --help does not work for PHP 8.1 HOT 1
- Faker related issues HOT 1
- Include spec linter HOT 1
- Add versioning/evolution strategy
- throw 405 on existing endpoints and wrong method
- Review PATCH RFC
- Submit to swagger-codegen HOT 1
- Faker generates duplicate primary keys
- If PATCH and PUT are specified, update action is created 2 times
- CamelCase Controller IDs are wrong HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yii2-app-api.