This is the complete rewrite of the TSSG Parser, which is now able to build the AST for TSSG Syntax V0.0.1.
Please note that this project is work-in-progress and will support other advance features soon.
Parser supports following expressoins:
- Schemas Block Expression
- Schema Expression
- Extendable Schema Expression
- Request Bodies Block Expression
- RequestBody Expression
- Extendable RequestBody Expression
- Parameters Block Expression
- Parameter Expression
Parser support following data types:
- Literal
- Identifier
- Boolean
- Object
- Array
- Function Calls
Note: Complex data types like
Array
ofString
,Array
ofObject
is also supported.
Parser also supports miscellaneous features:
- Whitespaces
- Multiline Comments
Schemas block can be written as follow:
Schemas {
BaseUser {
name: string,
email: string
}
Employee extends BaseUser {
salary: number,
department: string
}
}
Notice how we can
extend
schemas.
RequestBodies block can be written as Schemas
block:
RequestBodies {
BaseListParams {
page: number,
limit: number,
totalPages: number
}
ListUsers extends BaseListParams {
filters: {
ids: string[]
}
}
}
Similarly parameters block can be written as:
Parameters {
GetUser {
id: string
}
}
Data types can be used as follow:
User {
name: string,
age: integer,
address: {
city: string,
country: string,
zip: number
},
isVerified: boolean,
profileImages: {
size: {
width: number,
height: number
}
url: string
}[]
}
Notice
address
which is anObject
with 3 properties. AndprofileImages
which is anArray
ofObjects
with 2 properties.
Read our Proposal Draft.
- Update parser code and run
yarn build:prod
to generate the parser. - Update transformer code and again run
yarn build:prod
generate transformer. - Update
tests
and createPR
.
Read our Contribution Guidline.