Skip to content

Instantly share code, notes, and snippets.

@tanhauhau
Created August 30, 2018 10:56
Show Gist options
  • Save tanhauhau/e9acf905fefd2d9b2c7ea58635d7ea47 to your computer and use it in GitHub Desktop.
Save tanhauhau/e9acf905fefd2d9b2c7ea58635d7ea47 to your computer and use it in GitHub Desktop.
Test Manta Style
interface User {
/**
* @faker {{internet.userName}}
*/
userName: string;
gender: 0;
/**
* @faker date.past
*/
birthday: number;
/**
* @range 5 10
*/
age: number;
/**
* @faker {{address.country}}
*/
country: string;
/**
* @faker {{address.state}}
*/
state: string;
/**
* @faker {{address.city}}
*/
city: string;
/**
* @iterate Happy
* @iterate Birthday
* @iterate To
* @iterate You
*/
message: string;
/**
* @qotd
*/
quote: string;
}
type WithResponseSuccess<T> = {
status: 'ok';
data: T;
};
type WithResponseFailure = {
status: 'error';
/**
* @example Bad Request
*/
message: string;
};
type WithResponse<T> = WithResponseSuccess<T> | WithResponseFailure;
export type GET = {
'/user': WithResponse<User>;
};
{
"name": "test",
"scripts": {
"start": "ms -c ./config.ts"
},
"devDependencies": {
"@manta-style/cli": "0.1.1",
"@manta-style/plugin-mock-faker": "0.1.0",
"@manta-style/plugin-mock-range": "0.1.0",
"@manta-style/plugin-mock-iterate": "0.1.0",
"@manta-style/plugin-mock-qotd": "0.1.0"
}
}
@Cryrivers
Copy link

try 0.2.0-alpha.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment