-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
35de0c6
commit 9870229
Showing
26 changed files
with
235 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,5 @@ | ||
import { BodyLocation } from '../schema/index'; | ||
|
||
|
||
|
||
export interface IEmail { | ||
email(): string; | ||
} | ||
|
||
export interface IString { | ||
email(): IEmail; | ||
export function body(field: string) { | ||
return new BodyLocation(field); | ||
} | ||
|
||
export interface INumber { | ||
number(): string; | ||
} | ||
|
||
export interface IBoolean { | ||
boolean(): string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
|
||
export class MyLibrary {} | ||
// import { body } from './impl/index'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
// import { BodySchema } from './locations/body.schema'; | ||
import { NumberSchema } from './types/number.schema'; | ||
import { StringSchema } from './types/string.schema'; | ||
|
||
// new StringSchema().allow(); | ||
// new NumberSchema().min(10).allow(); | ||
export * from './types/index'; | ||
export * from './locations/index'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { AnyType } from '../types/any.type'; | ||
import { StringType } from '../types/string.type'; | ||
import { NumberType } from '../types/number.type'; | ||
|
||
export class BaseLocation { | ||
constructor( | ||
private _location: string, | ||
private _fieldName: string, | ||
) {} | ||
any(): AnyType { | ||
return new AnyType(this._location, this._fieldName); | ||
} | ||
string(): StringType { | ||
return new StringType(this._location, this._fieldName); | ||
} | ||
number(): NumberType { | ||
return new NumberType(this._location, this._fieldName); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { BaseLocation } from './base.location'; | ||
|
||
export class BodyLocation extends BaseLocation { | ||
constructor(fieldName: string) { | ||
super('body', fieldName); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { BaseLocation } from './base.location'; | ||
|
||
export class CookieLocation extends BaseLocation { | ||
constructor(fieldName: string) { | ||
super('cookie', fieldName); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { BaseLocation } from './base.location'; | ||
|
||
export class HeaderLocation extends BaseLocation { | ||
constructor(fieldName: string) { | ||
super('header', fieldName); | ||
} | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
|
||
export * from './body.schema'; | ||
export * from './body.location'; | ||
export * from './query.location'; | ||
export * from './param.location'; | ||
export * from './header.location'; | ||
export * from './cookie.location'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { BaseLocation } from './base.location'; | ||
|
||
export class ParamLocation extends BaseLocation { | ||
constructor(fieldName: string) { | ||
super('param', fieldName); | ||
} | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { BaseLocation } from './base.location'; | ||
|
||
export class QueryLocation extends BaseLocation { | ||
constructor(fieldName: string) { | ||
super('query', fieldName); | ||
} | ||
} |
Empty file.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* @name AnyType | ||
* @type Any | ||
* @description AnyType | ||
*/ | ||
|
||
import { BaseType } from './base.type'; | ||
|
||
export class AnyType extends BaseType<any> { | ||
protected _metaData: any; | ||
protected _schema: string[]; | ||
constructor( | ||
protected _location: string, | ||
protected _fieldName: string, | ||
) { | ||
super(); | ||
} | ||
} |
Empty file.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
|
||
export * from './base.schema'; | ||
export * from './any.schema'; | ||
export * from './string.schema'; | ||
export * from './number.schema'; | ||
export * from './base.type'; | ||
export * from './any.type'; | ||
export * from './string.type'; | ||
export * from './number.type'; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/** | ||
* @name NumberType | ||
* @type Number | ||
* @description NumberType | ||
*/ | ||
|
||
import { BaseType } from './base.type'; | ||
|
||
export class NumberType extends BaseType<number> { | ||
protected _metaData: any; | ||
protected _schema: string[]; | ||
constructor( | ||
protected _location: string, | ||
protected _fieldName: string, | ||
) { | ||
super(); | ||
} | ||
integer(convert: boolean = false): this { | ||
// TO DO | ||
return this; | ||
} | ||
float(convert: boolean = false): this { | ||
// TO DO | ||
return this; | ||
} | ||
unsafe(): this { | ||
// TO DO | ||
return this; | ||
} | ||
negative(): this { | ||
// TO DO | ||
return this; | ||
} | ||
position(): this { | ||
// TO DO | ||
return this; | ||
} | ||
precision(): this { | ||
// TO DO | ||
return this; | ||
} | ||
min(num: number): this { | ||
// TO DO | ||
return this; | ||
} | ||
max(num: number): this { | ||
// TO DO | ||
return this; | ||
} | ||
port(): this { | ||
// TO DO | ||
return this; | ||
} | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* @name ObjectType | ||
* @type Object | ||
* @description ObjectType | ||
*/ | ||
|
||
import { BaseType } from './base.type'; | ||
|
||
export class ObjectType extends BaseType<string> { | ||
protected _metaData: any; | ||
protected _schema: string[]; | ||
constructor( | ||
protected _location: string, | ||
protected _fieldName: string, | ||
) { | ||
super(); | ||
} | ||
} |
Oops, something went wrong.